{"version":3,"file":"vendor.1455fcfe.js","sources":["../../node_modules/tslib/tslib.es6.js","../../node_modules/ts-invariant/lib/invariant.esm.js","../../node_modules/@apollo/client/utilities/globals/maybe.js","../../node_modules/@apollo/client/utilities/globals/global.js","../../node_modules/@apollo/client/utilities/globals/DEV.js","../../node_modules/ts-invariant/process/index.js","../../node_modules/graphql/jsutils/devAssert.mjs","../../node_modules/graphql/jsutils/isObjectLike.mjs","../../node_modules/graphql/jsutils/invariant.mjs","../../node_modules/graphql/language/location.mjs","../../node_modules/graphql/language/printLocation.mjs","../../node_modules/graphql/error/GraphQLError.mjs","../../node_modules/graphql/error/syntaxError.mjs","../../node_modules/graphql/language/kinds.mjs","../../node_modules/graphql/language/ast.mjs","../../node_modules/graphql/language/tokenKind.mjs","../../node_modules/graphql/jsutils/inspect.mjs","../../node_modules/graphql/jsutils/instanceOf.mjs","../../node_modules/graphql/language/source.mjs","../../node_modules/graphql/language/directiveLocation.mjs","../../node_modules/graphql/language/characterClasses.mjs","../../node_modules/graphql/language/blockString.mjs","../../node_modules/graphql/language/lexer.mjs","../../node_modules/graphql/language/parser.mjs","../../node_modules/graphql/language/visitor.mjs","../../node_modules/graphql/language/printString.mjs","../../node_modules/graphql/language/printer.mjs","../../node_modules/@apollo/client/utilities/globals/fix-graphql.js","../../node_modules/@apollo/client/utilities/globals/index.js","../../node_modules/@apollo/client/utilities/graphql/directives.js","../../node_modules/@apollo/client/utilities/graphql/fragments.js","../../node_modules/@apollo/client/utilities/common/objects.js","../../node_modules/@apollo/client/utilities/graphql/storeUtils.js","../../node_modules/@apollo/client/utilities/graphql/getFromAST.js","../../node_modules/@apollo/client/utilities/common/filterInPlace.js","../../node_modules/@apollo/client/utilities/graphql/transform.js","../../node_modules/@apollo/client/utilities/common/mergeDeep.js","../../node_modules/zen-observable-ts/module.js","../../node_modules/symbol-observable/es/ponyfill.js","../../node_modules/symbol-observable/es/index.js","../../node_modules/@apollo/client/utilities/observables/Observable.js","../../node_modules/@apollo/client/utilities/common/cloneDeep.js","../../node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js","../../node_modules/@apollo/client/utilities/observables/iteration.js","../../node_modules/@apollo/client/utilities/observables/asyncMap.js","../../node_modules/@apollo/client/utilities/common/canUse.js","../../node_modules/@apollo/client/utilities/observables/subclassing.js","../../node_modules/@apollo/client/utilities/observables/Concast.js","../../node_modules/@apollo/client/utilities/common/arrays.js","../../node_modules/@apollo/client/utilities/common/errorHandling.js","../../node_modules/@apollo/client/utilities/common/compact.js","../../node_modules/@apollo/client/utilities/common/makeUniqueId.js","../../node_modules/@apollo/client/utilities/common/stringifyForDisplay.js","../../node_modules/@apollo/client/link/utils/fromError.js","../../node_modules/@apollo/client/link/utils/toPromise.js","../../node_modules/@apollo/client/link/utils/fromPromise.js","../../node_modules/@apollo/client/link/utils/throwServerError.js","../../node_modules/@apollo/client/link/utils/validateOperation.js","../../node_modules/@apollo/client/link/utils/createOperation.js","../../node_modules/@apollo/client/link/utils/transformOperation.js","../../node_modules/@apollo/client/link/core/ApolloLink.js","../../node_modules/@apollo/client/link/core/empty.js","../../node_modules/@apollo/client/link/core/from.js","../../node_modules/@apollo/client/link/core/split.js","../../node_modules/@apollo/client/link/core/concat.js","../../node_modules/@apollo/client/link/core/execute.js","../../node_modules/@apollo/client/version.js","../../node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js","../../node_modules/@apollo/client/link/http/serializeFetchParameter.js","../../node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js","../../node_modules/@apollo/client/link/http/checkFetcher.js","../../node_modules/@apollo/client/link/http/createSignalIfSupported.js","../../node_modules/@apollo/client/link/http/selectURI.js","../../node_modules/@apollo/client/link/http/rewriteURIForGET.js","../../node_modules/@apollo/client/link/http/createHttpLink.js","../../node_modules/@apollo/client/link/http/HttpLink.js","../../node_modules/@wry/equality/lib/equality.esm.js","../../node_modules/@wry/trie/lib/trie.esm.js","../../node_modules/@wry/context/lib/context.esm.js","../../node_modules/optimism/lib/bundle.esm.js","../../node_modules/@apollo/client/cache/core/cache.js","../../node_modules/@apollo/client/cache/core/types/Cache.js","../../node_modules/@apollo/client/cache/core/types/common.js","../../node_modules/@apollo/client/cache/inmemory/helpers.js","../../node_modules/@apollo/client/cache/inmemory/entityStore.js","../../node_modules/@apollo/client/cache/inmemory/object-canon.js","../../node_modules/@apollo/client/cache/inmemory/readFromStore.js","../../node_modules/@apollo/client/cache/inmemory/reactiveVars.js","../../node_modules/@apollo/client/cache/inmemory/key-extractor.js","../../node_modules/@apollo/client/cache/inmemory/policies.js","../../node_modules/@apollo/client/cache/inmemory/writeToStore.js","../../node_modules/@apollo/client/cache/inmemory/inMemoryCache.js","../../node_modules/@apollo/client/errors/index.js","../../node_modules/@apollo/client/core/networkStatus.js","../../node_modules/@apollo/client/core/ObservableQuery.js","../../node_modules/@apollo/client/core/LocalState.js","../../node_modules/@apollo/client/core/QueryInfo.js","../../node_modules/@apollo/client/core/QueryManager.js","../../node_modules/@apollo/client/core/ApolloClient.js","../../node_modules/graphql-tag/lib/index.js","../../node_modules/@apollo/client/core/index.js","../../node_modules/object-assign/index.js","../../node_modules/react/cjs/react.production.min.js","../../node_modules/react/index.js","../../node_modules/@apollo/client/react/context/ApolloContext.js","../../node_modules/@apollo/client/react/context/ApolloProvider.js","../../node_modules/@apollo/client/react/hooks/useApolloClient.js","../../node_modules/@apollo/client/react/parser/index.js","../../node_modules/@apollo/client/react/hooks/useQuery.js","../../node_modules/@apollo/client/react/hooks/useLazyQuery.js","../../node_modules/@apollo/client/react/hooks/useMutation.js","../../node_modules/@datadog/browser-core/esm/tools/display.js","../../node_modules/@datadog/browser-core/esm/tools/catchUserErrors.js","../../node_modules/@datadog/browser-core/esm/tools/experimentalFeatures.js","../../node_modules/@datadog/browser-core/esm/tools/utils/numberUtils.js","../../node_modules/@datadog/browser-core/esm/tools/utils/timeUtils.js","../../node_modules/@datadog/browser-core/esm/tools/utils/byteUtils.js","../../node_modules/@datadog/browser-core/esm/tools/utils/polyfills.js","../../node_modules/@datadog/browser-core/esm/tools/utils/objectUtils.js","../../node_modules/@datadog/browser-core/esm/tools/getGlobalObject.js","../../node_modules/@datadog/browser-core/esm/tools/getZoneJsOriginalValue.js","../../node_modules/@datadog/browser-core/esm/tools/monitor.js","../../node_modules/@datadog/browser-core/esm/tools/timer.js","../../node_modules/@datadog/browser-core/esm/tools/observable.js","../../node_modules/@datadog/browser-core/esm/tools/utils/functionUtils.js","../../node_modules/@datadog/browser-core/esm/tools/utils/stringUtils.js","../../node_modules/@datadog/browser-core/esm/tools/utils/browserDetection.js","../../node_modules/@datadog/browser-core/esm/browser/cookie.js","../../node_modules/@datadog/browser-core/esm/domain/session/storeStrategies/sessionStoreStrategy.js","../../node_modules/@datadog/browser-core/esm/domain/session/sessionConstants.js","../../node_modules/@datadog/browser-core/esm/domain/session/sessionState.js","../../node_modules/@datadog/browser-core/esm/domain/session/oldCookiesMigration.js","../../node_modules/@datadog/browser-core/esm/domain/session/storeStrategies/sessionInCookie.js","../../node_modules/@datadog/browser-core/esm/domain/session/storeStrategies/sessionInLocalStorage.js","../../node_modules/@datadog/browser-core/esm/domain/session/sessionStoreOperations.js","../../node_modules/@datadog/browser-core/esm/domain/session/sessionStore.js","../../node_modules/@datadog/browser-core/esm/domain/trackingConsent.js","../../node_modules/@datadog/browser-core/esm/tools/serialisation/jsonStringify.js","../../node_modules/@datadog/browser-core/esm/tools/utils/urlPolyfill.js","../../node_modules/@datadog/browser-core/esm/domain/configuration/intakeSites.js","../../node_modules/@datadog/browser-core/esm/domain/configuration/endpointBuilder.js","../../node_modules/@datadog/browser-core/esm/domain/configuration/tags.js","../../node_modules/@datadog/browser-core/esm/domain/configuration/transportConfiguration.js","../../node_modules/@datadog/browser-core/esm/domain/configuration/configuration.js","../../node_modules/@datadog/browser-core/esm/tools/stackTrace/computeStackTrace.js","../../node_modules/@datadog/browser-core/esm/tools/stackTrace/handlingStack.js","../../node_modules/@datadog/browser-core/esm/tools/instrumentMethod.js","../../node_modules/@datadog/browser-core/esm/tools/serialisation/sanitize.js","../../node_modules/@datadog/browser-core/esm/domain/error/error.js","../../node_modules/@datadog/browser-core/esm/domain/error/error.types.js","../../node_modules/@datadog/browser-core/esm/domain/error/trackRuntimeError.js","../../node_modules/@datadog/browser-core/esm/boot/init.js","../../node_modules/@datadog/browser-core/esm/boot/displayAlreadyInitializedError.js","../../node_modules/@datadog/browser-core/esm/browser/addEventListener.js","../../node_modules/@datadog/browser-core/esm/domain/report/reportObservable.js","../../node_modules/@datadog/browser-core/esm/tools/sendToExtension.js","../../node_modules/@datadog/browser-core/esm/tools/utils/typeUtils.js","../../node_modules/@datadog/browser-core/esm/tools/mergeInto.js","../../node_modules/@datadog/browser-core/esm/domain/connectivity/connectivity.js","../../node_modules/@datadog/browser-core/esm/tools/utils/arrayUtils.js","../../node_modules/@datadog/browser-core/esm/tools/boundedBuffer.js","../../node_modules/@datadog/browser-core/esm/domain/telemetry/rawTelemetryEvent.types.js","../../node_modules/@datadog/browser-core/esm/domain/telemetry/telemetry.js","../../node_modules/@datadog/browser-core/esm/tools/valueHistory.js","../../node_modules/@datadog/browser-core/esm/domain/session/sessionManager.js","../../node_modules/@datadog/browser-core/esm/tools/utils/responseUtils.js","../../node_modules/@datadog/browser-core/esm/transport/sendWithRetryStrategy.js","../../node_modules/@datadog/browser-core/esm/transport/httpRequest.js","../../node_modules/@datadog/browser-core/esm/transport/eventBridge.js","../../node_modules/@datadog/browser-core/esm/browser/pageExitObservable.js","../../node_modules/@datadog/browser-core/esm/transport/batch.js","../../node_modules/@datadog/browser-core/esm/transport/flushController.js","../../node_modules/@datadog/browser-core/esm/transport/startBatchWithReplica.js","../../node_modules/@datadog/browser-core/esm/tools/encoder.js","../../node_modules/@datadog/browser-core/esm/tools/abstractLifeCycle.js","../../node_modules/@datadog/browser-core/esm/domain/eventRateLimiter/createEventRateLimiter.js","../../node_modules/@datadog/browser-core/esm/browser/runOnReadyState.js","../../node_modules/@datadog/browser-core/esm/browser/xhrObservable.js","../../node_modules/@datadog/browser-core/esm/browser/fetchObservable.js","../../node_modules/@datadog/browser-core/esm/domain/console/consoleObservable.js","../../node_modules/@datadog/browser-core/esm/domain/context/contextManager.js","../../node_modules/@datadog/browser-core/esm/domain/context/storeContextManager.js","../../node_modules/@datadog/browser-core/esm/domain/context/customerDataTracker.js","../../node_modules/@datadog/browser-core/esm/tools/readBytesFromStream.js","../../node_modules/@datadog/browser-core/esm/domain/synthetics/syntheticsWorkerValues.js","../../node_modules/@datadog/browser-core/esm/domain/user/user.js","../../node_modules/@datadog/browser-core/esm/tools/matchOption.js","../../node_modules/@datadog/browser-logs/esm/domain/logger.js","../../node_modules/@datadog/browser-logs/esm/domain/contexts/commonContext.js","../../node_modules/@datadog/browser-logs/esm/domain/configuration.js","../../node_modules/@datadog/browser-logs/esm/boot/preStartLogs.js","../../node_modules/@datadog/browser-logs/esm/boot/logsPublicApi.js","../../node_modules/@datadog/browser-logs/esm/domain/logsSessionManager.js","../../node_modules/@datadog/browser-logs/esm/domain/contexts/rumInternalContext.js","../../node_modules/@datadog/browser-logs/esm/domain/assembly.js","../../node_modules/@datadog/browser-logs/esm/domain/console/consoleCollection.js","../../node_modules/@datadog/browser-logs/esm/domain/report/reportCollection.js","../../node_modules/@datadog/browser-logs/esm/domain/networkError/networkErrorCollection.js","../../node_modules/@datadog/browser-logs/esm/domain/runtimeError/runtimeErrorCollection.js","../../node_modules/@datadog/browser-logs/esm/domain/lifeCycle.js","../../node_modules/@datadog/browser-logs/esm/domain/logger/loggerCollection.js","../../node_modules/@datadog/browser-logs/esm/transport/startLogsBatch.js","../../node_modules/@datadog/browser-logs/esm/transport/startLogsBridge.js","../../node_modules/@datadog/browser-logs/esm/domain/contexts/internalContext.js","../../node_modules/@datadog/browser-logs/esm/domain/reportError.js","../../node_modules/@datadog/browser-logs/esm/domain/logsTelemetry.js","../../node_modules/@datadog/browser-logs/esm/boot/startLogs.js","../../node_modules/@datadog/browser-logs/esm/entries/main.js","../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/commonContext.js","../../node_modules/@datadog/browser-rum-core/esm/domain/tracing/tracer.js","../../node_modules/@datadog/browser-rum-core/esm/domain/configuration.js","../../node_modules/@datadog/browser-rum-core/esm/boot/preStartRum.js","../../node_modules/@datadog/browser-rum-core/esm/boot/rumPublicApi.js","../../node_modules/@datadog/browser-rum-core/esm/browser/domMutationObservable.js","../../node_modules/@datadog/browser-rum-core/esm/domain/resource/resourceUtils.js","../../node_modules/@datadog/browser-rum-core/esm/browser/htmlDomUtils.js","../../node_modules/@datadog/browser-rum-core/esm/domain/tracing/getDocumentTraceId.js","../../node_modules/@datadog/browser-rum-core/esm/browser/performanceCollection.js","../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/syntheticsContext.js","../../node_modules/@datadog/browser-rum-core/esm/domain/limitModification.js","../../node_modules/@datadog/browser-rum-core/esm/domain/assembly.js","../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/internalContext.js","../../node_modules/@datadog/browser-rum-core/esm/domain/lifeCycle.js","../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/viewContexts.js","../../node_modules/@datadog/browser-rum-core/esm/domain/requestCollection.js","../../node_modules/@datadog/browser-rum-core/esm/domain/discardNegativeDuration.js","../../node_modules/@datadog/browser-rum-core/esm/domain/trackEventCounts.js","../../node_modules/@datadog/browser-rum-core/esm/domain/waitPageActivityEnd.js","../../node_modules/@datadog/browser-rum-core/esm/browser/polyfills.js","../../node_modules/@datadog/browser-rum-core/esm/domain/action/getActionNameFromElement.js","../../node_modules/@datadog/browser-rum-core/esm/domain/getSelectorFromElement.js","../../node_modules/@datadog/browser-rum-core/esm/domain/action/clickChain.js","../../node_modules/@datadog/browser-rum-core/esm/domain/action/listenActionEvents.js","../../node_modules/@datadog/browser-rum-core/esm/domain/action/computeFrustration.js","../../node_modules/@datadog/browser-rum-core/esm/domain/action/trackClickActions.js","../../node_modules/@datadog/browser-rum-core/esm/domain/action/actionCollection.js","../../node_modules/@datadog/browser-rum-core/esm/domain/error/trackConsoleError.js","../../node_modules/@datadog/browser-rum-core/esm/domain/error/trackReportError.js","../../node_modules/@datadog/browser-rum-core/esm/domain/error/errorCollection.js","../../node_modules/@datadog/browser-rum-core/esm/domain/longTask/longTaskCollection.js","../../node_modules/@datadog/browser-rum-core/esm/domain/resource/matchRequestTiming.js","../../node_modules/@datadog/browser-rum-core/esm/domain/resource/resourceCollection.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/trackViewEventCounts.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackFirstInput.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackNavigationTimings.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackFirstHidden.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackInitialViewMetrics.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/interactionCountPolyfill.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackLoadingTime.js","../../node_modules/@datadog/browser-rum-core/esm/browser/scroll.js","../../node_modules/@datadog/browser-rum-core/esm/browser/viewportObservable.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackScrollMetrics.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackCommonViewMetrics.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/trackViews.js","../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewCollection.js","../../node_modules/@datadog/browser-rum-core/esm/domain/rumSessionManager.js","../../node_modules/@datadog/browser-rum-core/esm/transport/startRumBatch.js","../../node_modules/@datadog/browser-rum-core/esm/transport/startRumEventBridge.js","../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/urlContexts.js","../../node_modules/@datadog/browser-rum-core/esm/browser/locationChangeObservable.js","../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/featureFlagContext.js","../../node_modules/@datadog/browser-rum-core/esm/domain/startCustomerDataTelemetry.js","../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/pageStateHistory.js","../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/displayContext.js","../../node_modules/@datadog/browser-rum-core/esm/domain/vital/vitalCollection.js","../../node_modules/@datadog/browser-rum-core/esm/browser/cookieObservable.js","../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/ciVisibilityContext.js","../../node_modules/@datadog/browser-rum-core/esm/boot/startRum.js","../../node_modules/@datadog/browser-rum-core/esm/domain/getSessionReplayUrl.js","../../node_modules/@datadog/browser-rum/esm/domain/replayStats.js","../../node_modules/@datadog/browser-rum/esm/constants.js","../../node_modules/@datadog/browser-rum/esm/domain/record/privacy.js","../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializationUtils.js","../../node_modules/@datadog/browser-rum/esm/types/sessionReplayConstants.js","../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializeStyleSheets.js","../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializeAttribute.js","../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializeAttributes.js","../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializeNode.js","../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializeDocument.js","../../node_modules/@datadog/browser-rum/esm/domain/record/eventsUtils.js","../../node_modules/@datadog/browser-rum/esm/domain/record/viewports.js","../../node_modules/@datadog/browser-rum/esm/domain/record/assembly.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackMove.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackMouseInteraction.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackScroll.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackViewportResize.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackMediaInteraction.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackStyleSheet.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackFocus.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackFrustration.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackViewEnd.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackInput.js","../../node_modules/@datadog/browser-rum/esm/domain/record/mutationBatch.js","../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackMutation.js","../../node_modules/@datadog/browser-rum/esm/domain/record/elementsScrollPositions.js","../../node_modules/@datadog/browser-rum/esm/domain/record/shadowRootsController.js","../../node_modules/@datadog/browser-rum/esm/domain/record/startFullSnapshots.js","../../node_modules/@datadog/browser-rum/esm/domain/record/recordIds.js","../../node_modules/@datadog/browser-rum/esm/domain/record/record.js","../../node_modules/@datadog/browser-rum/esm/domain/segmentCollection/buildReplayPayload.js","../../node_modules/@datadog/browser-rum/esm/domain/segmentCollection/segment.js","../../node_modules/@datadog/browser-rum/esm/domain/segmentCollection/segmentCollection.js","../../node_modules/@datadog/browser-rum/esm/domain/startRecordBridge.js","../../node_modules/@datadog/browser-rum/esm/boot/startRecording.js","../../node_modules/@datadog/browser-rum/esm/boot/isBrowserSupported.js","../../node_modules/@datadog/browser-rum/esm/domain/getSessionReplayLink.js","../../node_modules/@datadog/browser-rum/esm/domain/deflate/deflateEncoder.js","../../node_modules/@datadog/browser-rum/esm/domain/deflate/deflateWorker.js","../../node_modules/@datadog/browser-rum/esm/boot/recorderApi.js","../../node_modules/@datadog/browser-rum/esm/entries/main.js","../../node_modules/launchdarkly-react-client-sdk/lib/types.js","../../node_modules/launchdarkly-react-client-sdk/lib/context.js","../../node_modules/launchdarkly-js-client-sdk/dist/ldclient.es.js","../../node_modules/lodash.camelcase/index.js","../../node_modules/launchdarkly-react-client-sdk/lib/utils.js","../../node_modules/launchdarkly-react-client-sdk/lib/initLDClient.js","../../node_modules/launchdarkly-react-client-sdk/lib/getFlagsProxy.js","../../node_modules/launchdarkly-react-client-sdk/lib/provider.js","../../node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/react-is/index.js","../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../node_modules/launchdarkly-react-client-sdk/lib/withLDProvider.js","../../node_modules/launchdarkly-react-client-sdk/lib/asyncWithLDProvider.js","../../node_modules/launchdarkly-react-client-sdk/lib/withLDConsumer.js","../../node_modules/launchdarkly-react-client-sdk/lib/useFlags.js","../../node_modules/launchdarkly-react-client-sdk/lib/useLDClient.js","../../node_modules/launchdarkly-react-client-sdk/lib/useLDClientError.js","../../node_modules/launchdarkly-react-client-sdk/lib/index.js","../../node_modules/scheduler/cjs/scheduler.production.min.js","../../node_modules/scheduler/index.js","../../node_modules/react-dom/cjs/react-dom.production.min.js","../../node_modules/react-dom/index.js","../../node_modules/@babel/runtime/helpers/esm/extends.js","../../node_modules/history/index.js","../../node_modules/react-router/index.js","../../node_modules/react-router-dom/index.js","../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../node_modules/react/jsx-runtime.js","../../react/jsx-runtime","../../node_modules/@transferz/fe-component-library/src/components/typography/Typography.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/XIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/loader/Loader.tsx","../../node_modules/@transferz/fe-component-library/src/components/button/Button.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/ChevronIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CircleXIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/errorScreen/ErrorScreen.tsx","../../node_modules/localize-react/dist/localize-react.js","../../node_modules/@transferz/fe-component-library/src/components/icons/ListIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/LogoIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/MenuIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/divider/Divider.tsx","../../node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js","../../node_modules/stylis/src/Enum.js","../../node_modules/stylis/src/Utility.js","../../node_modules/stylis/src/Tokenizer.js","../../node_modules/stylis/src/Parser.js","../../node_modules/stylis/src/Prefixer.js","../../node_modules/stylis/src/Serializer.js","../../node_modules/stylis/src/Middleware.js","../../node_modules/@emotion/memoize/dist/emotion-memoize.browser.esm.js","../../node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js","../../node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js","../../node_modules/@emotion/hash/dist/hash.browser.esm.js","../../node_modules/@emotion/unitless/dist/unitless.browser.esm.js","../../node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js","../../node_modules/@emotion/react/dist/emotion-element-699e6908.browser.esm.js","../../node_modules/@emotion/react/dist/emotion-react.browser.esm.js","../../node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../../node_modules/@babel/runtime/helpers/esm/createClass.js","../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/esm/inherits.js","../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../node_modules/react-select/dist/index-c7a4d7ce.esm.js","../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js","../../node_modules/react-select/dist/useStateManager-783b07d5.esm.js","../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js","../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","../../node_modules/memoize-one/dist/memoize-one.esm.js","../../node_modules/react-select/dist/Select-126cf1dd.esm.js","../../node_modules/react-select/dist/react-select.esm.js","../../node_modules/@transferz/fe-component-library/src/components/icons/ArrowIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/BabySeatIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/ChildSeatIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/BoosterSeatIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/BriefcaseIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CalendarIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CalendarNewIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CameraIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CaretIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CarIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CarRightIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CheckIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CircleCheckIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CircleIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/CirclePlusIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/ClockIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/DangerIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/EyeIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/HashtagIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/LocationIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/MapIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/LogoutIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/LuggageIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/MeetAndGreetIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/MeetingPointIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/MinusPersonIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/NotesIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/PenIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/PersonIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/PetsIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/PhoneIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/PhoneRingIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/PhotoIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/PlaneIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/PlayIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/PlusPersonIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/PointOfInterestIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/ProfileIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/QuestionMarkIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/SadFaceIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/SeaportIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/SearchIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/SmsIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/SortSizeIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/TimerIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/TrainIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/TrashIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/WhatsAppIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/ShipIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/dropdown/Dropdown.tsx","../../node_modules/@transferz/fe-component-library/src/components/popUp/PopUp.tsx","../../node_modules/@transferz/fe-component-library/src/components/imageUpload/ImageUpload.tsx","../../node_modules/prop-types/lib/ReactPropTypesSecret.js","../../node_modules/prop-types/factoryWithThrowingShims.js","../../node_modules/prop-types/index.js","../../node_modules/classnames/index.js","../../node_modules/date-fns/esm/_lib/requiredArgs/index.js","../../node_modules/date-fns/esm/isDate/index.js","../../node_modules/date-fns/esm/toDate/index.js","../../node_modules/date-fns/esm/isValid/index.js","../../node_modules/date-fns/esm/_lib/toInteger/index.js","../../node_modules/date-fns/esm/addMilliseconds/index.js","../../node_modules/date-fns/esm/subMilliseconds/index.js","../../node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js","../../node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js","../../node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js","../../node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js","../../node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js","../../node_modules/date-fns/esm/_lib/defaultOptions/index.js","../../node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js","../../node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js","../../node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js","../../node_modules/date-fns/esm/_lib/getUTCWeek/index.js","../../node_modules/date-fns/esm/_lib/addLeadingZeros/index.js","../../node_modules/date-fns/esm/_lib/format/lightFormatters/index.js","../../node_modules/date-fns/esm/_lib/format/formatters/index.js","../../node_modules/date-fns/esm/_lib/format/longFormatters/index.js","../../node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js","../../node_modules/date-fns/esm/_lib/protectedTokens/index.js","../../node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js","../../node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js","../../node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js","../../node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js","../../node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js","../../node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js","../../node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js","../../node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js","../../node_modules/date-fns/esm/locale/en-US/_lib/match/index.js","../../node_modules/date-fns/esm/locale/en-US/index.js","../../node_modules/date-fns/esm/format/index.js","../../node_modules/date-fns/esm/addMinutes/index.js","../../node_modules/date-fns/esm/addHours/index.js","../../node_modules/date-fns/esm/addDays/index.js","../../node_modules/date-fns/esm/addWeeks/index.js","../../node_modules/date-fns/esm/addMonths/index.js","../../node_modules/date-fns/esm/addQuarters/index.js","../../node_modules/date-fns/esm/addYears/index.js","../../node_modules/date-fns/esm/subDays/index.js","../../node_modules/date-fns/esm/subWeeks/index.js","../../node_modules/date-fns/esm/subMonths/index.js","../../node_modules/date-fns/esm/subQuarters/index.js","../../node_modules/date-fns/esm/subYears/index.js","../../node_modules/date-fns/esm/getSeconds/index.js","../../node_modules/date-fns/esm/getMinutes/index.js","../../node_modules/date-fns/esm/getHours/index.js","../../node_modules/date-fns/esm/getDay/index.js","../../node_modules/date-fns/esm/getDate/index.js","../../node_modules/date-fns/esm/startOfWeek/index.js","../../node_modules/date-fns/esm/startOfISOWeek/index.js","../../node_modules/date-fns/esm/getISOWeekYear/index.js","../../node_modules/date-fns/esm/startOfISOWeekYear/index.js","../../node_modules/date-fns/esm/getISOWeek/index.js","../../node_modules/date-fns/esm/getMonth/index.js","../../node_modules/date-fns/esm/getQuarter/index.js","../../node_modules/date-fns/esm/getYear/index.js","../../node_modules/date-fns/esm/getTime/index.js","../../node_modules/date-fns/esm/setSeconds/index.js","../../node_modules/date-fns/esm/setMinutes/index.js","../../node_modules/date-fns/esm/setHours/index.js","../../node_modules/date-fns/esm/getDaysInMonth/index.js","../../node_modules/date-fns/esm/setMonth/index.js","../../node_modules/date-fns/esm/setQuarter/index.js","../../node_modules/date-fns/esm/setYear/index.js","../../node_modules/date-fns/esm/min/index.js","../../node_modules/date-fns/esm/max/index.js","../../node_modules/date-fns/esm/startOfDay/index.js","../../node_modules/date-fns/esm/differenceInCalendarDays/index.js","../../node_modules/date-fns/esm/differenceInCalendarMonths/index.js","../../node_modules/date-fns/esm/differenceInCalendarYears/index.js","../../node_modules/date-fns/esm/startOfMonth/index.js","../../node_modules/date-fns/esm/startOfQuarter/index.js","../../node_modules/date-fns/esm/startOfYear/index.js","../../node_modules/date-fns/esm/endOfDay/index.js","../../node_modules/date-fns/esm/endOfMonth/index.js","../../node_modules/date-fns/esm/endOfYear/index.js","../../node_modules/date-fns/esm/isEqual/index.js","../../node_modules/date-fns/esm/isSameDay/index.js","../../node_modules/date-fns/esm/isSameMonth/index.js","../../node_modules/date-fns/esm/isSameYear/index.js","../../node_modules/date-fns/esm/isSameQuarter/index.js","../../node_modules/date-fns/esm/isAfter/index.js","../../node_modules/date-fns/esm/isBefore/index.js","../../node_modules/date-fns/esm/isWithinInterval/index.js","../../node_modules/date-fns/esm/_lib/assign/index.js","../../node_modules/date-fns/esm/parse/_lib/Setter.js","../../node_modules/date-fns/esm/parse/_lib/Parser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/EraParser.js","../../node_modules/date-fns/esm/constants/index.js","../../node_modules/date-fns/esm/parse/_lib/constants.js","../../node_modules/date-fns/esm/parse/_lib/utils.js","../../node_modules/date-fns/esm/parse/_lib/parsers/YearParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekYearParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekYearParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/ExtendedYearParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/QuarterParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneQuarterParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/MonthParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneMonthParser.js","../../node_modules/date-fns/esm/_lib/setUTCWeek/index.js","../../node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekParser.js","../../node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js","../../node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/DateParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/DayOfYearParser.js","../../node_modules/date-fns/esm/_lib/setUTCDay/index.js","../../node_modules/date-fns/esm/parse/_lib/parsers/DayParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/LocalDayParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneLocalDayParser.js","../../node_modules/date-fns/esm/_lib/setUTCISODay/index.js","../../node_modules/date-fns/esm/parse/_lib/parsers/ISODayParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/AMPMParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/AMPMMidnightParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/DayPeriodParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/Hour1to12Parser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/Hour0to23Parser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/Hour0To11Parser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/Hour1To24Parser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/MinuteParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/SecondParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/FractionOfSecondParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneWithZParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/TimestampSecondsParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/TimestampMillisecondsParser.js","../../node_modules/date-fns/esm/parse/_lib/parsers/index.js","../../node_modules/date-fns/esm/parse/index.js","../../node_modules/date-fns/esm/parseISO/index.js","../../node_modules/react-onclickoutside/dist/react-onclickoutside.es.js","../../node_modules/react-popper/lib/esm/Manager.js","../../node_modules/react-popper/lib/esm/utils.js","../../node_modules/@popperjs/core/lib/enums.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../node_modules/@popperjs/core/lib/utils/math.js","../../node_modules/@popperjs/core/lib/utils/userAgent.js","../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../node_modules/@popperjs/core/lib/utils/within.js","../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../node_modules/@popperjs/core/lib/utils/debounce.js","../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../node_modules/@popperjs/core/lib/createPopper.js","../../node_modules/@popperjs/core/lib/popper.js","../../node_modules/react-fast-compare/index.js","../../node_modules/react-popper/lib/esm/usePopper.js","../../node_modules/react-popper/lib/esm/Popper.js","../../node_modules/react-popper/lib/esm/Reference.js","../../node_modules/date-fns/esm/set/index.js","../../node_modules/react-datepicker/dist/es/index.js","../../node_modules/@transferz/fe-component-library/src/components/dateTimePicker/DateTimePicker.tsx","../../node_modules/@transferz/fe-component-library/src/components/input/Input.tsx","../../node_modules/@transferz/fe-component-library/src/components/notification/Notification.tsx","../../node_modules/react-hook-form/dist/index.esm.mjs","../../node_modules/react-gtm-module/dist/utils/warn.js","../../node_modules/react-gtm-module/dist/Snippets.js","../../node_modules/react-gtm-module/dist/TagManager.js","../../node_modules/react-gtm-module/dist/index.js","../../node_modules/jwt-decode/lib/atob.js","../../node_modules/jwt-decode/lib/base64_url_decode.js","../../node_modules/jwt-decode/lib/index.js","../../node_modules/jwt-check-expiration/src/index.js","../../node_modules/@transferz/fe-component-library/src/types/services/countries.ts","../../node_modules/@transferz/fe-component-library/src/components/phoneInput/PhoneInput.tsx","../../node_modules/react-remove-scroll-bar/dist/es2015/constants.js","../../node_modules/use-callback-ref/dist/es2015/assignRef.js","../../node_modules/use-callback-ref/dist/es2015/useRef.js","../../node_modules/use-callback-ref/dist/es2015/useMergeRef.js","../../node_modules/use-sidecar/dist/es2015/medium.js","../../node_modules/use-sidecar/dist/es2015/exports.js","../../node_modules/react-remove-scroll/dist/es2015/medium.js","../../node_modules/react-remove-scroll/dist/es2015/UI.js","../../node_modules/get-nonce/dist/es2015/index.js","../../node_modules/react-style-singleton/dist/es2015/singleton.js","../../node_modules/react-style-singleton/dist/es2015/hook.js","../../node_modules/react-style-singleton/dist/es2015/component.js","../../node_modules/react-remove-scroll-bar/dist/es2015/utils.js","../../node_modules/react-remove-scroll-bar/dist/es2015/component.js","../../node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js","../../node_modules/react-remove-scroll/dist/es2015/handleScroll.js","../../node_modules/react-remove-scroll/dist/es2015/SideEffect.js","../../node_modules/react-remove-scroll/dist/es2015/sidecar.js","../../node_modules/react-remove-scroll/dist/es2015/Combination.js","../../node_modules/@transferz/fe-component-library/src/utils/utilFunctions.ts","../../node_modules/@transferz/fe-component-library/src/components/bottomDrawer/BottomDrawer.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/NoResultsIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/tabs/Tabs.tsx","../../node_modules/@transferz/fe-component-library/src/shared/assets/images/video-cover-taxi.png","../../node_modules/@transferz/fe-component-library/src/shared/assets/images/video-cover-phone.png","../../node_modules/@transferz/fe-component-library/src/shared/assets/images/video-cover-profile.png","../../node_modules/@transferz/fe-component-library/src/shared/assets/images/video-cover-issues.png","../../node_modules/@transferz/fe-component-library/src/components/timeStamp/TimeStamp.tsx","../../node_modules/@transferz/fe-component-library/src/components/videoCard/VideoCard.tsx","../../node_modules/@transferz/fe-component-library/src/components/rangeDatePicker/RangeDatePicker.tsx","../../node_modules/lodash/lodash.js","../../node_modules/@transferz/fe-component-library/src/types/colors.ts","../../node_modules/@transferz/fe-component-library/src/utils/parsingFunctions.ts","../../node_modules/@transferz/fe-component-library/src/components/icons/PlaneFlyingIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/icons/RefreshIcon.tsx","../../node_modules/@transferz/fe-component-library/src/components/flightTracker/FlightTracker.tsx","../../node_modules/react-youtube/node_modules/prop-types/lib/ReactPropTypesSecret.js","../../node_modules/react-youtube/node_modules/prop-types/factoryWithThrowingShims.js","../../node_modules/react-youtube/node_modules/prop-types/index.js","../../node_modules/fast-deep-equal/index.js","../../node_modules/sister/src/sister.js","../../node_modules/load-script/index.js","../../node_modules/youtube-player/dist/loadYouTubeIframeApi.js","../../node_modules/youtube-player/node_modules/ms/index.js","../../node_modules/youtube-player/node_modules/debug/src/debug.js","../../node_modules/youtube-player/node_modules/debug/src/browser.js","../../node_modules/youtube-player/dist/functionNames.js","../../node_modules/youtube-player/dist/eventNames.js","../../node_modules/youtube-player/dist/constants/PlayerStates.js","../../node_modules/youtube-player/dist/FunctionStateMap.js","../../node_modules/youtube-player/dist/YouTubePlayer.js","../../node_modules/youtube-player/dist/index.js","../../node_modules/react-youtube/dist/index.esm.js","../../node_modules/eventemitter3/index.js","../../node_modules/@googlemaps/js-api-loader/dist/index.esm.js","../../node_modules/@mapbox/point-geometry/index.js","../../node_modules/google-map-react/dist/index.modern.js","../../node_modules/@transferz/fe-component-library/src/components/geoMap/GeoDirection.tsx","../../node_modules/@transferz/fe-component-library/src/components/meetingPoint/MeetingPoint.tsx","../../node_modules/@transferz/fe-component-library/src/components/accordion/Accordion.tsx","../../node_modules/@transferz/fe-component-library/src/components/checkbox/Checkbox.tsx","../../node_modules/@transferz/fe-component-library/src/components/geoMap/GeoMap.tsx","../../node_modules/@hookform/resolvers/dist/resolvers.module.js","../../node_modules/@hookform/resolvers/yup/dist/yup.module.js","../../node_modules/react-google-recaptcha-v3/dist/react-google-recaptcha-v3.esm.js","../../node_modules/nanoclone/src/index.js","../../node_modules/yup/es/util/printValue.js","../../node_modules/yup/es/locale.js","../../node_modules/lodash/_baseHas.js","../../node_modules/lodash/isArray.js","../../node_modules/lodash/_freeGlobal.js","../../node_modules/lodash/_root.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/_isKey.js","../../node_modules/lodash/isObject.js","../../node_modules/lodash/isFunction.js","../../node_modules/lodash/_coreJsData.js","../../node_modules/lodash/_isMasked.js","../../node_modules/lodash/_toSource.js","../../node_modules/lodash/_baseIsNative.js","../../node_modules/lodash/_getValue.js","../../node_modules/lodash/_getNative.js","../../node_modules/lodash/_nativeCreate.js","../../node_modules/lodash/_hashClear.js","../../node_modules/lodash/_hashDelete.js","../../node_modules/lodash/_hashGet.js","../../node_modules/lodash/_hashHas.js","../../node_modules/lodash/_hashSet.js","../../node_modules/lodash/_Hash.js","../../node_modules/lodash/_listCacheClear.js","../../node_modules/lodash/eq.js","../../node_modules/lodash/_assocIndexOf.js","../../node_modules/lodash/_listCacheDelete.js","../../node_modules/lodash/_listCacheGet.js","../../node_modules/lodash/_listCacheHas.js","../../node_modules/lodash/_listCacheSet.js","../../node_modules/lodash/_ListCache.js","../../node_modules/lodash/_Map.js","../../node_modules/lodash/_mapCacheClear.js","../../node_modules/lodash/_isKeyable.js","../../node_modules/lodash/_getMapData.js","../../node_modules/lodash/_mapCacheDelete.js","../../node_modules/lodash/_mapCacheGet.js","../../node_modules/lodash/_mapCacheHas.js","../../node_modules/lodash/_mapCacheSet.js","../../node_modules/lodash/_MapCache.js","../../node_modules/lodash/memoize.js","../../node_modules/lodash/_memoizeCapped.js","../../node_modules/lodash/_stringToPath.js","../../node_modules/lodash/_arrayMap.js","../../node_modules/lodash/_baseToString.js","../../node_modules/lodash/toString.js","../../node_modules/lodash/_castPath.js","../../node_modules/lodash/_baseIsArguments.js","../../node_modules/lodash/isArguments.js","../../node_modules/lodash/_isIndex.js","../../node_modules/lodash/isLength.js","../../node_modules/lodash/_toKey.js","../../node_modules/lodash/_hasPath.js","../../node_modules/lodash/has.js","../../node_modules/yup/es/util/isSchema.js","../../node_modules/yup/es/Condition.js","../../node_modules/yup/es/util/toArray.js","../../node_modules/yup/es/ValidationError.js","../../node_modules/yup/es/util/runTests.js","../../node_modules/lodash/_defineProperty.js","../../node_modules/lodash/_baseAssignValue.js","../../node_modules/lodash/_createBaseFor.js","../../node_modules/lodash/_baseFor.js","../../node_modules/lodash/_baseTimes.js","../../node_modules/lodash/stubFalse.js","../../node_modules/lodash/isBuffer.js","../../node_modules/lodash/_baseIsTypedArray.js","../../node_modules/lodash/_baseUnary.js","../../node_modules/lodash/_nodeUtil.js","../../node_modules/lodash/isTypedArray.js","../../node_modules/lodash/_arrayLikeKeys.js","../../node_modules/lodash/_isPrototype.js","../../node_modules/lodash/_overArg.js","../../node_modules/lodash/_nativeKeys.js","../../node_modules/lodash/_baseKeys.js","../../node_modules/lodash/isArrayLike.js","../../node_modules/lodash/keys.js","../../node_modules/lodash/_baseForOwn.js","../../node_modules/lodash/_stackClear.js","../../node_modules/lodash/_stackDelete.js","../../node_modules/lodash/_stackGet.js","../../node_modules/lodash/_stackHas.js","../../node_modules/lodash/_stackSet.js","../../node_modules/lodash/_Stack.js","../../node_modules/lodash/_setCacheAdd.js","../../node_modules/lodash/_setCacheHas.js","../../node_modules/lodash/_SetCache.js","../../node_modules/lodash/_arraySome.js","../../node_modules/lodash/_cacheHas.js","../../node_modules/lodash/_equalArrays.js","../../node_modules/lodash/_Uint8Array.js","../../node_modules/lodash/_mapToArray.js","../../node_modules/lodash/_setToArray.js","../../node_modules/lodash/_equalByTag.js","../../node_modules/lodash/_arrayPush.js","../../node_modules/lodash/_baseGetAllKeys.js","../../node_modules/lodash/_arrayFilter.js","../../node_modules/lodash/stubArray.js","../../node_modules/lodash/_getSymbols.js","../../node_modules/lodash/_getAllKeys.js","../../node_modules/lodash/_equalObjects.js","../../node_modules/lodash/_DataView.js","../../node_modules/lodash/_Promise.js","../../node_modules/lodash/_Set.js","../../node_modules/lodash/_WeakMap.js","../../node_modules/lodash/_getTag.js","../../node_modules/lodash/_baseIsEqualDeep.js","../../node_modules/lodash/_baseIsEqual.js","../../node_modules/lodash/_baseIsMatch.js","../../node_modules/lodash/_isStrictComparable.js","../../node_modules/lodash/_getMatchData.js","../../node_modules/lodash/_matchesStrictComparable.js","../../node_modules/lodash/_baseMatches.js","../../node_modules/lodash/_baseGet.js","../../node_modules/lodash/get.js","../../node_modules/lodash/_baseHasIn.js","../../node_modules/lodash/hasIn.js","../../node_modules/lodash/_baseMatchesProperty.js","../../node_modules/lodash/identity.js","../../node_modules/lodash/_baseProperty.js","../../node_modules/lodash/_basePropertyDeep.js","../../node_modules/lodash/property.js","../../node_modules/lodash/_baseIteratee.js","../../node_modules/lodash/mapValues.js","../../node_modules/property-expr/index.js","../../node_modules/yup/es/Reference.js","../../node_modules/yup/es/util/createValidation.js","../../node_modules/yup/es/util/reach.js","../../node_modules/yup/es/util/ReferenceSet.js","../../node_modules/yup/es/schema.js","../../node_modules/yup/es/util/isAbsent.js","../../node_modules/yup/es/string.js","../../node_modules/yup/es/number.js","../../node_modules/yup/es/util/isodate.js","../../node_modules/yup/es/date.js","../../node_modules/lodash/_arrayReduce.js","../../node_modules/lodash/_basePropertyOf.js","../../node_modules/lodash/_deburrLetter.js","../../node_modules/lodash/deburr.js","../../node_modules/lodash/_asciiWords.js","../../node_modules/lodash/_hasUnicodeWord.js","../../node_modules/lodash/_unicodeWords.js","../../node_modules/lodash/words.js","../../node_modules/lodash/_createCompounder.js","../../node_modules/lodash/snakeCase.js","../../node_modules/lodash/_baseSlice.js","../../node_modules/lodash/_castSlice.js","../../node_modules/lodash/_hasUnicode.js","../../node_modules/lodash/_asciiToArray.js","../../node_modules/lodash/_unicodeToArray.js","../../node_modules/lodash/_stringToArray.js","../../node_modules/lodash/_createCaseFirst.js","../../node_modules/lodash/upperFirst.js","../../node_modules/lodash/capitalize.js","../../node_modules/lodash/camelCase.js","../../node_modules/lodash/mapKeys.js","../../node_modules/toposort/index.js","../../node_modules/yup/es/util/sortFields.js","../../node_modules/yup/es/util/sortByKeyOrder.js","../../node_modules/yup/es/object.js","../../node_modules/@transferz/fe-component-library/src/components/pin/PinInput.tsx","../../node_modules/@transferz/fe-component-library/src/components/pinSingleInput/PinSingleInput.tsx","../../node_modules/@transferz/fe-component-library/src/components/avatarImageUpload/AvatarImageUpload.tsx","../../node_modules/extract-files/public/ReactNativeFile.js","../../node_modules/extract-files/public/isExtractableFile.js","../../node_modules/extract-files/public/extractFiles.js","../../node_modules/apollo-upload-client/public/formDataAppendFile.js","../../node_modules/apollo-upload-client/public/isExtractableFile.js","../../node_modules/apollo-upload-client/public/createUploadLink.js"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import { __extends } from 'tslib';\n\nvar genericMessage = \"Invariant Violation\";\r\nvar _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) {\r\n obj.__proto__ = proto;\r\n return obj;\r\n} : _a;\r\nvar InvariantError = /** @class */ (function (_super) {\r\n __extends(InvariantError, _super);\r\n function InvariantError(message) {\r\n if (message === void 0) { message = genericMessage; }\r\n var _this = _super.call(this, typeof message === \"number\"\r\n ? genericMessage + \": \" + message + \" (see https://github.com/apollographql/invariant-packages)\"\r\n : message) || this;\r\n _this.framesToPop = 1;\r\n _this.name = genericMessage;\r\n setPrototypeOf(_this, InvariantError.prototype);\r\n return _this;\r\n }\r\n return InvariantError;\r\n}(Error));\r\nfunction invariant(condition, message) {\r\n if (!condition) {\r\n throw new InvariantError(message);\r\n }\r\n}\r\nvar verbosityLevels = [\"debug\", \"log\", \"warn\", \"error\", \"silent\"];\r\nvar verbosityLevel = verbosityLevels.indexOf(\"log\");\r\nfunction wrapConsoleMethod(name) {\r\n return function () {\r\n if (verbosityLevels.indexOf(name) >= verbosityLevel) {\r\n // Default to console.log if this host environment happens not to provide\r\n // all the console.* methods we need.\r\n var method = console[name] || console.log;\r\n return method.apply(console, arguments);\r\n }\r\n };\r\n}\r\n(function (invariant) {\r\n invariant.debug = wrapConsoleMethod(\"debug\");\r\n invariant.log = wrapConsoleMethod(\"log\");\r\n invariant.warn = wrapConsoleMethod(\"warn\");\r\n invariant.error = wrapConsoleMethod(\"error\");\r\n})(invariant || (invariant = {}));\r\nfunction setVerbosity(level) {\r\n var old = verbosityLevels[verbosityLevel];\r\n verbosityLevel = Math.max(0, verbosityLevels.indexOf(level));\r\n return old;\r\n}\r\nvar invariant$1 = invariant;\n\nexport { InvariantError, invariant$1 as default, invariant, setVerbosity };\n//# sourceMappingURL=invariant.esm.js.map\n","export function maybe(thunk) {\n try {\n return thunk();\n }\n catch (_a) { }\n}\n//# sourceMappingURL=maybe.js.map","import { maybe } from \"./maybe.js\";\nexport default (maybe(function () { return globalThis; }) ||\n maybe(function () { return window; }) ||\n maybe(function () { return self; }) ||\n maybe(function () { return global; }) ||\n maybe(function () { return maybe.constructor(\"return this\")(); }));\n//# sourceMappingURL=global.js.map","import global from \"./global.js\";\nimport { maybe } from \"./maybe.js\";\nvar __ = \"__\";\nvar GLOBAL_KEY = [__, __].join(\"DEV\");\nfunction getDEV() {\n try {\n return Boolean(__DEV__);\n }\n catch (_a) {\n Object.defineProperty(global, GLOBAL_KEY, {\n value: maybe(function () { return process.env.NODE_ENV; }) !== \"production\",\n enumerable: false,\n configurable: true,\n writable: true,\n });\n return global[GLOBAL_KEY];\n }\n}\nexport default getDEV();\n//# sourceMappingURL=DEV.js.map","function maybe(thunk) {\n try { return thunk() } catch (_) {}\n}\n\nvar safeGlobal = (\n maybe(function() { return globalThis }) ||\n maybe(function() { return window }) ||\n maybe(function() { return self }) ||\n maybe(function() { return global }) ||\n // We don't expect the Function constructor ever to be invoked at runtime, as\n // long as at least one of globalThis, window, self, or global is defined, so\n // we are under no obligation to make it easy for static analysis tools to\n // detect syntactic usage of the Function constructor. If you think you can\n // improve your static analysis to detect this obfuscation, think again. This\n // is an arms race you cannot win, at least not in JavaScript.\n maybe(function() { return maybe.constructor(\"return this\")() })\n);\n\nvar needToRemove = false;\n\nexport function install() {\n if (safeGlobal &&\n !maybe(function() { return process.env.NODE_ENV }) &&\n !maybe(function() { return process })) {\n Object.defineProperty(safeGlobal, \"process\", {\n value: {\n env: {\n // This default needs to be \"production\" instead of \"development\", to\n // avoid the problem https://github.com/graphql/graphql-js/pull/2894\n // will eventually solve, once merged and released.\n NODE_ENV: \"production\",\n },\n },\n // Let anyone else change global.process as they see fit, but hide it from\n // Object.keys(global) enumeration.\n configurable: true,\n enumerable: false,\n writable: true,\n });\n needToRemove = true;\n }\n}\n\n// Call install() at least once, when this module is imported.\ninstall();\n\nexport function remove() {\n if (needToRemove) {\n delete safeGlobal.process;\n needToRemove = false;\n }\n}\n","export function devAssert(condition, message) {\n const booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(message);\n }\n}\n","/**\n * Return true if `value` is object-like. A value is object-like if it's not\n * `null` and has a `typeof` result of \"object\".\n */\nexport function isObjectLike(value) {\n return typeof value == 'object' && value !== null;\n}\n","export function invariant(condition, message) {\n const booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(\n message != null ? message : 'Unexpected invariant triggered.',\n );\n }\n}\n","import { invariant } from '../jsutils/invariant.mjs';\nconst LineRegExp = /\\r\\n|[\\n\\r]/g;\n/**\n * Represents a location in a Source.\n */\n\n/**\n * Takes a Source and a UTF-8 character offset, and returns the corresponding\n * line and column as a SourceLocation.\n */\nexport function getLocation(source, position) {\n let lastLineStart = 0;\n let line = 1;\n\n for (const match of source.body.matchAll(LineRegExp)) {\n typeof match.index === 'number' || invariant(false);\n\n if (match.index >= position) {\n break;\n }\n\n lastLineStart = match.index + match[0].length;\n line += 1;\n }\n\n return {\n line,\n column: position + 1 - lastLineStart,\n };\n}\n","import { getLocation } from './location.mjs';\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\n\nexport function printLocation(location) {\n return printSourceLocation(\n location.source,\n getLocation(location.source, location.start),\n );\n}\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\n\nexport function printSourceLocation(source, sourceLocation) {\n const firstLineColumnOffset = source.locationOffset.column - 1;\n const body = ''.padStart(firstLineColumnOffset) + source.body;\n const lineIndex = sourceLocation.line - 1;\n const lineOffset = source.locationOffset.line - 1;\n const lineNum = sourceLocation.line + lineOffset;\n const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;\n const columnNum = sourceLocation.column + columnOffset;\n const locationStr = `${source.name}:${lineNum}:${columnNum}\\n`;\n const lines = body.split(/\\r\\n|[\\n\\r]/g);\n const locationLine = lines[lineIndex]; // Special case for minified documents\n\n if (locationLine.length > 120) {\n const subLineIndex = Math.floor(columnNum / 80);\n const subLineColumnNum = columnNum % 80;\n const subLines = [];\n\n for (let i = 0; i < locationLine.length; i += 80) {\n subLines.push(locationLine.slice(i, i + 80));\n }\n\n return (\n locationStr +\n printPrefixedLines([\n [`${lineNum} |`, subLines[0]],\n ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]),\n ['|', '^'.padStart(subLineColumnNum)],\n ['|', subLines[subLineIndex + 1]],\n ])\n );\n }\n\n return (\n locationStr +\n printPrefixedLines([\n // Lines specified like this: [\"prefix\", \"string\"],\n [`${lineNum - 1} |`, lines[lineIndex - 1]],\n [`${lineNum} |`, locationLine],\n ['|', '^'.padStart(columnNum)],\n [`${lineNum + 1} |`, lines[lineIndex + 1]],\n ])\n );\n}\n\nfunction printPrefixedLines(lines) {\n const existingLines = lines.filter(([_, line]) => line !== undefined);\n const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));\n return existingLines\n .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : ''))\n .join('\\n');\n}\n","import { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { getLocation } from '../language/location.mjs';\nimport {\n printLocation,\n printSourceLocation,\n} from '../language/printLocation.mjs';\n/**\n * Custom extensions\n *\n * @remarks\n * Use a unique identifier name for your extension, for example the name of\n * your library or project. Do not use a shortened identifier as this increases\n * the risk of conflicts. We recommend you add at most one extension field,\n * an object which can contain all the values you need.\n */\n\n/**\n * A GraphQLError describes an Error found during the parse, validate, or\n * execute phases of performing a GraphQL operation. In addition to a message\n * and stack trace, it also includes information about the locations in a\n * GraphQL document and/or execution result that correspond to the Error.\n */\nexport class GraphQLError extends Error {\n /**\n * An array of `{ line, column }` locations within the source GraphQL document\n * which correspond to this error.\n *\n * Errors during validation often contain multiple locations, for example to\n * point out two things with the same name. Errors during execution include a\n * single location, the field which produced the error.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array describing the JSON-path into the execution response which\n * corresponds to this error. Only included for errors during execution.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array of GraphQL AST Nodes corresponding to this error.\n */\n\n /**\n * The source GraphQL document for the first location of this error.\n *\n * Note that if this Error represents more than one node, the source may not\n * represent nodes after the first node.\n */\n\n /**\n * An array of character offsets within the source GraphQL document\n * which correspond to this error.\n */\n\n /**\n * The original error thrown from a field resolver during execution.\n */\n\n /**\n * Extension fields to add to the formatted error.\n */\n constructor(\n message,\n nodes,\n source,\n positions,\n path,\n originalError,\n extensions,\n ) {\n var _this$nodes, _nodeLocations$, _ref;\n\n super(message);\n this.name = 'GraphQLError';\n this.path = path !== null && path !== void 0 ? path : undefined;\n this.originalError =\n originalError !== null && originalError !== void 0\n ? originalError\n : undefined; // Compute list of blame nodes.\n\n this.nodes = undefinedIfEmpty(\n Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined,\n );\n const nodeLocations = undefinedIfEmpty(\n (_this$nodes = this.nodes) === null || _this$nodes === void 0\n ? void 0\n : _this$nodes.map((node) => node.loc).filter((loc) => loc != null),\n ); // Compute locations in the source for the given nodes/positions.\n\n this.source =\n source !== null && source !== void 0\n ? source\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : (_nodeLocations$ = nodeLocations[0]) === null ||\n _nodeLocations$ === void 0\n ? void 0\n : _nodeLocations$.source;\n this.positions =\n positions !== null && positions !== void 0\n ? positions\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : nodeLocations.map((loc) => loc.start);\n this.locations =\n positions && source\n ? positions.map((pos) => getLocation(source, pos))\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : nodeLocations.map((loc) => getLocation(loc.source, loc.start));\n const originalExtensions = isObjectLike(\n originalError === null || originalError === void 0\n ? void 0\n : originalError.extensions,\n )\n ? originalError === null || originalError === void 0\n ? void 0\n : originalError.extensions\n : undefined;\n this.extensions =\n (_ref =\n extensions !== null && extensions !== void 0\n ? extensions\n : originalExtensions) !== null && _ref !== void 0\n ? _ref\n : Object.create(null); // Only properties prescribed by the spec should be enumerable.\n // Keep the rest as non-enumerable.\n\n Object.defineProperties(this, {\n message: {\n writable: true,\n enumerable: true,\n },\n name: {\n enumerable: false,\n },\n nodes: {\n enumerable: false,\n },\n source: {\n enumerable: false,\n },\n positions: {\n enumerable: false,\n },\n originalError: {\n enumerable: false,\n },\n }); // Include (non-enumerable) stack trace.\n\n /* c8 ignore start */\n // FIXME: https://github.com/graphql/graphql-js/issues/2317\n\n if (\n originalError !== null &&\n originalError !== void 0 &&\n originalError.stack\n ) {\n Object.defineProperty(this, 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true,\n });\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, GraphQLError);\n } else {\n Object.defineProperty(this, 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true,\n });\n }\n /* c8 ignore stop */\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLError';\n }\n\n toString() {\n let output = this.message;\n\n if (this.nodes) {\n for (const node of this.nodes) {\n if (node.loc) {\n output += '\\n\\n' + printLocation(node.loc);\n }\n }\n } else if (this.source && this.locations) {\n for (const location of this.locations) {\n output += '\\n\\n' + printSourceLocation(this.source, location);\n }\n }\n\n return output;\n }\n\n toJSON() {\n const formattedError = {\n message: this.message,\n };\n\n if (this.locations != null) {\n formattedError.locations = this.locations;\n }\n\n if (this.path != null) {\n formattedError.path = this.path;\n }\n\n if (this.extensions != null && Object.keys(this.extensions).length > 0) {\n formattedError.extensions = this.extensions;\n }\n\n return formattedError;\n }\n}\n\nfunction undefinedIfEmpty(array) {\n return array === undefined || array.length === 0 ? undefined : array;\n}\n/**\n * See: https://spec.graphql.org/draft/#sec-Errors\n */\n\n/**\n * Prints a GraphQLError to a string, representing useful location information\n * about the error's position in the source.\n *\n * @deprecated Please use `error.toString` instead. Will be removed in v17\n */\nexport function printError(error) {\n return error.toString();\n}\n/**\n * Given a GraphQLError, format it according to the rules described by the\n * Response Format, Errors section of the GraphQL Specification.\n *\n * @deprecated Please use `error.toString` instead. Will be removed in v17\n */\n\nexport function formatError(error) {\n return error.toJSON();\n}\n","import { GraphQLError } from './GraphQLError.mjs';\n/**\n * Produces a GraphQLError representing a syntax error, containing useful\n * descriptive information about the syntax error's position in the source.\n */\n\nexport function syntaxError(source, position, description) {\n return new GraphQLError(`Syntax Error: ${description}`, undefined, source, [\n position,\n ]);\n}\n","/**\n * The set of allowed kind values for AST nodes.\n */\nexport let Kind;\n/**\n * The enum type representing the possible kind values of AST nodes.\n *\n * @deprecated Please use `Kind`. Will be remove in v17.\n */\n\n(function (Kind) {\n Kind['NAME'] = 'Name';\n Kind['DOCUMENT'] = 'Document';\n Kind['OPERATION_DEFINITION'] = 'OperationDefinition';\n Kind['VARIABLE_DEFINITION'] = 'VariableDefinition';\n Kind['SELECTION_SET'] = 'SelectionSet';\n Kind['FIELD'] = 'Field';\n Kind['ARGUMENT'] = 'Argument';\n Kind['FRAGMENT_SPREAD'] = 'FragmentSpread';\n Kind['INLINE_FRAGMENT'] = 'InlineFragment';\n Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition';\n Kind['VARIABLE'] = 'Variable';\n Kind['INT'] = 'IntValue';\n Kind['FLOAT'] = 'FloatValue';\n Kind['STRING'] = 'StringValue';\n Kind['BOOLEAN'] = 'BooleanValue';\n Kind['NULL'] = 'NullValue';\n Kind['ENUM'] = 'EnumValue';\n Kind['LIST'] = 'ListValue';\n Kind['OBJECT'] = 'ObjectValue';\n Kind['OBJECT_FIELD'] = 'ObjectField';\n Kind['DIRECTIVE'] = 'Directive';\n Kind['NAMED_TYPE'] = 'NamedType';\n Kind['LIST_TYPE'] = 'ListType';\n Kind['NON_NULL_TYPE'] = 'NonNullType';\n Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition';\n Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition';\n Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition';\n Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition';\n Kind['FIELD_DEFINITION'] = 'FieldDefinition';\n Kind['INPUT_VALUE_DEFINITION'] = 'InputValueDefinition';\n Kind['INTERFACE_TYPE_DEFINITION'] = 'InterfaceTypeDefinition';\n Kind['UNION_TYPE_DEFINITION'] = 'UnionTypeDefinition';\n Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition';\n Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition';\n Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition';\n Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition';\n Kind['SCHEMA_EXTENSION'] = 'SchemaExtension';\n Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension';\n Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension';\n Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension';\n Kind['UNION_TYPE_EXTENSION'] = 'UnionTypeExtension';\n Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';\n Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';\n})(Kind || (Kind = {}));\n","/**\n * Contains a range of UTF-8 character offsets and token references that\n * identify the region of the source from which the AST derived.\n */\nexport class Location {\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The Token at which this Node begins.\n */\n\n /**\n * The Token at which this Node ends.\n */\n\n /**\n * The Source document the AST represents.\n */\n constructor(startToken, endToken, source) {\n this.start = startToken.start;\n this.end = endToken.end;\n this.startToken = startToken;\n this.endToken = endToken;\n this.source = source;\n }\n\n get [Symbol.toStringTag]() {\n return 'Location';\n }\n\n toJSON() {\n return {\n start: this.start,\n end: this.end,\n };\n }\n}\n/**\n * Represents a range of characters represented by a lexical token\n * within a Source.\n */\n\nexport class Token {\n /**\n * The kind of Token.\n */\n\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The 1-indexed line number on which this Token appears.\n */\n\n /**\n * The 1-indexed column number at which this Token begins.\n */\n\n /**\n * For non-punctuation tokens, represents the interpreted value of the token.\n *\n * Note: is undefined for punctuation tokens, but typed as string for\n * convenience in the parser.\n */\n\n /**\n * Tokens exist as nodes in a double-linked-list amongst all tokens\n * including ignored tokens. is always the first node and \n * the last.\n */\n constructor(kind, start, end, line, column, value) {\n this.kind = kind;\n this.start = start;\n this.end = end;\n this.line = line;\n this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\n this.value = value;\n this.prev = null;\n this.next = null;\n }\n\n get [Symbol.toStringTag]() {\n return 'Token';\n }\n\n toJSON() {\n return {\n kind: this.kind,\n value: this.value,\n line: this.line,\n column: this.column,\n };\n }\n}\n/**\n * The list of all possible AST node types.\n */\n\n/**\n * @internal\n */\nexport const QueryDocumentKeys = {\n Name: [],\n Document: ['definitions'],\n OperationDefinition: [\n 'name',\n 'variableDefinitions',\n 'directives',\n 'selectionSet',\n ],\n VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'],\n Variable: ['name'],\n SelectionSet: ['selections'],\n Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'],\n Argument: ['name', 'value'],\n FragmentSpread: ['name', 'directives'],\n InlineFragment: ['typeCondition', 'directives', 'selectionSet'],\n FragmentDefinition: [\n 'name', // Note: fragment variable definitions are deprecated and will removed in v17.0.0\n 'variableDefinitions',\n 'typeCondition',\n 'directives',\n 'selectionSet',\n ],\n IntValue: [],\n FloatValue: [],\n StringValue: [],\n BooleanValue: [],\n NullValue: [],\n EnumValue: [],\n ListValue: ['values'],\n ObjectValue: ['fields'],\n ObjectField: ['name', 'value'],\n Directive: ['name', 'arguments'],\n NamedType: ['name'],\n ListType: ['type'],\n NonNullType: ['type'],\n SchemaDefinition: ['description', 'directives', 'operationTypes'],\n OperationTypeDefinition: ['type'],\n ScalarTypeDefinition: ['description', 'name', 'directives'],\n ObjectTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],\n InputValueDefinition: [\n 'description',\n 'name',\n 'type',\n 'defaultValue',\n 'directives',\n ],\n InterfaceTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n UnionTypeDefinition: ['description', 'name', 'directives', 'types'],\n EnumTypeDefinition: ['description', 'name', 'directives', 'values'],\n EnumValueDefinition: ['description', 'name', 'directives'],\n InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],\n DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],\n SchemaExtension: ['directives', 'operationTypes'],\n ScalarTypeExtension: ['name', 'directives'],\n ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n UnionTypeExtension: ['name', 'directives', 'types'],\n EnumTypeExtension: ['name', 'directives', 'values'],\n InputObjectTypeExtension: ['name', 'directives', 'fields'],\n};\nconst kindValues = new Set(Object.keys(QueryDocumentKeys));\n/**\n * @internal\n */\n\nexport function isNode(maybeNode) {\n const maybeKind =\n maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;\n return typeof maybeKind === 'string' && kindValues.has(maybeKind);\n}\n/** Name */\n\nexport let OperationTypeNode;\n\n(function (OperationTypeNode) {\n OperationTypeNode['QUERY'] = 'query';\n OperationTypeNode['MUTATION'] = 'mutation';\n OperationTypeNode['SUBSCRIPTION'] = 'subscription';\n})(OperationTypeNode || (OperationTypeNode = {}));\n","/**\n * An exported enum describing the different kinds of tokens that the\n * lexer emits.\n */\nexport let TokenKind;\n/**\n * The enum type representing the token kinds values.\n *\n * @deprecated Please use `TokenKind`. Will be remove in v17.\n */\n\n(function (TokenKind) {\n TokenKind['SOF'] = '';\n TokenKind['EOF'] = '';\n TokenKind['BANG'] = '!';\n TokenKind['DOLLAR'] = '$';\n TokenKind['AMP'] = '&';\n TokenKind['PAREN_L'] = '(';\n TokenKind['PAREN_R'] = ')';\n TokenKind['SPREAD'] = '...';\n TokenKind['COLON'] = ':';\n TokenKind['EQUALS'] = '=';\n TokenKind['AT'] = '@';\n TokenKind['BRACKET_L'] = '[';\n TokenKind['BRACKET_R'] = ']';\n TokenKind['BRACE_L'] = '{';\n TokenKind['PIPE'] = '|';\n TokenKind['BRACE_R'] = '}';\n TokenKind['NAME'] = 'Name';\n TokenKind['INT'] = 'Int';\n TokenKind['FLOAT'] = 'Float';\n TokenKind['STRING'] = 'String';\n TokenKind['BLOCK_STRING'] = 'BlockString';\n TokenKind['COMMENT'] = 'Comment';\n})(TokenKind || (TokenKind = {}));\n","const MAX_ARRAY_LENGTH = 10;\nconst MAX_RECURSIVE_DEPTH = 2;\n/**\n * Used to print values in error messages.\n */\n\nexport function inspect(value) {\n return formatValue(value, []);\n}\n\nfunction formatValue(value, seenValues) {\n switch (typeof value) {\n case 'string':\n return JSON.stringify(value);\n\n case 'function':\n return value.name ? `[function ${value.name}]` : '[function]';\n\n case 'object':\n return formatObjectValue(value, seenValues);\n\n default:\n return String(value);\n }\n}\n\nfunction formatObjectValue(value, previouslySeenValues) {\n if (value === null) {\n return 'null';\n }\n\n if (previouslySeenValues.includes(value)) {\n return '[Circular]';\n }\n\n const seenValues = [...previouslySeenValues, value];\n\n if (isJSONable(value)) {\n const jsonValue = value.toJSON(); // check for infinite recursion\n\n if (jsonValue !== value) {\n return typeof jsonValue === 'string'\n ? jsonValue\n : formatValue(jsonValue, seenValues);\n }\n } else if (Array.isArray(value)) {\n return formatArray(value, seenValues);\n }\n\n return formatObject(value, seenValues);\n}\n\nfunction isJSONable(value) {\n return typeof value.toJSON === 'function';\n}\n\nfunction formatObject(object, seenValues) {\n const entries = Object.entries(object);\n\n if (entries.length === 0) {\n return '{}';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[' + getObjectTag(object) + ']';\n }\n\n const properties = entries.map(\n ([key, value]) => key + ': ' + formatValue(value, seenValues),\n );\n return '{ ' + properties.join(', ') + ' }';\n}\n\nfunction formatArray(array, seenValues) {\n if (array.length === 0) {\n return '[]';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[Array]';\n }\n\n const len = Math.min(MAX_ARRAY_LENGTH, array.length);\n const remaining = array.length - len;\n const items = [];\n\n for (let i = 0; i < len; ++i) {\n items.push(formatValue(array[i], seenValues));\n }\n\n if (remaining === 1) {\n items.push('... 1 more item');\n } else if (remaining > 1) {\n items.push(`... ${remaining} more items`);\n }\n\n return '[' + items.join(', ') + ']';\n}\n\nfunction getObjectTag(object) {\n const tag = Object.prototype.toString\n .call(object)\n .replace(/^\\[object /, '')\n .replace(/]$/, '');\n\n if (tag === 'Object' && typeof object.constructor === 'function') {\n const name = object.constructor.name;\n\n if (typeof name === 'string' && name !== '') {\n return name;\n }\n }\n\n return tag;\n}\n","import { inspect } from './inspect.mjs';\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n * See: https://webpack.js.org/guides/production/\n */\n\nexport const instanceOf =\n /* c8 ignore next 5 */\n // FIXME: https://github.com/graphql/graphql-js/issues/2317\n process.env.NODE_ENV === 'production'\n ? function instanceOf(value, constructor) {\n return value instanceof constructor;\n }\n : function instanceOf(value, constructor) {\n if (value instanceof constructor) {\n return true;\n }\n\n if (typeof value === 'object' && value !== null) {\n var _value$constructor;\n\n // Prefer Symbol.toStringTag since it is immune to minification.\n const className = constructor.prototype[Symbol.toStringTag];\n const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009\n ? value[Symbol.toStringTag]\n : (_value$constructor = value.constructor) === null ||\n _value$constructor === void 0\n ? void 0\n : _value$constructor.name;\n\n if (className === valueClassName) {\n const stringifiedValue = inspect(value);\n throw new Error(`Cannot use ${className} \"${stringifiedValue}\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`);\n }\n }\n\n return false;\n };\n","import { inspect } from '../jsutils/inspect.mjs';\nimport { devAssert } from '../jsutils/devAssert.mjs';\nimport { instanceOf } from '../jsutils/instanceOf.mjs';\n\n/**\n * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are\n * optional, but they are useful for clients who store GraphQL documents in source files.\n * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might\n * be useful for `name` to be `\"Foo.graphql\"` and location to be `{ line: 40, column: 1 }`.\n * The `line` and `column` properties in `locationOffset` are 1-indexed.\n */\nexport class Source {\n constructor(\n body,\n name = 'GraphQL request',\n locationOffset = {\n line: 1,\n column: 1,\n },\n ) {\n typeof body === 'string' ||\n devAssert(false, `Body must be a string. Received: ${inspect(body)}.`);\n this.body = body;\n this.name = name;\n this.locationOffset = locationOffset;\n this.locationOffset.line > 0 ||\n devAssert(\n false,\n 'line in locationOffset is 1-indexed and must be positive.',\n );\n this.locationOffset.column > 0 ||\n devAssert(\n false,\n 'column in locationOffset is 1-indexed and must be positive.',\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'Source';\n }\n}\n/**\n * Test if the given value is a Source object.\n *\n * @internal\n */\n\nexport function isSource(source) {\n return instanceOf(source, Source);\n}\n","/**\n * The set of allowed directive location values.\n */\nexport let DirectiveLocation;\n/**\n * The enum type representing the directive location values.\n *\n * @deprecated Please use `DirectiveLocation`. Will be remove in v17.\n */\n\n(function (DirectiveLocation) {\n DirectiveLocation['QUERY'] = 'QUERY';\n DirectiveLocation['MUTATION'] = 'MUTATION';\n DirectiveLocation['SUBSCRIPTION'] = 'SUBSCRIPTION';\n DirectiveLocation['FIELD'] = 'FIELD';\n DirectiveLocation['FRAGMENT_DEFINITION'] = 'FRAGMENT_DEFINITION';\n DirectiveLocation['FRAGMENT_SPREAD'] = 'FRAGMENT_SPREAD';\n DirectiveLocation['INLINE_FRAGMENT'] = 'INLINE_FRAGMENT';\n DirectiveLocation['VARIABLE_DEFINITION'] = 'VARIABLE_DEFINITION';\n DirectiveLocation['SCHEMA'] = 'SCHEMA';\n DirectiveLocation['SCALAR'] = 'SCALAR';\n DirectiveLocation['OBJECT'] = 'OBJECT';\n DirectiveLocation['FIELD_DEFINITION'] = 'FIELD_DEFINITION';\n DirectiveLocation['ARGUMENT_DEFINITION'] = 'ARGUMENT_DEFINITION';\n DirectiveLocation['INTERFACE'] = 'INTERFACE';\n DirectiveLocation['UNION'] = 'UNION';\n DirectiveLocation['ENUM'] = 'ENUM';\n DirectiveLocation['ENUM_VALUE'] = 'ENUM_VALUE';\n DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';\n DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';\n})(DirectiveLocation || (DirectiveLocation = {}));\n","/**\n * ```\n * WhiteSpace ::\n * - \"Horizontal Tab (U+0009)\"\n * - \"Space (U+0020)\"\n * ```\n * @internal\n */\nexport function isWhiteSpace(code) {\n return code === 0x0009 || code === 0x0020;\n}\n/**\n * ```\n * Digit :: one of\n * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`\n * ```\n * @internal\n */\n\nexport function isDigit(code) {\n return code >= 0x0030 && code <= 0x0039;\n}\n/**\n * ```\n * Letter :: one of\n * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M`\n * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`\n * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m`\n * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`\n * ```\n * @internal\n */\n\nexport function isLetter(code) {\n return (\n (code >= 0x0061 && code <= 0x007a) || // A-Z\n (code >= 0x0041 && code <= 0x005a) // a-z\n );\n}\n/**\n * ```\n * NameStart ::\n * - Letter\n * - `_`\n * ```\n * @internal\n */\n\nexport function isNameStart(code) {\n return isLetter(code) || code === 0x005f;\n}\n/**\n * ```\n * NameContinue ::\n * - Letter\n * - Digit\n * - `_`\n * ```\n * @internal\n */\n\nexport function isNameContinue(code) {\n return isLetter(code) || isDigit(code) || code === 0x005f;\n}\n","import { isWhiteSpace } from './characterClasses.mjs';\n/**\n * Produces the value of a block string from its parsed raw value, similar to\n * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.\n *\n * This implements the GraphQL spec's BlockStringValue() static algorithm.\n *\n * @internal\n */\n\nexport function dedentBlockStringLines(lines) {\n var _firstNonEmptyLine2;\n\n let commonIndent = Number.MAX_SAFE_INTEGER;\n let firstNonEmptyLine = null;\n let lastNonEmptyLine = -1;\n\n for (let i = 0; i < lines.length; ++i) {\n var _firstNonEmptyLine;\n\n const line = lines[i];\n const indent = leadingWhitespace(line);\n\n if (indent === line.length) {\n continue; // skip empty lines\n }\n\n firstNonEmptyLine =\n (_firstNonEmptyLine = firstNonEmptyLine) !== null &&\n _firstNonEmptyLine !== void 0\n ? _firstNonEmptyLine\n : i;\n lastNonEmptyLine = i;\n\n if (i !== 0 && indent < commonIndent) {\n commonIndent = indent;\n }\n }\n\n return lines // Remove common indentation from all lines but first.\n .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) // Remove leading and trailing blank lines.\n .slice(\n (_firstNonEmptyLine2 = firstNonEmptyLine) !== null &&\n _firstNonEmptyLine2 !== void 0\n ? _firstNonEmptyLine2\n : 0,\n lastNonEmptyLine + 1,\n );\n}\n\nfunction leadingWhitespace(str) {\n let i = 0;\n\n while (i < str.length && isWhiteSpace(str.charCodeAt(i))) {\n ++i;\n }\n\n return i;\n}\n/**\n * @internal\n */\n\nexport function isPrintableAsBlockString(value) {\n if (value === '') {\n return true; // empty string is printable\n }\n\n let isEmptyLine = true;\n let hasIndent = false;\n let hasCommonIndent = true;\n let seenNonEmptyLine = false;\n\n for (let i = 0; i < value.length; ++i) {\n switch (value.codePointAt(i)) {\n case 0x0000:\n case 0x0001:\n case 0x0002:\n case 0x0003:\n case 0x0004:\n case 0x0005:\n case 0x0006:\n case 0x0007:\n case 0x0008:\n case 0x000b:\n case 0x000c:\n case 0x000e:\n case 0x000f:\n return false;\n // Has non-printable characters\n\n case 0x000d:\n // \\r\n return false;\n // Has \\r or \\r\\n which will be replaced as \\n\n\n case 10:\n // \\n\n if (isEmptyLine && !seenNonEmptyLine) {\n return false; // Has leading new line\n }\n\n seenNonEmptyLine = true;\n isEmptyLine = true;\n hasIndent = false;\n break;\n\n case 9: // \\t\n\n case 32:\n // \n hasIndent || (hasIndent = isEmptyLine);\n break;\n\n default:\n hasCommonIndent && (hasCommonIndent = hasIndent);\n isEmptyLine = false;\n }\n }\n\n if (isEmptyLine) {\n return false; // Has trailing empty lines\n }\n\n if (hasCommonIndent && seenNonEmptyLine) {\n return false; // Has internal indent\n }\n\n return true;\n}\n/**\n * Print a block string in the indented block form by adding a leading and\n * trailing blank line. However, if a block string starts with whitespace and is\n * a single-line, adding a leading blank line would strip that whitespace.\n *\n * @internal\n */\n\nexport function printBlockString(value, options) {\n const escapedValue = value.replace(/\"\"\"/g, '\\\\\"\"\"'); // Expand a block string's raw value into independent lines.\n\n const lines = escapedValue.split(/\\r\\n|[\\n\\r]/g);\n const isSingleLine = lines.length === 1; // If common indentation is found we can fix some of those cases by adding leading new line\n\n const forceLeadingNewLine =\n lines.length > 1 &&\n lines\n .slice(1)\n .every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0))); // Trailing triple quotes just looks confusing but doesn't force trailing new line\n\n const hasTrailingTripleQuotes = escapedValue.endsWith('\\\\\"\"\"'); // Trailing quote (single or double) or slash forces trailing new line\n\n const hasTrailingQuote = value.endsWith('\"') && !hasTrailingTripleQuotes;\n const hasTrailingSlash = value.endsWith('\\\\');\n const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;\n const printAsMultipleLines =\n !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability\n (!isSingleLine ||\n value.length > 70 ||\n forceTrailingNewline ||\n forceLeadingNewLine ||\n hasTrailingTripleQuotes);\n let result = ''; // Format a multi-line block quote to account for leading space.\n\n const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));\n\n if ((printAsMultipleLines && !skipLeadingNewLine) || forceLeadingNewLine) {\n result += '\\n';\n }\n\n result += escapedValue;\n\n if (printAsMultipleLines || forceTrailingNewline) {\n result += '\\n';\n }\n\n return '\"\"\"' + result + '\"\"\"';\n}\n","import { syntaxError } from '../error/syntaxError.mjs';\nimport { Token } from './ast.mjs';\nimport { TokenKind } from './tokenKind.mjs';\nimport { dedentBlockStringLines } from './blockString.mjs';\nimport { isDigit, isNameStart, isNameContinue } from './characterClasses.mjs';\n/**\n * Given a Source object, creates a Lexer for that source.\n * A Lexer is a stateful stream generator in that every time\n * it is advanced, it returns the next token in the Source. Assuming the\n * source lexes, the final Token emitted by the lexer will be of kind\n * EOF, after which the lexer will repeatedly return the same EOF token\n * whenever called.\n */\n\nexport class Lexer {\n /**\n * The previously focused non-ignored token.\n */\n\n /**\n * The currently focused non-ignored token.\n */\n\n /**\n * The (1-indexed) line containing the current token.\n */\n\n /**\n * The character offset at which the current line begins.\n */\n constructor(source) {\n const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0);\n this.source = source;\n this.lastToken = startOfFileToken;\n this.token = startOfFileToken;\n this.line = 1;\n this.lineStart = 0;\n }\n\n get [Symbol.toStringTag]() {\n return 'Lexer';\n }\n /**\n * Advances the token stream to the next non-ignored token.\n */\n\n advance() {\n this.lastToken = this.token;\n const token = (this.token = this.lookahead());\n return token;\n }\n /**\n * Looks ahead and returns the next non-ignored token, but does not change\n * the state of Lexer.\n */\n\n lookahead() {\n let token = this.token;\n\n if (token.kind !== TokenKind.EOF) {\n do {\n if (token.next) {\n token = token.next;\n } else {\n // Read the next token and form a link in the token linked-list.\n const nextToken = readNextToken(this, token.end); // @ts-expect-error next is only mutable during parsing.\n\n token.next = nextToken; // @ts-expect-error prev is only mutable during parsing.\n\n nextToken.prev = token;\n token = nextToken;\n }\n } while (token.kind === TokenKind.COMMENT);\n }\n\n return token;\n }\n}\n/**\n * @internal\n */\n\nexport function isPunctuatorTokenKind(kind) {\n return (\n kind === TokenKind.BANG ||\n kind === TokenKind.DOLLAR ||\n kind === TokenKind.AMP ||\n kind === TokenKind.PAREN_L ||\n kind === TokenKind.PAREN_R ||\n kind === TokenKind.SPREAD ||\n kind === TokenKind.COLON ||\n kind === TokenKind.EQUALS ||\n kind === TokenKind.AT ||\n kind === TokenKind.BRACKET_L ||\n kind === TokenKind.BRACKET_R ||\n kind === TokenKind.BRACE_L ||\n kind === TokenKind.PIPE ||\n kind === TokenKind.BRACE_R\n );\n}\n/**\n * A Unicode scalar value is any Unicode code point except surrogate code\n * points. In other words, the inclusive ranges of values 0x0000 to 0xD7FF and\n * 0xE000 to 0x10FFFF.\n *\n * SourceCharacter ::\n * - \"Any Unicode scalar value\"\n */\n\nfunction isUnicodeScalarValue(code) {\n return (\n (code >= 0x0000 && code <= 0xd7ff) || (code >= 0xe000 && code <= 0x10ffff)\n );\n}\n/**\n * The GraphQL specification defines source text as a sequence of unicode scalar\n * values (which Unicode defines to exclude surrogate code points). However\n * JavaScript defines strings as a sequence of UTF-16 code units which may\n * include surrogates. A surrogate pair is a valid source character as it\n * encodes a supplementary code point (above U+FFFF), but unpaired surrogate\n * code points are not valid source characters.\n */\n\nfunction isSupplementaryCodePoint(body, location) {\n return (\n isLeadingSurrogate(body.charCodeAt(location)) &&\n isTrailingSurrogate(body.charCodeAt(location + 1))\n );\n}\n\nfunction isLeadingSurrogate(code) {\n return code >= 0xd800 && code <= 0xdbff;\n}\n\nfunction isTrailingSurrogate(code) {\n return code >= 0xdc00 && code <= 0xdfff;\n}\n/**\n * Prints the code point (or end of file reference) at a given location in a\n * source for use in error messages.\n *\n * Printable ASCII is printed quoted, while other points are printed in Unicode\n * code point form (ie. U+1234).\n */\n\nfunction printCodePointAt(lexer, location) {\n const code = lexer.source.body.codePointAt(location);\n\n if (code === undefined) {\n return TokenKind.EOF;\n } else if (code >= 0x0020 && code <= 0x007e) {\n // Printable ASCII\n const char = String.fromCodePoint(code);\n return char === '\"' ? \"'\\\"'\" : `\"${char}\"`;\n } // Unicode code point\n\n return 'U+' + code.toString(16).toUpperCase().padStart(4, '0');\n}\n/**\n * Create a token with line and column location information.\n */\n\nfunction createToken(lexer, kind, start, end, value) {\n const line = lexer.line;\n const col = 1 + start - lexer.lineStart;\n return new Token(kind, start, end, line, col, value);\n}\n/**\n * Gets the next token from the source starting at the given position.\n *\n * This skips over whitespace until it finds the next lexable token, then lexes\n * punctuators immediately or calls the appropriate helper function for more\n * complicated tokens.\n */\n\nfunction readNextToken(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start;\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // SourceCharacter\n\n switch (code) {\n // Ignored ::\n // - UnicodeBOM\n // - WhiteSpace\n // - LineTerminator\n // - Comment\n // - Comma\n //\n // UnicodeBOM :: \"Byte Order Mark (U+FEFF)\"\n //\n // WhiteSpace ::\n // - \"Horizontal Tab (U+0009)\"\n // - \"Space (U+0020)\"\n //\n // Comma :: ,\n case 0xfeff: // \n\n case 0x0009: // \\t\n\n case 0x0020: // \n\n case 0x002c:\n // ,\n ++position;\n continue;\n // LineTerminator ::\n // - \"New Line (U+000A)\"\n // - \"Carriage Return (U+000D)\" [lookahead != \"New Line (U+000A)\"]\n // - \"Carriage Return (U+000D)\" \"New Line (U+000A)\"\n\n case 0x000a:\n // \\n\n ++position;\n ++lexer.line;\n lexer.lineStart = position;\n continue;\n\n case 0x000d:\n // \\r\n if (body.charCodeAt(position + 1) === 0x000a) {\n position += 2;\n } else {\n ++position;\n }\n\n ++lexer.line;\n lexer.lineStart = position;\n continue;\n // Comment\n\n case 0x0023:\n // #\n return readComment(lexer, position);\n // Token ::\n // - Punctuator\n // - Name\n // - IntValue\n // - FloatValue\n // - StringValue\n //\n // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }\n\n case 0x0021:\n // !\n return createToken(lexer, TokenKind.BANG, position, position + 1);\n\n case 0x0024:\n // $\n return createToken(lexer, TokenKind.DOLLAR, position, position + 1);\n\n case 0x0026:\n // &\n return createToken(lexer, TokenKind.AMP, position, position + 1);\n\n case 0x0028:\n // (\n return createToken(lexer, TokenKind.PAREN_L, position, position + 1);\n\n case 0x0029:\n // )\n return createToken(lexer, TokenKind.PAREN_R, position, position + 1);\n\n case 0x002e:\n // .\n if (\n body.charCodeAt(position + 1) === 0x002e &&\n body.charCodeAt(position + 2) === 0x002e\n ) {\n return createToken(lexer, TokenKind.SPREAD, position, position + 3);\n }\n\n break;\n\n case 0x003a:\n // :\n return createToken(lexer, TokenKind.COLON, position, position + 1);\n\n case 0x003d:\n // =\n return createToken(lexer, TokenKind.EQUALS, position, position + 1);\n\n case 0x0040:\n // @\n return createToken(lexer, TokenKind.AT, position, position + 1);\n\n case 0x005b:\n // [\n return createToken(lexer, TokenKind.BRACKET_L, position, position + 1);\n\n case 0x005d:\n // ]\n return createToken(lexer, TokenKind.BRACKET_R, position, position + 1);\n\n case 0x007b:\n // {\n return createToken(lexer, TokenKind.BRACE_L, position, position + 1);\n\n case 0x007c:\n // |\n return createToken(lexer, TokenKind.PIPE, position, position + 1);\n\n case 0x007d:\n // }\n return createToken(lexer, TokenKind.BRACE_R, position, position + 1);\n // StringValue\n\n case 0x0022:\n // \"\n if (\n body.charCodeAt(position + 1) === 0x0022 &&\n body.charCodeAt(position + 2) === 0x0022\n ) {\n return readBlockString(lexer, position);\n }\n\n return readString(lexer, position);\n } // IntValue | FloatValue (Digit | -)\n\n if (isDigit(code) || code === 0x002d) {\n return readNumber(lexer, position, code);\n } // Name\n\n if (isNameStart(code)) {\n return readName(lexer, position);\n }\n\n throw syntaxError(\n lexer.source,\n position,\n code === 0x0027\n ? 'Unexpected single quote character (\\'), did you mean to use a double quote (\")?'\n : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position)\n ? `Unexpected character: ${printCodePointAt(lexer, position)}.`\n : `Invalid character: ${printCodePointAt(lexer, position)}.`,\n );\n }\n\n return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength);\n}\n/**\n * Reads a comment token from the source file.\n *\n * ```\n * Comment :: # CommentChar* [lookahead != CommentChar]\n *\n * CommentChar :: SourceCharacter but not LineTerminator\n * ```\n */\n\nfunction readComment(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start + 1;\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // LineTerminator (\\n | \\r)\n\n if (code === 0x000a || code === 0x000d) {\n break;\n } // SourceCharacter\n\n if (isUnicodeScalarValue(code)) {\n ++position;\n } else if (isSupplementaryCodePoint(body, position)) {\n position += 2;\n } else {\n break;\n }\n }\n\n return createToken(\n lexer,\n TokenKind.COMMENT,\n start,\n position,\n body.slice(start + 1, position),\n );\n}\n/**\n * Reads a number token from the source file, either a FloatValue or an IntValue\n * depending on whether a FractionalPart or ExponentPart is encountered.\n *\n * ```\n * IntValue :: IntegerPart [lookahead != {Digit, `.`, NameStart}]\n *\n * IntegerPart ::\n * - NegativeSign? 0\n * - NegativeSign? NonZeroDigit Digit*\n *\n * NegativeSign :: -\n *\n * NonZeroDigit :: Digit but not `0`\n *\n * FloatValue ::\n * - IntegerPart FractionalPart ExponentPart [lookahead != {Digit, `.`, NameStart}]\n * - IntegerPart FractionalPart [lookahead != {Digit, `.`, NameStart}]\n * - IntegerPart ExponentPart [lookahead != {Digit, `.`, NameStart}]\n *\n * FractionalPart :: . Digit+\n *\n * ExponentPart :: ExponentIndicator Sign? Digit+\n *\n * ExponentIndicator :: one of `e` `E`\n *\n * Sign :: one of + -\n * ```\n */\n\nfunction readNumber(lexer, start, firstCode) {\n const body = lexer.source.body;\n let position = start;\n let code = firstCode;\n let isFloat = false; // NegativeSign (-)\n\n if (code === 0x002d) {\n code = body.charCodeAt(++position);\n } // Zero (0)\n\n if (code === 0x0030) {\n code = body.charCodeAt(++position);\n\n if (isDigit(code)) {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid number, unexpected digit after 0: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n } else {\n position = readDigits(lexer, position, code);\n code = body.charCodeAt(position);\n } // Full stop (.)\n\n if (code === 0x002e) {\n isFloat = true;\n code = body.charCodeAt(++position);\n position = readDigits(lexer, position, code);\n code = body.charCodeAt(position);\n } // E e\n\n if (code === 0x0045 || code === 0x0065) {\n isFloat = true;\n code = body.charCodeAt(++position); // + -\n\n if (code === 0x002b || code === 0x002d) {\n code = body.charCodeAt(++position);\n }\n\n position = readDigits(lexer, position, code);\n code = body.charCodeAt(position);\n } // Numbers cannot be followed by . or NameStart\n\n if (code === 0x002e || isNameStart(code)) {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid number, expected digit but got: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n\n return createToken(\n lexer,\n isFloat ? TokenKind.FLOAT : TokenKind.INT,\n start,\n position,\n body.slice(start, position),\n );\n}\n/**\n * Returns the new position in the source after reading one or more digits.\n */\n\nfunction readDigits(lexer, start, firstCode) {\n if (!isDigit(firstCode)) {\n throw syntaxError(\n lexer.source,\n start,\n `Invalid number, expected digit but got: ${printCodePointAt(\n lexer,\n start,\n )}.`,\n );\n }\n\n const body = lexer.source.body;\n let position = start + 1; // +1 to skip first firstCode\n\n while (isDigit(body.charCodeAt(position))) {\n ++position;\n }\n\n return position;\n}\n/**\n * Reads a single-quote string token from the source file.\n *\n * ```\n * StringValue ::\n * - `\"\"` [lookahead != `\"`]\n * - `\"` StringCharacter+ `\"`\n *\n * StringCharacter ::\n * - SourceCharacter but not `\"` or `\\` or LineTerminator\n * - `\\u` EscapedUnicode\n * - `\\` EscapedCharacter\n *\n * EscapedUnicode ::\n * - `{` HexDigit+ `}`\n * - HexDigit HexDigit HexDigit HexDigit\n *\n * EscapedCharacter :: one of `\"` `\\` `/` `b` `f` `n` `r` `t`\n * ```\n */\n\nfunction readString(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start + 1;\n let chunkStart = position;\n let value = '';\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // Closing Quote (\")\n\n if (code === 0x0022) {\n value += body.slice(chunkStart, position);\n return createToken(lexer, TokenKind.STRING, start, position + 1, value);\n } // Escape Sequence (\\)\n\n if (code === 0x005c) {\n value += body.slice(chunkStart, position);\n const escape =\n body.charCodeAt(position + 1) === 0x0075 // u\n ? body.charCodeAt(position + 2) === 0x007b // {\n ? readEscapedUnicodeVariableWidth(lexer, position)\n : readEscapedUnicodeFixedWidth(lexer, position)\n : readEscapedCharacter(lexer, position);\n value += escape.value;\n position += escape.size;\n chunkStart = position;\n continue;\n } // LineTerminator (\\n | \\r)\n\n if (code === 0x000a || code === 0x000d) {\n break;\n } // SourceCharacter\n\n if (isUnicodeScalarValue(code)) {\n ++position;\n } else if (isSupplementaryCodePoint(body, position)) {\n position += 2;\n } else {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid character within String: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n }\n\n throw syntaxError(lexer.source, position, 'Unterminated string.');\n} // The string value and lexed size of an escape sequence.\n\nfunction readEscapedUnicodeVariableWidth(lexer, position) {\n const body = lexer.source.body;\n let point = 0;\n let size = 3; // Cannot be larger than 12 chars (\\u{00000000}).\n\n while (size < 12) {\n const code = body.charCodeAt(position + size++); // Closing Brace (})\n\n if (code === 0x007d) {\n // Must be at least 5 chars (\\u{0}) and encode a Unicode scalar value.\n if (size < 5 || !isUnicodeScalarValue(point)) {\n break;\n }\n\n return {\n value: String.fromCodePoint(point),\n size,\n };\n } // Append this hex digit to the code point.\n\n point = (point << 4) | readHexDigit(code);\n\n if (point < 0) {\n break;\n }\n }\n\n throw syntaxError(\n lexer.source,\n position,\n `Invalid Unicode escape sequence: \"${body.slice(\n position,\n position + size,\n )}\".`,\n );\n}\n\nfunction readEscapedUnicodeFixedWidth(lexer, position) {\n const body = lexer.source.body;\n const code = read16BitHexCode(body, position + 2);\n\n if (isUnicodeScalarValue(code)) {\n return {\n value: String.fromCodePoint(code),\n size: 6,\n };\n } // GraphQL allows JSON-style surrogate pair escape sequences, but only when\n // a valid pair is formed.\n\n if (isLeadingSurrogate(code)) {\n // \\u\n if (\n body.charCodeAt(position + 6) === 0x005c &&\n body.charCodeAt(position + 7) === 0x0075\n ) {\n const trailingCode = read16BitHexCode(body, position + 8);\n\n if (isTrailingSurrogate(trailingCode)) {\n // JavaScript defines strings as a sequence of UTF-16 code units and\n // encodes Unicode code points above U+FFFF using a surrogate pair of\n // code units. Since this is a surrogate pair escape sequence, just\n // include both codes into the JavaScript string value. Had JavaScript\n // not been internally based on UTF-16, then this surrogate pair would\n // be decoded to retrieve the supplementary code point.\n return {\n value: String.fromCodePoint(code, trailingCode),\n size: 12,\n };\n }\n }\n }\n\n throw syntaxError(\n lexer.source,\n position,\n `Invalid Unicode escape sequence: \"${body.slice(position, position + 6)}\".`,\n );\n}\n/**\n * Reads four hexadecimal characters and returns the positive integer that 16bit\n * hexadecimal string represents. For example, \"000f\" will return 15, and \"dead\"\n * will return 57005.\n *\n * Returns a negative number if any char was not a valid hexadecimal digit.\n */\n\nfunction read16BitHexCode(body, position) {\n // readHexDigit() returns -1 on error. ORing a negative value with any other\n // value always produces a negative value.\n return (\n (readHexDigit(body.charCodeAt(position)) << 12) |\n (readHexDigit(body.charCodeAt(position + 1)) << 8) |\n (readHexDigit(body.charCodeAt(position + 2)) << 4) |\n readHexDigit(body.charCodeAt(position + 3))\n );\n}\n/**\n * Reads a hexadecimal character and returns its positive integer value (0-15).\n *\n * '0' becomes 0, '9' becomes 9\n * 'A' becomes 10, 'F' becomes 15\n * 'a' becomes 10, 'f' becomes 15\n *\n * Returns -1 if the provided character code was not a valid hexadecimal digit.\n *\n * HexDigit :: one of\n * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`\n * - `A` `B` `C` `D` `E` `F`\n * - `a` `b` `c` `d` `e` `f`\n */\n\nfunction readHexDigit(code) {\n return code >= 0x0030 && code <= 0x0039 // 0-9\n ? code - 0x0030\n : code >= 0x0041 && code <= 0x0046 // A-F\n ? code - 0x0037\n : code >= 0x0061 && code <= 0x0066 // a-f\n ? code - 0x0057\n : -1;\n}\n/**\n * | Escaped Character | Code Point | Character Name |\n * | ----------------- | ---------- | ---------------------------- |\n * | `\"` | U+0022 | double quote |\n * | `\\` | U+005C | reverse solidus (back slash) |\n * | `/` | U+002F | solidus (forward slash) |\n * | `b` | U+0008 | backspace |\n * | `f` | U+000C | form feed |\n * | `n` | U+000A | line feed (new line) |\n * | `r` | U+000D | carriage return |\n * | `t` | U+0009 | horizontal tab |\n */\n\nfunction readEscapedCharacter(lexer, position) {\n const body = lexer.source.body;\n const code = body.charCodeAt(position + 1);\n\n switch (code) {\n case 0x0022:\n // \"\n return {\n value: '\\u0022',\n size: 2,\n };\n\n case 0x005c:\n // \\\n return {\n value: '\\u005c',\n size: 2,\n };\n\n case 0x002f:\n // /\n return {\n value: '\\u002f',\n size: 2,\n };\n\n case 0x0062:\n // b\n return {\n value: '\\u0008',\n size: 2,\n };\n\n case 0x0066:\n // f\n return {\n value: '\\u000c',\n size: 2,\n };\n\n case 0x006e:\n // n\n return {\n value: '\\u000a',\n size: 2,\n };\n\n case 0x0072:\n // r\n return {\n value: '\\u000d',\n size: 2,\n };\n\n case 0x0074:\n // t\n return {\n value: '\\u0009',\n size: 2,\n };\n }\n\n throw syntaxError(\n lexer.source,\n position,\n `Invalid character escape sequence: \"${body.slice(\n position,\n position + 2,\n )}\".`,\n );\n}\n/**\n * Reads a block string token from the source file.\n *\n * ```\n * StringValue ::\n * - `\"\"\"` BlockStringCharacter* `\"\"\"`\n *\n * BlockStringCharacter ::\n * - SourceCharacter but not `\"\"\"` or `\\\"\"\"`\n * - `\\\"\"\"`\n * ```\n */\n\nfunction readBlockString(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let lineStart = lexer.lineStart;\n let position = start + 3;\n let chunkStart = position;\n let currentLine = '';\n const blockLines = [];\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // Closing Triple-Quote (\"\"\")\n\n if (\n code === 0x0022 &&\n body.charCodeAt(position + 1) === 0x0022 &&\n body.charCodeAt(position + 2) === 0x0022\n ) {\n currentLine += body.slice(chunkStart, position);\n blockLines.push(currentLine);\n const token = createToken(\n lexer,\n TokenKind.BLOCK_STRING,\n start,\n position + 3, // Return a string of the lines joined with U+000A.\n dedentBlockStringLines(blockLines).join('\\n'),\n );\n lexer.line += blockLines.length - 1;\n lexer.lineStart = lineStart;\n return token;\n } // Escaped Triple-Quote (\\\"\"\")\n\n if (\n code === 0x005c &&\n body.charCodeAt(position + 1) === 0x0022 &&\n body.charCodeAt(position + 2) === 0x0022 &&\n body.charCodeAt(position + 3) === 0x0022\n ) {\n currentLine += body.slice(chunkStart, position);\n chunkStart = position + 1; // skip only slash\n\n position += 4;\n continue;\n } // LineTerminator\n\n if (code === 0x000a || code === 0x000d) {\n currentLine += body.slice(chunkStart, position);\n blockLines.push(currentLine);\n\n if (code === 0x000d && body.charCodeAt(position + 1) === 0x000a) {\n position += 2;\n } else {\n ++position;\n }\n\n currentLine = '';\n chunkStart = position;\n lineStart = position;\n continue;\n } // SourceCharacter\n\n if (isUnicodeScalarValue(code)) {\n ++position;\n } else if (isSupplementaryCodePoint(body, position)) {\n position += 2;\n } else {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid character within String: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n }\n\n throw syntaxError(lexer.source, position, 'Unterminated string.');\n}\n/**\n * Reads an alphanumeric + underscore name from the source.\n *\n * ```\n * Name ::\n * - NameStart NameContinue* [lookahead != NameContinue]\n * ```\n */\n\nfunction readName(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start + 1;\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position);\n\n if (isNameContinue(code)) {\n ++position;\n } else {\n break;\n }\n }\n\n return createToken(\n lexer,\n TokenKind.NAME,\n start,\n position,\n body.slice(start, position),\n );\n}\n","import { syntaxError } from '../error/syntaxError.mjs';\nimport { Kind } from './kinds.mjs';\nimport { Location, OperationTypeNode } from './ast.mjs';\nimport { TokenKind } from './tokenKind.mjs';\nimport { Source, isSource } from './source.mjs';\nimport { DirectiveLocation } from './directiveLocation.mjs';\nimport { Lexer, isPunctuatorTokenKind } from './lexer.mjs';\n/**\n * Configuration options to control parser behavior\n */\n\n/**\n * Given a GraphQL source, parses it into a Document.\n * Throws GraphQLError if a syntax error is encountered.\n */\nexport function parse(source, options) {\n const parser = new Parser(source, options);\n return parser.parseDocument();\n}\n/**\n * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for\n * that value.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * This is useful within tools that operate upon GraphQL Values directly and\n * in isolation of complete GraphQL documents.\n *\n * Consider providing the results to the utility function: valueFromAST().\n */\n\nexport function parseValue(source, options) {\n const parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n const value = parser.parseValueLiteral(false);\n parser.expectToken(TokenKind.EOF);\n return value;\n}\n/**\n * Similar to parseValue(), but raises a parse error if it encounters a\n * variable. The return type will be a constant value.\n */\n\nexport function parseConstValue(source, options) {\n const parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n const value = parser.parseConstValueLiteral();\n parser.expectToken(TokenKind.EOF);\n return value;\n}\n/**\n * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for\n * that type.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * This is useful within tools that operate upon GraphQL Types directly and\n * in isolation of complete GraphQL documents.\n *\n * Consider providing the results to the utility function: typeFromAST().\n */\n\nexport function parseType(source, options) {\n const parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n const type = parser.parseTypeReference();\n parser.expectToken(TokenKind.EOF);\n return type;\n}\n/**\n * This class is exported only to assist people in implementing their own parsers\n * without duplicating too much code and should be used only as last resort for cases\n * such as experimental syntax or if certain features could not be contributed upstream.\n *\n * It is still part of the internal API and is versioned, so any changes to it are never\n * considered breaking changes. If you still need to support multiple versions of the\n * library, please use the `versionInfo` variable for version detection.\n *\n * @internal\n */\n\nexport class Parser {\n constructor(source, options) {\n const sourceObj = isSource(source) ? source : new Source(source);\n this._lexer = new Lexer(sourceObj);\n this._options = options;\n }\n /**\n * Converts a name lex token into a name parse node.\n */\n\n parseName() {\n const token = this.expectToken(TokenKind.NAME);\n return this.node(token, {\n kind: Kind.NAME,\n value: token.value,\n });\n } // Implements the parsing rules in the Document section.\n\n /**\n * Document : Definition+\n */\n\n parseDocument() {\n return this.node(this._lexer.token, {\n kind: Kind.DOCUMENT,\n definitions: this.many(\n TokenKind.SOF,\n this.parseDefinition,\n TokenKind.EOF,\n ),\n });\n }\n /**\n * Definition :\n * - ExecutableDefinition\n * - TypeSystemDefinition\n * - TypeSystemExtension\n *\n * ExecutableDefinition :\n * - OperationDefinition\n * - FragmentDefinition\n *\n * TypeSystemDefinition :\n * - SchemaDefinition\n * - TypeDefinition\n * - DirectiveDefinition\n *\n * TypeDefinition :\n * - ScalarTypeDefinition\n * - ObjectTypeDefinition\n * - InterfaceTypeDefinition\n * - UnionTypeDefinition\n * - EnumTypeDefinition\n * - InputObjectTypeDefinition\n */\n\n parseDefinition() {\n if (this.peek(TokenKind.BRACE_L)) {\n return this.parseOperationDefinition();\n } // Many definitions begin with a description and require a lookahead.\n\n const hasDescription = this.peekDescription();\n const keywordToken = hasDescription\n ? this._lexer.lookahead()\n : this._lexer.token;\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaDefinition();\n\n case 'scalar':\n return this.parseScalarTypeDefinition();\n\n case 'type':\n return this.parseObjectTypeDefinition();\n\n case 'interface':\n return this.parseInterfaceTypeDefinition();\n\n case 'union':\n return this.parseUnionTypeDefinition();\n\n case 'enum':\n return this.parseEnumTypeDefinition();\n\n case 'input':\n return this.parseInputObjectTypeDefinition();\n\n case 'directive':\n return this.parseDirectiveDefinition();\n }\n\n if (hasDescription) {\n throw syntaxError(\n this._lexer.source,\n this._lexer.token.start,\n 'Unexpected description, descriptions are supported only on type definitions.',\n );\n }\n\n switch (keywordToken.value) {\n case 'query':\n case 'mutation':\n case 'subscription':\n return this.parseOperationDefinition();\n\n case 'fragment':\n return this.parseFragmentDefinition();\n\n case 'extend':\n return this.parseTypeSystemExtension();\n }\n }\n\n throw this.unexpected(keywordToken);\n } // Implements the parsing rules in the Operations section.\n\n /**\n * OperationDefinition :\n * - SelectionSet\n * - OperationType Name? VariableDefinitions? Directives? SelectionSet\n */\n\n parseOperationDefinition() {\n const start = this._lexer.token;\n\n if (this.peek(TokenKind.BRACE_L)) {\n return this.node(start, {\n kind: Kind.OPERATION_DEFINITION,\n operation: OperationTypeNode.QUERY,\n name: undefined,\n variableDefinitions: [],\n directives: [],\n selectionSet: this.parseSelectionSet(),\n });\n }\n\n const operation = this.parseOperationType();\n let name;\n\n if (this.peek(TokenKind.NAME)) {\n name = this.parseName();\n }\n\n return this.node(start, {\n kind: Kind.OPERATION_DEFINITION,\n operation,\n name,\n variableDefinitions: this.parseVariableDefinitions(),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n /**\n * OperationType : one of query mutation subscription\n */\n\n parseOperationType() {\n const operationToken = this.expectToken(TokenKind.NAME);\n\n switch (operationToken.value) {\n case 'query':\n return OperationTypeNode.QUERY;\n\n case 'mutation':\n return OperationTypeNode.MUTATION;\n\n case 'subscription':\n return OperationTypeNode.SUBSCRIPTION;\n }\n\n throw this.unexpected(operationToken);\n }\n /**\n * VariableDefinitions : ( VariableDefinition+ )\n */\n\n parseVariableDefinitions() {\n return this.optionalMany(\n TokenKind.PAREN_L,\n this.parseVariableDefinition,\n TokenKind.PAREN_R,\n );\n }\n /**\n * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?\n */\n\n parseVariableDefinition() {\n return this.node(this._lexer.token, {\n kind: Kind.VARIABLE_DEFINITION,\n variable: this.parseVariable(),\n type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),\n defaultValue: this.expectOptionalToken(TokenKind.EQUALS)\n ? this.parseConstValueLiteral()\n : undefined,\n directives: this.parseConstDirectives(),\n });\n }\n /**\n * Variable : $ Name\n */\n\n parseVariable() {\n const start = this._lexer.token;\n this.expectToken(TokenKind.DOLLAR);\n return this.node(start, {\n kind: Kind.VARIABLE,\n name: this.parseName(),\n });\n }\n /**\n * ```\n * SelectionSet : { Selection+ }\n * ```\n */\n\n parseSelectionSet() {\n return this.node(this._lexer.token, {\n kind: Kind.SELECTION_SET,\n selections: this.many(\n TokenKind.BRACE_L,\n this.parseSelection,\n TokenKind.BRACE_R,\n ),\n });\n }\n /**\n * Selection :\n * - Field\n * - FragmentSpread\n * - InlineFragment\n */\n\n parseSelection() {\n return this.peek(TokenKind.SPREAD)\n ? this.parseFragment()\n : this.parseField();\n }\n /**\n * Field : Alias? Name Arguments? Directives? SelectionSet?\n *\n * Alias : Name :\n */\n\n parseField() {\n const start = this._lexer.token;\n const nameOrAlias = this.parseName();\n let alias;\n let name;\n\n if (this.expectOptionalToken(TokenKind.COLON)) {\n alias = nameOrAlias;\n name = this.parseName();\n } else {\n name = nameOrAlias;\n }\n\n return this.node(start, {\n kind: Kind.FIELD,\n alias,\n name,\n arguments: this.parseArguments(false),\n directives: this.parseDirectives(false),\n selectionSet: this.peek(TokenKind.BRACE_L)\n ? this.parseSelectionSet()\n : undefined,\n });\n }\n /**\n * Arguments[Const] : ( Argument[?Const]+ )\n */\n\n parseArguments(isConst) {\n const item = isConst ? this.parseConstArgument : this.parseArgument;\n return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R);\n }\n /**\n * Argument[Const] : Name : Value[?Const]\n */\n\n parseArgument(isConst = false) {\n const start = this._lexer.token;\n const name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return this.node(start, {\n kind: Kind.ARGUMENT,\n name,\n value: this.parseValueLiteral(isConst),\n });\n }\n\n parseConstArgument() {\n return this.parseArgument(true);\n } // Implements the parsing rules in the Fragments section.\n\n /**\n * Corresponds to both FragmentSpread and InlineFragment in the spec.\n *\n * FragmentSpread : ... FragmentName Directives?\n *\n * InlineFragment : ... TypeCondition? Directives? SelectionSet\n */\n\n parseFragment() {\n const start = this._lexer.token;\n this.expectToken(TokenKind.SPREAD);\n const hasTypeCondition = this.expectOptionalKeyword('on');\n\n if (!hasTypeCondition && this.peek(TokenKind.NAME)) {\n return this.node(start, {\n kind: Kind.FRAGMENT_SPREAD,\n name: this.parseFragmentName(),\n directives: this.parseDirectives(false),\n });\n }\n\n return this.node(start, {\n kind: Kind.INLINE_FRAGMENT,\n typeCondition: hasTypeCondition ? this.parseNamedType() : undefined,\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n /**\n * FragmentDefinition :\n * - fragment FragmentName on TypeCondition Directives? SelectionSet\n *\n * TypeCondition : NamedType\n */\n\n parseFragmentDefinition() {\n var _this$_options;\n\n const start = this._lexer.token;\n this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes\n // the grammar of FragmentDefinition:\n // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet\n\n if (\n ((_this$_options = this._options) === null || _this$_options === void 0\n ? void 0\n : _this$_options.allowLegacyFragmentVariables) === true\n ) {\n return this.node(start, {\n kind: Kind.FRAGMENT_DEFINITION,\n name: this.parseFragmentName(),\n variableDefinitions: this.parseVariableDefinitions(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n\n return this.node(start, {\n kind: Kind.FRAGMENT_DEFINITION,\n name: this.parseFragmentName(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n /**\n * FragmentName : Name but not `on`\n */\n\n parseFragmentName() {\n if (this._lexer.token.value === 'on') {\n throw this.unexpected();\n }\n\n return this.parseName();\n } // Implements the parsing rules in the Values section.\n\n /**\n * Value[Const] :\n * - [~Const] Variable\n * - IntValue\n * - FloatValue\n * - StringValue\n * - BooleanValue\n * - NullValue\n * - EnumValue\n * - ListValue[?Const]\n * - ObjectValue[?Const]\n *\n * BooleanValue : one of `true` `false`\n *\n * NullValue : `null`\n *\n * EnumValue : Name but not `true`, `false` or `null`\n */\n\n parseValueLiteral(isConst) {\n const token = this._lexer.token;\n\n switch (token.kind) {\n case TokenKind.BRACKET_L:\n return this.parseList(isConst);\n\n case TokenKind.BRACE_L:\n return this.parseObject(isConst);\n\n case TokenKind.INT:\n this._lexer.advance();\n\n return this.node(token, {\n kind: Kind.INT,\n value: token.value,\n });\n\n case TokenKind.FLOAT:\n this._lexer.advance();\n\n return this.node(token, {\n kind: Kind.FLOAT,\n value: token.value,\n });\n\n case TokenKind.STRING:\n case TokenKind.BLOCK_STRING:\n return this.parseStringLiteral();\n\n case TokenKind.NAME:\n this._lexer.advance();\n\n switch (token.value) {\n case 'true':\n return this.node(token, {\n kind: Kind.BOOLEAN,\n value: true,\n });\n\n case 'false':\n return this.node(token, {\n kind: Kind.BOOLEAN,\n value: false,\n });\n\n case 'null':\n return this.node(token, {\n kind: Kind.NULL,\n });\n\n default:\n return this.node(token, {\n kind: Kind.ENUM,\n value: token.value,\n });\n }\n\n case TokenKind.DOLLAR:\n if (isConst) {\n this.expectToken(TokenKind.DOLLAR);\n\n if (this._lexer.token.kind === TokenKind.NAME) {\n const varName = this._lexer.token.value;\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Unexpected variable \"$${varName}\" in constant value.`,\n );\n } else {\n throw this.unexpected(token);\n }\n }\n\n return this.parseVariable();\n\n default:\n throw this.unexpected();\n }\n }\n\n parseConstValueLiteral() {\n return this.parseValueLiteral(true);\n }\n\n parseStringLiteral() {\n const token = this._lexer.token;\n\n this._lexer.advance();\n\n return this.node(token, {\n kind: Kind.STRING,\n value: token.value,\n block: token.kind === TokenKind.BLOCK_STRING,\n });\n }\n /**\n * ListValue[Const] :\n * - [ ]\n * - [ Value[?Const]+ ]\n */\n\n parseList(isConst) {\n const item = () => this.parseValueLiteral(isConst);\n\n return this.node(this._lexer.token, {\n kind: Kind.LIST,\n values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R),\n });\n }\n /**\n * ```\n * ObjectValue[Const] :\n * - { }\n * - { ObjectField[?Const]+ }\n * ```\n */\n\n parseObject(isConst) {\n const item = () => this.parseObjectField(isConst);\n\n return this.node(this._lexer.token, {\n kind: Kind.OBJECT,\n fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R),\n });\n }\n /**\n * ObjectField[Const] : Name : Value[?Const]\n */\n\n parseObjectField(isConst) {\n const start = this._lexer.token;\n const name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return this.node(start, {\n kind: Kind.OBJECT_FIELD,\n name,\n value: this.parseValueLiteral(isConst),\n });\n } // Implements the parsing rules in the Directives section.\n\n /**\n * Directives[Const] : Directive[?Const]+\n */\n\n parseDirectives(isConst) {\n const directives = [];\n\n while (this.peek(TokenKind.AT)) {\n directives.push(this.parseDirective(isConst));\n }\n\n return directives;\n }\n\n parseConstDirectives() {\n return this.parseDirectives(true);\n }\n /**\n * ```\n * Directive[Const] : @ Name Arguments[?Const]?\n * ```\n */\n\n parseDirective(isConst) {\n const start = this._lexer.token;\n this.expectToken(TokenKind.AT);\n return this.node(start, {\n kind: Kind.DIRECTIVE,\n name: this.parseName(),\n arguments: this.parseArguments(isConst),\n });\n } // Implements the parsing rules in the Types section.\n\n /**\n * Type :\n * - NamedType\n * - ListType\n * - NonNullType\n */\n\n parseTypeReference() {\n const start = this._lexer.token;\n let type;\n\n if (this.expectOptionalToken(TokenKind.BRACKET_L)) {\n const innerType = this.parseTypeReference();\n this.expectToken(TokenKind.BRACKET_R);\n type = this.node(start, {\n kind: Kind.LIST_TYPE,\n type: innerType,\n });\n } else {\n type = this.parseNamedType();\n }\n\n if (this.expectOptionalToken(TokenKind.BANG)) {\n return this.node(start, {\n kind: Kind.NON_NULL_TYPE,\n type,\n });\n }\n\n return type;\n }\n /**\n * NamedType : Name\n */\n\n parseNamedType() {\n return this.node(this._lexer.token, {\n kind: Kind.NAMED_TYPE,\n name: this.parseName(),\n });\n } // Implements the parsing rules in the Type Definition section.\n\n peekDescription() {\n return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);\n }\n /**\n * Description : StringValue\n */\n\n parseDescription() {\n if (this.peekDescription()) {\n return this.parseStringLiteral();\n }\n }\n /**\n * ```\n * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }\n * ```\n */\n\n parseSchemaDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('schema');\n const directives = this.parseConstDirectives();\n const operationTypes = this.many(\n TokenKind.BRACE_L,\n this.parseOperationTypeDefinition,\n TokenKind.BRACE_R,\n );\n return this.node(start, {\n kind: Kind.SCHEMA_DEFINITION,\n description,\n directives,\n operationTypes,\n });\n }\n /**\n * OperationTypeDefinition : OperationType : NamedType\n */\n\n parseOperationTypeDefinition() {\n const start = this._lexer.token;\n const operation = this.parseOperationType();\n this.expectToken(TokenKind.COLON);\n const type = this.parseNamedType();\n return this.node(start, {\n kind: Kind.OPERATION_TYPE_DEFINITION,\n operation,\n type,\n });\n }\n /**\n * ScalarTypeDefinition : Description? scalar Name Directives[Const]?\n */\n\n parseScalarTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('scalar');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.SCALAR_TYPE_DEFINITION,\n description,\n name,\n directives,\n });\n }\n /**\n * ObjectTypeDefinition :\n * Description?\n * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?\n */\n\n parseObjectTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('type');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n return this.node(start, {\n kind: Kind.OBJECT_TYPE_DEFINITION,\n description,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * ImplementsInterfaces :\n * - implements `&`? NamedType\n * - ImplementsInterfaces & NamedType\n */\n\n parseImplementsInterfaces() {\n return this.expectOptionalKeyword('implements')\n ? this.delimitedMany(TokenKind.AMP, this.parseNamedType)\n : [];\n }\n /**\n * ```\n * FieldsDefinition : { FieldDefinition+ }\n * ```\n */\n\n parseFieldsDefinition() {\n return this.optionalMany(\n TokenKind.BRACE_L,\n this.parseFieldDefinition,\n TokenKind.BRACE_R,\n );\n }\n /**\n * FieldDefinition :\n * - Description? Name ArgumentsDefinition? : Type Directives[Const]?\n */\n\n parseFieldDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n const name = this.parseName();\n const args = this.parseArgumentDefs();\n this.expectToken(TokenKind.COLON);\n const type = this.parseTypeReference();\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.FIELD_DEFINITION,\n description,\n name,\n arguments: args,\n type,\n directives,\n });\n }\n /**\n * ArgumentsDefinition : ( InputValueDefinition+ )\n */\n\n parseArgumentDefs() {\n return this.optionalMany(\n TokenKind.PAREN_L,\n this.parseInputValueDef,\n TokenKind.PAREN_R,\n );\n }\n /**\n * InputValueDefinition :\n * - Description? Name : Type DefaultValue? Directives[Const]?\n */\n\n parseInputValueDef() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n const name = this.parseName();\n this.expectToken(TokenKind.COLON);\n const type = this.parseTypeReference();\n let defaultValue;\n\n if (this.expectOptionalToken(TokenKind.EQUALS)) {\n defaultValue = this.parseConstValueLiteral();\n }\n\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.INPUT_VALUE_DEFINITION,\n description,\n name,\n type,\n defaultValue,\n directives,\n });\n }\n /**\n * InterfaceTypeDefinition :\n * - Description? interface Name Directives[Const]? FieldsDefinition?\n */\n\n parseInterfaceTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('interface');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n return this.node(start, {\n kind: Kind.INTERFACE_TYPE_DEFINITION,\n description,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * UnionTypeDefinition :\n * - Description? union Name Directives[Const]? UnionMemberTypes?\n */\n\n parseUnionTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('union');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const types = this.parseUnionMemberTypes();\n return this.node(start, {\n kind: Kind.UNION_TYPE_DEFINITION,\n description,\n name,\n directives,\n types,\n });\n }\n /**\n * UnionMemberTypes :\n * - = `|`? NamedType\n * - UnionMemberTypes | NamedType\n */\n\n parseUnionMemberTypes() {\n return this.expectOptionalToken(TokenKind.EQUALS)\n ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType)\n : [];\n }\n /**\n * EnumTypeDefinition :\n * - Description? enum Name Directives[Const]? EnumValuesDefinition?\n */\n\n parseEnumTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('enum');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const values = this.parseEnumValuesDefinition();\n return this.node(start, {\n kind: Kind.ENUM_TYPE_DEFINITION,\n description,\n name,\n directives,\n values,\n });\n }\n /**\n * ```\n * EnumValuesDefinition : { EnumValueDefinition+ }\n * ```\n */\n\n parseEnumValuesDefinition() {\n return this.optionalMany(\n TokenKind.BRACE_L,\n this.parseEnumValueDefinition,\n TokenKind.BRACE_R,\n );\n }\n /**\n * EnumValueDefinition : Description? EnumValue Directives[Const]?\n */\n\n parseEnumValueDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n const name = this.parseEnumValueName();\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.ENUM_VALUE_DEFINITION,\n description,\n name,\n directives,\n });\n }\n /**\n * EnumValue : Name but not `true`, `false` or `null`\n */\n\n parseEnumValueName() {\n if (\n this._lexer.token.value === 'true' ||\n this._lexer.token.value === 'false' ||\n this._lexer.token.value === 'null'\n ) {\n throw syntaxError(\n this._lexer.source,\n this._lexer.token.start,\n `${getTokenDesc(\n this._lexer.token,\n )} is reserved and cannot be used for an enum value.`,\n );\n }\n\n return this.parseName();\n }\n /**\n * InputObjectTypeDefinition :\n * - Description? input Name Directives[Const]? InputFieldsDefinition?\n */\n\n parseInputObjectTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('input');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const fields = this.parseInputFieldsDefinition();\n return this.node(start, {\n kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,\n description,\n name,\n directives,\n fields,\n });\n }\n /**\n * ```\n * InputFieldsDefinition : { InputValueDefinition+ }\n * ```\n */\n\n parseInputFieldsDefinition() {\n return this.optionalMany(\n TokenKind.BRACE_L,\n this.parseInputValueDef,\n TokenKind.BRACE_R,\n );\n }\n /**\n * TypeSystemExtension :\n * - SchemaExtension\n * - TypeExtension\n *\n * TypeExtension :\n * - ScalarTypeExtension\n * - ObjectTypeExtension\n * - InterfaceTypeExtension\n * - UnionTypeExtension\n * - EnumTypeExtension\n * - InputObjectTypeDefinition\n */\n\n parseTypeSystemExtension() {\n const keywordToken = this._lexer.lookahead();\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaExtension();\n\n case 'scalar':\n return this.parseScalarTypeExtension();\n\n case 'type':\n return this.parseObjectTypeExtension();\n\n case 'interface':\n return this.parseInterfaceTypeExtension();\n\n case 'union':\n return this.parseUnionTypeExtension();\n\n case 'enum':\n return this.parseEnumTypeExtension();\n\n case 'input':\n return this.parseInputObjectTypeExtension();\n }\n }\n\n throw this.unexpected(keywordToken);\n }\n /**\n * ```\n * SchemaExtension :\n * - extend schema Directives[Const]? { OperationTypeDefinition+ }\n * - extend schema Directives[Const]\n * ```\n */\n\n parseSchemaExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('schema');\n const directives = this.parseConstDirectives();\n const operationTypes = this.optionalMany(\n TokenKind.BRACE_L,\n this.parseOperationTypeDefinition,\n TokenKind.BRACE_R,\n );\n\n if (directives.length === 0 && operationTypes.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.SCHEMA_EXTENSION,\n directives,\n operationTypes,\n });\n }\n /**\n * ScalarTypeExtension :\n * - extend scalar Name Directives[Const]\n */\n\n parseScalarTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('scalar');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n\n if (directives.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.SCALAR_TYPE_EXTENSION,\n name,\n directives,\n });\n }\n /**\n * ObjectTypeExtension :\n * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition\n * - extend type Name ImplementsInterfaces? Directives[Const]\n * - extend type Name ImplementsInterfaces\n */\n\n parseObjectTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('type');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n\n if (\n interfaces.length === 0 &&\n directives.length === 0 &&\n fields.length === 0\n ) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.OBJECT_TYPE_EXTENSION,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * InterfaceTypeExtension :\n * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition\n * - extend interface Name ImplementsInterfaces? Directives[Const]\n * - extend interface Name ImplementsInterfaces\n */\n\n parseInterfaceTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('interface');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n\n if (\n interfaces.length === 0 &&\n directives.length === 0 &&\n fields.length === 0\n ) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.INTERFACE_TYPE_EXTENSION,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * UnionTypeExtension :\n * - extend union Name Directives[Const]? UnionMemberTypes\n * - extend union Name Directives[Const]\n */\n\n parseUnionTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('union');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const types = this.parseUnionMemberTypes();\n\n if (directives.length === 0 && types.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.UNION_TYPE_EXTENSION,\n name,\n directives,\n types,\n });\n }\n /**\n * EnumTypeExtension :\n * - extend enum Name Directives[Const]? EnumValuesDefinition\n * - extend enum Name Directives[Const]\n */\n\n parseEnumTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('enum');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const values = this.parseEnumValuesDefinition();\n\n if (directives.length === 0 && values.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.ENUM_TYPE_EXTENSION,\n name,\n directives,\n values,\n });\n }\n /**\n * InputObjectTypeExtension :\n * - extend input Name Directives[Const]? InputFieldsDefinition\n * - extend input Name Directives[Const]\n */\n\n parseInputObjectTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('input');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const fields = this.parseInputFieldsDefinition();\n\n if (directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,\n name,\n directives,\n fields,\n });\n }\n /**\n * ```\n * DirectiveDefinition :\n * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations\n * ```\n */\n\n parseDirectiveDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('directive');\n this.expectToken(TokenKind.AT);\n const name = this.parseName();\n const args = this.parseArgumentDefs();\n const repeatable = this.expectOptionalKeyword('repeatable');\n this.expectKeyword('on');\n const locations = this.parseDirectiveLocations();\n return this.node(start, {\n kind: Kind.DIRECTIVE_DEFINITION,\n description,\n name,\n arguments: args,\n repeatable,\n locations,\n });\n }\n /**\n * DirectiveLocations :\n * - `|`? DirectiveLocation\n * - DirectiveLocations | DirectiveLocation\n */\n\n parseDirectiveLocations() {\n return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);\n }\n /*\n * DirectiveLocation :\n * - ExecutableDirectiveLocation\n * - TypeSystemDirectiveLocation\n *\n * ExecutableDirectiveLocation : one of\n * `QUERY`\n * `MUTATION`\n * `SUBSCRIPTION`\n * `FIELD`\n * `FRAGMENT_DEFINITION`\n * `FRAGMENT_SPREAD`\n * `INLINE_FRAGMENT`\n *\n * TypeSystemDirectiveLocation : one of\n * `SCHEMA`\n * `SCALAR`\n * `OBJECT`\n * `FIELD_DEFINITION`\n * `ARGUMENT_DEFINITION`\n * `INTERFACE`\n * `UNION`\n * `ENUM`\n * `ENUM_VALUE`\n * `INPUT_OBJECT`\n * `INPUT_FIELD_DEFINITION`\n */\n\n parseDirectiveLocation() {\n const start = this._lexer.token;\n const name = this.parseName();\n\n if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) {\n return name;\n }\n\n throw this.unexpected(start);\n } // Core parsing utility functions\n\n /**\n * Returns a node that, if configured to do so, sets a \"loc\" field as a\n * location object, used to identify the place in the source that created a\n * given parsed object.\n */\n\n node(startToken, node) {\n var _this$_options2;\n\n if (\n ((_this$_options2 = this._options) === null || _this$_options2 === void 0\n ? void 0\n : _this$_options2.noLocation) !== true\n ) {\n node.loc = new Location(\n startToken,\n this._lexer.lastToken,\n this._lexer.source,\n );\n }\n\n return node;\n }\n /**\n * Determines if the next token is of a given kind\n */\n\n peek(kind) {\n return this._lexer.token.kind === kind;\n }\n /**\n * If the next token is of the given kind, return that token after advancing the lexer.\n * Otherwise, do not change the parser state and throw an error.\n */\n\n expectToken(kind) {\n const token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return token;\n }\n\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`,\n );\n }\n /**\n * If the next token is of the given kind, return \"true\" after advancing the lexer.\n * Otherwise, do not change the parser state and return \"false\".\n */\n\n expectOptionalToken(kind) {\n const token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return true;\n }\n\n return false;\n }\n /**\n * If the next token is a given keyword, advance the lexer.\n * Otherwise, do not change the parser state and throw an error.\n */\n\n expectKeyword(value) {\n const token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this._lexer.advance();\n } else {\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Expected \"${value}\", found ${getTokenDesc(token)}.`,\n );\n }\n }\n /**\n * If the next token is a given keyword, return \"true\" after advancing the lexer.\n * Otherwise, do not change the parser state and return \"false\".\n */\n\n expectOptionalKeyword(value) {\n const token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this._lexer.advance();\n\n return true;\n }\n\n return false;\n }\n /**\n * Helper function for creating an error when an unexpected lexed token is encountered.\n */\n\n unexpected(atToken) {\n const token =\n atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;\n return syntaxError(\n this._lexer.source,\n token.start,\n `Unexpected ${getTokenDesc(token)}.`,\n );\n }\n /**\n * Returns a possibly empty list of parse nodes, determined by the parseFn.\n * This list begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n\n any(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n const nodes = [];\n\n while (!this.expectOptionalToken(closeKind)) {\n nodes.push(parseFn.call(this));\n }\n\n return nodes;\n }\n /**\n * Returns a list of parse nodes, determined by the parseFn.\n * It can be empty only if open token is missing otherwise it will always return non-empty list\n * that begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n\n optionalMany(openKind, parseFn, closeKind) {\n if (this.expectOptionalToken(openKind)) {\n const nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n\n return nodes;\n }\n\n return [];\n }\n /**\n * Returns a non-empty list of parse nodes, determined by the parseFn.\n * This list begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n\n many(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n const nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n\n return nodes;\n }\n /**\n * Returns a non-empty list of parse nodes, determined by the parseFn.\n * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.\n * Advances the parser to the next lex token after last item in the list.\n */\n\n delimitedMany(delimiterKind, parseFn) {\n this.expectOptionalToken(delimiterKind);\n const nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (this.expectOptionalToken(delimiterKind));\n\n return nodes;\n }\n}\n/**\n * A helper function to describe a token as a string for debugging.\n */\n\nfunction getTokenDesc(token) {\n const value = token.value;\n return getTokenKindDesc(token.kind) + (value != null ? ` \"${value}\"` : '');\n}\n/**\n * A helper function to describe a token kind as a string for debugging.\n */\n\nfunction getTokenKindDesc(kind) {\n return isPunctuatorTokenKind(kind) ? `\"${kind}\"` : kind;\n}\n","import { inspect } from '../jsutils/inspect.mjs';\nimport { devAssert } from '../jsutils/devAssert.mjs';\nimport { isNode, QueryDocumentKeys } from './ast.mjs';\nimport { Kind } from './kinds.mjs';\n/**\n * A visitor is provided to visit, it contains the collection of\n * relevant functions to be called during the visitor's traversal.\n */\n\nexport const BREAK = Object.freeze({});\n/**\n * visit() will walk through an AST using a depth-first traversal, calling\n * the visitor's enter function at each node in the traversal, and calling the\n * leave function after visiting that node and all of its child nodes.\n *\n * By returning different values from the enter and leave functions, the\n * behavior of the visitor can be altered, including skipping over a sub-tree of\n * the AST (by returning false), editing the AST by returning a value or null\n * to remove the value, or to stop the whole traversal by returning BREAK.\n *\n * When using visit() to edit an AST, the original AST will not be modified, and\n * a new version of the AST with the changes applied will be returned from the\n * visit function.\n *\n * ```ts\n * const editedAST = visit(ast, {\n * enter(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: skip visiting this node\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * },\n * leave(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: no action\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * }\n * });\n * ```\n *\n * Alternatively to providing enter() and leave() functions, a visitor can\n * instead provide functions named the same as the kinds of AST nodes, or\n * enter/leave visitors at a named key, leading to three permutations of the\n * visitor API:\n *\n * 1) Named visitors triggered when entering a node of a specific kind.\n *\n * ```ts\n * visit(ast, {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * })\n * ```\n *\n * 2) Named visitors that trigger upon entering and leaving a node of a specific kind.\n *\n * ```ts\n * visit(ast, {\n * Kind: {\n * enter(node) {\n * // enter the \"Kind\" node\n * }\n * leave(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n * ```\n *\n * 3) Generic visitors that trigger upon entering and leaving any node.\n *\n * ```ts\n * visit(ast, {\n * enter(node) {\n * // enter any node\n * },\n * leave(node) {\n * // leave any node\n * }\n * })\n * ```\n */\n\nexport function visit(root, visitor, visitorKeys = QueryDocumentKeys) {\n const enterLeaveMap = new Map();\n\n for (const kind of Object.values(Kind)) {\n enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));\n }\n /* eslint-disable no-undef-init */\n\n let stack = undefined;\n let inArray = Array.isArray(root);\n let keys = [root];\n let index = -1;\n let edits = [];\n let node = undefined;\n let key = undefined;\n let parent = undefined;\n const path = [];\n const ancestors = [];\n let newRoot = root;\n /* eslint-enable no-undef-init */\n\n do {\n index++;\n const isLeaving = index === keys.length;\n const isEdited = isLeaving && edits.length !== 0;\n\n if (isLeaving) {\n key = ancestors.length === 0 ? undefined : path[path.length - 1];\n node = parent;\n parent = ancestors.pop();\n\n if (isEdited) {\n if (inArray) {\n node = node.slice();\n let editOffset = 0;\n\n for (const [editKey, editValue] of edits) {\n const arrayKey = editKey - editOffset;\n\n if (editValue === null) {\n node.splice(arrayKey, 1);\n editOffset++;\n } else {\n node[arrayKey] = editValue;\n }\n }\n } else {\n node = Object.defineProperties(\n {},\n Object.getOwnPropertyDescriptors(node),\n );\n\n for (const [editKey, editValue] of edits) {\n node[editKey] = editValue;\n }\n }\n }\n\n index = stack.index;\n keys = stack.keys;\n edits = stack.edits;\n inArray = stack.inArray;\n stack = stack.prev;\n } else {\n key = parent ? (inArray ? index : keys[index]) : undefined;\n node = parent ? parent[key] : newRoot;\n\n if (node === null || node === undefined) {\n continue;\n }\n\n if (parent) {\n path.push(key);\n }\n }\n\n let result;\n\n if (!Array.isArray(node)) {\n var _enterLeaveMap$get, _enterLeaveMap$get2;\n\n isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);\n const visitFn = isLeaving\n ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null ||\n _enterLeaveMap$get === void 0\n ? void 0\n : _enterLeaveMap$get.leave\n : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null ||\n _enterLeaveMap$get2 === void 0\n ? void 0\n : _enterLeaveMap$get2.enter;\n result =\n visitFn === null || visitFn === void 0\n ? void 0\n : visitFn.call(visitor, node, key, parent, path, ancestors);\n\n if (result === BREAK) {\n break;\n }\n\n if (result === false) {\n if (!isLeaving) {\n path.pop();\n continue;\n }\n } else if (result !== undefined) {\n edits.push([key, result]);\n\n if (!isLeaving) {\n if (isNode(result)) {\n node = result;\n } else {\n path.pop();\n continue;\n }\n }\n }\n }\n\n if (result === undefined && isEdited) {\n edits.push([key, node]);\n }\n\n if (isLeaving) {\n path.pop();\n } else {\n var _node$kind;\n\n stack = {\n inArray,\n index,\n keys,\n edits,\n prev: stack,\n };\n inArray = Array.isArray(node);\n keys = inArray\n ? node\n : (_node$kind = visitorKeys[node.kind]) !== null &&\n _node$kind !== void 0\n ? _node$kind\n : [];\n index = -1;\n edits = [];\n\n if (parent) {\n ancestors.push(parent);\n }\n\n parent = node;\n }\n } while (stack !== undefined);\n\n if (edits.length !== 0) {\n newRoot = edits[edits.length - 1][1];\n }\n\n return newRoot;\n}\n/**\n * Creates a new visitor instance which delegates to many visitors to run in\n * parallel. Each visitor will be visited for each node before moving on.\n *\n * If a prior visitor edits a node, no following visitors will see that node.\n */\n\nexport function visitInParallel(visitors) {\n const skipping = new Array(visitors.length).fill(null);\n const mergedVisitor = Object.create(null);\n\n for (const kind of Object.values(Kind)) {\n let hasVisitor = false;\n const enterList = new Array(visitors.length).fill(undefined);\n const leaveList = new Array(visitors.length).fill(undefined);\n\n for (let i = 0; i < visitors.length; ++i) {\n const { enter, leave } = getEnterLeaveForKind(visitors[i], kind);\n hasVisitor || (hasVisitor = enter != null || leave != null);\n enterList[i] = enter;\n leaveList[i] = leave;\n }\n\n if (!hasVisitor) {\n continue;\n }\n\n const mergedEnterLeave = {\n enter(...args) {\n const node = args[0];\n\n for (let i = 0; i < visitors.length; i++) {\n if (skipping[i] === null) {\n var _enterList$i;\n\n const result =\n (_enterList$i = enterList[i]) === null || _enterList$i === void 0\n ? void 0\n : _enterList$i.apply(visitors[i], args);\n\n if (result === false) {\n skipping[i] = node;\n } else if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined) {\n return result;\n }\n }\n }\n },\n\n leave(...args) {\n const node = args[0];\n\n for (let i = 0; i < visitors.length; i++) {\n if (skipping[i] === null) {\n var _leaveList$i;\n\n const result =\n (_leaveList$i = leaveList[i]) === null || _leaveList$i === void 0\n ? void 0\n : _leaveList$i.apply(visitors[i], args);\n\n if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined && result !== false) {\n return result;\n }\n } else if (skipping[i] === node) {\n skipping[i] = null;\n }\n }\n },\n };\n mergedVisitor[kind] = mergedEnterLeave;\n }\n\n return mergedVisitor;\n}\n/**\n * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind.\n */\n\nexport function getEnterLeaveForKind(visitor, kind) {\n const kindVisitor = visitor[kind];\n\n if (typeof kindVisitor === 'object') {\n // { Kind: { enter() {}, leave() {} } }\n return kindVisitor;\n } else if (typeof kindVisitor === 'function') {\n // { Kind() {} }\n return {\n enter: kindVisitor,\n leave: undefined,\n };\n } // { enter() {}, leave() {} }\n\n return {\n enter: visitor.enter,\n leave: visitor.leave,\n };\n}\n/**\n * Given a visitor instance, if it is leaving or not, and a node kind, return\n * the function the visitor runtime should call.\n *\n * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17\n */\n\n/* c8 ignore next 8 */\n\nexport function getVisitFn(visitor, kind, isLeaving) {\n const { enter, leave } = getEnterLeaveForKind(visitor, kind);\n return isLeaving ? leave : enter;\n}\n","/**\n * Prints a string as a GraphQL StringValue literal. Replaces control characters\n * and excluded characters (\" U+0022 and \\\\ U+005C) with escape sequences.\n */\nexport function printString(str) {\n return `\"${str.replace(escapedRegExp, escapedReplacer)}\"`;\n} // eslint-disable-next-line no-control-regex\n\nconst escapedRegExp = /[\\x00-\\x1f\\x22\\x5c\\x7f-\\x9f]/g;\n\nfunction escapedReplacer(str) {\n return escapeSequences[str.charCodeAt(0)];\n} // prettier-ignore\n\nconst escapeSequences = [\n '\\\\u0000',\n '\\\\u0001',\n '\\\\u0002',\n '\\\\u0003',\n '\\\\u0004',\n '\\\\u0005',\n '\\\\u0006',\n '\\\\u0007',\n '\\\\b',\n '\\\\t',\n '\\\\n',\n '\\\\u000B',\n '\\\\f',\n '\\\\r',\n '\\\\u000E',\n '\\\\u000F',\n '\\\\u0010',\n '\\\\u0011',\n '\\\\u0012',\n '\\\\u0013',\n '\\\\u0014',\n '\\\\u0015',\n '\\\\u0016',\n '\\\\u0017',\n '\\\\u0018',\n '\\\\u0019',\n '\\\\u001A',\n '\\\\u001B',\n '\\\\u001C',\n '\\\\u001D',\n '\\\\u001E',\n '\\\\u001F',\n '',\n '',\n '\\\\\"',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 2F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 3F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 4F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '\\\\\\\\',\n '',\n '',\n '', // 5F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '', // 6F\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '',\n '\\\\u007F',\n '\\\\u0080',\n '\\\\u0081',\n '\\\\u0082',\n '\\\\u0083',\n '\\\\u0084',\n '\\\\u0085',\n '\\\\u0086',\n '\\\\u0087',\n '\\\\u0088',\n '\\\\u0089',\n '\\\\u008A',\n '\\\\u008B',\n '\\\\u008C',\n '\\\\u008D',\n '\\\\u008E',\n '\\\\u008F',\n '\\\\u0090',\n '\\\\u0091',\n '\\\\u0092',\n '\\\\u0093',\n '\\\\u0094',\n '\\\\u0095',\n '\\\\u0096',\n '\\\\u0097',\n '\\\\u0098',\n '\\\\u0099',\n '\\\\u009A',\n '\\\\u009B',\n '\\\\u009C',\n '\\\\u009D',\n '\\\\u009E',\n '\\\\u009F',\n];\n","import { visit } from './visitor.mjs';\nimport { printBlockString } from './blockString.mjs';\nimport { printString } from './printString.mjs';\n/**\n * Converts an AST into a string, using one set of reasonable\n * formatting rules.\n */\n\nexport function print(ast) {\n return visit(ast, printDocASTReducer);\n}\nconst MAX_LINE_LENGTH = 80;\nconst printDocASTReducer = {\n Name: {\n leave: (node) => node.value,\n },\n Variable: {\n leave: (node) => '$' + node.name,\n },\n // Document\n Document: {\n leave: (node) => join(node.definitions, '\\n\\n'),\n },\n OperationDefinition: {\n leave(node) {\n const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')');\n const prefix = join(\n [\n node.operation,\n join([node.name, varDefs]),\n join(node.directives, ' '),\n ],\n ' ',\n ); // Anonymous queries with no directives or variable definitions can use\n // the query short form.\n\n return (prefix === 'query' ? '' : prefix + ' ') + node.selectionSet;\n },\n },\n VariableDefinition: {\n leave: ({ variable, type, defaultValue, directives }) =>\n variable +\n ': ' +\n type +\n wrap(' = ', defaultValue) +\n wrap(' ', join(directives, ' ')),\n },\n SelectionSet: {\n leave: ({ selections }) => block(selections),\n },\n Field: {\n leave({ alias, name, arguments: args, directives, selectionSet }) {\n const prefix = wrap('', alias, ': ') + name;\n let argsLine = prefix + wrap('(', join(args, ', '), ')');\n\n if (argsLine.length > MAX_LINE_LENGTH) {\n argsLine = prefix + wrap('(\\n', indent(join(args, '\\n')), '\\n)');\n }\n\n return join([argsLine, join(directives, ' '), selectionSet], ' ');\n },\n },\n Argument: {\n leave: ({ name, value }) => name + ': ' + value,\n },\n // Fragments\n FragmentSpread: {\n leave: ({ name, directives }) =>\n '...' + name + wrap(' ', join(directives, ' ')),\n },\n InlineFragment: {\n leave: ({ typeCondition, directives, selectionSet }) =>\n join(\n [\n '...',\n wrap('on ', typeCondition),\n join(directives, ' '),\n selectionSet,\n ],\n ' ',\n ),\n },\n FragmentDefinition: {\n leave: (\n { name, typeCondition, variableDefinitions, directives, selectionSet }, // Note: fragment variable definitions are experimental and may be changed\n ) =>\n // or removed in the future.\n `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` +\n `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` +\n selectionSet,\n },\n // Value\n IntValue: {\n leave: ({ value }) => value,\n },\n FloatValue: {\n leave: ({ value }) => value,\n },\n StringValue: {\n leave: ({ value, block: isBlockString }) =>\n isBlockString ? printBlockString(value) : printString(value),\n },\n BooleanValue: {\n leave: ({ value }) => (value ? 'true' : 'false'),\n },\n NullValue: {\n leave: () => 'null',\n },\n EnumValue: {\n leave: ({ value }) => value,\n },\n ListValue: {\n leave: ({ values }) => '[' + join(values, ', ') + ']',\n },\n ObjectValue: {\n leave: ({ fields }) => '{' + join(fields, ', ') + '}',\n },\n ObjectField: {\n leave: ({ name, value }) => name + ': ' + value,\n },\n // Directive\n Directive: {\n leave: ({ name, arguments: args }) =>\n '@' + name + wrap('(', join(args, ', '), ')'),\n },\n // Type\n NamedType: {\n leave: ({ name }) => name,\n },\n ListType: {\n leave: ({ type }) => '[' + type + ']',\n },\n NonNullType: {\n leave: ({ type }) => type + '!',\n },\n // Type System Definitions\n SchemaDefinition: {\n leave: ({ description, directives, operationTypes }) =>\n wrap('', description, '\\n') +\n join(['schema', join(directives, ' '), block(operationTypes)], ' '),\n },\n OperationTypeDefinition: {\n leave: ({ operation, type }) => operation + ': ' + type,\n },\n ScalarTypeDefinition: {\n leave: ({ description, name, directives }) =>\n wrap('', description, '\\n') +\n join(['scalar', name, join(directives, ' ')], ' '),\n },\n ObjectTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap('', description, '\\n') +\n join(\n [\n 'type',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n FieldDefinition: {\n leave: ({ description, name, arguments: args, type, directives }) =>\n wrap('', description, '\\n') +\n name +\n (hasMultilineItems(args)\n ? wrap('(\\n', indent(join(args, '\\n')), '\\n)')\n : wrap('(', join(args, ', '), ')')) +\n ': ' +\n type +\n wrap(' ', join(directives, ' ')),\n },\n InputValueDefinition: {\n leave: ({ description, name, type, defaultValue, directives }) =>\n wrap('', description, '\\n') +\n join(\n [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')],\n ' ',\n ),\n },\n InterfaceTypeDefinition: {\n leave: ({ description, name, interfaces, directives, fields }) =>\n wrap('', description, '\\n') +\n join(\n [\n 'interface',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n UnionTypeDefinition: {\n leave: ({ description, name, directives, types }) =>\n wrap('', description, '\\n') +\n join(\n ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))],\n ' ',\n ),\n },\n EnumTypeDefinition: {\n leave: ({ description, name, directives, values }) =>\n wrap('', description, '\\n') +\n join(['enum', name, join(directives, ' '), block(values)], ' '),\n },\n EnumValueDefinition: {\n leave: ({ description, name, directives }) =>\n wrap('', description, '\\n') + join([name, join(directives, ' ')], ' '),\n },\n InputObjectTypeDefinition: {\n leave: ({ description, name, directives, fields }) =>\n wrap('', description, '\\n') +\n join(['input', name, join(directives, ' '), block(fields)], ' '),\n },\n DirectiveDefinition: {\n leave: ({ description, name, arguments: args, repeatable, locations }) =>\n wrap('', description, '\\n') +\n 'directive @' +\n name +\n (hasMultilineItems(args)\n ? wrap('(\\n', indent(join(args, '\\n')), '\\n)')\n : wrap('(', join(args, ', '), ')')) +\n (repeatable ? ' repeatable' : '') +\n ' on ' +\n join(locations, ' | '),\n },\n SchemaExtension: {\n leave: ({ directives, operationTypes }) =>\n join(\n ['extend schema', join(directives, ' '), block(operationTypes)],\n ' ',\n ),\n },\n ScalarTypeExtension: {\n leave: ({ name, directives }) =>\n join(['extend scalar', name, join(directives, ' ')], ' '),\n },\n ObjectTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n 'extend type',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n InterfaceTypeExtension: {\n leave: ({ name, interfaces, directives, fields }) =>\n join(\n [\n 'extend interface',\n name,\n wrap('implements ', join(interfaces, ' & ')),\n join(directives, ' '),\n block(fields),\n ],\n ' ',\n ),\n },\n UnionTypeExtension: {\n leave: ({ name, directives, types }) =>\n join(\n [\n 'extend union',\n name,\n join(directives, ' '),\n wrap('= ', join(types, ' | ')),\n ],\n ' ',\n ),\n },\n EnumTypeExtension: {\n leave: ({ name, directives, values }) =>\n join(['extend enum', name, join(directives, ' '), block(values)], ' '),\n },\n InputObjectTypeExtension: {\n leave: ({ name, directives, fields }) =>\n join(['extend input', name, join(directives, ' '), block(fields)], ' '),\n },\n};\n/**\n * Given maybeArray, print an empty string if it is null or empty, otherwise\n * print all items together separated by separator if provided\n */\n\nfunction join(maybeArray, separator = '') {\n var _maybeArray$filter$jo;\n\n return (_maybeArray$filter$jo =\n maybeArray === null || maybeArray === void 0\n ? void 0\n : maybeArray.filter((x) => x).join(separator)) !== null &&\n _maybeArray$filter$jo !== void 0\n ? _maybeArray$filter$jo\n : '';\n}\n/**\n * Given array, print each item on its own line, wrapped in an indented `{ }` block.\n */\n\nfunction block(array) {\n return wrap('{\\n', indent(join(array, '\\n')), '\\n}');\n}\n/**\n * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string.\n */\n\nfunction wrap(start, maybeString, end = '') {\n return maybeString != null && maybeString !== ''\n ? start + maybeString + end\n : '';\n}\n\nfunction indent(str) {\n return wrap(' ', str.replace(/\\n/g, '\\n '));\n}\n\nfunction hasMultilineItems(maybeArray) {\n var _maybeArray$some;\n\n // FIXME: https://github.com/graphql/graphql-js/issues/2203\n\n /* c8 ignore next */\n return (_maybeArray$some =\n maybeArray === null || maybeArray === void 0\n ? void 0\n : maybeArray.some((str) => str.includes('\\n'))) !== null &&\n _maybeArray$some !== void 0\n ? _maybeArray$some\n : false;\n}\n","import { remove } from \"ts-invariant/process/index.js\";\nimport { Source } from 'graphql';\nexport function removeTemporaryGlobals() {\n return typeof Source === \"function\" ? remove() : remove();\n}\n//# sourceMappingURL=fix-graphql.js.map","import { invariant, InvariantError } from \"ts-invariant\";\nimport DEV from \"./DEV.js\";\nexport { DEV };\nexport function checkDEV() {\n __DEV__ ? invariant(\"boolean\" === typeof DEV, DEV) : invariant(\"boolean\" === typeof DEV, 36);\n}\nimport { removeTemporaryGlobals } from \"./fix-graphql.js\";\nremoveTemporaryGlobals();\nexport { maybe } from \"./maybe.js\";\nexport { default as global } from \"./global.js\";\nexport { invariant, InvariantError };\ncheckDEV();\n//# sourceMappingURL=index.js.map","import { invariant } from \"../globals/index.js\";\nimport { visit, } from 'graphql';\nexport function shouldInclude(_a, variables) {\n var directives = _a.directives;\n if (!directives || !directives.length) {\n return true;\n }\n return getInclusionDirectives(directives).every(function (_a) {\n var directive = _a.directive, ifArgument = _a.ifArgument;\n var evaledValue = false;\n if (ifArgument.value.kind === 'Variable') {\n evaledValue = variables && variables[ifArgument.value.name.value];\n __DEV__ ? invariant(evaledValue !== void 0, \"Invalid variable referenced in @\".concat(directive.name.value, \" directive.\")) : invariant(evaledValue !== void 0, 37);\n }\n else {\n evaledValue = ifArgument.value.value;\n }\n return directive.name.value === 'skip' ? !evaledValue : evaledValue;\n });\n}\nexport function getDirectiveNames(root) {\n var names = [];\n visit(root, {\n Directive: function (node) {\n names.push(node.name.value);\n },\n });\n return names;\n}\nexport function hasDirectives(names, root) {\n return getDirectiveNames(root).some(function (name) { return names.indexOf(name) > -1; });\n}\nexport function hasClientExports(document) {\n return (document &&\n hasDirectives(['client'], document) &&\n hasDirectives(['export'], document));\n}\nfunction isInclusionDirective(_a) {\n var value = _a.name.value;\n return value === 'skip' || value === 'include';\n}\nexport function getInclusionDirectives(directives) {\n var result = [];\n if (directives && directives.length) {\n directives.forEach(function (directive) {\n if (!isInclusionDirective(directive))\n return;\n var directiveArguments = directive.arguments;\n var directiveName = directive.name.value;\n __DEV__ ? invariant(directiveArguments && directiveArguments.length === 1, \"Incorrect number of arguments for the @\".concat(directiveName, \" directive.\")) : invariant(directiveArguments && directiveArguments.length === 1, 38);\n var ifArgument = directiveArguments[0];\n __DEV__ ? invariant(ifArgument.name && ifArgument.name.value === 'if', \"Invalid argument for the @\".concat(directiveName, \" directive.\")) : invariant(ifArgument.name && ifArgument.name.value === 'if', 39);\n var ifValue = ifArgument.value;\n __DEV__ ? invariant(ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), \"Argument for the @\".concat(directiveName, \" directive must be a variable or a boolean value.\")) : invariant(ifValue &&\n (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 40);\n result.push({ directive: directive, ifArgument: ifArgument });\n });\n }\n return result;\n}\n//# sourceMappingURL=directives.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { invariant, InvariantError } from \"../globals/index.js\";\nexport function getFragmentQueryDocument(document, fragmentName) {\n var actualFragmentName = fragmentName;\n var fragments = [];\n document.definitions.forEach(function (definition) {\n if (definition.kind === 'OperationDefinition') {\n throw __DEV__ ? new InvariantError(\"Found a \".concat(definition.operation, \" operation\").concat(definition.name ? \" named '\".concat(definition.name.value, \"'\") : '', \". \") +\n 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new InvariantError(41);\n }\n if (definition.kind === 'FragmentDefinition') {\n fragments.push(definition);\n }\n });\n if (typeof actualFragmentName === 'undefined') {\n __DEV__ ? invariant(fragments.length === 1, \"Found \".concat(fragments.length, \" fragments. `fragmentName` must be provided when there is not exactly 1 fragment.\")) : invariant(fragments.length === 1, 42);\n actualFragmentName = fragments[0].name.value;\n }\n var query = __assign(__assign({}, document), { definitions: __spreadArray([\n {\n kind: 'OperationDefinition',\n operation: 'query',\n selectionSet: {\n kind: 'SelectionSet',\n selections: [\n {\n kind: 'FragmentSpread',\n name: {\n kind: 'Name',\n value: actualFragmentName,\n },\n },\n ],\n },\n }\n ], document.definitions, true) });\n return query;\n}\nexport function createFragmentMap(fragments) {\n if (fragments === void 0) { fragments = []; }\n var symTable = {};\n fragments.forEach(function (fragment) {\n symTable[fragment.name.value] = fragment;\n });\n return symTable;\n}\nexport function getFragmentFromSelection(selection, fragmentMap) {\n switch (selection.kind) {\n case 'InlineFragment':\n return selection;\n case 'FragmentSpread': {\n var fragment = fragmentMap && fragmentMap[selection.name.value];\n __DEV__ ? invariant(fragment, \"No fragment named \".concat(selection.name.value, \".\")) : invariant(fragment, 43);\n return fragment;\n }\n default:\n return null;\n }\n}\n//# sourceMappingURL=fragments.js.map","export function isNonNullObject(obj) {\n return obj !== null && typeof obj === 'object';\n}\n//# sourceMappingURL=objects.js.map","import { InvariantError } from \"../globals/index.js\";\nimport { isNonNullObject } from \"../common/objects.js\";\nimport { getFragmentFromSelection } from \"./fragments.js\";\nexport function makeReference(id) {\n return { __ref: String(id) };\n}\nexport function isReference(obj) {\n return Boolean(obj && typeof obj === 'object' && typeof obj.__ref === 'string');\n}\nexport function isDocumentNode(value) {\n return (isNonNullObject(value) &&\n value.kind === \"Document\" &&\n Array.isArray(value.definitions));\n}\nfunction isStringValue(value) {\n return value.kind === 'StringValue';\n}\nfunction isBooleanValue(value) {\n return value.kind === 'BooleanValue';\n}\nfunction isIntValue(value) {\n return value.kind === 'IntValue';\n}\nfunction isFloatValue(value) {\n return value.kind === 'FloatValue';\n}\nfunction isVariable(value) {\n return value.kind === 'Variable';\n}\nfunction isObjectValue(value) {\n return value.kind === 'ObjectValue';\n}\nfunction isListValue(value) {\n return value.kind === 'ListValue';\n}\nfunction isEnumValue(value) {\n return value.kind === 'EnumValue';\n}\nfunction isNullValue(value) {\n return value.kind === 'NullValue';\n}\nexport function valueToObjectRepresentation(argObj, name, value, variables) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n }\n else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n }\n else if (isObjectValue(value)) {\n var nestedArgObj_1 = {};\n value.fields.map(function (obj) {\n return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables);\n });\n argObj[name.value] = nestedArgObj_1;\n }\n else if (isVariable(value)) {\n var variableValue = (variables || {})[value.name.value];\n argObj[name.value] = variableValue;\n }\n else if (isListValue(value)) {\n argObj[name.value] = value.values.map(function (listValue) {\n var nestedArgArrayObj = {};\n valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables);\n return nestedArgArrayObj[name.value];\n });\n }\n else if (isEnumValue(value)) {\n argObj[name.value] = value.value;\n }\n else if (isNullValue(value)) {\n argObj[name.value] = null;\n }\n else {\n throw __DEV__ ? new InvariantError(\"The inline argument \\\"\".concat(name.value, \"\\\" of kind \\\"\").concat(value.kind, \"\\\"\") +\n 'is not supported. Use variables instead of inline arguments to ' +\n 'overcome this limitation.') : new InvariantError(52);\n }\n}\nexport function storeKeyNameFromField(field, variables) {\n var directivesObj = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(function (directive) {\n directivesObj[directive.name.value] = {};\n if (directive.arguments) {\n directive.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables);\n });\n }\n });\n }\n var argObj = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(argObj, name, value, variables);\n });\n }\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\nvar KNOWN_DIRECTIVES = [\n 'connection',\n 'include',\n 'skip',\n 'client',\n 'rest',\n 'export',\n];\nexport var getStoreKeyName = Object.assign(function (fieldName, args, directives) {\n if (args &&\n directives &&\n directives['connection'] &&\n directives['connection']['key']) {\n if (directives['connection']['filter'] &&\n directives['connection']['filter'].length > 0) {\n var filterKeys = directives['connection']['filter']\n ? directives['connection']['filter']\n : [];\n filterKeys.sort();\n var filteredArgs_1 = {};\n filterKeys.forEach(function (key) {\n filteredArgs_1[key] = args[key];\n });\n return \"\".concat(directives['connection']['key'], \"(\").concat(stringify(filteredArgs_1), \")\");\n }\n else {\n return directives['connection']['key'];\n }\n }\n var completeFieldName = fieldName;\n if (args) {\n var stringifiedArgs = stringify(args);\n completeFieldName += \"(\".concat(stringifiedArgs, \")\");\n }\n if (directives) {\n Object.keys(directives).forEach(function (key) {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1)\n return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += \"@\".concat(key, \"(\").concat(stringify(directives[key]), \")\");\n }\n else {\n completeFieldName += \"@\".concat(key);\n }\n });\n }\n return completeFieldName;\n}, {\n setStringify: function (s) {\n var previous = stringify;\n stringify = s;\n return previous;\n },\n});\nvar stringify = function defaultStringify(value) {\n return JSON.stringify(value, stringifyReplacer);\n};\nfunction stringifyReplacer(_key, value) {\n if (isNonNullObject(value) && !Array.isArray(value)) {\n value = Object.keys(value).sort().reduce(function (copy, key) {\n copy[key] = value[key];\n return copy;\n }, {});\n }\n return value;\n}\nexport function argumentsObjectFromField(field, variables) {\n if (field.arguments && field.arguments.length) {\n var argObj_1 = {};\n field.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(argObj_1, name, value, variables);\n });\n return argObj_1;\n }\n return null;\n}\nexport function resultKeyNameFromField(field) {\n return field.alias ? field.alias.value : field.name.value;\n}\nexport function getTypenameFromResult(result, selectionSet, fragmentMap) {\n if (typeof result.__typename === 'string') {\n return result.__typename;\n }\n for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {\n var selection = _a[_i];\n if (isField(selection)) {\n if (selection.name.value === '__typename') {\n return result[resultKeyNameFromField(selection)];\n }\n }\n else {\n var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);\n if (typeof typename === 'string') {\n return typename;\n }\n }\n }\n}\nexport function isField(selection) {\n return selection.kind === 'Field';\n}\nexport function isInlineFragment(selection) {\n return selection.kind === 'InlineFragment';\n}\n//# sourceMappingURL=storeUtils.js.map","import { invariant, InvariantError } from \"../globals/index.js\";\nimport { valueToObjectRepresentation } from \"./storeUtils.js\";\nexport function checkDocument(doc) {\n __DEV__ ? invariant(doc && doc.kind === 'Document', \"Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \\\"gql\\\" tag? http://docs.apollostack.com/apollo-client/core.html#gql\") : invariant(doc && doc.kind === 'Document', 44);\n var operations = doc.definitions\n .filter(function (d) { return d.kind !== 'FragmentDefinition'; })\n .map(function (definition) {\n if (definition.kind !== 'OperationDefinition') {\n throw __DEV__ ? new InvariantError(\"Schema type definitions not allowed in queries. Found: \\\"\".concat(definition.kind, \"\\\"\")) : new InvariantError(45);\n }\n return definition;\n });\n __DEV__ ? invariant(operations.length <= 1, \"Ambiguous GraphQL document: contains \".concat(operations.length, \" operations\")) : invariant(operations.length <= 1, 46);\n return doc;\n}\nexport function getOperationDefinition(doc) {\n checkDocument(doc);\n return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0];\n}\nexport function getOperationName(doc) {\n return (doc.definitions\n .filter(function (definition) {\n return definition.kind === 'OperationDefinition' && definition.name;\n })\n .map(function (x) { return x.name.value; })[0] || null);\n}\nexport function getFragmentDefinitions(doc) {\n return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; });\n}\nexport function getQueryDefinition(doc) {\n var queryDef = getOperationDefinition(doc);\n __DEV__ ? invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : invariant(queryDef && queryDef.operation === 'query', 47);\n return queryDef;\n}\nexport function getFragmentDefinition(doc) {\n __DEV__ ? invariant(doc.kind === 'Document', \"Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \\\"gql\\\" tag? http://docs.apollostack.com/apollo-client/core.html#gql\") : invariant(doc.kind === 'Document', 48);\n __DEV__ ? invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : invariant(doc.definitions.length <= 1, 49);\n var fragmentDef = doc.definitions[0];\n __DEV__ ? invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : invariant(fragmentDef.kind === 'FragmentDefinition', 50);\n return fragmentDef;\n}\nexport function getMainDefinition(queryDoc) {\n checkDocument(queryDoc);\n var fragmentDefinition;\n for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) {\n var definition = _a[_i];\n if (definition.kind === 'OperationDefinition') {\n var operation = definition.operation;\n if (operation === 'query' ||\n operation === 'mutation' ||\n operation === 'subscription') {\n return definition;\n }\n }\n if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {\n fragmentDefinition = definition;\n }\n }\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n throw __DEV__ ? new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new InvariantError(51);\n}\nexport function getDefaultValues(definition) {\n var defaultValues = Object.create(null);\n var defs = definition && definition.variableDefinitions;\n if (defs && defs.length) {\n defs.forEach(function (def) {\n if (def.defaultValue) {\n valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue);\n }\n });\n }\n return defaultValues;\n}\n//# sourceMappingURL=getFromAST.js.map","export function filterInPlace(array, test, context) {\n var target = 0;\n array.forEach(function (elem, i) {\n if (test.call(this, elem, i, array)) {\n array[target++] = elem;\n }\n }, context);\n array.length = target;\n return array;\n}\n//# sourceMappingURL=filterInPlace.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { invariant } from \"../globals/index.js\";\nimport { visit, } from 'graphql';\nimport { checkDocument, getOperationDefinition, getFragmentDefinition, getFragmentDefinitions, getMainDefinition, } from \"./getFromAST.js\";\nimport { filterInPlace } from \"../common/filterInPlace.js\";\nimport { isField, isInlineFragment } from \"./storeUtils.js\";\nimport { createFragmentMap, } from \"./fragments.js\";\nvar TYPENAME_FIELD = {\n kind: 'Field',\n name: {\n kind: 'Name',\n value: '__typename',\n },\n};\nfunction isEmpty(op, fragments) {\n return op.selectionSet.selections.every(function (selection) {\n return selection.kind === 'FragmentSpread' &&\n isEmpty(fragments[selection.name.value], fragments);\n });\n}\nfunction nullIfDocIsEmpty(doc) {\n return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))\n ? null\n : doc;\n}\nfunction getDirectiveMatcher(directives) {\n return function directiveMatcher(directive) {\n return directives.some(function (dir) {\n return (dir.name && dir.name === directive.name.value) ||\n (dir.test && dir.test(directive));\n });\n };\n}\nexport function removeDirectivesFromDocument(directives, doc) {\n var variablesInUse = Object.create(null);\n var variablesToRemove = [];\n var fragmentSpreadsInUse = Object.create(null);\n var fragmentSpreadsToRemove = [];\n var modifiedDoc = nullIfDocIsEmpty(visit(doc, {\n Variable: {\n enter: function (node, _key, parent) {\n if (parent.kind !== 'VariableDefinition') {\n variablesInUse[node.name.value] = true;\n }\n },\n },\n Field: {\n enter: function (node) {\n if (directives && node.directives) {\n var shouldRemoveField = directives.some(function (directive) { return directive.remove; });\n if (shouldRemoveField &&\n node.directives &&\n node.directives.some(getDirectiveMatcher(directives))) {\n if (node.arguments) {\n node.arguments.forEach(function (arg) {\n if (arg.value.kind === 'Variable') {\n variablesToRemove.push({\n name: arg.value.name.value,\n });\n }\n });\n }\n if (node.selectionSet) {\n getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) {\n fragmentSpreadsToRemove.push({\n name: frag.name.value,\n });\n });\n }\n return null;\n }\n }\n },\n },\n FragmentSpread: {\n enter: function (node) {\n fragmentSpreadsInUse[node.name.value] = true;\n },\n },\n Directive: {\n enter: function (node) {\n if (getDirectiveMatcher(directives)(node)) {\n return null;\n }\n },\n },\n }));\n if (modifiedDoc &&\n filterInPlace(variablesToRemove, function (v) { return !!v.name && !variablesInUse[v.name]; }).length) {\n modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);\n }\n if (modifiedDoc &&\n filterInPlace(fragmentSpreadsToRemove, function (fs) { return !!fs.name && !fragmentSpreadsInUse[fs.name]; })\n .length) {\n modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc);\n }\n return modifiedDoc;\n}\nexport var addTypenameToDocument = Object.assign(function (doc) {\n return visit(checkDocument(doc), {\n SelectionSet: {\n enter: function (node, _key, parent) {\n if (parent &&\n parent.kind === 'OperationDefinition') {\n return;\n }\n var selections = node.selections;\n if (!selections) {\n return;\n }\n var skip = selections.some(function (selection) {\n return (isField(selection) &&\n (selection.name.value === '__typename' ||\n selection.name.value.lastIndexOf('__', 0) === 0));\n });\n if (skip) {\n return;\n }\n var field = parent;\n if (isField(field) &&\n field.directives &&\n field.directives.some(function (d) { return d.name.value === 'export'; })) {\n return;\n }\n return __assign(__assign({}, node), { selections: __spreadArray(__spreadArray([], selections, true), [TYPENAME_FIELD], false) });\n },\n },\n });\n}, {\n added: function (field) {\n return field === TYPENAME_FIELD;\n },\n});\nvar connectionRemoveConfig = {\n test: function (directive) {\n var willRemove = directive.name.value === 'connection';\n if (willRemove) {\n if (!directive.arguments ||\n !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) {\n __DEV__ && invariant.warn('Removing an @connection directive even though it does not have a key. ' +\n 'You may want to use the key parameter to specify a store key.');\n }\n }\n return willRemove;\n },\n};\nexport function removeConnectionDirectiveFromDocument(doc) {\n return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc));\n}\nfunction hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) {\n if (nestedCheck === void 0) { nestedCheck = true; }\n return (!!selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(function (selection) {\n return hasDirectivesInSelection(directives, selection, nestedCheck);\n }));\n}\nfunction hasDirectivesInSelection(directives, selection, nestedCheck) {\n if (nestedCheck === void 0) { nestedCheck = true; }\n if (!isField(selection)) {\n return true;\n }\n if (!selection.directives) {\n return false;\n }\n return (selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck)));\n}\nfunction getArgumentMatcher(config) {\n return function argumentMatcher(argument) {\n return config.some(function (aConfig) {\n return argument.value &&\n argument.value.kind === 'Variable' &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument)));\n });\n };\n}\nexport function removeArgumentsFromDocument(config, doc) {\n var argMatcher = getArgumentMatcher(config);\n return nullIfDocIsEmpty(visit(doc, {\n OperationDefinition: {\n enter: function (node) {\n return __assign(__assign({}, node), { variableDefinitions: node.variableDefinitions ? node.variableDefinitions.filter(function (varDef) {\n return !config.some(function (arg) { return arg.name === varDef.variable.name.value; });\n }) : [] });\n },\n },\n Field: {\n enter: function (node) {\n var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; });\n if (shouldRemoveField) {\n var argMatchCount_1 = 0;\n if (node.arguments) {\n node.arguments.forEach(function (arg) {\n if (argMatcher(arg)) {\n argMatchCount_1 += 1;\n }\n });\n }\n if (argMatchCount_1 === 1) {\n return null;\n }\n }\n },\n },\n Argument: {\n enter: function (node) {\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }));\n}\nexport function removeFragmentSpreadFromDocument(config, doc) {\n function enter(node) {\n if (config.some(function (def) { return def.name === node.name.value; })) {\n return null;\n }\n }\n return nullIfDocIsEmpty(visit(doc, {\n FragmentSpread: { enter: enter },\n FragmentDefinition: { enter: enter },\n }));\n}\nfunction getAllFragmentSpreadsFromSelectionSet(selectionSet) {\n var allFragments = [];\n selectionSet.selections.forEach(function (selection) {\n if ((isField(selection) || isInlineFragment(selection)) &&\n selection.selectionSet) {\n getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); });\n }\n else if (selection.kind === 'FragmentSpread') {\n allFragments.push(selection);\n }\n });\n return allFragments;\n}\nexport function buildQueryFromSelectionSet(document) {\n var definition = getMainDefinition(document);\n var definitionOperation = definition.operation;\n if (definitionOperation === 'query') {\n return document;\n }\n var modifiedDoc = visit(document, {\n OperationDefinition: {\n enter: function (node) {\n return __assign(__assign({}, node), { operation: 'query' });\n },\n },\n });\n return modifiedDoc;\n}\nexport function removeClientSetsFromDocument(document) {\n checkDocument(document);\n var modifiedDoc = removeDirectivesFromDocument([\n {\n test: function (directive) { return directive.name.value === 'client'; },\n remove: true,\n },\n ], document);\n if (modifiedDoc) {\n modifiedDoc = visit(modifiedDoc, {\n FragmentDefinition: {\n enter: function (node) {\n if (node.selectionSet) {\n var isTypenameOnly = node.selectionSet.selections.every(function (selection) {\n return isField(selection) && selection.name.value === '__typename';\n });\n if (isTypenameOnly) {\n return null;\n }\n }\n },\n },\n });\n }\n return modifiedDoc;\n}\n//# sourceMappingURL=transform.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { isNonNullObject } from \"./objects.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function mergeDeep() {\n var sources = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n sources[_i] = arguments[_i];\n }\n return mergeDeepArray(sources);\n}\nexport function mergeDeepArray(sources) {\n var target = sources[0] || {};\n var count = sources.length;\n if (count > 1) {\n var merger = new DeepMerger();\n for (var i = 1; i < count; ++i) {\n target = merger.merge(target, sources[i]);\n }\n }\n return target;\n}\nvar defaultReconciler = function (target, source, property) {\n return this.merge(target[property], source[property]);\n};\nvar DeepMerger = (function () {\n function DeepMerger(reconciler) {\n if (reconciler === void 0) { reconciler = defaultReconciler; }\n this.reconciler = reconciler;\n this.isObject = isNonNullObject;\n this.pastCopies = new Set();\n }\n DeepMerger.prototype.merge = function (target, source) {\n var _this = this;\n var context = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n context[_i - 2] = arguments[_i];\n }\n if (isNonNullObject(source) && isNonNullObject(target)) {\n Object.keys(source).forEach(function (sourceKey) {\n if (hasOwnProperty.call(target, sourceKey)) {\n var targetValue = target[sourceKey];\n if (source[sourceKey] !== targetValue) {\n var result = _this.reconciler.apply(_this, __spreadArray([target, source, sourceKey], context, false));\n if (result !== targetValue) {\n target = _this.shallowCopyForMerge(target);\n target[sourceKey] = result;\n }\n }\n }\n else {\n target = _this.shallowCopyForMerge(target);\n target[sourceKey] = source[sourceKey];\n }\n });\n return target;\n }\n return source;\n };\n DeepMerger.prototype.shallowCopyForMerge = function (value) {\n if (isNonNullObject(value)) {\n if (this.pastCopies.has(value)) {\n if (!Object.isFrozen(value))\n return value;\n this.pastCopies.delete(value);\n }\n if (Array.isArray(value)) {\n value = value.slice(0);\n }\n else {\n value = __assign({ __proto__: Object.getPrototypeOf(value) }, value);\n }\n this.pastCopies.add(value);\n }\n return value;\n };\n return DeepMerger;\n}());\nexport { DeepMerger };\n//# sourceMappingURL=mergeDeep.js.map","function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n// === Symbol Support ===\nvar hasSymbols = function () {\n return typeof Symbol === 'function';\n};\n\nvar hasSymbol = function (name) {\n return hasSymbols() && Boolean(Symbol[name]);\n};\n\nvar getSymbol = function (name) {\n return hasSymbol(name) ? Symbol[name] : '@@' + name;\n};\n\nif (hasSymbols() && !hasSymbol('observable')) {\n Symbol.observable = Symbol('observable');\n}\n\nvar SymbolIterator = getSymbol('iterator');\nvar SymbolObservable = getSymbol('observable');\nvar SymbolSpecies = getSymbol('species'); // === Abstract Operations ===\n\nfunction getMethod(obj, key) {\n var value = obj[key];\n if (value == null) return undefined;\n if (typeof value !== 'function') throw new TypeError(value + ' is not a function');\n return value;\n}\n\nfunction getSpecies(obj) {\n var ctor = obj.constructor;\n\n if (ctor !== undefined) {\n ctor = ctor[SymbolSpecies];\n\n if (ctor === null) {\n ctor = undefined;\n }\n }\n\n return ctor !== undefined ? ctor : Observable;\n}\n\nfunction isObservable(x) {\n return x instanceof Observable; // SPEC: Brand check\n}\n\nfunction hostReportError(e) {\n if (hostReportError.log) {\n hostReportError.log(e);\n } else {\n setTimeout(function () {\n throw e;\n });\n }\n}\n\nfunction enqueue(fn) {\n Promise.resolve().then(function () {\n try {\n fn();\n } catch (e) {\n hostReportError(e);\n }\n });\n}\n\nfunction cleanupSubscription(subscription) {\n var cleanup = subscription._cleanup;\n if (cleanup === undefined) return;\n subscription._cleanup = undefined;\n\n if (!cleanup) {\n return;\n }\n\n try {\n if (typeof cleanup === 'function') {\n cleanup();\n } else {\n var unsubscribe = getMethod(cleanup, 'unsubscribe');\n\n if (unsubscribe) {\n unsubscribe.call(cleanup);\n }\n }\n } catch (e) {\n hostReportError(e);\n }\n}\n\nfunction closeSubscription(subscription) {\n subscription._observer = undefined;\n subscription._queue = undefined;\n subscription._state = 'closed';\n}\n\nfunction flushSubscription(subscription) {\n var queue = subscription._queue;\n\n if (!queue) {\n return;\n }\n\n subscription._queue = undefined;\n subscription._state = 'ready';\n\n for (var i = 0; i < queue.length; ++i) {\n notifySubscription(subscription, queue[i].type, queue[i].value);\n if (subscription._state === 'closed') break;\n }\n}\n\nfunction notifySubscription(subscription, type, value) {\n subscription._state = 'running';\n var observer = subscription._observer;\n\n try {\n var m = getMethod(observer, type);\n\n switch (type) {\n case 'next':\n if (m) m.call(observer, value);\n break;\n\n case 'error':\n closeSubscription(subscription);\n if (m) m.call(observer, value);else throw value;\n break;\n\n case 'complete':\n closeSubscription(subscription);\n if (m) m.call(observer);\n break;\n }\n } catch (e) {\n hostReportError(e);\n }\n\n if (subscription._state === 'closed') cleanupSubscription(subscription);else if (subscription._state === 'running') subscription._state = 'ready';\n}\n\nfunction onNotify(subscription, type, value) {\n if (subscription._state === 'closed') return;\n\n if (subscription._state === 'buffering') {\n subscription._queue.push({\n type: type,\n value: value\n });\n\n return;\n }\n\n if (subscription._state !== 'ready') {\n subscription._state = 'buffering';\n subscription._queue = [{\n type: type,\n value: value\n }];\n enqueue(function () {\n return flushSubscription(subscription);\n });\n return;\n }\n\n notifySubscription(subscription, type, value);\n}\n\nvar Subscription = /*#__PURE__*/function () {\n function Subscription(observer, subscriber) {\n // ASSERT: observer is an object\n // ASSERT: subscriber is callable\n this._cleanup = undefined;\n this._observer = observer;\n this._queue = undefined;\n this._state = 'initializing';\n var subscriptionObserver = new SubscriptionObserver(this);\n\n try {\n this._cleanup = subscriber.call(undefined, subscriptionObserver);\n } catch (e) {\n subscriptionObserver.error(e);\n }\n\n if (this._state === 'initializing') this._state = 'ready';\n }\n\n var _proto = Subscription.prototype;\n\n _proto.unsubscribe = function unsubscribe() {\n if (this._state !== 'closed') {\n closeSubscription(this);\n cleanupSubscription(this);\n }\n };\n\n _createClass(Subscription, [{\n key: \"closed\",\n get: function () {\n return this._state === 'closed';\n }\n }]);\n\n return Subscription;\n}();\n\nvar SubscriptionObserver = /*#__PURE__*/function () {\n function SubscriptionObserver(subscription) {\n this._subscription = subscription;\n }\n\n var _proto2 = SubscriptionObserver.prototype;\n\n _proto2.next = function next(value) {\n onNotify(this._subscription, 'next', value);\n };\n\n _proto2.error = function error(value) {\n onNotify(this._subscription, 'error', value);\n };\n\n _proto2.complete = function complete() {\n onNotify(this._subscription, 'complete');\n };\n\n _createClass(SubscriptionObserver, [{\n key: \"closed\",\n get: function () {\n return this._subscription._state === 'closed';\n }\n }]);\n\n return SubscriptionObserver;\n}();\n\nvar Observable = /*#__PURE__*/function () {\n function Observable(subscriber) {\n if (!(this instanceof Observable)) throw new TypeError('Observable cannot be called as a function');\n if (typeof subscriber !== 'function') throw new TypeError('Observable initializer must be a function');\n this._subscriber = subscriber;\n }\n\n var _proto3 = Observable.prototype;\n\n _proto3.subscribe = function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n observer = {\n next: observer,\n error: arguments[1],\n complete: arguments[2]\n };\n }\n\n return new Subscription(observer, this._subscriber);\n };\n\n _proto3.forEach = function forEach(fn) {\n var _this = this;\n\n return new Promise(function (resolve, reject) {\n if (typeof fn !== 'function') {\n reject(new TypeError(fn + ' is not a function'));\n return;\n }\n\n function done() {\n subscription.unsubscribe();\n resolve();\n }\n\n var subscription = _this.subscribe({\n next: function (value) {\n try {\n fn(value, done);\n } catch (e) {\n reject(e);\n subscription.unsubscribe();\n }\n },\n error: reject,\n complete: resolve\n });\n });\n };\n\n _proto3.map = function map(fn) {\n var _this2 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n return new C(function (observer) {\n return _this2.subscribe({\n next: function (value) {\n try {\n value = fn(value);\n } catch (e) {\n return observer.error(e);\n }\n\n observer.next(value);\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n observer.complete();\n }\n });\n });\n };\n\n _proto3.filter = function filter(fn) {\n var _this3 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n return new C(function (observer) {\n return _this3.subscribe({\n next: function (value) {\n try {\n if (!fn(value)) return;\n } catch (e) {\n return observer.error(e);\n }\n\n observer.next(value);\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n observer.complete();\n }\n });\n });\n };\n\n _proto3.reduce = function reduce(fn) {\n var _this4 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n var hasSeed = arguments.length > 1;\n var hasValue = false;\n var seed = arguments[1];\n var acc = seed;\n return new C(function (observer) {\n return _this4.subscribe({\n next: function (value) {\n var first = !hasValue;\n hasValue = true;\n\n if (!first || hasSeed) {\n try {\n acc = fn(acc, value);\n } catch (e) {\n return observer.error(e);\n }\n } else {\n acc = value;\n }\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n if (!hasValue && !hasSeed) return observer.error(new TypeError('Cannot reduce an empty sequence'));\n observer.next(acc);\n observer.complete();\n }\n });\n });\n };\n\n _proto3.concat = function concat() {\n var _this5 = this;\n\n for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {\n sources[_key] = arguments[_key];\n }\n\n var C = getSpecies(this);\n return new C(function (observer) {\n var subscription;\n var index = 0;\n\n function startNext(next) {\n subscription = next.subscribe({\n next: function (v) {\n observer.next(v);\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n if (index === sources.length) {\n subscription = undefined;\n observer.complete();\n } else {\n startNext(C.from(sources[index++]));\n }\n }\n });\n }\n\n startNext(_this5);\n return function () {\n if (subscription) {\n subscription.unsubscribe();\n subscription = undefined;\n }\n };\n });\n };\n\n _proto3.flatMap = function flatMap(fn) {\n var _this6 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n return new C(function (observer) {\n var subscriptions = [];\n\n var outer = _this6.subscribe({\n next: function (value) {\n if (fn) {\n try {\n value = fn(value);\n } catch (e) {\n return observer.error(e);\n }\n }\n\n var inner = C.from(value).subscribe({\n next: function (value) {\n observer.next(value);\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n var i = subscriptions.indexOf(inner);\n if (i >= 0) subscriptions.splice(i, 1);\n completeIfDone();\n }\n });\n subscriptions.push(inner);\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n completeIfDone();\n }\n });\n\n function completeIfDone() {\n if (outer.closed && subscriptions.length === 0) observer.complete();\n }\n\n return function () {\n subscriptions.forEach(function (s) {\n return s.unsubscribe();\n });\n outer.unsubscribe();\n };\n });\n };\n\n _proto3[SymbolObservable] = function () {\n return this;\n };\n\n Observable.from = function from(x) {\n var C = typeof this === 'function' ? this : Observable;\n if (x == null) throw new TypeError(x + ' is not an object');\n var method = getMethod(x, SymbolObservable);\n\n if (method) {\n var observable = method.call(x);\n if (Object(observable) !== observable) throw new TypeError(observable + ' is not an object');\n if (isObservable(observable) && observable.constructor === C) return observable;\n return new C(function (observer) {\n return observable.subscribe(observer);\n });\n }\n\n if (hasSymbol('iterator')) {\n method = getMethod(x, SymbolIterator);\n\n if (method) {\n return new C(function (observer) {\n enqueue(function () {\n if (observer.closed) return;\n\n for (var _iterator = _createForOfIteratorHelperLoose(method.call(x)), _step; !(_step = _iterator()).done;) {\n var item = _step.value;\n observer.next(item);\n if (observer.closed) return;\n }\n\n observer.complete();\n });\n });\n }\n }\n\n if (Array.isArray(x)) {\n return new C(function (observer) {\n enqueue(function () {\n if (observer.closed) return;\n\n for (var i = 0; i < x.length; ++i) {\n observer.next(x[i]);\n if (observer.closed) return;\n }\n\n observer.complete();\n });\n });\n }\n\n throw new TypeError(x + ' is not observable');\n };\n\n Observable.of = function of() {\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n\n var C = typeof this === 'function' ? this : Observable;\n return new C(function (observer) {\n enqueue(function () {\n if (observer.closed) return;\n\n for (var i = 0; i < items.length; ++i) {\n observer.next(items[i]);\n if (observer.closed) return;\n }\n\n observer.complete();\n });\n });\n };\n\n _createClass(Observable, null, [{\n key: SymbolSpecies,\n get: function () {\n return this;\n }\n }]);\n\n return Observable;\n}();\n\nif (hasSymbols()) {\n Object.defineProperty(Observable, Symbol('extensions'), {\n value: {\n symbol: SymbolObservable,\n hostReportError: hostReportError\n },\n configurable: true\n });\n}\n\nexport { Observable };\n","export default function symbolObservablePonyfill(root) {\n\tvar result;\n\tvar Symbol = root.Symbol;\n\n\tif (typeof Symbol === 'function') {\n\t\tif (Symbol.observable) {\n\t\t\tresult = Symbol.observable;\n\t\t} else {\n\n\t\t\tif (typeof Symbol.for === 'function') {\n\t\t\t\t// This just needs to be something that won't trample other user's Symbol.for use\n\t\t\t\t// It also will guide people to the source of their issues, if this is problematic.\n\t\t\t\t// META: It's a resource locator!\n\t\t\t\tresult = Symbol.for('https://github.com/benlesh/symbol-observable');\n\t\t\t} else {\n\t\t\t\t// Symbol.for didn't exist! The best we can do at this point is a totally \n\t\t\t\t// unique symbol. Note that the string argument here is a descriptor, not\n\t\t\t\t// an identifier. This symbol is unique.\n\t\t\t\tresult = Symbol('https://github.com/benlesh/symbol-observable');\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tSymbol.observable = result;\n\t\t\t} catch (err) {\n\t\t\t\t// Do nothing. In some environments, users have frozen `Symbol` for security reasons,\n\t\t\t\t// if it is frozen assigning to it will throw. In this case, we don't care, because\n\t\t\t\t// they will need to use the returned value from the ponyfill.\n\t\t\t}\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n","/* global window */\nimport ponyfill from './ponyfill.js';\n\nvar root;\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = ponyfill(root);\nexport default result;\n","import { Observable, } from 'zen-observable-ts';\nimport 'symbol-observable';\nvar prototype = Observable.prototype;\nvar fakeObsSymbol = '@@observable';\nif (!prototype[fakeObsSymbol]) {\n prototype[fakeObsSymbol] = function () { return this; };\n}\nexport { Observable };\n//# sourceMappingURL=Observable.js.map","var toString = Object.prototype.toString;\nexport function cloneDeep(value) {\n return cloneDeepHelper(value);\n}\nfunction cloneDeepHelper(val, seen) {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n seen = seen || new Map;\n if (seen.has(val))\n return seen.get(val);\n var copy_1 = val.slice(0);\n seen.set(val, copy_1);\n copy_1.forEach(function (child, i) {\n copy_1[i] = cloneDeepHelper(child, seen);\n });\n return copy_1;\n }\n case \"[object Object]\": {\n seen = seen || new Map;\n if (seen.has(val))\n return seen.get(val);\n var copy_2 = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy_2);\n Object.keys(val).forEach(function (key) {\n copy_2[key] = cloneDeepHelper(val[key], seen);\n });\n return copy_2;\n }\n default:\n return val;\n }\n}\n//# sourceMappingURL=cloneDeep.js.map","import \"../globals/index.js\";\nimport { isNonNullObject } from \"./objects.js\";\nfunction deepFreeze(value) {\n var workSet = new Set([value]);\n workSet.forEach(function (obj) {\n if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {\n Object.getOwnPropertyNames(obj).forEach(function (name) {\n if (isNonNullObject(obj[name]))\n workSet.add(obj[name]);\n });\n }\n });\n return value;\n}\nfunction shallowFreeze(obj) {\n if (__DEV__ && !Object.isFrozen(obj)) {\n try {\n Object.freeze(obj);\n }\n catch (e) {\n if (e instanceof TypeError)\n return null;\n throw e;\n }\n }\n return obj;\n}\nexport function maybeDeepFreeze(obj) {\n if (__DEV__) {\n deepFreeze(obj);\n }\n return obj;\n}\n//# sourceMappingURL=maybeDeepFreeze.js.map","export function iterateObserversSafely(observers, method, argument) {\n var observersWithMethod = [];\n observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); });\n observersWithMethod.forEach(function (obs) { return obs[method](argument); });\n}\n//# sourceMappingURL=iteration.js.map","import { Observable } from \"./Observable.js\";\nexport function asyncMap(observable, mapFn, catchFn) {\n return new Observable(function (observer) {\n var next = observer.next, error = observer.error, complete = observer.complete;\n var activeCallbackCount = 0;\n var completed = false;\n var promiseQueue = {\n then: function (callback) {\n return new Promise(function (resolve) { return resolve(callback()); });\n },\n };\n function makeCallback(examiner, delegate) {\n if (examiner) {\n return function (arg) {\n ++activeCallbackCount;\n var both = function () { return examiner(arg); };\n promiseQueue = promiseQueue.then(both, both).then(function (result) {\n --activeCallbackCount;\n next && next.call(observer, result);\n if (completed) {\n handler.complete();\n }\n }, function (error) {\n --activeCallbackCount;\n throw error;\n }).catch(function (caught) {\n error && error.call(observer, caught);\n });\n };\n }\n else {\n return function (arg) { return delegate && delegate.call(observer, arg); };\n }\n }\n var handler = {\n next: makeCallback(mapFn, next),\n error: makeCallback(catchFn, error),\n complete: function () {\n completed = true;\n if (!activeCallbackCount) {\n complete && complete.call(observer);\n }\n },\n };\n var sub = observable.subscribe(handler);\n return function () { return sub.unsubscribe(); };\n });\n}\n//# sourceMappingURL=asyncMap.js.map","export var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&\n navigator.product === 'ReactNative');\nexport var canUseWeakSet = typeof WeakSet === 'function';\nexport var canUseSymbol = typeof Symbol === 'function' &&\n typeof Symbol.for === 'function';\n//# sourceMappingURL=canUse.js.map","import { Observable } from \"./Observable.js\";\nimport { canUseSymbol } from \"../common/canUse.js\";\nexport function fixObservableSubclass(subclass) {\n function set(key) {\n Object.defineProperty(subclass, key, { value: Observable });\n }\n if (canUseSymbol && Symbol.species) {\n set(Symbol.species);\n }\n set(\"@@species\");\n return subclass;\n}\n//# sourceMappingURL=subclassing.js.map","import { __extends } from \"tslib\";\nimport { Observable } from \"./Observable.js\";\nimport { iterateObserversSafely } from \"./iteration.js\";\nimport { fixObservableSubclass } from \"./subclassing.js\";\nfunction isPromiseLike(value) {\n return value && typeof value.then === \"function\";\n}\nvar Concast = (function (_super) {\n __extends(Concast, _super);\n function Concast(sources) {\n var _this = _super.call(this, function (observer) {\n _this.addObserver(observer);\n return function () { return _this.removeObserver(observer); };\n }) || this;\n _this.observers = new Set();\n _this.addCount = 0;\n _this.promise = new Promise(function (resolve, reject) {\n _this.resolve = resolve;\n _this.reject = reject;\n });\n _this.handlers = {\n next: function (result) {\n if (_this.sub !== null) {\n _this.latest = [\"next\", result];\n iterateObserversSafely(_this.observers, \"next\", result);\n }\n },\n error: function (error) {\n var sub = _this.sub;\n if (sub !== null) {\n if (sub)\n setTimeout(function () { return sub.unsubscribe(); });\n _this.sub = null;\n _this.latest = [\"error\", error];\n _this.reject(error);\n iterateObserversSafely(_this.observers, \"error\", error);\n }\n },\n complete: function () {\n if (_this.sub !== null) {\n var value = _this.sources.shift();\n if (!value) {\n _this.sub = null;\n if (_this.latest &&\n _this.latest[0] === \"next\") {\n _this.resolve(_this.latest[1]);\n }\n else {\n _this.resolve();\n }\n iterateObserversSafely(_this.observers, \"complete\");\n }\n else if (isPromiseLike(value)) {\n value.then(function (obs) { return _this.sub = obs.subscribe(_this.handlers); });\n }\n else {\n _this.sub = value.subscribe(_this.handlers);\n }\n }\n },\n };\n _this.cancel = function (reason) {\n _this.reject(reason);\n _this.sources = [];\n _this.handlers.complete();\n };\n _this.promise.catch(function (_) { });\n if (typeof sources === \"function\") {\n sources = [new Observable(sources)];\n }\n if (isPromiseLike(sources)) {\n sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error);\n }\n else {\n _this.start(sources);\n }\n return _this;\n }\n Concast.prototype.start = function (sources) {\n if (this.sub !== void 0)\n return;\n this.sources = Array.from(sources);\n this.handlers.complete();\n };\n Concast.prototype.deliverLastMessage = function (observer) {\n if (this.latest) {\n var nextOrError = this.latest[0];\n var method = observer[nextOrError];\n if (method) {\n method.call(observer, this.latest[1]);\n }\n if (this.sub === null &&\n nextOrError === \"next\" &&\n observer.complete) {\n observer.complete();\n }\n }\n };\n Concast.prototype.addObserver = function (observer) {\n if (!this.observers.has(observer)) {\n this.deliverLastMessage(observer);\n this.observers.add(observer);\n ++this.addCount;\n }\n };\n Concast.prototype.removeObserver = function (observer, quietly) {\n if (this.observers.delete(observer) &&\n --this.addCount < 1 &&\n !quietly) {\n this.handlers.error(new Error(\"Observable cancelled prematurely\"));\n }\n };\n Concast.prototype.cleanup = function (callback) {\n var _this = this;\n var called = false;\n var once = function () {\n if (!called) {\n called = true;\n _this.observers.delete(observer);\n callback();\n }\n };\n var observer = {\n next: once,\n error: once,\n complete: once,\n };\n var count = this.addCount;\n this.addObserver(observer);\n this.addCount = count;\n };\n return Concast;\n}(Observable));\nexport { Concast };\nfixObservableSubclass(Concast);\n//# sourceMappingURL=Concast.js.map","export function isNonEmptyArray(value) {\n return Array.isArray(value) && value.length > 0;\n}\n//# sourceMappingURL=arrays.js.map","export function graphQLResultHasError(result) {\n return (result.errors && result.errors.length > 0) || false;\n}\n//# sourceMappingURL=errorHandling.js.map","export function compact() {\n var objects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n objects[_i] = arguments[_i];\n }\n var result = Object.create(null);\n objects.forEach(function (obj) {\n if (!obj)\n return;\n Object.keys(obj).forEach(function (key) {\n var value = obj[key];\n if (value !== void 0) {\n result[key] = value;\n }\n });\n });\n return result;\n}\n//# sourceMappingURL=compact.js.map","var prefixCounts = new Map();\nexport function makeUniqueId(prefix) {\n var count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return \"\".concat(prefix, \":\").concat(count, \":\").concat(Math.random().toString(36).slice(2));\n}\n//# sourceMappingURL=makeUniqueId.js.map","import { makeUniqueId } from \"./makeUniqueId.js\";\nexport function stringifyForDisplay(value) {\n var undefId = makeUniqueId(\"stringifyForDisplay\");\n return JSON.stringify(value, function (key, value) {\n return value === void 0 ? undefId : value;\n }).split(JSON.stringify(undefId)).join(\"\");\n}\n//# sourceMappingURL=stringifyForDisplay.js.map","import { Observable } from \"../../utilities/index.js\";\nexport function fromError(errorValue) {\n return new Observable(function (observer) {\n observer.error(errorValue);\n });\n}\n//# sourceMappingURL=fromError.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nexport function toPromise(observable) {\n var completed = false;\n return new Promise(function (resolve, reject) {\n observable.subscribe({\n next: function (data) {\n if (completed) {\n __DEV__ && invariant.warn(\"Promise Wrapper does not support multiple results from Observable\");\n }\n else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n//# sourceMappingURL=toPromise.js.map","import { Observable } from \"../../utilities/index.js\";\nexport function fromPromise(promise) {\n return new Observable(function (observer) {\n promise\n .then(function (value) {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\n//# sourceMappingURL=fromPromise.js.map","export var throwServerError = function (response, result, message) {\n var error = new Error(message);\n error.name = 'ServerError';\n error.response = response;\n error.statusCode = response.status;\n error.result = result;\n throw error;\n};\n//# sourceMappingURL=throwServerError.js.map","import { InvariantError } from \"../../utilities/globals/index.js\";\nexport function validateOperation(operation) {\n var OPERATION_FIELDS = [\n 'query',\n 'operationName',\n 'variables',\n 'extensions',\n 'context',\n ];\n for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {\n var key = _a[_i];\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw __DEV__ ? new InvariantError(\"illegal argument: \".concat(key)) : new InvariantError(24);\n }\n }\n return operation;\n}\n//# sourceMappingURL=validateOperation.js.map","import { __assign } from \"tslib\";\nexport function createOperation(starting, operation) {\n var context = __assign({}, starting);\n var setContext = function (next) {\n if (typeof next === 'function') {\n context = __assign(__assign({}, context), next(context));\n }\n else {\n context = __assign(__assign({}, context), next);\n }\n };\n var getContext = function () { return (__assign({}, context)); };\n Object.defineProperty(operation, 'setContext', {\n enumerable: false,\n value: setContext,\n });\n Object.defineProperty(operation, 'getContext', {\n enumerable: false,\n value: getContext,\n });\n return operation;\n}\n//# sourceMappingURL=createOperation.js.map","import { getOperationName } from \"../../utilities/index.js\";\nexport function transformOperation(operation) {\n var transformedOperation = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== 'string'\n ? getOperationName(transformedOperation.query) || undefined\n : '';\n }\n return transformedOperation;\n}\n//# sourceMappingURL=transformOperation.js.map","import { __extends } from \"tslib\";\nimport { InvariantError, invariant } from \"../../utilities/globals/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { validateOperation, createOperation, transformOperation, } from \"../utils/index.js\";\nfunction passthrough(op, forward) {\n return (forward ? forward(op) : Observable.of());\n}\nfunction toLink(handler) {\n return typeof handler === 'function' ? new ApolloLink(handler) : handler;\n}\nfunction isTerminating(link) {\n return link.request.length <= 1;\n}\nvar LinkError = (function (_super) {\n __extends(LinkError, _super);\n function LinkError(message, link) {\n var _this = _super.call(this, message) || this;\n _this.link = link;\n return _this;\n }\n return LinkError;\n}(Error));\nvar ApolloLink = (function () {\n function ApolloLink(request) {\n if (request)\n this.request = request;\n }\n ApolloLink.empty = function () {\n return new ApolloLink(function () { return Observable.of(); });\n };\n ApolloLink.from = function (links) {\n if (links.length === 0)\n return ApolloLink.empty();\n return links.map(toLink).reduce(function (x, y) { return x.concat(y); });\n };\n ApolloLink.split = function (test, left, right) {\n var leftLink = toLink(left);\n var rightLink = toLink(right || new ApolloLink(passthrough));\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n return new ApolloLink(function (operation) {\n return test(operation)\n ? leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n }\n else {\n return new ApolloLink(function (operation, forward) {\n return test(operation)\n ? leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n };\n ApolloLink.execute = function (link, operation) {\n return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());\n };\n ApolloLink.concat = function (first, second) {\n var firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n __DEV__ && invariant.warn(new LinkError(\"You are calling concat on a terminating link, which will have no effect\", firstLink));\n return firstLink;\n }\n var nextLink = toLink(second);\n if (isTerminating(nextLink)) {\n return new ApolloLink(function (operation) {\n return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();\n });\n }\n else {\n return new ApolloLink(function (operation, forward) {\n return (firstLink.request(operation, function (op) {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of());\n });\n }\n };\n ApolloLink.prototype.split = function (test, left, right) {\n return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough)));\n };\n ApolloLink.prototype.concat = function (next) {\n return ApolloLink.concat(this, next);\n };\n ApolloLink.prototype.request = function (operation, forward) {\n throw __DEV__ ? new InvariantError('request is not implemented') : new InvariantError(19);\n };\n ApolloLink.prototype.onError = function (error, observer) {\n if (observer && observer.error) {\n observer.error(error);\n return false;\n }\n throw error;\n };\n ApolloLink.prototype.setOnError = function (fn) {\n this.onError = fn;\n return this;\n };\n return ApolloLink;\n}());\nexport { ApolloLink };\n//# sourceMappingURL=ApolloLink.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var empty = ApolloLink.empty;\n//# sourceMappingURL=empty.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var from = ApolloLink.from;\n//# sourceMappingURL=from.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var split = ApolloLink.split;\n//# sourceMappingURL=split.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var concat = ApolloLink.concat;\n//# sourceMappingURL=concat.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var execute = ApolloLink.execute;\n//# sourceMappingURL=execute.js.map","export var version = '3.5.7';\n//# sourceMappingURL=version.js.map","import { throwServerError } from \"../utils/index.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function parseAndCheckHttpResponse(operations) {\n return function (response) { return response\n .text()\n .then(function (bodyText) {\n try {\n return JSON.parse(bodyText);\n }\n catch (err) {\n var parseError = err;\n parseError.name = 'ServerParseError';\n parseError.response = response;\n parseError.statusCode = response.status;\n parseError.bodyText = bodyText;\n throw parseError;\n }\n })\n .then(function (result) {\n if (response.status >= 300) {\n throwServerError(response, result, \"Response not successful: Received status code \".concat(response.status));\n }\n if (!Array.isArray(result) &&\n !hasOwnProperty.call(result, 'data') &&\n !hasOwnProperty.call(result, 'errors')) {\n throwServerError(response, result, \"Server response was missing for query '\".concat(Array.isArray(operations)\n ? operations.map(function (op) { return op.operationName; })\n : operations.operationName, \"'.\"));\n }\n return result;\n }); };\n}\n//# sourceMappingURL=parseAndCheckHttpResponse.js.map","import { InvariantError } from \"../../utilities/globals/index.js\";\nexport var serializeFetchParameter = function (p, label) {\n var serialized;\n try {\n serialized = JSON.stringify(p);\n }\n catch (e) {\n var parseError = __DEV__ ? new InvariantError(\"Network request failed. \".concat(label, \" is not serializable: \").concat(e.message)) : new InvariantError(21);\n parseError.parseError = e;\n throw parseError;\n }\n return serialized;\n};\n//# sourceMappingURL=serializeFetchParameter.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { print } from 'graphql';\n;\nvar defaultHttpOptions = {\n includeQuery: true,\n includeExtensions: false,\n};\nvar defaultHeaders = {\n accept: '*/*',\n 'content-type': 'application/json',\n};\nvar defaultOptions = {\n method: 'POST',\n};\nexport var fallbackHttpConfig = {\n http: defaultHttpOptions,\n headers: defaultHeaders,\n options: defaultOptions,\n};\nexport var defaultPrinter = function (ast, printer) { return printer(ast); };\nexport function selectHttpOptionsAndBody(operation, fallbackConfig) {\n var configs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n configs[_i - 2] = arguments[_i];\n }\n configs.unshift(fallbackConfig);\n return selectHttpOptionsAndBodyInternal.apply(void 0, __spreadArray([operation,\n defaultPrinter], configs, false));\n}\nexport function selectHttpOptionsAndBodyInternal(operation, printer) {\n var configs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n configs[_i - 2] = arguments[_i];\n }\n var options = {};\n var http = {};\n configs.forEach(function (config) {\n options = __assign(__assign(__assign({}, options), config.options), { headers: __assign(__assign({}, options.headers), headersToLowerCase(config.headers)) });\n if (config.credentials) {\n options.credentials = config.credentials;\n }\n http = __assign(__assign({}, http), config.http);\n });\n var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;\n var body = { operationName: operationName, variables: variables };\n if (http.includeExtensions)\n body.extensions = extensions;\n if (http.includeQuery)\n body.query = printer(query, print);\n return {\n options: options,\n body: body,\n };\n}\n;\nfunction headersToLowerCase(headers) {\n if (headers) {\n var normalized_1 = Object.create(null);\n Object.keys(Object(headers)).forEach(function (name) {\n normalized_1[name.toLowerCase()] = headers[name];\n });\n return normalized_1;\n }\n return headers;\n}\n//# sourceMappingURL=selectHttpOptionsAndBody.js.map","import { InvariantError } from \"../../utilities/globals/index.js\";\nexport var checkFetcher = function (fetcher) {\n if (!fetcher && typeof fetch === 'undefined') {\n throw __DEV__ ? new InvariantError(\"\\n\\\"fetch\\\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\\n\\nimport fetch from 'cross-fetch';\\nimport { ApolloClient, HttpLink } from '@apollo/client';\\nconst client = new ApolloClient({\\n link: new HttpLink({ uri: '/graphql', fetch })\\n});\\n \") : new InvariantError(20);\n }\n};\n//# sourceMappingURL=checkFetcher.js.map","export var createSignalIfSupported = function () {\n if (typeof AbortController === 'undefined')\n return { controller: false, signal: false };\n var controller = new AbortController();\n var signal = controller.signal;\n return { controller: controller, signal: signal };\n};\n//# sourceMappingURL=createSignalIfSupported.js.map","export var selectURI = function (operation, fallbackURI) {\n var context = operation.getContext();\n var contextURI = context.uri;\n if (contextURI) {\n return contextURI;\n }\n else if (typeof fallbackURI === 'function') {\n return fallbackURI(operation);\n }\n else {\n return fallbackURI || '/graphql';\n }\n};\n//# sourceMappingURL=selectURI.js.map","import { serializeFetchParameter } from \"./serializeFetchParameter.js\";\nexport function rewriteURIForGET(chosenURI, body) {\n var queryParams = [];\n var addQueryParam = function (key, value) {\n queryParams.push(\"\".concat(key, \"=\").concat(encodeURIComponent(value)));\n };\n if ('query' in body) {\n addQueryParam('query', body.query);\n }\n if (body.operationName) {\n addQueryParam('operationName', body.operationName);\n }\n if (body.variables) {\n var serializedVariables = void 0;\n try {\n serializedVariables = serializeFetchParameter(body.variables, 'Variables map');\n }\n catch (parseError) {\n return { parseError: parseError };\n }\n addQueryParam('variables', serializedVariables);\n }\n if (body.extensions) {\n var serializedExtensions = void 0;\n try {\n serializedExtensions = serializeFetchParameter(body.extensions, 'Extensions map');\n }\n catch (parseError) {\n return { parseError: parseError };\n }\n addQueryParam('extensions', serializedExtensions);\n }\n var fragment = '', preFragment = chosenURI;\n var fragmentStart = chosenURI.indexOf('#');\n if (fragmentStart !== -1) {\n fragment = chosenURI.substr(fragmentStart);\n preFragment = chosenURI.substr(0, fragmentStart);\n }\n var queryParamsPrefix = preFragment.indexOf('?') === -1 ? '?' : '&';\n var newURI = preFragment + queryParamsPrefix + queryParams.join('&') + fragment;\n return { newURI: newURI };\n}\n//# sourceMappingURL=rewriteURIForGET.js.map","import { __assign, __rest } from \"tslib\";\nimport \"../../utilities/globals/index.js\";\nimport { visit } from 'graphql';\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { serializeFetchParameter } from \"./serializeFetchParameter.js\";\nimport { selectURI } from \"./selectURI.js\";\nimport { parseAndCheckHttpResponse } from \"./parseAndCheckHttpResponse.js\";\nimport { checkFetcher } from \"./checkFetcher.js\";\nimport { selectHttpOptionsAndBodyInternal, defaultPrinter, fallbackHttpConfig } from \"./selectHttpOptionsAndBody.js\";\nimport { createSignalIfSupported } from \"./createSignalIfSupported.js\";\nimport { rewriteURIForGET } from \"./rewriteURIForGET.js\";\nimport { fromError } from \"../utils/index.js\";\nimport { maybe } from \"../../utilities/index.js\";\nvar backupFetch = maybe(function () { return fetch; });\nexport var createHttpLink = function (linkOptions) {\n if (linkOptions === void 0) { linkOptions = {}; }\n var _a = linkOptions.uri, uri = _a === void 0 ? '/graphql' : _a, preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = __rest(linkOptions, [\"uri\", \"fetch\", \"print\", \"includeExtensions\", \"useGETForQueries\", \"includeUnusedVariables\"]);\n if (__DEV__) {\n checkFetcher(preferredFetch || backupFetch);\n }\n var linkConfig = {\n http: { includeExtensions: includeExtensions },\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n return new ApolloLink(function (operation) {\n var chosenURI = selectURI(operation, uri);\n var context = operation.getContext();\n var clientAwarenessHeaders = {};\n if (context.clientAwareness) {\n var _a = context.clientAwareness, name_1 = _a.name, version = _a.version;\n if (name_1) {\n clientAwarenessHeaders['apollographql-client-name'] = name_1;\n }\n if (version) {\n clientAwarenessHeaders['apollographql-client-version'] = version;\n }\n }\n var contextHeaders = __assign(__assign({}, clientAwarenessHeaders), context.headers);\n var contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: contextHeaders,\n };\n var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;\n if (body.variables && !includeUnusedVariables) {\n var unusedNames_1 = new Set(Object.keys(body.variables));\n visit(operation.query, {\n Variable: function (node, _key, parent) {\n if (parent && parent.kind !== 'VariableDefinition') {\n unusedNames_1.delete(node.name.value);\n }\n },\n });\n if (unusedNames_1.size) {\n body.variables = __assign({}, body.variables);\n unusedNames_1.forEach(function (name) {\n delete body.variables[name];\n });\n }\n }\n var controller;\n if (!options.signal) {\n var _c = createSignalIfSupported(), _controller = _c.controller, signal = _c.signal;\n controller = _controller;\n if (controller)\n options.signal = signal;\n }\n var definitionIsMutation = function (d) {\n return d.kind === 'OperationDefinition' && d.operation === 'mutation';\n };\n if (useGETForQueries &&\n !operation.query.definitions.some(definitionIsMutation)) {\n options.method = 'GET';\n }\n if (options.method === 'GET') {\n var _d = rewriteURIForGET(chosenURI, body), newURI = _d.newURI, parseError = _d.parseError;\n if (parseError) {\n return fromError(parseError);\n }\n chosenURI = newURI;\n }\n else {\n try {\n options.body = serializeFetchParameter(body, 'Payload');\n }\n catch (parseError) {\n return fromError(parseError);\n }\n }\n return new Observable(function (observer) {\n var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch;\n currentFetch(chosenURI, options)\n .then(function (response) {\n operation.setContext({ response: response });\n return response;\n })\n .then(parseAndCheckHttpResponse(operation))\n .then(function (result) {\n observer.next(result);\n observer.complete();\n return result;\n })\n .catch(function (err) {\n if (err.name === 'AbortError')\n return;\n if (err.result && err.result.errors && err.result.data) {\n observer.next(err.result);\n }\n observer.error(err);\n });\n return function () {\n if (controller)\n controller.abort();\n };\n });\n });\n};\n//# sourceMappingURL=createHttpLink.js.map","import { __extends } from \"tslib\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { createHttpLink } from \"./createHttpLink.js\";\nvar HttpLink = (function (_super) {\n __extends(HttpLink, _super);\n function HttpLink(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this, createHttpLink(options).request) || this;\n _this.options = options;\n return _this;\n }\n return HttpLink;\n}(ApolloLink));\nexport { HttpLink };\n//# sourceMappingURL=HttpLink.js.map","var _a = Object.prototype, toString = _a.toString, hasOwnProperty = _a.hasOwnProperty;\r\nvar fnToStr = Function.prototype.toString;\r\nvar previousComparisons = new Map();\r\n/**\r\n * Performs a deep equality check on two JavaScript values, tolerating cycles.\r\n */\r\nfunction equal(a, b) {\r\n try {\r\n return check(a, b);\r\n }\r\n finally {\r\n previousComparisons.clear();\r\n }\r\n}\r\nfunction check(a, b) {\r\n // If the two values are strictly equal, our job is easy.\r\n if (a === b) {\r\n return true;\r\n }\r\n // Object.prototype.toString returns a representation of the runtime type of\r\n // the given value that is considerably more precise than typeof.\r\n var aTag = toString.call(a);\r\n var bTag = toString.call(b);\r\n // If the runtime types of a and b are different, they could maybe be equal\r\n // under some interpretation of equality, but for simplicity and performance\r\n // we just return false instead.\r\n if (aTag !== bTag) {\r\n return false;\r\n }\r\n switch (aTag) {\r\n case '[object Array]':\r\n // Arrays are a lot like other objects, but we can cheaply compare their\r\n // lengths as a short-cut before comparing their elements.\r\n if (a.length !== b.length)\r\n return false;\r\n // Fall through to object case...\r\n case '[object Object]': {\r\n if (previouslyCompared(a, b))\r\n return true;\r\n var aKeys = definedKeys(a);\r\n var bKeys = definedKeys(b);\r\n // If `a` and `b` have a different number of enumerable keys, they\r\n // must be different.\r\n var keyCount = aKeys.length;\r\n if (keyCount !== bKeys.length)\r\n return false;\r\n // Now make sure they have the same keys.\r\n for (var k = 0; k < keyCount; ++k) {\r\n if (!hasOwnProperty.call(b, aKeys[k])) {\r\n return false;\r\n }\r\n }\r\n // Finally, check deep equality of all child properties.\r\n for (var k = 0; k < keyCount; ++k) {\r\n var key = aKeys[k];\r\n if (!check(a[key], b[key])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n case '[object Error]':\r\n return a.name === b.name && a.message === b.message;\r\n case '[object Number]':\r\n // Handle NaN, which is !== itself.\r\n if (a !== a)\r\n return b !== b;\r\n // Fall through to shared +a === +b case...\r\n case '[object Boolean]':\r\n case '[object Date]':\r\n return +a === +b;\r\n case '[object RegExp]':\r\n case '[object String]':\r\n return a == \"\" + b;\r\n case '[object Map]':\r\n case '[object Set]': {\r\n if (a.size !== b.size)\r\n return false;\r\n if (previouslyCompared(a, b))\r\n return true;\r\n var aIterator = a.entries();\r\n var isMap = aTag === '[object Map]';\r\n while (true) {\r\n var info = aIterator.next();\r\n if (info.done)\r\n break;\r\n // If a instanceof Set, aValue === aKey.\r\n var _a = info.value, aKey = _a[0], aValue = _a[1];\r\n // So this works the same way for both Set and Map.\r\n if (!b.has(aKey)) {\r\n return false;\r\n }\r\n // However, we care about deep equality of values only when dealing\r\n // with Map structures.\r\n if (isMap && !check(aValue, b.get(aKey))) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n case '[object Uint16Array]':\r\n case '[object Uint8Array]': // Buffer, in Node.js.\r\n case '[object Uint32Array]':\r\n case '[object Int32Array]':\r\n case '[object Int8Array]':\r\n case '[object Int16Array]':\r\n case '[object ArrayBuffer]':\r\n // DataView doesn't need these conversions, but the equality check is\r\n // otherwise the same.\r\n a = new Uint8Array(a);\r\n b = new Uint8Array(b);\r\n // Fall through...\r\n case '[object DataView]': {\r\n var len = a.byteLength;\r\n if (len === b.byteLength) {\r\n while (len-- && a[len] === b[len]) {\r\n // Keep looping as long as the bytes are equal.\r\n }\r\n }\r\n return len === -1;\r\n }\r\n case '[object AsyncFunction]':\r\n case '[object GeneratorFunction]':\r\n case '[object AsyncGeneratorFunction]':\r\n case '[object Function]': {\r\n var aCode = fnToStr.call(a);\r\n if (aCode !== fnToStr.call(b)) {\r\n return false;\r\n }\r\n // We consider non-native functions equal if they have the same code\r\n // (native functions require === because their code is censored).\r\n // Note that this behavior is not entirely sound, since !== function\r\n // objects with the same code can behave differently depending on\r\n // their closure scope. However, any function can behave differently\r\n // depending on the values of its input arguments (including this)\r\n // and its calling context (including its closure scope), even\r\n // though the function object is === to itself; and it is entirely\r\n // possible for functions that are not === to behave exactly the\r\n // same under all conceivable circumstances. Because none of these\r\n // factors are statically decidable in JavaScript, JS function\r\n // equality is not well-defined. This ambiguity allows us to\r\n // consider the best possible heuristic among various imperfect\r\n // options, and equating non-native functions that have the same\r\n // code has enormous practical benefits, such as when comparing\r\n // functions that are repeatedly passed as fresh function\r\n // expressions within objects that are otherwise deeply equal. Since\r\n // any function created from the same syntactic expression (in the\r\n // same code location) will always stringify to the same code\r\n // according to fnToStr.call, we can reasonably expect these\r\n // repeatedly passed function expressions to have the same code, and\r\n // thus behave \"the same\" (with all the caveats mentioned above),\r\n // even though the runtime function objects are !== to one another.\r\n return !endsWith(aCode, nativeCodeSuffix);\r\n }\r\n }\r\n // Otherwise the values are not equal.\r\n return false;\r\n}\r\nfunction definedKeys(obj) {\r\n // Remember that the second argument to Array.prototype.filter will be\r\n // used as `this` within the callback function.\r\n return Object.keys(obj).filter(isDefinedKey, obj);\r\n}\r\nfunction isDefinedKey(key) {\r\n return this[key] !== void 0;\r\n}\r\nvar nativeCodeSuffix = \"{ [native code] }\";\r\nfunction endsWith(full, suffix) {\r\n var fromIndex = full.length - suffix.length;\r\n return fromIndex >= 0 &&\r\n full.indexOf(suffix, fromIndex) === fromIndex;\r\n}\r\nfunction previouslyCompared(a, b) {\r\n // Though cyclic references can make an object graph appear infinite from the\r\n // perspective of a depth-first traversal, the graph still contains a finite\r\n // number of distinct object references. We use the previousComparisons cache\r\n // to avoid comparing the same pair of object references more than once, which\r\n // guarantees termination (even if we end up comparing every object in one\r\n // graph to every object in the other graph, which is extremely unlikely),\r\n // while still allowing weird isomorphic structures (like rings with different\r\n // lengths) a chance to pass the equality test.\r\n var bSet = previousComparisons.get(a);\r\n if (bSet) {\r\n // Return true here because we can be sure false will be returned somewhere\r\n // else if the objects are not equivalent.\r\n if (bSet.has(b))\r\n return true;\r\n }\r\n else {\r\n previousComparisons.set(a, bSet = new Set);\r\n }\r\n bSet.add(b);\r\n return false;\r\n}\n\nexport { equal as default, equal };\n//# sourceMappingURL=equality.esm.js.map\n","// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds\r\n// object keys weakly, yet can also hold non-object keys, unlike the\r\n// native `WeakMap`.\r\n// If no makeData function is supplied, the looked-up data will be an empty,\r\n// null-prototype Object.\r\nvar defaultMakeData = function () { return Object.create(null); };\r\n// Useful for processing arguments objects as well as arrays.\r\nvar _a = Array.prototype, forEach = _a.forEach, slice = _a.slice;\r\nvar Trie = /** @class */ (function () {\r\n function Trie(weakness, makeData) {\r\n if (weakness === void 0) { weakness = true; }\r\n if (makeData === void 0) { makeData = defaultMakeData; }\r\n this.weakness = weakness;\r\n this.makeData = makeData;\r\n }\r\n Trie.prototype.lookup = function () {\r\n var array = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n array[_i] = arguments[_i];\r\n }\r\n return this.lookupArray(array);\r\n };\r\n Trie.prototype.lookupArray = function (array) {\r\n var node = this;\r\n forEach.call(array, function (key) { return node = node.getChildTrie(key); });\r\n return node.data || (node.data = this.makeData(slice.call(array)));\r\n };\r\n Trie.prototype.getChildTrie = function (key) {\r\n var map = this.weakness && isObjRef(key)\r\n ? this.weak || (this.weak = new WeakMap())\r\n : this.strong || (this.strong = new Map());\r\n var child = map.get(key);\r\n if (!child)\r\n map.set(key, child = new Trie(this.weakness, this.makeData));\r\n return child;\r\n };\r\n return Trie;\r\n}());\r\nfunction isObjRef(value) {\r\n switch (typeof value) {\r\n case \"object\":\r\n if (value === null)\r\n break;\r\n // Fall through to return true...\r\n case \"function\":\r\n return true;\r\n }\r\n return false;\r\n}\n\nexport { Trie };\n//# sourceMappingURL=trie.esm.js.map\n","// This currentContext variable will only be used if the makeSlotClass\r\n// function is called, which happens only if this is the first copy of the\r\n// @wry/context package to be imported.\r\nvar currentContext = null;\r\n// This unique internal object is used to denote the absence of a value\r\n// for a given Slot, and is never exposed to outside code.\r\nvar MISSING_VALUE = {};\r\nvar idCounter = 1;\r\n// Although we can't do anything about the cost of duplicated code from\r\n// accidentally bundling multiple copies of the @wry/context package, we can\r\n// avoid creating the Slot class more than once using makeSlotClass.\r\nvar makeSlotClass = function () { return /** @class */ (function () {\r\n function Slot() {\r\n // If you have a Slot object, you can find out its slot.id, but you cannot\r\n // guess the slot.id of a Slot you don't have access to, thanks to the\r\n // randomized suffix.\r\n this.id = [\r\n \"slot\",\r\n idCounter++,\r\n Date.now(),\r\n Math.random().toString(36).slice(2),\r\n ].join(\":\");\r\n }\r\n Slot.prototype.hasValue = function () {\r\n for (var context_1 = currentContext; context_1; context_1 = context_1.parent) {\r\n // We use the Slot object iself as a key to its value, which means the\r\n // value cannot be obtained without a reference to the Slot object.\r\n if (this.id in context_1.slots) {\r\n var value = context_1.slots[this.id];\r\n if (value === MISSING_VALUE)\r\n break;\r\n if (context_1 !== currentContext) {\r\n // Cache the value in currentContext.slots so the next lookup will\r\n // be faster. This caching is safe because the tree of contexts and\r\n // the values of the slots are logically immutable.\r\n currentContext.slots[this.id] = value;\r\n }\r\n return true;\r\n }\r\n }\r\n if (currentContext) {\r\n // If a value was not found for this Slot, it's never going to be found\r\n // no matter how many times we look it up, so we might as well cache\r\n // the absence of the value, too.\r\n currentContext.slots[this.id] = MISSING_VALUE;\r\n }\r\n return false;\r\n };\r\n Slot.prototype.getValue = function () {\r\n if (this.hasValue()) {\r\n return currentContext.slots[this.id];\r\n }\r\n };\r\n Slot.prototype.withValue = function (value, callback, \r\n // Given the prevalence of arrow functions, specifying arguments is likely\r\n // to be much more common than specifying `this`, hence this ordering:\r\n args, thisArg) {\r\n var _a;\r\n var slots = (_a = {\r\n __proto__: null\r\n },\r\n _a[this.id] = value,\r\n _a);\r\n var parent = currentContext;\r\n currentContext = { parent: parent, slots: slots };\r\n try {\r\n // Function.prototype.apply allows the arguments array argument to be\r\n // omitted or undefined, so args! is fine here.\r\n return callback.apply(thisArg, args);\r\n }\r\n finally {\r\n currentContext = parent;\r\n }\r\n };\r\n // Capture the current context and wrap a callback function so that it\r\n // reestablishes the captured context when called.\r\n Slot.bind = function (callback) {\r\n var context = currentContext;\r\n return function () {\r\n var saved = currentContext;\r\n try {\r\n currentContext = context;\r\n return callback.apply(this, arguments);\r\n }\r\n finally {\r\n currentContext = saved;\r\n }\r\n };\r\n };\r\n // Immediately run a callback function without any captured context.\r\n Slot.noContext = function (callback, \r\n // Given the prevalence of arrow functions, specifying arguments is likely\r\n // to be much more common than specifying `this`, hence this ordering:\r\n args, thisArg) {\r\n if (currentContext) {\r\n var saved = currentContext;\r\n try {\r\n currentContext = null;\r\n // Function.prototype.apply allows the arguments array argument to be\r\n // omitted or undefined, so args! is fine here.\r\n return callback.apply(thisArg, args);\r\n }\r\n finally {\r\n currentContext = saved;\r\n }\r\n }\r\n else {\r\n return callback.apply(thisArg, args);\r\n }\r\n };\r\n return Slot;\r\n}()); };\r\n// We store a single global implementation of the Slot class as a permanent\r\n// non-enumerable symbol property of the Array constructor. This obfuscation\r\n// does nothing to prevent access to the Slot class, but at least it ensures\r\n// the implementation (i.e. currentContext) cannot be tampered with, and all\r\n// copies of the @wry/context package (hopefully just one) will share the\r\n// same Slot implementation. Since the first copy of the @wry/context package\r\n// to be imported wins, this technique imposes a very high cost for any\r\n// future breaking changes to the Slot class.\r\nvar globalKey = \"@wry/context:Slot\";\r\nvar host = Array;\r\nvar Slot = host[globalKey] || function () {\r\n var Slot = makeSlotClass();\r\n try {\r\n Object.defineProperty(host, globalKey, {\r\n value: host[globalKey] = Slot,\r\n enumerable: false,\r\n writable: false,\r\n configurable: false,\r\n });\r\n }\r\n finally {\r\n return Slot;\r\n }\r\n}();\n\nvar bind = Slot.bind, noContext = Slot.noContext;\r\nfunction setTimeoutWithContext(callback, delay) {\r\n return setTimeout(bind(callback), delay);\r\n}\r\n// Turn any generator function into an async function (using yield instead\r\n// of await), with context automatically preserved across yields.\r\nfunction asyncFromGen(genFn) {\r\n return function () {\r\n var gen = genFn.apply(this, arguments);\r\n var boundNext = bind(gen.next);\r\n var boundThrow = bind(gen.throw);\r\n return new Promise(function (resolve, reject) {\r\n function invoke(method, argument) {\r\n try {\r\n var result = method.call(gen, argument);\r\n }\r\n catch (error) {\r\n return reject(error);\r\n }\r\n var next = result.done ? resolve : invokeNext;\r\n if (isPromiseLike(result.value)) {\r\n result.value.then(next, result.done ? reject : invokeThrow);\r\n }\r\n else {\r\n next(result.value);\r\n }\r\n }\r\n var invokeNext = function (value) { return invoke(boundNext, value); };\r\n var invokeThrow = function (error) { return invoke(boundThrow, error); };\r\n invokeNext();\r\n });\r\n };\r\n}\r\nfunction isPromiseLike(value) {\r\n return value && typeof value.then === \"function\";\r\n}\r\n// If you use the fibers npm package to implement coroutines in Node.js,\r\n// you should call this function at least once to ensure context management\r\n// remains coherent across any yields.\r\nvar wrappedFibers = [];\r\nfunction wrapYieldingFiberMethods(Fiber) {\r\n // There can be only one implementation of Fiber per process, so this array\r\n // should never grow longer than one element.\r\n if (wrappedFibers.indexOf(Fiber) < 0) {\r\n var wrap = function (obj, method) {\r\n var fn = obj[method];\r\n obj[method] = function () {\r\n return noContext(fn, arguments, this);\r\n };\r\n };\r\n // These methods can yield, according to\r\n // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100\r\n wrap(Fiber, \"yield\");\r\n wrap(Fiber.prototype, \"run\");\r\n wrap(Fiber.prototype, \"throwInto\");\r\n wrappedFibers.push(Fiber);\r\n }\r\n return Fiber;\r\n}\n\nexport { Slot, asyncFromGen, bind, noContext, setTimeoutWithContext as setTimeout, wrapYieldingFiberMethods };\n//# sourceMappingURL=context.esm.js.map\n","import { Trie } from '@wry/trie';\nexport { Trie as KeyTrie } from '@wry/trie';\nimport { Slot } from '@wry/context';\nexport { asyncFromGen, bind as bindContext, noContext, setTimeout } from '@wry/context';\n\nfunction defaultDispose() { }\r\nvar Cache = /** @class */ (function () {\r\n function Cache(max, dispose) {\r\n if (max === void 0) { max = Infinity; }\r\n if (dispose === void 0) { dispose = defaultDispose; }\r\n this.max = max;\r\n this.dispose = dispose;\r\n this.map = new Map();\r\n this.newest = null;\r\n this.oldest = null;\r\n }\r\n Cache.prototype.has = function (key) {\r\n return this.map.has(key);\r\n };\r\n Cache.prototype.get = function (key) {\r\n var node = this.getNode(key);\r\n return node && node.value;\r\n };\r\n Cache.prototype.getNode = function (key) {\r\n var node = this.map.get(key);\r\n if (node && node !== this.newest) {\r\n var older = node.older, newer = node.newer;\r\n if (newer) {\r\n newer.older = older;\r\n }\r\n if (older) {\r\n older.newer = newer;\r\n }\r\n node.older = this.newest;\r\n node.older.newer = node;\r\n node.newer = null;\r\n this.newest = node;\r\n if (node === this.oldest) {\r\n this.oldest = newer;\r\n }\r\n }\r\n return node;\r\n };\r\n Cache.prototype.set = function (key, value) {\r\n var node = this.getNode(key);\r\n if (node) {\r\n return node.value = value;\r\n }\r\n node = {\r\n key: key,\r\n value: value,\r\n newer: null,\r\n older: this.newest\r\n };\r\n if (this.newest) {\r\n this.newest.newer = node;\r\n }\r\n this.newest = node;\r\n this.oldest = this.oldest || node;\r\n this.map.set(key, node);\r\n return node.value;\r\n };\r\n Cache.prototype.clean = function () {\r\n while (this.oldest && this.map.size > this.max) {\r\n this.delete(this.oldest.key);\r\n }\r\n };\r\n Cache.prototype.delete = function (key) {\r\n var node = this.map.get(key);\r\n if (node) {\r\n if (node === this.newest) {\r\n this.newest = node.older;\r\n }\r\n if (node === this.oldest) {\r\n this.oldest = node.newer;\r\n }\r\n if (node.newer) {\r\n node.newer.older = node.older;\r\n }\r\n if (node.older) {\r\n node.older.newer = node.newer;\r\n }\r\n this.map.delete(key);\r\n this.dispose(node.value, key);\r\n return true;\r\n }\r\n return false;\r\n };\r\n return Cache;\r\n}());\n\nvar parentEntrySlot = new Slot();\n\nvar _a;\r\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\r\nvar \r\n// This Array.from polyfill is restricted to working with Set for now,\r\n// but we can improve the polyfill and add other input types, as needed. Note\r\n// that this fallback implementation will only be used if the host environment\r\n// does not support a native Array.from function. In most modern JS runtimes,\r\n// the toArray function exported here will be === Array.from.\r\ntoArray = (_a = Array.from, _a === void 0 ? function (collection) {\r\n var array = [];\r\n collection.forEach(function (item) { return array.push(item); });\r\n return array;\r\n} : _a);\r\nfunction maybeUnsubscribe(entryOrDep) {\r\n var unsubscribe = entryOrDep.unsubscribe;\r\n if (typeof unsubscribe === \"function\") {\r\n entryOrDep.unsubscribe = void 0;\r\n unsubscribe();\r\n }\r\n}\n\nvar emptySetPool = [];\r\nvar POOL_TARGET_SIZE = 100;\r\n// Since this package might be used browsers, we should avoid using the\r\n// Node built-in assert module.\r\nfunction assert(condition, optionalMessage) {\r\n if (!condition) {\r\n throw new Error(optionalMessage || \"assertion failure\");\r\n }\r\n}\r\nfunction valueIs(a, b) {\r\n var len = a.length;\r\n return (\r\n // Unknown values are not equal to each other.\r\n len > 0 &&\r\n // Both values must be ordinary (or both exceptional) to be equal.\r\n len === b.length &&\r\n // The underlying value or exception must be the same.\r\n a[len - 1] === b[len - 1]);\r\n}\r\nfunction valueGet(value) {\r\n switch (value.length) {\r\n case 0: throw new Error(\"unknown value\");\r\n case 1: return value[0];\r\n case 2: throw value[1];\r\n }\r\n}\r\nfunction valueCopy(value) {\r\n return value.slice(0);\r\n}\r\nvar Entry = /** @class */ (function () {\r\n function Entry(fn) {\r\n this.fn = fn;\r\n this.parents = new Set();\r\n this.childValues = new Map();\r\n // When this Entry has children that are dirty, this property becomes\r\n // a Set containing other Entry objects, borrowed from emptySetPool.\r\n // When the set becomes empty, it gets recycled back to emptySetPool.\r\n this.dirtyChildren = null;\r\n this.dirty = true;\r\n this.recomputing = false;\r\n this.value = [];\r\n this.deps = null;\r\n ++Entry.count;\r\n }\r\n Entry.prototype.peek = function () {\r\n if (this.value.length === 1 && !mightBeDirty(this)) {\r\n rememberParent(this);\r\n return this.value[0];\r\n }\r\n };\r\n // This is the most important method of the Entry API, because it\r\n // determines whether the cached this.value can be returned immediately,\r\n // or must be recomputed. The overall performance of the caching system\r\n // depends on the truth of the following observations: (1) this.dirty is\r\n // usually false, (2) this.dirtyChildren is usually null/empty, and thus\r\n // (3) valueGet(this.value) is usually returned without recomputation.\r\n Entry.prototype.recompute = function (args) {\r\n assert(!this.recomputing, \"already recomputing\");\r\n rememberParent(this);\r\n return mightBeDirty(this)\r\n ? reallyRecompute(this, args)\r\n : valueGet(this.value);\r\n };\r\n Entry.prototype.setDirty = function () {\r\n if (this.dirty)\r\n return;\r\n this.dirty = true;\r\n this.value.length = 0;\r\n reportDirty(this);\r\n // We can go ahead and unsubscribe here, since any further dirty\r\n // notifications we receive will be redundant, and unsubscribing may\r\n // free up some resources, e.g. file watchers.\r\n maybeUnsubscribe(this);\r\n };\r\n Entry.prototype.dispose = function () {\r\n var _this = this;\r\n this.setDirty();\r\n // Sever any dependency relationships with our own children, so those\r\n // children don't retain this parent Entry in their child.parents sets,\r\n // thereby preventing it from being fully garbage collected.\r\n forgetChildren(this);\r\n // Because this entry has been kicked out of the cache (in index.js),\r\n // we've lost the ability to find out if/when this entry becomes dirty,\r\n // whether that happens through a subscription, because of a direct call\r\n // to entry.setDirty(), or because one of its children becomes dirty.\r\n // Because of this loss of future information, we have to assume the\r\n // worst (that this entry might have become dirty very soon), so we must\r\n // immediately mark this entry's parents as dirty. Normally we could\r\n // just call entry.setDirty() rather than calling parent.setDirty() for\r\n // each parent, but that would leave this entry in parent.childValues\r\n // and parent.dirtyChildren, which would prevent the child from being\r\n // truly forgotten.\r\n eachParent(this, function (parent, child) {\r\n parent.setDirty();\r\n forgetChild(parent, _this);\r\n });\r\n };\r\n Entry.prototype.forget = function () {\r\n // The code that creates Entry objects in index.ts will replace this method\r\n // with one that actually removes the Entry from the cache, which will also\r\n // trigger the entry.dispose method.\r\n this.dispose();\r\n };\r\n Entry.prototype.dependOn = function (dep) {\r\n dep.add(this);\r\n if (!this.deps) {\r\n this.deps = emptySetPool.pop() || new Set();\r\n }\r\n this.deps.add(dep);\r\n };\r\n Entry.prototype.forgetDeps = function () {\r\n var _this = this;\r\n if (this.deps) {\r\n toArray(this.deps).forEach(function (dep) { return dep.delete(_this); });\r\n this.deps.clear();\r\n emptySetPool.push(this.deps);\r\n this.deps = null;\r\n }\r\n };\r\n Entry.count = 0;\r\n return Entry;\r\n}());\r\nfunction rememberParent(child) {\r\n var parent = parentEntrySlot.getValue();\r\n if (parent) {\r\n child.parents.add(parent);\r\n if (!parent.childValues.has(child)) {\r\n parent.childValues.set(child, []);\r\n }\r\n if (mightBeDirty(child)) {\r\n reportDirtyChild(parent, child);\r\n }\r\n else {\r\n reportCleanChild(parent, child);\r\n }\r\n return parent;\r\n }\r\n}\r\nfunction reallyRecompute(entry, args) {\r\n forgetChildren(entry);\r\n // Set entry as the parent entry while calling recomputeNewValue(entry).\r\n parentEntrySlot.withValue(entry, recomputeNewValue, [entry, args]);\r\n if (maybeSubscribe(entry, args)) {\r\n // If we successfully recomputed entry.value and did not fail to\r\n // (re)subscribe, then this Entry is no longer explicitly dirty.\r\n setClean(entry);\r\n }\r\n return valueGet(entry.value);\r\n}\r\nfunction recomputeNewValue(entry, args) {\r\n entry.recomputing = true;\r\n // Set entry.value as unknown.\r\n entry.value.length = 0;\r\n try {\r\n // If entry.fn succeeds, entry.value will become a normal Value.\r\n entry.value[0] = entry.fn.apply(null, args);\r\n }\r\n catch (e) {\r\n // If entry.fn throws, entry.value will become exceptional.\r\n entry.value[1] = e;\r\n }\r\n // Either way, this line is always reached.\r\n entry.recomputing = false;\r\n}\r\nfunction mightBeDirty(entry) {\r\n return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size);\r\n}\r\nfunction setClean(entry) {\r\n entry.dirty = false;\r\n if (mightBeDirty(entry)) {\r\n // This Entry may still have dirty children, in which case we can't\r\n // let our parents know we're clean just yet.\r\n return;\r\n }\r\n reportClean(entry);\r\n}\r\nfunction reportDirty(child) {\r\n eachParent(child, reportDirtyChild);\r\n}\r\nfunction reportClean(child) {\r\n eachParent(child, reportCleanChild);\r\n}\r\nfunction eachParent(child, callback) {\r\n var parentCount = child.parents.size;\r\n if (parentCount) {\r\n var parents = toArray(child.parents);\r\n for (var i = 0; i < parentCount; ++i) {\r\n callback(parents[i], child);\r\n }\r\n }\r\n}\r\n// Let a parent Entry know that one of its children may be dirty.\r\nfunction reportDirtyChild(parent, child) {\r\n // Must have called rememberParent(child) before calling\r\n // reportDirtyChild(parent, child).\r\n assert(parent.childValues.has(child));\r\n assert(mightBeDirty(child));\r\n var parentWasClean = !mightBeDirty(parent);\r\n if (!parent.dirtyChildren) {\r\n parent.dirtyChildren = emptySetPool.pop() || new Set;\r\n }\r\n else if (parent.dirtyChildren.has(child)) {\r\n // If we already know this child is dirty, then we must have already\r\n // informed our own parents that we are dirty, so we can terminate\r\n // the recursion early.\r\n return;\r\n }\r\n parent.dirtyChildren.add(child);\r\n // If parent was clean before, it just became (possibly) dirty (according to\r\n // mightBeDirty), since we just added child to parent.dirtyChildren.\r\n if (parentWasClean) {\r\n reportDirty(parent);\r\n }\r\n}\r\n// Let a parent Entry know that one of its children is no longer dirty.\r\nfunction reportCleanChild(parent, child) {\r\n // Must have called rememberChild(child) before calling\r\n // reportCleanChild(parent, child).\r\n assert(parent.childValues.has(child));\r\n assert(!mightBeDirty(child));\r\n var childValue = parent.childValues.get(child);\r\n if (childValue.length === 0) {\r\n parent.childValues.set(child, valueCopy(child.value));\r\n }\r\n else if (!valueIs(childValue, child.value)) {\r\n parent.setDirty();\r\n }\r\n removeDirtyChild(parent, child);\r\n if (mightBeDirty(parent)) {\r\n return;\r\n }\r\n reportClean(parent);\r\n}\r\nfunction removeDirtyChild(parent, child) {\r\n var dc = parent.dirtyChildren;\r\n if (dc) {\r\n dc.delete(child);\r\n if (dc.size === 0) {\r\n if (emptySetPool.length < POOL_TARGET_SIZE) {\r\n emptySetPool.push(dc);\r\n }\r\n parent.dirtyChildren = null;\r\n }\r\n }\r\n}\r\n// Removes all children from this entry and returns an array of the\r\n// removed children.\r\nfunction forgetChildren(parent) {\r\n if (parent.childValues.size > 0) {\r\n parent.childValues.forEach(function (_value, child) {\r\n forgetChild(parent, child);\r\n });\r\n }\r\n // Remove this parent Entry from any sets to which it was added by the\r\n // addToSet method.\r\n parent.forgetDeps();\r\n // After we forget all our children, this.dirtyChildren must be empty\r\n // and therefore must have been reset to null.\r\n assert(parent.dirtyChildren === null);\r\n}\r\nfunction forgetChild(parent, child) {\r\n child.parents.delete(parent);\r\n parent.childValues.delete(child);\r\n removeDirtyChild(parent, child);\r\n}\r\nfunction maybeSubscribe(entry, args) {\r\n if (typeof entry.subscribe === \"function\") {\r\n try {\r\n maybeUnsubscribe(entry); // Prevent double subscriptions.\r\n entry.unsubscribe = entry.subscribe.apply(null, args);\r\n }\r\n catch (e) {\r\n // If this Entry has a subscribe function and it threw an exception\r\n // (or an unsubscribe function it previously returned now throws),\r\n // return false to indicate that we were not able to subscribe (or\r\n // unsubscribe), and this Entry should remain dirty.\r\n entry.setDirty();\r\n return false;\r\n }\r\n }\r\n // Returning true indicates either that there was no entry.subscribe\r\n // function or that it succeeded.\r\n return true;\r\n}\n\nvar EntryMethods = {\r\n setDirty: true,\r\n dispose: true,\r\n forget: true,\r\n};\r\nfunction dep(options) {\r\n var depsByKey = new Map();\r\n var subscribe = options && options.subscribe;\r\n function depend(key) {\r\n var parent = parentEntrySlot.getValue();\r\n if (parent) {\r\n var dep_1 = depsByKey.get(key);\r\n if (!dep_1) {\r\n depsByKey.set(key, dep_1 = new Set);\r\n }\r\n parent.dependOn(dep_1);\r\n if (typeof subscribe === \"function\") {\r\n maybeUnsubscribe(dep_1);\r\n dep_1.unsubscribe = subscribe(key);\r\n }\r\n }\r\n }\r\n depend.dirty = function dirty(key, entryMethodName) {\r\n var dep = depsByKey.get(key);\r\n if (dep) {\r\n var m_1 = (entryMethodName &&\r\n hasOwnProperty.call(EntryMethods, entryMethodName)) ? entryMethodName : \"setDirty\";\r\n // We have to use toArray(dep).forEach instead of dep.forEach, because\r\n // modifying a Set while iterating over it can cause elements in the Set\r\n // to be removed from the Set before they've been iterated over.\r\n toArray(dep).forEach(function (entry) { return entry[m_1](); });\r\n depsByKey.delete(key);\r\n maybeUnsubscribe(dep);\r\n }\r\n };\r\n return depend;\r\n}\n\nfunction makeDefaultMakeCacheKeyFunction() {\r\n var keyTrie = new Trie(typeof WeakMap === \"function\");\r\n return function () {\r\n return keyTrie.lookupArray(arguments);\r\n };\r\n}\r\n// The defaultMakeCacheKey function is remarkably powerful, because it gives\r\n// a unique object for any shallow-identical list of arguments. If you need\r\n// to implement a custom makeCacheKey function, you may find it helpful to\r\n// delegate the final work to defaultMakeCacheKey, which is why we export it\r\n// here. However, you may want to avoid defaultMakeCacheKey if your runtime\r\n// does not support WeakMap, or you have the ability to return a string key.\r\n// In those cases, just write your own custom makeCacheKey functions.\r\nvar defaultMakeCacheKey = makeDefaultMakeCacheKeyFunction();\r\nvar caches = new Set();\r\nfunction wrap(originalFunction, options) {\r\n if (options === void 0) { options = Object.create(null); }\r\n var cache = new Cache(options.max || Math.pow(2, 16), function (entry) { return entry.dispose(); });\r\n var keyArgs = options.keyArgs;\r\n var makeCacheKey = options.makeCacheKey ||\r\n makeDefaultMakeCacheKeyFunction();\r\n var optimistic = function () {\r\n var key = makeCacheKey.apply(null, keyArgs ? keyArgs.apply(null, arguments) : arguments);\r\n if (key === void 0) {\r\n return originalFunction.apply(null, arguments);\r\n }\r\n var entry = cache.get(key);\r\n if (!entry) {\r\n cache.set(key, entry = new Entry(originalFunction));\r\n entry.subscribe = options.subscribe;\r\n // Give the Entry the ability to trigger cache.delete(key), even though\r\n // the Entry itself does not know about key or cache.\r\n entry.forget = function () { return cache.delete(key); };\r\n }\r\n var value = entry.recompute(Array.prototype.slice.call(arguments));\r\n // Move this entry to the front of the least-recently used queue,\r\n // since we just finished computing its value.\r\n cache.set(key, entry);\r\n caches.add(cache);\r\n // Clean up any excess entries in the cache, but only if there is no\r\n // active parent entry, meaning we're not in the middle of a larger\r\n // computation that might be flummoxed by the cleaning.\r\n if (!parentEntrySlot.hasValue()) {\r\n caches.forEach(function (cache) { return cache.clean(); });\r\n caches.clear();\r\n }\r\n return value;\r\n };\r\n Object.defineProperty(optimistic, \"size\", {\r\n get: function () {\r\n return cache[\"map\"].size;\r\n },\r\n configurable: false,\r\n enumerable: false,\r\n });\r\n function dirtyKey(key) {\r\n var entry = cache.get(key);\r\n if (entry) {\r\n entry.setDirty();\r\n }\r\n }\r\n optimistic.dirtyKey = dirtyKey;\r\n optimistic.dirty = function dirty() {\r\n dirtyKey(makeCacheKey.apply(null, arguments));\r\n };\r\n function peekKey(key) {\r\n var entry = cache.get(key);\r\n if (entry) {\r\n return entry.peek();\r\n }\r\n }\r\n optimistic.peekKey = peekKey;\r\n optimistic.peek = function peek() {\r\n return peekKey(makeCacheKey.apply(null, arguments));\r\n };\r\n function forgetKey(key) {\r\n return cache.delete(key);\r\n }\r\n optimistic.forgetKey = forgetKey;\r\n optimistic.forget = function forget() {\r\n return forgetKey(makeCacheKey.apply(null, arguments));\r\n };\r\n optimistic.makeCacheKey = makeCacheKey;\r\n optimistic.getKey = keyArgs ? function getKey() {\r\n return makeCacheKey.apply(null, keyArgs.apply(null, arguments));\r\n } : makeCacheKey;\r\n return Object.freeze(optimistic);\r\n}\n\nexport { defaultMakeCacheKey, dep, wrap };\n//# sourceMappingURL=bundle.esm.js.map\n","import { __assign, __rest } from \"tslib\";\nimport { wrap } from 'optimism';\nimport { getFragmentQueryDocument, } from \"../../utilities/index.js\";\nvar ApolloCache = (function () {\n function ApolloCache() {\n this.getFragmentDoc = wrap(getFragmentQueryDocument);\n }\n ApolloCache.prototype.batch = function (options) {\n var _this = this;\n var optimisticId = typeof options.optimistic === \"string\" ? options.optimistic :\n options.optimistic === false ? null : void 0;\n var updateResult;\n this.performTransaction(function () { return updateResult = options.update(_this); }, optimisticId);\n return updateResult;\n };\n ApolloCache.prototype.recordOptimisticTransaction = function (transaction, optimisticId) {\n this.performTransaction(transaction, optimisticId);\n };\n ApolloCache.prototype.transformDocument = function (document) {\n return document;\n };\n ApolloCache.prototype.identify = function (object) {\n return;\n };\n ApolloCache.prototype.gc = function () {\n return [];\n };\n ApolloCache.prototype.modify = function (options) {\n return false;\n };\n ApolloCache.prototype.transformForLink = function (document) {\n return document;\n };\n ApolloCache.prototype.readQuery = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = !!options.optimistic; }\n return this.read(__assign(__assign({}, options), { rootId: options.id || 'ROOT_QUERY', optimistic: optimistic }));\n };\n ApolloCache.prototype.readFragment = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = !!options.optimistic; }\n return this.read(__assign(__assign({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic }));\n };\n ApolloCache.prototype.writeQuery = function (_a) {\n var id = _a.id, data = _a.data, options = __rest(_a, [\"id\", \"data\"]);\n return this.write(Object.assign(options, {\n dataId: id || 'ROOT_QUERY',\n result: data,\n }));\n };\n ApolloCache.prototype.writeFragment = function (_a) {\n var id = _a.id, data = _a.data, fragment = _a.fragment, fragmentName = _a.fragmentName, options = __rest(_a, [\"id\", \"data\", \"fragment\", \"fragmentName\"]);\n return this.write(Object.assign(options, {\n query: this.getFragmentDoc(fragment, fragmentName),\n dataId: id,\n result: data,\n }));\n };\n ApolloCache.prototype.updateQuery = function (options, update) {\n return this.batch({\n update: function (cache) {\n var value = cache.readQuery(options);\n var data = update(value);\n if (data === void 0 || data === null)\n return value;\n cache.writeQuery(__assign(__assign({}, options), { data: data }));\n return data;\n },\n });\n };\n ApolloCache.prototype.updateFragment = function (options, update) {\n return this.batch({\n update: function (cache) {\n var value = cache.readFragment(options);\n var data = update(value);\n if (data === void 0 || data === null)\n return value;\n cache.writeFragment(__assign(__assign({}, options), { data: data }));\n return data;\n },\n });\n };\n return ApolloCache;\n}());\nexport { ApolloCache };\n//# sourceMappingURL=cache.js.map","export var Cache;\n(function (Cache) {\n})(Cache || (Cache = {}));\n//# sourceMappingURL=Cache.js.map","var MissingFieldError = (function () {\n function MissingFieldError(message, path, query, variables) {\n this.message = message;\n this.path = path;\n this.query = query;\n this.variables = variables;\n }\n return MissingFieldError;\n}());\nexport { MissingFieldError };\n//# sourceMappingURL=common.js.map","import { isReference, isField, DeepMerger, resultKeyNameFromField, shouldInclude, isNonNullObject, compact, } from \"../../utilities/index.js\";\nexport var hasOwn = Object.prototype.hasOwnProperty;\nexport function defaultDataIdFromObject(_a, context) {\n var __typename = _a.__typename, id = _a.id, _id = _a._id;\n if (typeof __typename === \"string\") {\n if (context) {\n context.keyObject =\n id !== void 0 ? { id: id } :\n _id !== void 0 ? { _id: _id } :\n void 0;\n }\n if (id === void 0)\n id = _id;\n if (id !== void 0) {\n return \"\".concat(__typename, \":\").concat((typeof id === \"number\" ||\n typeof id === \"string\") ? id : JSON.stringify(id));\n }\n }\n}\nvar defaultConfig = {\n dataIdFromObject: defaultDataIdFromObject,\n addTypename: true,\n resultCaching: true,\n canonizeResults: false,\n};\nexport function normalizeConfig(config) {\n return compact(defaultConfig, config);\n}\nexport function shouldCanonizeResults(config) {\n var value = config.canonizeResults;\n return value === void 0 ? defaultConfig.canonizeResults : value;\n}\nexport function getTypenameFromStoreObject(store, objectOrReference) {\n return isReference(objectOrReference)\n ? store.get(objectOrReference.__ref, \"__typename\")\n : objectOrReference && objectOrReference.__typename;\n}\nexport var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;\nexport function fieldNameFromStoreName(storeFieldName) {\n var match = storeFieldName.match(TypeOrFieldNameRegExp);\n return match ? match[0] : storeFieldName;\n}\nexport function selectionSetMatchesResult(selectionSet, result, variables) {\n if (isNonNullObject(result)) {\n return Array.isArray(result)\n ? result.every(function (item) { return selectionSetMatchesResult(selectionSet, item, variables); })\n : selectionSet.selections.every(function (field) {\n if (isField(field) && shouldInclude(field, variables)) {\n var key = resultKeyNameFromField(field);\n return hasOwn.call(result, key) &&\n (!field.selectionSet ||\n selectionSetMatchesResult(field.selectionSet, result[key], variables));\n }\n return true;\n });\n }\n return false;\n}\nexport function storeValueIsStoreObject(value) {\n return isNonNullObject(value) &&\n !isReference(value) &&\n !Array.isArray(value);\n}\nexport function makeProcessedFieldsMerger() {\n return new DeepMerger;\n}\n//# sourceMappingURL=helpers.js.map","import { __assign, __extends, __rest } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport { dep } from 'optimism';\nimport { equal } from '@wry/equality';\nimport { Trie } from '@wry/trie';\nimport { isReference, makeReference, DeepMerger, maybeDeepFreeze, canUseWeakMap, isNonNullObject, } from \"../../utilities/index.js\";\nimport { hasOwn, fieldNameFromStoreName } from \"./helpers.js\";\nvar DELETE = Object.create(null);\nvar delModifier = function () { return DELETE; };\nvar INVALIDATE = Object.create(null);\nvar EntityStore = (function () {\n function EntityStore(policies, group) {\n var _this = this;\n this.policies = policies;\n this.group = group;\n this.data = Object.create(null);\n this.rootIds = Object.create(null);\n this.refs = Object.create(null);\n this.getFieldValue = function (objectOrReference, storeFieldName) { return maybeDeepFreeze(isReference(objectOrReference)\n ? _this.get(objectOrReference.__ref, storeFieldName)\n : objectOrReference && objectOrReference[storeFieldName]); };\n this.canRead = function (objOrRef) {\n return isReference(objOrRef)\n ? _this.has(objOrRef.__ref)\n : typeof objOrRef === \"object\";\n };\n this.toReference = function (objOrIdOrRef, mergeIntoStore) {\n if (typeof objOrIdOrRef === \"string\") {\n return makeReference(objOrIdOrRef);\n }\n if (isReference(objOrIdOrRef)) {\n return objOrIdOrRef;\n }\n var id = _this.policies.identify(objOrIdOrRef)[0];\n if (id) {\n var ref = makeReference(id);\n if (mergeIntoStore) {\n _this.merge(id, objOrIdOrRef);\n }\n return ref;\n }\n };\n }\n EntityStore.prototype.toObject = function () {\n return __assign({}, this.data);\n };\n EntityStore.prototype.has = function (dataId) {\n return this.lookup(dataId, true) !== void 0;\n };\n EntityStore.prototype.get = function (dataId, fieldName) {\n this.group.depend(dataId, fieldName);\n if (hasOwn.call(this.data, dataId)) {\n var storeObject = this.data[dataId];\n if (storeObject && hasOwn.call(storeObject, fieldName)) {\n return storeObject[fieldName];\n }\n }\n if (fieldName === \"__typename\" &&\n hasOwn.call(this.policies.rootTypenamesById, dataId)) {\n return this.policies.rootTypenamesById[dataId];\n }\n if (this instanceof Layer) {\n return this.parent.get(dataId, fieldName);\n }\n };\n EntityStore.prototype.lookup = function (dataId, dependOnExistence) {\n if (dependOnExistence)\n this.group.depend(dataId, \"__exists\");\n if (hasOwn.call(this.data, dataId)) {\n return this.data[dataId];\n }\n if (this instanceof Layer) {\n return this.parent.lookup(dataId, dependOnExistence);\n }\n if (this.policies.rootTypenamesById[dataId]) {\n return Object.create(null);\n }\n };\n EntityStore.prototype.merge = function (older, newer) {\n var _this = this;\n var dataId;\n if (isReference(older))\n older = older.__ref;\n if (isReference(newer))\n newer = newer.__ref;\n var existing = typeof older === \"string\"\n ? this.lookup(dataId = older)\n : older;\n var incoming = typeof newer === \"string\"\n ? this.lookup(dataId = newer)\n : newer;\n if (!incoming)\n return;\n __DEV__ ? invariant(typeof dataId === \"string\", \"store.merge expects a string ID\") : invariant(typeof dataId === \"string\", 1);\n var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);\n this.data[dataId] = merged;\n if (merged !== existing) {\n delete this.refs[dataId];\n if (this.group.caching) {\n var fieldsToDirty_1 = Object.create(null);\n if (!existing)\n fieldsToDirty_1.__exists = 1;\n Object.keys(incoming).forEach(function (storeFieldName) {\n if (!existing || existing[storeFieldName] !== merged[storeFieldName]) {\n fieldsToDirty_1[storeFieldName] = 1;\n var fieldName = fieldNameFromStoreName(storeFieldName);\n if (fieldName !== storeFieldName &&\n !_this.policies.hasKeyArgs(merged.__typename, fieldName)) {\n fieldsToDirty_1[fieldName] = 1;\n }\n if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) {\n delete merged[storeFieldName];\n }\n }\n });\n if (fieldsToDirty_1.__typename &&\n !(existing && existing.__typename) &&\n this.policies.rootTypenamesById[dataId] === merged.__typename) {\n delete fieldsToDirty_1.__typename;\n }\n Object.keys(fieldsToDirty_1).forEach(function (fieldName) { return _this.group.dirty(dataId, fieldName); });\n }\n }\n };\n EntityStore.prototype.modify = function (dataId, fields) {\n var _this = this;\n var storeObject = this.lookup(dataId);\n if (storeObject) {\n var changedFields_1 = Object.create(null);\n var needToMerge_1 = false;\n var allDeleted_1 = true;\n var sharedDetails_1 = {\n DELETE: DELETE,\n INVALIDATE: INVALIDATE,\n isReference: isReference,\n toReference: this.toReference,\n canRead: this.canRead,\n readField: function (fieldNameOrOptions, from) { return _this.policies.readField(typeof fieldNameOrOptions === \"string\" ? {\n fieldName: fieldNameOrOptions,\n from: from || makeReference(dataId),\n } : fieldNameOrOptions, { store: _this }); },\n };\n Object.keys(storeObject).forEach(function (storeFieldName) {\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var fieldValue = storeObject[storeFieldName];\n if (fieldValue === void 0)\n return;\n var modify = typeof fields === \"function\"\n ? fields\n : fields[storeFieldName] || fields[fieldName];\n if (modify) {\n var newValue = modify === delModifier ? DELETE :\n modify(maybeDeepFreeze(fieldValue), __assign(__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) }));\n if (newValue === INVALIDATE) {\n _this.group.dirty(dataId, storeFieldName);\n }\n else {\n if (newValue === DELETE)\n newValue = void 0;\n if (newValue !== fieldValue) {\n changedFields_1[storeFieldName] = newValue;\n needToMerge_1 = true;\n fieldValue = newValue;\n }\n }\n }\n if (fieldValue !== void 0) {\n allDeleted_1 = false;\n }\n });\n if (needToMerge_1) {\n this.merge(dataId, changedFields_1);\n if (allDeleted_1) {\n if (this instanceof Layer) {\n this.data[dataId] = void 0;\n }\n else {\n delete this.data[dataId];\n }\n this.group.dirty(dataId, \"__exists\");\n }\n return true;\n }\n }\n return false;\n };\n EntityStore.prototype.delete = function (dataId, fieldName, args) {\n var _a;\n var storeObject = this.lookup(dataId);\n if (storeObject) {\n var typename = this.getFieldValue(storeObject, \"__typename\");\n var storeFieldName = fieldName && args\n ? this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args })\n : fieldName;\n return this.modify(dataId, storeFieldName ? (_a = {},\n _a[storeFieldName] = delModifier,\n _a) : delModifier);\n }\n return false;\n };\n EntityStore.prototype.evict = function (options, limit) {\n var evicted = false;\n if (options.id) {\n if (hasOwn.call(this.data, options.id)) {\n evicted = this.delete(options.id, options.fieldName, options.args);\n }\n if (this instanceof Layer && this !== limit) {\n evicted = this.parent.evict(options, limit) || evicted;\n }\n if (options.fieldName || evicted) {\n this.group.dirty(options.id, options.fieldName || \"__exists\");\n }\n }\n return evicted;\n };\n EntityStore.prototype.clear = function () {\n this.replace(null);\n };\n EntityStore.prototype.extract = function () {\n var _this = this;\n var obj = this.toObject();\n var extraRootIds = [];\n this.getRootIdSet().forEach(function (id) {\n if (!hasOwn.call(_this.policies.rootTypenamesById, id)) {\n extraRootIds.push(id);\n }\n });\n if (extraRootIds.length) {\n obj.__META = { extraRootIds: extraRootIds.sort() };\n }\n return obj;\n };\n EntityStore.prototype.replace = function (newData) {\n var _this = this;\n Object.keys(this.data).forEach(function (dataId) {\n if (!(newData && hasOwn.call(newData, dataId))) {\n _this.delete(dataId);\n }\n });\n if (newData) {\n var __META = newData.__META, rest_1 = __rest(newData, [\"__META\"]);\n Object.keys(rest_1).forEach(function (dataId) {\n _this.merge(dataId, rest_1[dataId]);\n });\n if (__META) {\n __META.extraRootIds.forEach(this.retain, this);\n }\n }\n };\n EntityStore.prototype.retain = function (rootId) {\n return this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1;\n };\n EntityStore.prototype.release = function (rootId) {\n if (this.rootIds[rootId] > 0) {\n var count = --this.rootIds[rootId];\n if (!count)\n delete this.rootIds[rootId];\n return count;\n }\n return 0;\n };\n EntityStore.prototype.getRootIdSet = function (ids) {\n if (ids === void 0) { ids = new Set(); }\n Object.keys(this.rootIds).forEach(ids.add, ids);\n if (this instanceof Layer) {\n this.parent.getRootIdSet(ids);\n }\n else {\n Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids);\n }\n return ids;\n };\n EntityStore.prototype.gc = function () {\n var _this = this;\n var ids = this.getRootIdSet();\n var snapshot = this.toObject();\n ids.forEach(function (id) {\n if (hasOwn.call(snapshot, id)) {\n Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids);\n delete snapshot[id];\n }\n });\n var idsToRemove = Object.keys(snapshot);\n if (idsToRemove.length) {\n var root_1 = this;\n while (root_1 instanceof Layer)\n root_1 = root_1.parent;\n idsToRemove.forEach(function (id) { return root_1.delete(id); });\n }\n return idsToRemove;\n };\n EntityStore.prototype.findChildRefIds = function (dataId) {\n if (!hasOwn.call(this.refs, dataId)) {\n var found_1 = this.refs[dataId] = Object.create(null);\n var root = this.data[dataId];\n if (!root)\n return found_1;\n var workSet_1 = new Set([root]);\n workSet_1.forEach(function (obj) {\n if (isReference(obj)) {\n found_1[obj.__ref] = true;\n }\n if (isNonNullObject(obj)) {\n Object.keys(obj).forEach(function (key) {\n var child = obj[key];\n if (isNonNullObject(child)) {\n workSet_1.add(child);\n }\n });\n }\n });\n }\n return this.refs[dataId];\n };\n EntityStore.prototype.makeCacheKey = function () {\n return this.group.keyMaker.lookupArray(arguments);\n };\n return EntityStore;\n}());\nexport { EntityStore };\nvar CacheGroup = (function () {\n function CacheGroup(caching, parent) {\n if (parent === void 0) { parent = null; }\n this.caching = caching;\n this.parent = parent;\n this.d = null;\n this.resetCaching();\n }\n CacheGroup.prototype.resetCaching = function () {\n this.d = this.caching ? dep() : null;\n this.keyMaker = new Trie(canUseWeakMap);\n };\n CacheGroup.prototype.depend = function (dataId, storeFieldName) {\n if (this.d) {\n this.d(makeDepKey(dataId, storeFieldName));\n var fieldName = fieldNameFromStoreName(storeFieldName);\n if (fieldName !== storeFieldName) {\n this.d(makeDepKey(dataId, fieldName));\n }\n if (this.parent) {\n this.parent.depend(dataId, storeFieldName);\n }\n }\n };\n CacheGroup.prototype.dirty = function (dataId, storeFieldName) {\n if (this.d) {\n this.d.dirty(makeDepKey(dataId, storeFieldName), storeFieldName === \"__exists\" ? \"forget\" : \"setDirty\");\n }\n };\n return CacheGroup;\n}());\nfunction makeDepKey(dataId, storeFieldName) {\n return storeFieldName + '#' + dataId;\n}\nexport function maybeDependOnExistenceOfEntity(store, entityId) {\n if (supportsResultCaching(store)) {\n store.group.depend(entityId, \"__exists\");\n }\n}\n(function (EntityStore) {\n var Root = (function (_super) {\n __extends(Root, _super);\n function Root(_a) {\n var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed;\n var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this;\n _this.stump = new Stump(_this);\n _this.storageTrie = new Trie(canUseWeakMap);\n if (seed)\n _this.replace(seed);\n return _this;\n }\n Root.prototype.addLayer = function (layerId, replay) {\n return this.stump.addLayer(layerId, replay);\n };\n Root.prototype.removeLayer = function () {\n return this;\n };\n Root.prototype.getStorage = function () {\n return this.storageTrie.lookupArray(arguments);\n };\n return Root;\n }(EntityStore));\n EntityStore.Root = Root;\n})(EntityStore || (EntityStore = {}));\nvar Layer = (function (_super) {\n __extends(Layer, _super);\n function Layer(id, parent, replay, group) {\n var _this = _super.call(this, parent.policies, group) || this;\n _this.id = id;\n _this.parent = parent;\n _this.replay = replay;\n _this.group = group;\n replay(_this);\n return _this;\n }\n Layer.prototype.addLayer = function (layerId, replay) {\n return new Layer(layerId, this, replay, this.group);\n };\n Layer.prototype.removeLayer = function (layerId) {\n var _this = this;\n var parent = this.parent.removeLayer(layerId);\n if (layerId === this.id) {\n if (this.group.caching) {\n Object.keys(this.data).forEach(function (dataId) {\n var ownStoreObject = _this.data[dataId];\n var parentStoreObject = parent[\"lookup\"](dataId);\n if (!parentStoreObject) {\n _this.delete(dataId);\n }\n else if (!ownStoreObject) {\n _this.group.dirty(dataId, \"__exists\");\n Object.keys(parentStoreObject).forEach(function (storeFieldName) {\n _this.group.dirty(dataId, storeFieldName);\n });\n }\n else if (ownStoreObject !== parentStoreObject) {\n Object.keys(ownStoreObject).forEach(function (storeFieldName) {\n if (!equal(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) {\n _this.group.dirty(dataId, storeFieldName);\n }\n });\n }\n });\n }\n return parent;\n }\n if (parent === this.parent)\n return this;\n return parent.addLayer(this.id, this.replay);\n };\n Layer.prototype.toObject = function () {\n return __assign(__assign({}, this.parent.toObject()), this.data);\n };\n Layer.prototype.findChildRefIds = function (dataId) {\n var fromParent = this.parent.findChildRefIds(dataId);\n return hasOwn.call(this.data, dataId) ? __assign(__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent;\n };\n Layer.prototype.getStorage = function () {\n var p = this.parent;\n while (p.parent)\n p = p.parent;\n return p.getStorage.apply(p, arguments);\n };\n return Layer;\n}(EntityStore));\nvar Stump = (function (_super) {\n __extends(Stump, _super);\n function Stump(root) {\n return _super.call(this, \"EntityStore.Stump\", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this;\n }\n Stump.prototype.removeLayer = function () {\n return this;\n };\n Stump.prototype.merge = function () {\n return this.parent.merge.apply(this.parent, arguments);\n };\n return Stump;\n}(Layer));\nfunction storeObjectReconciler(existingObject, incomingObject, property) {\n var existingValue = existingObject[property];\n var incomingValue = incomingObject[property];\n return equal(existingValue, incomingValue) ? existingValue : incomingValue;\n}\nexport function supportsResultCaching(store) {\n return !!(store instanceof EntityStore && store.group.caching);\n}\n//# sourceMappingURL=entityStore.js.map","import { __assign } from \"tslib\";\nimport \"../../utilities/globals/index.js\";\nimport { Trie } from \"@wry/trie\";\nimport { canUseWeakMap, canUseWeakSet, isNonNullObject as isObjectOrArray, } from \"../../utilities/index.js\";\nfunction shallowCopy(value) {\n if (isObjectOrArray(value)) {\n return Array.isArray(value)\n ? value.slice(0)\n : __assign({ __proto__: Object.getPrototypeOf(value) }, value);\n }\n return value;\n}\nvar ObjectCanon = (function () {\n function ObjectCanon() {\n this.known = new (canUseWeakSet ? WeakSet : Set)();\n this.pool = new Trie(canUseWeakMap);\n this.passes = new WeakMap();\n this.keysByJSON = new Map();\n this.empty = this.admit({});\n }\n ObjectCanon.prototype.isKnown = function (value) {\n return isObjectOrArray(value) && this.known.has(value);\n };\n ObjectCanon.prototype.pass = function (value) {\n if (isObjectOrArray(value)) {\n var copy = shallowCopy(value);\n this.passes.set(copy, value);\n return copy;\n }\n return value;\n };\n ObjectCanon.prototype.admit = function (value) {\n var _this = this;\n if (isObjectOrArray(value)) {\n var original = this.passes.get(value);\n if (original)\n return original;\n var proto = Object.getPrototypeOf(value);\n switch (proto) {\n case Array.prototype: {\n if (this.known.has(value))\n return value;\n var array = value.map(this.admit, this);\n var node = this.pool.lookupArray(array);\n if (!node.array) {\n this.known.add(node.array = array);\n if (__DEV__) {\n Object.freeze(array);\n }\n }\n return node.array;\n }\n case null:\n case Object.prototype: {\n if (this.known.has(value))\n return value;\n var proto_1 = Object.getPrototypeOf(value);\n var array_1 = [proto_1];\n var keys = this.sortedKeys(value);\n array_1.push(keys.json);\n var firstValueIndex_1 = array_1.length;\n keys.sorted.forEach(function (key) {\n array_1.push(_this.admit(value[key]));\n });\n var node = this.pool.lookupArray(array_1);\n if (!node.object) {\n var obj_1 = node.object = Object.create(proto_1);\n this.known.add(obj_1);\n keys.sorted.forEach(function (key, i) {\n obj_1[key] = array_1[firstValueIndex_1 + i];\n });\n if (__DEV__) {\n Object.freeze(obj_1);\n }\n }\n return node.object;\n }\n }\n }\n return value;\n };\n ObjectCanon.prototype.sortedKeys = function (obj) {\n var keys = Object.keys(obj);\n var node = this.pool.lookupArray(keys);\n if (!node.keys) {\n keys.sort();\n var json = JSON.stringify(keys);\n if (!(node.keys = this.keysByJSON.get(json))) {\n this.keysByJSON.set(json, node.keys = { sorted: keys, json: json });\n }\n }\n return node.keys;\n };\n return ObjectCanon;\n}());\nexport { ObjectCanon };\nexport var canonicalStringify = Object.assign(function (value) {\n if (isObjectOrArray(value)) {\n if (stringifyCanon === void 0) {\n resetCanonicalStringify();\n }\n var canonical = stringifyCanon.admit(value);\n var json = stringifyCache.get(canonical);\n if (json === void 0) {\n stringifyCache.set(canonical, json = JSON.stringify(canonical));\n }\n return json;\n }\n return JSON.stringify(value);\n}, {\n reset: resetCanonicalStringify,\n});\nvar stringifyCanon;\nvar stringifyCache;\nfunction resetCanonicalStringify() {\n stringifyCanon = new ObjectCanon;\n stringifyCache = new (canUseWeakMap ? WeakMap : Map)();\n}\n//# sourceMappingURL=object-canon.js.map","import { __assign } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport { wrap } from 'optimism';\nimport { isField, resultKeyNameFromField, isReference, makeReference, createFragmentMap, shouldInclude, addTypenameToDocument, getDefaultValues, getFragmentDefinitions, getMainDefinition, getQueryDefinition, DeepMerger, getFragmentFromSelection, maybeDeepFreeze, isNonNullObject, canUseWeakMap, compact, } from \"../../utilities/index.js\";\nimport { maybeDependOnExistenceOfEntity, supportsResultCaching } from \"./entityStore.js\";\nimport { getTypenameFromStoreObject, shouldCanonizeResults } from \"./helpers.js\";\nimport { MissingFieldError } from \"../core/types/common.js\";\nimport { canonicalStringify, ObjectCanon } from \"./object-canon.js\";\n;\nfunction execSelectionSetKeyArgs(options) {\n return [\n options.selectionSet,\n options.objectOrReference,\n options.context,\n options.context.canonizeResults,\n ];\n}\nvar StoreReader = (function () {\n function StoreReader(config) {\n var _this = this;\n this.knownResults = new (canUseWeakMap ? WeakMap : Map)();\n this.config = compact(config, {\n addTypename: config.addTypename !== false,\n canonizeResults: shouldCanonizeResults(config),\n });\n this.canon = config.canon || new ObjectCanon;\n this.executeSelectionSet = wrap(function (options) {\n var _a;\n var canonizeResults = options.context.canonizeResults;\n var peekArgs = execSelectionSetKeyArgs(options);\n peekArgs[3] = !canonizeResults;\n var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs);\n if (other) {\n if (canonizeResults) {\n return __assign(__assign({}, other), { result: _this.canon.admit(other.result) });\n }\n return other;\n }\n maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref);\n return _this.execSelectionSetImpl(options);\n }, {\n max: this.config.resultCacheMaxSize,\n keyArgs: execSelectionSetKeyArgs,\n makeCacheKey: function (selectionSet, parent, context, canonizeResults) {\n if (supportsResultCaching(context.store)) {\n return context.store.makeCacheKey(selectionSet, isReference(parent) ? parent.__ref : parent, context.varString, canonizeResults);\n }\n }\n });\n this.executeSubSelectedArray = wrap(function (options) {\n maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref);\n return _this.execSubSelectedArrayImpl(options);\n }, {\n max: this.config.resultCacheMaxSize,\n makeCacheKey: function (_a) {\n var field = _a.field, array = _a.array, context = _a.context;\n if (supportsResultCaching(context.store)) {\n return context.store.makeCacheKey(field, array, context.varString);\n }\n }\n });\n }\n StoreReader.prototype.resetCanon = function () {\n this.canon = new ObjectCanon;\n };\n StoreReader.prototype.diffQueryAgainstStore = function (_a) {\n var store = _a.store, query = _a.query, _b = _a.rootId, rootId = _b === void 0 ? 'ROOT_QUERY' : _b, variables = _a.variables, _c = _a.returnPartialData, returnPartialData = _c === void 0 ? true : _c, _d = _a.canonizeResults, canonizeResults = _d === void 0 ? this.config.canonizeResults : _d;\n var policies = this.config.cache.policies;\n variables = __assign(__assign({}, getDefaultValues(getQueryDefinition(query))), variables);\n var rootRef = makeReference(rootId);\n var merger = new DeepMerger;\n var execResult = this.executeSelectionSet({\n selectionSet: getMainDefinition(query).selectionSet,\n objectOrReference: rootRef,\n enclosingRef: rootRef,\n context: {\n store: store,\n query: query,\n policies: policies,\n variables: variables,\n varString: canonicalStringify(variables),\n canonizeResults: canonizeResults,\n fragmentMap: createFragmentMap(getFragmentDefinitions(query)),\n merge: function (a, b) {\n return merger.merge(a, b);\n },\n },\n });\n var missing;\n if (execResult.missing) {\n missing = [new MissingFieldError(firstMissing(execResult.missing), execResult.missing, query, variables)];\n if (!returnPartialData) {\n throw missing[0];\n }\n }\n return {\n result: execResult.result,\n complete: !missing,\n missing: missing,\n };\n };\n StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) {\n if (supportsResultCaching(context.store) &&\n this.knownResults.get(result) === selectionSet) {\n var latest = this.executeSelectionSet.peek(selectionSet, parent, context, this.canon.isKnown(result));\n if (latest && result === latest.result) {\n return true;\n }\n }\n return false;\n };\n StoreReader.prototype.execSelectionSetImpl = function (_a) {\n var _this = this;\n var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, enclosingRef = _a.enclosingRef, context = _a.context;\n if (isReference(objectOrReference) &&\n !context.policies.rootTypenamesById[objectOrReference.__ref] &&\n !context.store.has(objectOrReference.__ref)) {\n return {\n result: this.canon.empty,\n missing: \"Dangling reference to missing \".concat(objectOrReference.__ref, \" object\"),\n };\n }\n var variables = context.variables, policies = context.policies, store = context.store;\n var typename = store.getFieldValue(objectOrReference, \"__typename\");\n var result = {};\n var missing;\n if (this.config.addTypename &&\n typeof typename === \"string\" &&\n !policies.rootIdsByTypename[typename]) {\n result = { __typename: typename };\n }\n function handleMissing(result, resultName) {\n var _a;\n if (result.missing) {\n missing = context.merge(missing, (_a = {}, _a[resultName] = result.missing, _a));\n }\n return result.result;\n }\n var workSet = new Set(selectionSet.selections);\n workSet.forEach(function (selection) {\n var _a, _b;\n if (!shouldInclude(selection, variables))\n return;\n if (isField(selection)) {\n var fieldValue = policies.readField({\n fieldName: selection.name.value,\n field: selection,\n variables: context.variables,\n from: objectOrReference,\n }, context);\n var resultName = resultKeyNameFromField(selection);\n if (fieldValue === void 0) {\n if (!addTypenameToDocument.added(selection)) {\n missing = context.merge(missing, (_a = {},\n _a[resultName] = \"Can't find field '\".concat(selection.name.value, \"' on \").concat(isReference(objectOrReference)\n ? objectOrReference.__ref + \" object\"\n : \"object \" + JSON.stringify(objectOrReference, null, 2)),\n _a));\n }\n }\n else if (Array.isArray(fieldValue)) {\n fieldValue = handleMissing(_this.executeSubSelectedArray({\n field: selection,\n array: fieldValue,\n enclosingRef: enclosingRef,\n context: context,\n }), resultName);\n }\n else if (!selection.selectionSet) {\n if (context.canonizeResults) {\n fieldValue = _this.canon.pass(fieldValue);\n }\n }\n else if (fieldValue != null) {\n fieldValue = handleMissing(_this.executeSelectionSet({\n selectionSet: selection.selectionSet,\n objectOrReference: fieldValue,\n enclosingRef: isReference(fieldValue) ? fieldValue : enclosingRef,\n context: context,\n }), resultName);\n }\n if (fieldValue !== void 0) {\n result = context.merge(result, (_b = {}, _b[resultName] = fieldValue, _b));\n }\n }\n else {\n var fragment = getFragmentFromSelection(selection, context.fragmentMap);\n if (fragment && policies.fragmentMatches(fragment, typename)) {\n fragment.selectionSet.selections.forEach(workSet.add, workSet);\n }\n }\n });\n var finalResult = { result: result, missing: missing };\n var frozen = context.canonizeResults\n ? this.canon.admit(finalResult)\n : maybeDeepFreeze(finalResult);\n if (frozen.result) {\n this.knownResults.set(frozen.result, selectionSet);\n }\n return frozen;\n };\n StoreReader.prototype.execSubSelectedArrayImpl = function (_a) {\n var _this = this;\n var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context;\n var missing;\n function handleMissing(childResult, i) {\n var _a;\n if (childResult.missing) {\n missing = context.merge(missing, (_a = {}, _a[i] = childResult.missing, _a));\n }\n return childResult.result;\n }\n if (field.selectionSet) {\n array = array.filter(context.store.canRead);\n }\n array = array.map(function (item, i) {\n if (item === null) {\n return null;\n }\n if (Array.isArray(item)) {\n return handleMissing(_this.executeSubSelectedArray({\n field: field,\n array: item,\n enclosingRef: enclosingRef,\n context: context,\n }), i);\n }\n if (field.selectionSet) {\n return handleMissing(_this.executeSelectionSet({\n selectionSet: field.selectionSet,\n objectOrReference: item,\n enclosingRef: isReference(item) ? item : enclosingRef,\n context: context,\n }), i);\n }\n if (__DEV__) {\n assertSelectionSetForIdValue(context.store, field, item);\n }\n return item;\n });\n return {\n result: context.canonizeResults ? this.canon.admit(array) : array,\n missing: missing,\n };\n };\n return StoreReader;\n}());\nexport { StoreReader };\nfunction firstMissing(tree) {\n try {\n JSON.stringify(tree, function (_, value) {\n if (typeof value === \"string\")\n throw value;\n return value;\n });\n }\n catch (result) {\n return result;\n }\n}\nfunction assertSelectionSetForIdValue(store, field, fieldValue) {\n if (!field.selectionSet) {\n var workSet_1 = new Set([fieldValue]);\n workSet_1.forEach(function (value) {\n if (isNonNullObject(value)) {\n __DEV__ ? invariant(!isReference(value), \"Missing selection set for object of type \".concat(getTypenameFromStoreObject(store, value), \" returned for query field \").concat(field.name.value)) : invariant(!isReference(value), 5);\n Object.values(value).forEach(workSet_1.add, workSet_1);\n }\n });\n }\n}\n//# sourceMappingURL=readFromStore.js.map","import { dep } from \"optimism\";\nimport { Slot } from \"@wry/context\";\nexport var cacheSlot = new Slot();\nvar cacheInfoMap = new WeakMap();\nfunction getCacheInfo(cache) {\n var info = cacheInfoMap.get(cache);\n if (!info) {\n cacheInfoMap.set(cache, info = {\n vars: new Set,\n dep: dep(),\n });\n }\n return info;\n}\nexport function forgetCache(cache) {\n getCacheInfo(cache).vars.forEach(function (rv) { return rv.forgetCache(cache); });\n}\nexport function recallCache(cache) {\n getCacheInfo(cache).vars.forEach(function (rv) { return rv.attachCache(cache); });\n}\nexport function makeVar(value) {\n var caches = new Set();\n var listeners = new Set();\n var rv = function (newValue) {\n if (arguments.length > 0) {\n if (value !== newValue) {\n value = newValue;\n caches.forEach(function (cache) {\n getCacheInfo(cache).dep.dirty(rv);\n broadcast(cache);\n });\n var oldListeners = Array.from(listeners);\n listeners.clear();\n oldListeners.forEach(function (listener) { return listener(value); });\n }\n }\n else {\n var cache = cacheSlot.getValue();\n if (cache) {\n attach(cache);\n getCacheInfo(cache).dep(rv);\n }\n }\n return value;\n };\n rv.onNextChange = function (listener) {\n listeners.add(listener);\n return function () {\n listeners.delete(listener);\n };\n };\n var attach = rv.attachCache = function (cache) {\n caches.add(cache);\n getCacheInfo(cache).vars.add(rv);\n return rv;\n };\n rv.forgetCache = function (cache) { return caches.delete(cache); };\n return rv;\n}\nfunction broadcast(cache) {\n if (cache.broadcastWatches) {\n cache.broadcastWatches();\n }\n}\n//# sourceMappingURL=reactiveVars.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport { argumentsObjectFromField, DeepMerger, isNonEmptyArray, isNonNullObject, } from \"../../utilities/index.js\";\nimport { hasOwn } from \"./helpers.js\";\nvar specifierInfoCache = Object.create(null);\nfunction lookupSpecifierInfo(spec) {\n var cacheKey = JSON.stringify(spec);\n return specifierInfoCache[cacheKey] ||\n (specifierInfoCache[cacheKey] = Object.create(null));\n}\nexport function keyFieldsFnFromSpecifier(specifier) {\n var info = lookupSpecifierInfo(specifier);\n return info.keyFieldsFn || (info.keyFieldsFn = function (object, context) {\n var extract = function (from, key) { return context.readField(key, from); };\n var keyObject = context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) {\n var extracted = extractKeyPath(context.storeObject, schemaKeyPath, extract);\n if (extracted === void 0 &&\n object !== context.storeObject &&\n hasOwn.call(object, schemaKeyPath[0])) {\n extracted = extractKeyPath(object, schemaKeyPath, extractKey);\n }\n __DEV__ ? invariant(extracted !== void 0, \"Missing field '\".concat(schemaKeyPath.join('.'), \"' while extracting keyFields from \").concat(JSON.stringify(object))) : invariant(extracted !== void 0, 2);\n return extracted;\n });\n return \"\".concat(context.typename, \":\").concat(JSON.stringify(keyObject));\n });\n}\nexport function keyArgsFnFromSpecifier(specifier) {\n var info = lookupSpecifierInfo(specifier);\n return info.keyArgsFn || (info.keyArgsFn = function (args, _a) {\n var field = _a.field, variables = _a.variables, fieldName = _a.fieldName;\n var collected = collectSpecifierPaths(specifier, function (keyPath) {\n var firstKey = keyPath[0];\n var firstChar = firstKey.charAt(0);\n if (firstChar === \"@\") {\n if (field && isNonEmptyArray(field.directives)) {\n var directiveName_1 = firstKey.slice(1);\n var d = field.directives.find(function (d) { return d.name.value === directiveName_1; });\n var directiveArgs = d && argumentsObjectFromField(d, variables);\n return directiveArgs && extractKeyPath(directiveArgs, keyPath.slice(1));\n }\n return;\n }\n if (firstChar === \"$\") {\n var variableName = firstKey.slice(1);\n if (variables && hasOwn.call(variables, variableName)) {\n var varKeyPath = keyPath.slice(0);\n varKeyPath[0] = variableName;\n return extractKeyPath(variables, varKeyPath);\n }\n return;\n }\n if (args) {\n return extractKeyPath(args, keyPath);\n }\n });\n var suffix = JSON.stringify(collected);\n if (args || suffix !== \"{}\") {\n fieldName += \":\" + suffix;\n }\n return fieldName;\n });\n}\nexport function collectSpecifierPaths(specifier, extractor) {\n var merger = new DeepMerger;\n return getSpecifierPaths(specifier).reduce(function (collected, path) {\n var _a;\n var toMerge = extractor(path);\n if (toMerge !== void 0) {\n for (var i = path.length - 1; i >= 0; --i) {\n toMerge = (_a = {}, _a[path[i]] = toMerge, _a);\n }\n collected = merger.merge(collected, toMerge);\n }\n return collected;\n }, Object.create(null));\n}\nexport function getSpecifierPaths(spec) {\n var info = lookupSpecifierInfo(spec);\n if (!info.paths) {\n var paths_1 = info.paths = [];\n var currentPath_1 = [];\n spec.forEach(function (s, i) {\n if (Array.isArray(s)) {\n getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); });\n currentPath_1.length = 0;\n }\n else {\n currentPath_1.push(s);\n if (!Array.isArray(spec[i + 1])) {\n paths_1.push(currentPath_1.slice(0));\n currentPath_1.length = 0;\n }\n }\n });\n }\n return info.paths;\n}\nfunction extractKey(object, key) {\n return object[key];\n}\nexport function extractKeyPath(object, path, extract) {\n extract = extract || extractKey;\n return normalize(path.reduce(function reducer(obj, key) {\n return Array.isArray(obj)\n ? obj.map(function (child) { return reducer(child, key); })\n : obj && extract(obj, key);\n }, object));\n}\nfunction normalize(value) {\n if (isNonNullObject(value)) {\n if (Array.isArray(value)) {\n return value.map(normalize);\n }\n return collectSpecifierPaths(Object.keys(value).sort(), function (path) { return extractKeyPath(value, path); });\n }\n return value;\n}\n//# sourceMappingURL=key-extractor.js.map","import { __assign, __rest } from \"tslib\";\nimport { invariant, InvariantError } from \"../../utilities/globals/index.js\";\nimport { storeKeyNameFromField, argumentsObjectFromField, isReference, getStoreKeyName, isNonNullObject, stringifyForDisplay, } from \"../../utilities/index.js\";\nimport { hasOwn, fieldNameFromStoreName, storeValueIsStoreObject, selectionSetMatchesResult, TypeOrFieldNameRegExp, defaultDataIdFromObject, } from \"./helpers.js\";\nimport { cacheSlot } from \"./reactiveVars.js\";\nimport { canonicalStringify } from \"./object-canon.js\";\nimport { keyArgsFnFromSpecifier, keyFieldsFnFromSpecifier } from \"./key-extractor.js\";\ngetStoreKeyName.setStringify(canonicalStringify);\nfunction argsFromFieldSpecifier(spec) {\n return spec.args !== void 0 ? spec.args :\n spec.field ? argumentsObjectFromField(spec.field, spec.variables) : null;\n}\nvar nullKeyFieldsFn = function () { return void 0; };\nvar simpleKeyArgsFn = function (_args, context) { return context.fieldName; };\nvar mergeTrueFn = function (existing, incoming, _a) {\n var mergeObjects = _a.mergeObjects;\n return mergeObjects(existing, incoming);\n};\nvar mergeFalseFn = function (_, incoming) { return incoming; };\nvar Policies = (function () {\n function Policies(config) {\n this.config = config;\n this.typePolicies = Object.create(null);\n this.toBeAdded = Object.create(null);\n this.supertypeMap = new Map();\n this.fuzzySubtypes = new Map();\n this.rootIdsByTypename = Object.create(null);\n this.rootTypenamesById = Object.create(null);\n this.usingPossibleTypes = false;\n this.config = __assign({ dataIdFromObject: defaultDataIdFromObject }, config);\n this.cache = this.config.cache;\n this.setRootTypename(\"Query\");\n this.setRootTypename(\"Mutation\");\n this.setRootTypename(\"Subscription\");\n if (config.possibleTypes) {\n this.addPossibleTypes(config.possibleTypes);\n }\n if (config.typePolicies) {\n this.addTypePolicies(config.typePolicies);\n }\n }\n Policies.prototype.identify = function (object, partialContext) {\n var _a;\n var policies = this;\n var typename = partialContext && (partialContext.typename ||\n ((_a = partialContext.storeObject) === null || _a === void 0 ? void 0 : _a.__typename)) || object.__typename;\n if (typename === this.rootTypenamesById.ROOT_QUERY) {\n return [\"ROOT_QUERY\"];\n }\n var storeObject = partialContext && partialContext.storeObject || object;\n var context = __assign(__assign({}, partialContext), { typename: typename, storeObject: storeObject, readField: partialContext && partialContext.readField || function () {\n var options = normalizeReadFieldOptions(arguments, storeObject);\n return policies.readField(options, {\n store: policies.cache[\"data\"],\n variables: options.variables,\n });\n } });\n var id;\n var policy = typename && this.getTypePolicy(typename);\n var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;\n while (keyFn) {\n var specifierOrId = keyFn(object, context);\n if (Array.isArray(specifierOrId)) {\n keyFn = keyFieldsFnFromSpecifier(specifierOrId);\n }\n else {\n id = specifierOrId;\n break;\n }\n }\n id = id ? String(id) : void 0;\n return context.keyObject ? [id, context.keyObject] : [id];\n };\n Policies.prototype.addTypePolicies = function (typePolicies) {\n var _this = this;\n Object.keys(typePolicies).forEach(function (typename) {\n var _a = typePolicies[typename], queryType = _a.queryType, mutationType = _a.mutationType, subscriptionType = _a.subscriptionType, incoming = __rest(_a, [\"queryType\", \"mutationType\", \"subscriptionType\"]);\n if (queryType)\n _this.setRootTypename(\"Query\", typename);\n if (mutationType)\n _this.setRootTypename(\"Mutation\", typename);\n if (subscriptionType)\n _this.setRootTypename(\"Subscription\", typename);\n if (hasOwn.call(_this.toBeAdded, typename)) {\n _this.toBeAdded[typename].push(incoming);\n }\n else {\n _this.toBeAdded[typename] = [incoming];\n }\n });\n };\n Policies.prototype.updateTypePolicy = function (typename, incoming) {\n var _this = this;\n var existing = this.getTypePolicy(typename);\n var keyFields = incoming.keyFields, fields = incoming.fields;\n function setMerge(existing, merge) {\n existing.merge =\n typeof merge === \"function\" ? merge :\n merge === true ? mergeTrueFn :\n merge === false ? mergeFalseFn :\n existing.merge;\n }\n setMerge(existing, incoming.merge);\n existing.keyFn =\n keyFields === false ? nullKeyFieldsFn :\n Array.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) :\n typeof keyFields === \"function\" ? keyFields :\n existing.keyFn;\n if (fields) {\n Object.keys(fields).forEach(function (fieldName) {\n var existing = _this.getFieldPolicy(typename, fieldName, true);\n var incoming = fields[fieldName];\n if (typeof incoming === \"function\") {\n existing.read = incoming;\n }\n else {\n var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;\n existing.keyFn =\n keyArgs === false ? simpleKeyArgsFn :\n Array.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) :\n typeof keyArgs === \"function\" ? keyArgs :\n existing.keyFn;\n if (typeof read === \"function\") {\n existing.read = read;\n }\n setMerge(existing, merge);\n }\n if (existing.read && existing.merge) {\n existing.keyFn = existing.keyFn || simpleKeyArgsFn;\n }\n });\n }\n };\n Policies.prototype.setRootTypename = function (which, typename) {\n if (typename === void 0) { typename = which; }\n var rootId = \"ROOT_\" + which.toUpperCase();\n var old = this.rootTypenamesById[rootId];\n if (typename !== old) {\n __DEV__ ? invariant(!old || old === which, \"Cannot change root \".concat(which, \" __typename more than once\")) : invariant(!old || old === which, 3);\n if (old)\n delete this.rootIdsByTypename[old];\n this.rootIdsByTypename[typename] = rootId;\n this.rootTypenamesById[rootId] = typename;\n }\n };\n Policies.prototype.addPossibleTypes = function (possibleTypes) {\n var _this = this;\n this.usingPossibleTypes = true;\n Object.keys(possibleTypes).forEach(function (supertype) {\n _this.getSupertypeSet(supertype, true);\n possibleTypes[supertype].forEach(function (subtype) {\n _this.getSupertypeSet(subtype, true).add(supertype);\n var match = subtype.match(TypeOrFieldNameRegExp);\n if (!match || match[0] !== subtype) {\n _this.fuzzySubtypes.set(subtype, new RegExp(subtype));\n }\n });\n });\n };\n Policies.prototype.getTypePolicy = function (typename) {\n var _this = this;\n if (!hasOwn.call(this.typePolicies, typename)) {\n var policy_1 = this.typePolicies[typename] = Object.create(null);\n policy_1.fields = Object.create(null);\n var supertypes = this.supertypeMap.get(typename);\n if (supertypes && supertypes.size) {\n supertypes.forEach(function (supertype) {\n var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = __rest(_a, [\"fields\"]);\n Object.assign(policy_1, rest);\n Object.assign(policy_1.fields, fields);\n });\n }\n }\n var inbox = this.toBeAdded[typename];\n if (inbox && inbox.length) {\n inbox.splice(0).forEach(function (policy) {\n _this.updateTypePolicy(typename, policy);\n });\n }\n return this.typePolicies[typename];\n };\n Policies.prototype.getFieldPolicy = function (typename, fieldName, createIfMissing) {\n if (typename) {\n var fieldPolicies = this.getTypePolicy(typename).fields;\n return fieldPolicies[fieldName] || (createIfMissing && (fieldPolicies[fieldName] = Object.create(null)));\n }\n };\n Policies.prototype.getSupertypeSet = function (subtype, createIfMissing) {\n var supertypeSet = this.supertypeMap.get(subtype);\n if (!supertypeSet && createIfMissing) {\n this.supertypeMap.set(subtype, supertypeSet = new Set());\n }\n return supertypeSet;\n };\n Policies.prototype.fragmentMatches = function (fragment, typename, result, variables) {\n var _this = this;\n if (!fragment.typeCondition)\n return true;\n if (!typename)\n return false;\n var supertype = fragment.typeCondition.name.value;\n if (typename === supertype)\n return true;\n if (this.usingPossibleTypes &&\n this.supertypeMap.has(supertype)) {\n var typenameSupertypeSet = this.getSupertypeSet(typename, true);\n var workQueue_1 = [typenameSupertypeSet];\n var maybeEnqueue_1 = function (subtype) {\n var supertypeSet = _this.getSupertypeSet(subtype, false);\n if (supertypeSet &&\n supertypeSet.size &&\n workQueue_1.indexOf(supertypeSet) < 0) {\n workQueue_1.push(supertypeSet);\n }\n };\n var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size);\n var checkingFuzzySubtypes = false;\n for (var i = 0; i < workQueue_1.length; ++i) {\n var supertypeSet = workQueue_1[i];\n if (supertypeSet.has(supertype)) {\n if (!typenameSupertypeSet.has(supertype)) {\n if (checkingFuzzySubtypes) {\n __DEV__ && invariant.warn(\"Inferring subtype \".concat(typename, \" of supertype \").concat(supertype));\n }\n typenameSupertypeSet.add(supertype);\n }\n return true;\n }\n supertypeSet.forEach(maybeEnqueue_1);\n if (needToCheckFuzzySubtypes &&\n i === workQueue_1.length - 1 &&\n selectionSetMatchesResult(fragment.selectionSet, result, variables)) {\n needToCheckFuzzySubtypes = false;\n checkingFuzzySubtypes = true;\n this.fuzzySubtypes.forEach(function (regExp, fuzzyString) {\n var match = typename.match(regExp);\n if (match && match[0] === typename) {\n maybeEnqueue_1(fuzzyString);\n }\n });\n }\n }\n }\n return false;\n };\n Policies.prototype.hasKeyArgs = function (typename, fieldName) {\n var policy = this.getFieldPolicy(typename, fieldName, false);\n return !!(policy && policy.keyFn);\n };\n Policies.prototype.getStoreFieldName = function (fieldSpec) {\n var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName;\n var policy = this.getFieldPolicy(typename, fieldName, false);\n var storeFieldName;\n var keyFn = policy && policy.keyFn;\n if (keyFn && typename) {\n var context = {\n typename: typename,\n fieldName: fieldName,\n field: fieldSpec.field || null,\n variables: fieldSpec.variables,\n };\n var args = argsFromFieldSpecifier(fieldSpec);\n while (keyFn) {\n var specifierOrString = keyFn(args, context);\n if (Array.isArray(specifierOrString)) {\n keyFn = keyArgsFnFromSpecifier(specifierOrString);\n }\n else {\n storeFieldName = specifierOrString || fieldName;\n break;\n }\n }\n }\n if (storeFieldName === void 0) {\n storeFieldName = fieldSpec.field\n ? storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)\n : getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));\n }\n if (storeFieldName === false) {\n return fieldName;\n }\n return fieldName === fieldNameFromStoreName(storeFieldName)\n ? storeFieldName\n : fieldName + \":\" + storeFieldName;\n };\n Policies.prototype.readField = function (options, context) {\n var objectOrReference = options.from;\n if (!objectOrReference)\n return;\n var nameOrField = options.field || options.fieldName;\n if (!nameOrField)\n return;\n if (options.typename === void 0) {\n var typename = context.store.getFieldValue(objectOrReference, \"__typename\");\n if (typename)\n options.typename = typename;\n }\n var storeFieldName = this.getStoreFieldName(options);\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var existing = context.store.getFieldValue(objectOrReference, storeFieldName);\n var policy = this.getFieldPolicy(options.typename, fieldName, false);\n var read = policy && policy.read;\n if (read) {\n var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(isReference(objectOrReference)\n ? objectOrReference.__ref\n : objectOrReference, storeFieldName));\n return cacheSlot.withValue(this.cache, read, [existing, readOptions]);\n }\n return existing;\n };\n Policies.prototype.getReadFunction = function (typename, fieldName) {\n var policy = this.getFieldPolicy(typename, fieldName, false);\n return policy && policy.read;\n };\n Policies.prototype.getMergeFunction = function (parentTypename, fieldName, childTypename) {\n var policy = this.getFieldPolicy(parentTypename, fieldName, false);\n var merge = policy && policy.merge;\n if (!merge && childTypename) {\n policy = this.getTypePolicy(childTypename);\n merge = policy && policy.merge;\n }\n return merge;\n };\n Policies.prototype.runMergeFunction = function (existing, incoming, _a, context, storage) {\n var field = _a.field, typename = _a.typename, merge = _a.merge;\n if (merge === mergeTrueFn) {\n return makeMergeObjectsFunction(context.store)(existing, incoming);\n }\n if (merge === mergeFalseFn) {\n return incoming;\n }\n if (context.overwrite) {\n existing = void 0;\n }\n return merge(existing, incoming, makeFieldFunctionOptions(this, void 0, { typename: typename, fieldName: field.name.value, field: field, variables: context.variables }, context, storage || Object.create(null)));\n };\n return Policies;\n}());\nexport { Policies };\nfunction makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) {\n var storeFieldName = policies.getStoreFieldName(fieldSpec);\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var variables = fieldSpec.variables || context.variables;\n var _a = context.store, toReference = _a.toReference, canRead = _a.canRead;\n return {\n args: argsFromFieldSpecifier(fieldSpec),\n field: fieldSpec.field || null,\n fieldName: fieldName,\n storeFieldName: storeFieldName,\n variables: variables,\n isReference: isReference,\n toReference: toReference,\n storage: storage,\n cache: policies.cache,\n canRead: canRead,\n readField: function () {\n return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, context), context);\n },\n mergeObjects: makeMergeObjectsFunction(context.store),\n };\n}\nexport function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables) {\n var fieldNameOrOptions = readFieldArgs[0], from = readFieldArgs[1], argc = readFieldArgs.length;\n var options;\n if (typeof fieldNameOrOptions === \"string\") {\n options = {\n fieldName: fieldNameOrOptions,\n from: argc > 1 ? from : objectOrReference,\n };\n }\n else {\n options = __assign({}, fieldNameOrOptions);\n if (!hasOwn.call(options, \"from\")) {\n options.from = objectOrReference;\n }\n }\n if (__DEV__ && options.from === void 0) {\n __DEV__ && invariant.warn(\"Undefined 'from' passed to readField with arguments \".concat(stringifyForDisplay(Array.from(readFieldArgs))));\n }\n if (void 0 === options.variables) {\n options.variables = variables;\n }\n return options;\n}\nfunction makeMergeObjectsFunction(store) {\n return function mergeObjects(existing, incoming) {\n if (Array.isArray(existing) || Array.isArray(incoming)) {\n throw __DEV__ ? new InvariantError(\"Cannot automatically merge arrays\") : new InvariantError(4);\n }\n if (isNonNullObject(existing) &&\n isNonNullObject(incoming)) {\n var eType = store.getFieldValue(existing, \"__typename\");\n var iType = store.getFieldValue(incoming, \"__typename\");\n var typesDiffer = eType && iType && eType !== iType;\n if (typesDiffer) {\n return incoming;\n }\n if (isReference(existing) &&\n storeValueIsStoreObject(incoming)) {\n store.merge(existing.__ref, incoming);\n return existing;\n }\n if (storeValueIsStoreObject(existing) &&\n isReference(incoming)) {\n store.merge(existing, incoming.__ref);\n return incoming;\n }\n if (storeValueIsStoreObject(existing) &&\n storeValueIsStoreObject(incoming)) {\n return __assign(__assign({}, existing), incoming);\n }\n }\n return incoming;\n };\n}\n//# sourceMappingURL=policies.js.map","import { __assign } from \"tslib\";\nimport { invariant, InvariantError } from \"../../utilities/globals/index.js\";\nimport { equal } from '@wry/equality';\nimport { Trie } from '@wry/trie';\nimport { createFragmentMap, getFragmentFromSelection, getDefaultValues, getFragmentDefinitions, getOperationDefinition, getTypenameFromResult, makeReference, isField, resultKeyNameFromField, isReference, shouldInclude, cloneDeep, addTypenameToDocument, isNonEmptyArray, argumentsObjectFromField, } from \"../../utilities/index.js\";\nimport { makeProcessedFieldsMerger, fieldNameFromStoreName, storeValueIsStoreObject } from \"./helpers.js\";\nimport { canonicalStringify } from \"./object-canon.js\";\nimport { normalizeReadFieldOptions } from \"./policies.js\";\n;\nfunction getContextFlavor(context, clientOnly, deferred) {\n var key = \"\".concat(clientOnly).concat(deferred);\n var flavored = context.flavors.get(key);\n if (!flavored) {\n context.flavors.set(key, flavored = (context.clientOnly === clientOnly &&\n context.deferred === deferred) ? context : __assign(__assign({}, context), { clientOnly: clientOnly, deferred: deferred }));\n }\n return flavored;\n}\nvar StoreWriter = (function () {\n function StoreWriter(cache, reader) {\n this.cache = cache;\n this.reader = reader;\n }\n StoreWriter.prototype.writeToStore = function (store, _a) {\n var _this = this;\n var query = _a.query, result = _a.result, dataId = _a.dataId, variables = _a.variables, overwrite = _a.overwrite;\n var operationDefinition = getOperationDefinition(query);\n var merger = makeProcessedFieldsMerger();\n variables = __assign(__assign({}, getDefaultValues(operationDefinition)), variables);\n var context = {\n store: store,\n written: Object.create(null),\n merge: function (existing, incoming) {\n return merger.merge(existing, incoming);\n },\n variables: variables,\n varString: canonicalStringify(variables),\n fragmentMap: createFragmentMap(getFragmentDefinitions(query)),\n overwrite: !!overwrite,\n incomingById: new Map,\n clientOnly: false,\n deferred: false,\n flavors: new Map,\n };\n var ref = this.processSelectionSet({\n result: result || Object.create(null),\n dataId: dataId,\n selectionSet: operationDefinition.selectionSet,\n mergeTree: { map: new Map },\n context: context,\n });\n if (!isReference(ref)) {\n throw __DEV__ ? new InvariantError(\"Could not identify object \".concat(JSON.stringify(result))) : new InvariantError(6);\n }\n context.incomingById.forEach(function (_a, dataId) {\n var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;\n var entityRef = makeReference(dataId);\n if (mergeTree && mergeTree.map.size) {\n var applied = _this.applyMerges(mergeTree, entityRef, storeObject, context);\n if (isReference(applied)) {\n return;\n }\n storeObject = applied;\n }\n if (__DEV__ && !context.overwrite) {\n var fieldsWithSelectionSets_1 = Object.create(null);\n fieldNodeSet.forEach(function (field) {\n if (field.selectionSet) {\n fieldsWithSelectionSets_1[field.name.value] = true;\n }\n });\n var hasSelectionSet_1 = function (storeFieldName) {\n return fieldsWithSelectionSets_1[fieldNameFromStoreName(storeFieldName)] === true;\n };\n var hasMergeFunction_1 = function (storeFieldName) {\n var childTree = mergeTree && mergeTree.map.get(storeFieldName);\n return Boolean(childTree && childTree.info && childTree.info.merge);\n };\n Object.keys(storeObject).forEach(function (storeFieldName) {\n if (hasSelectionSet_1(storeFieldName) &&\n !hasMergeFunction_1(storeFieldName)) {\n warnAboutDataLoss(entityRef, storeObject, storeFieldName, context.store);\n }\n });\n }\n store.merge(dataId, storeObject);\n });\n store.retain(ref.__ref);\n return ref;\n };\n StoreWriter.prototype.processSelectionSet = function (_a) {\n var _this = this;\n var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context, mergeTree = _a.mergeTree;\n var policies = this.cache.policies;\n var incoming = Object.create(null);\n var typename = (dataId && policies.rootTypenamesById[dataId]) ||\n getTypenameFromResult(result, selectionSet, context.fragmentMap) ||\n (dataId && context.store.get(dataId, \"__typename\"));\n if (\"string\" === typeof typename) {\n incoming.__typename = typename;\n }\n var readField = function () {\n var options = normalizeReadFieldOptions(arguments, incoming, context.variables);\n if (isReference(options.from)) {\n var info = context.incomingById.get(options.from.__ref);\n if (info) {\n var result_1 = policies.readField(__assign(__assign({}, options), { from: info.storeObject }), context);\n if (result_1 !== void 0) {\n return result_1;\n }\n }\n }\n return policies.readField(options, context);\n };\n var fieldNodeSet = new Set();\n this.flattenFields(selectionSet, result, context, typename).forEach(function (context, field) {\n var _a;\n var resultFieldKey = resultKeyNameFromField(field);\n var value = result[resultFieldKey];\n fieldNodeSet.add(field);\n if (value !== void 0) {\n var storeFieldName = policies.getStoreFieldName({\n typename: typename,\n fieldName: field.name.value,\n field: field,\n variables: context.variables,\n });\n var childTree = getChildMergeTree(mergeTree, storeFieldName);\n var incomingValue = _this.processFieldValue(value, field, field.selectionSet\n ? getContextFlavor(context, false, false)\n : context, childTree);\n var childTypename = void 0;\n if (field.selectionSet &&\n (isReference(incomingValue) ||\n storeValueIsStoreObject(incomingValue))) {\n childTypename = readField(\"__typename\", incomingValue);\n }\n var merge = policies.getMergeFunction(typename, field.name.value, childTypename);\n if (merge) {\n childTree.info = {\n field: field,\n typename: typename,\n merge: merge,\n };\n }\n else {\n maybeRecycleChildMergeTree(mergeTree, storeFieldName);\n }\n incoming = context.merge(incoming, (_a = {},\n _a[storeFieldName] = incomingValue,\n _a));\n }\n else if (__DEV__ &&\n !context.clientOnly &&\n !context.deferred &&\n !addTypenameToDocument.added(field) &&\n !policies.getReadFunction(typename, field.name.value)) {\n __DEV__ && invariant.error(\"Missing field '\".concat(resultKeyNameFromField(field), \"' while writing result \").concat(JSON.stringify(result, null, 2)).substring(0, 1000));\n }\n });\n try {\n var _b = policies.identify(result, {\n typename: typename,\n selectionSet: selectionSet,\n fragmentMap: context.fragmentMap,\n storeObject: incoming,\n readField: readField,\n }), id = _b[0], keyObject = _b[1];\n dataId = dataId || id;\n if (keyObject) {\n incoming = context.merge(incoming, keyObject);\n }\n }\n catch (e) {\n if (!dataId)\n throw e;\n }\n if (\"string\" === typeof dataId) {\n var dataRef = makeReference(dataId);\n var sets = context.written[dataId] || (context.written[dataId] = []);\n if (sets.indexOf(selectionSet) >= 0)\n return dataRef;\n sets.push(selectionSet);\n if (this.reader && this.reader.isFresh(result, dataRef, selectionSet, context)) {\n return dataRef;\n }\n var previous_1 = context.incomingById.get(dataId);\n if (previous_1) {\n previous_1.storeObject = context.merge(previous_1.storeObject, incoming);\n previous_1.mergeTree = mergeMergeTrees(previous_1.mergeTree, mergeTree);\n fieldNodeSet.forEach(function (field) { return previous_1.fieldNodeSet.add(field); });\n }\n else {\n context.incomingById.set(dataId, {\n storeObject: incoming,\n mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree,\n fieldNodeSet: fieldNodeSet,\n });\n }\n return dataRef;\n }\n return incoming;\n };\n StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) {\n var _this = this;\n if (!field.selectionSet || value === null) {\n return __DEV__ ? cloneDeep(value) : value;\n }\n if (Array.isArray(value)) {\n return value.map(function (item, i) {\n var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i));\n maybeRecycleChildMergeTree(mergeTree, i);\n return value;\n });\n }\n return this.processSelectionSet({\n result: value,\n selectionSet: field.selectionSet,\n context: context,\n mergeTree: mergeTree,\n });\n };\n StoreWriter.prototype.flattenFields = function (selectionSet, result, context, typename) {\n if (typename === void 0) { typename = getTypenameFromResult(result, selectionSet, context.fragmentMap); }\n var fieldMap = new Map();\n var policies = this.cache.policies;\n var limitingTrie = new Trie(false);\n (function flatten(selectionSet, inheritedContext) {\n var visitedNode = limitingTrie.lookup(selectionSet, inheritedContext.clientOnly, inheritedContext.deferred);\n if (visitedNode.visited)\n return;\n visitedNode.visited = true;\n selectionSet.selections.forEach(function (selection) {\n if (!shouldInclude(selection, context.variables))\n return;\n var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred;\n if (!(clientOnly && deferred) &&\n isNonEmptyArray(selection.directives)) {\n selection.directives.forEach(function (dir) {\n var name = dir.name.value;\n if (name === \"client\")\n clientOnly = true;\n if (name === \"defer\") {\n var args = argumentsObjectFromField(dir, context.variables);\n if (!args || args.if !== false) {\n deferred = true;\n }\n }\n });\n }\n if (isField(selection)) {\n var existing = fieldMap.get(selection);\n if (existing) {\n clientOnly = clientOnly && existing.clientOnly;\n deferred = deferred && existing.deferred;\n }\n fieldMap.set(selection, getContextFlavor(context, clientOnly, deferred));\n }\n else {\n var fragment = getFragmentFromSelection(selection, context.fragmentMap);\n if (fragment &&\n policies.fragmentMatches(fragment, typename, result, context.variables)) {\n flatten(fragment.selectionSet, getContextFlavor(context, clientOnly, deferred));\n }\n }\n });\n })(selectionSet, context);\n return fieldMap;\n };\n StoreWriter.prototype.applyMerges = function (mergeTree, existing, incoming, context, getStorageArgs) {\n var _a;\n var _this = this;\n if (mergeTree.map.size && !isReference(incoming)) {\n var e_1 = (!Array.isArray(incoming) &&\n (isReference(existing) || storeValueIsStoreObject(existing))) ? existing : void 0;\n var i_1 = incoming;\n if (e_1 && !getStorageArgs) {\n getStorageArgs = [isReference(e_1) ? e_1.__ref : e_1];\n }\n var changedFields_1;\n var getValue_1 = function (from, name) {\n return Array.isArray(from)\n ? (typeof name === \"number\" ? from[name] : void 0)\n : context.store.getFieldValue(from, String(name));\n };\n mergeTree.map.forEach(function (childTree, storeFieldName) {\n var eVal = getValue_1(e_1, storeFieldName);\n var iVal = getValue_1(i_1, storeFieldName);\n if (void 0 === iVal)\n return;\n if (getStorageArgs) {\n getStorageArgs.push(storeFieldName);\n }\n var aVal = _this.applyMerges(childTree, eVal, iVal, context, getStorageArgs);\n if (aVal !== iVal) {\n changedFields_1 = changedFields_1 || new Map;\n changedFields_1.set(storeFieldName, aVal);\n }\n if (getStorageArgs) {\n invariant(getStorageArgs.pop() === storeFieldName);\n }\n });\n if (changedFields_1) {\n incoming = (Array.isArray(i_1) ? i_1.slice(0) : __assign({}, i_1));\n changedFields_1.forEach(function (value, name) {\n incoming[name] = value;\n });\n }\n }\n if (mergeTree.info) {\n return this.cache.policies.runMergeFunction(existing, incoming, mergeTree.info, context, getStorageArgs && (_a = context.store).getStorage.apply(_a, getStorageArgs));\n }\n return incoming;\n };\n return StoreWriter;\n}());\nexport { StoreWriter };\nvar emptyMergeTreePool = [];\nfunction getChildMergeTree(_a, name) {\n var map = _a.map;\n if (!map.has(name)) {\n map.set(name, emptyMergeTreePool.pop() || { map: new Map });\n }\n return map.get(name);\n}\nfunction mergeMergeTrees(left, right) {\n if (left === right || !right || mergeTreeIsEmpty(right))\n return left;\n if (!left || mergeTreeIsEmpty(left))\n return right;\n var info = left.info && right.info ? __assign(__assign({}, left.info), right.info) : left.info || right.info;\n var needToMergeMaps = left.map.size && right.map.size;\n var map = needToMergeMaps ? new Map :\n left.map.size ? left.map : right.map;\n var merged = { info: info, map: map };\n if (needToMergeMaps) {\n var remainingRightKeys_1 = new Set(right.map.keys());\n left.map.forEach(function (leftTree, key) {\n merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key)));\n remainingRightKeys_1.delete(key);\n });\n remainingRightKeys_1.forEach(function (key) {\n merged.map.set(key, mergeMergeTrees(right.map.get(key), left.map.get(key)));\n });\n }\n return merged;\n}\nfunction mergeTreeIsEmpty(tree) {\n return !tree || !(tree.info || tree.map.size);\n}\nfunction maybeRecycleChildMergeTree(_a, name) {\n var map = _a.map;\n var childTree = map.get(name);\n if (childTree && mergeTreeIsEmpty(childTree)) {\n emptyMergeTreePool.push(childTree);\n map.delete(name);\n }\n}\nvar warnings = new Set();\nfunction warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {\n var getChild = function (objOrRef) {\n var child = store.getFieldValue(objOrRef, storeFieldName);\n return typeof child === \"object\" && child;\n };\n var existing = getChild(existingRef);\n if (!existing)\n return;\n var incoming = getChild(incomingObj);\n if (!incoming)\n return;\n if (isReference(existing))\n return;\n if (equal(existing, incoming))\n return;\n if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) {\n return;\n }\n var parentType = store.getFieldValue(existingRef, \"__typename\") ||\n store.getFieldValue(incomingObj, \"__typename\");\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var typeDotName = \"\".concat(parentType, \".\").concat(fieldName);\n if (warnings.has(typeDotName))\n return;\n warnings.add(typeDotName);\n var childTypenames = [];\n if (!Array.isArray(existing) &&\n !Array.isArray(incoming)) {\n [existing, incoming].forEach(function (child) {\n var typename = store.getFieldValue(child, \"__typename\");\n if (typeof typename === \"string\" &&\n !childTypenames.includes(typename)) {\n childTypenames.push(typename);\n }\n });\n }\n __DEV__ && invariant.warn(\"Cache data may be lost when replacing the \".concat(fieldName, \" field of a \").concat(parentType, \" object.\\n\\nTo address this problem (which is not a bug in Apollo Client), \").concat(childTypenames.length\n ? \"either ensure all objects of type \" +\n childTypenames.join(\" and \") + \" have an ID or a custom merge function, or \"\n : \"\", \"define a custom merge function for the \").concat(typeDotName, \" field, so InMemoryCache can safely merge these objects:\\n\\n existing: \").concat(JSON.stringify(existing).slice(0, 1000), \"\\n incoming: \").concat(JSON.stringify(incoming).slice(0, 1000), \"\\n\\nFor more information about these options, please refer to the documentation:\\n\\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\\n\"));\n}\n//# sourceMappingURL=writeToStore.js.map","import { __assign, __extends } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport \"./fixPolyfills.js\";\nimport { wrap } from 'optimism';\nimport { equal } from '@wry/equality';\nimport { ApolloCache } from \"../core/cache.js\";\nimport { MissingFieldError } from \"../core/types/common.js\";\nimport { addTypenameToDocument, isReference, } from \"../../utilities/index.js\";\nimport { StoreReader } from \"./readFromStore.js\";\nimport { StoreWriter } from \"./writeToStore.js\";\nimport { EntityStore, supportsResultCaching } from \"./entityStore.js\";\nimport { makeVar, forgetCache, recallCache } from \"./reactiveVars.js\";\nimport { Policies } from \"./policies.js\";\nimport { hasOwn, normalizeConfig, shouldCanonizeResults } from \"./helpers.js\";\nimport { canonicalStringify } from \"./object-canon.js\";\nvar InMemoryCache = (function (_super) {\n __extends(InMemoryCache, _super);\n function InMemoryCache(config) {\n if (config === void 0) { config = {}; }\n var _this = _super.call(this) || this;\n _this.watches = new Set();\n _this.typenameDocumentCache = new Map();\n _this.makeVar = makeVar;\n _this.txCount = 0;\n _this.config = normalizeConfig(config);\n _this.addTypename = !!_this.config.addTypename;\n _this.policies = new Policies({\n cache: _this,\n dataIdFromObject: _this.config.dataIdFromObject,\n possibleTypes: _this.config.possibleTypes,\n typePolicies: _this.config.typePolicies,\n });\n _this.init();\n return _this;\n }\n InMemoryCache.prototype.init = function () {\n var rootStore = this.data = new EntityStore.Root({\n policies: this.policies,\n resultCaching: this.config.resultCaching,\n });\n this.optimisticData = rootStore.stump;\n this.resetResultCache();\n };\n InMemoryCache.prototype.resetResultCache = function (resetResultIdentities) {\n var _this = this;\n var previousReader = this.storeReader;\n this.storeWriter = new StoreWriter(this, this.storeReader = new StoreReader({\n cache: this,\n addTypename: this.addTypename,\n resultCacheMaxSize: this.config.resultCacheMaxSize,\n canonizeResults: shouldCanonizeResults(this.config),\n canon: resetResultIdentities\n ? void 0\n : previousReader && previousReader.canon,\n }));\n this.maybeBroadcastWatch = wrap(function (c, options) {\n return _this.broadcastWatch(c, options);\n }, {\n max: this.config.resultCacheMaxSize,\n makeCacheKey: function (c) {\n var store = c.optimistic ? _this.optimisticData : _this.data;\n if (supportsResultCaching(store)) {\n var optimistic = c.optimistic, rootId = c.rootId, variables = c.variables;\n return store.makeCacheKey(c.query, c.callback, canonicalStringify({ optimistic: optimistic, rootId: rootId, variables: variables }));\n }\n }\n });\n new Set([\n this.data.group,\n this.optimisticData.group,\n ]).forEach(function (group) { return group.resetCaching(); });\n };\n InMemoryCache.prototype.restore = function (data) {\n this.init();\n if (data)\n this.data.replace(data);\n return this;\n };\n InMemoryCache.prototype.extract = function (optimistic) {\n if (optimistic === void 0) { optimistic = false; }\n return (optimistic ? this.optimisticData : this.data).extract();\n };\n InMemoryCache.prototype.read = function (options) {\n var _a = options.returnPartialData, returnPartialData = _a === void 0 ? false : _a;\n try {\n return this.storeReader.diffQueryAgainstStore(__assign(__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null;\n }\n catch (e) {\n if (e instanceof MissingFieldError) {\n return null;\n }\n throw e;\n }\n };\n InMemoryCache.prototype.write = function (options) {\n try {\n ++this.txCount;\n return this.storeWriter.writeToStore(this.data, options);\n }\n finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n };\n InMemoryCache.prototype.modify = function (options) {\n if (hasOwn.call(options, \"id\") && !options.id) {\n return false;\n }\n var store = options.optimistic\n ? this.optimisticData\n : this.data;\n try {\n ++this.txCount;\n return store.modify(options.id || \"ROOT_QUERY\", options.fields);\n }\n finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n };\n InMemoryCache.prototype.diff = function (options) {\n return this.storeReader.diffQueryAgainstStore(__assign(__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || \"ROOT_QUERY\", config: this.config }));\n };\n InMemoryCache.prototype.watch = function (watch) {\n var _this = this;\n if (!this.watches.size) {\n recallCache(this);\n }\n this.watches.add(watch);\n if (watch.immediate) {\n this.maybeBroadcastWatch(watch);\n }\n return function () {\n if (_this.watches.delete(watch) && !_this.watches.size) {\n forgetCache(_this);\n }\n _this.maybeBroadcastWatch.forget(watch);\n };\n };\n InMemoryCache.prototype.gc = function (options) {\n canonicalStringify.reset();\n var ids = this.optimisticData.gc();\n if (options && !this.txCount) {\n if (options.resetResultCache) {\n this.resetResultCache(options.resetResultIdentities);\n }\n else if (options.resetResultIdentities) {\n this.storeReader.resetCanon();\n }\n }\n return ids;\n };\n InMemoryCache.prototype.retain = function (rootId, optimistic) {\n return (optimistic ? this.optimisticData : this.data).retain(rootId);\n };\n InMemoryCache.prototype.release = function (rootId, optimistic) {\n return (optimistic ? this.optimisticData : this.data).release(rootId);\n };\n InMemoryCache.prototype.identify = function (object) {\n if (isReference(object))\n return object.__ref;\n try {\n return this.policies.identify(object)[0];\n }\n catch (e) {\n __DEV__ && invariant.warn(e);\n }\n };\n InMemoryCache.prototype.evict = function (options) {\n if (!options.id) {\n if (hasOwn.call(options, \"id\")) {\n return false;\n }\n options = __assign(__assign({}, options), { id: \"ROOT_QUERY\" });\n }\n try {\n ++this.txCount;\n return this.optimisticData.evict(options, this.data);\n }\n finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n };\n InMemoryCache.prototype.reset = function (options) {\n var _this = this;\n this.init();\n canonicalStringify.reset();\n if (options && options.discardWatches) {\n this.watches.forEach(function (watch) { return _this.maybeBroadcastWatch.forget(watch); });\n this.watches.clear();\n forgetCache(this);\n }\n else {\n this.broadcastWatches();\n }\n return Promise.resolve();\n };\n InMemoryCache.prototype.removeOptimistic = function (idToRemove) {\n var newOptimisticData = this.optimisticData.removeLayer(idToRemove);\n if (newOptimisticData !== this.optimisticData) {\n this.optimisticData = newOptimisticData;\n this.broadcastWatches();\n }\n };\n InMemoryCache.prototype.batch = function (options) {\n var _this = this;\n var update = options.update, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, removeOptimistic = options.removeOptimistic, onWatchUpdated = options.onWatchUpdated;\n var updateResult;\n var perform = function (layer) {\n var _a = _this, data = _a.data, optimisticData = _a.optimisticData;\n ++_this.txCount;\n if (layer) {\n _this.data = _this.optimisticData = layer;\n }\n try {\n return updateResult = update(_this);\n }\n finally {\n --_this.txCount;\n _this.data = data;\n _this.optimisticData = optimisticData;\n }\n };\n var alreadyDirty = new Set();\n if (onWatchUpdated && !this.txCount) {\n this.broadcastWatches(__assign(__assign({}, options), { onWatchUpdated: function (watch) {\n alreadyDirty.add(watch);\n return false;\n } }));\n }\n if (typeof optimistic === 'string') {\n this.optimisticData = this.optimisticData.addLayer(optimistic, perform);\n }\n else if (optimistic === false) {\n perform(this.data);\n }\n else {\n perform();\n }\n if (typeof removeOptimistic === \"string\") {\n this.optimisticData = this.optimisticData.removeLayer(removeOptimistic);\n }\n if (onWatchUpdated && alreadyDirty.size) {\n this.broadcastWatches(__assign(__assign({}, options), { onWatchUpdated: function (watch, diff) {\n var result = onWatchUpdated.call(this, watch, diff);\n if (result !== false) {\n alreadyDirty.delete(watch);\n }\n return result;\n } }));\n if (alreadyDirty.size) {\n alreadyDirty.forEach(function (watch) { return _this.maybeBroadcastWatch.dirty(watch); });\n }\n }\n else {\n this.broadcastWatches(options);\n }\n return updateResult;\n };\n InMemoryCache.prototype.performTransaction = function (update, optimisticId) {\n return this.batch({\n update: update,\n optimistic: optimisticId || (optimisticId !== null),\n });\n };\n InMemoryCache.prototype.transformDocument = function (document) {\n if (this.addTypename) {\n var result = this.typenameDocumentCache.get(document);\n if (!result) {\n result = addTypenameToDocument(document);\n this.typenameDocumentCache.set(document, result);\n this.typenameDocumentCache.set(result, result);\n }\n return result;\n }\n return document;\n };\n InMemoryCache.prototype.broadcastWatches = function (options) {\n var _this = this;\n if (!this.txCount) {\n this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); });\n }\n };\n InMemoryCache.prototype.broadcastWatch = function (c, options) {\n var lastDiff = c.lastDiff;\n var diff = this.diff(c);\n if (options) {\n if (c.optimistic &&\n typeof options.optimistic === \"string\") {\n diff.fromOptimisticTransaction = true;\n }\n if (options.onWatchUpdated &&\n options.onWatchUpdated.call(this, c, diff, lastDiff) === false) {\n return;\n }\n }\n if (!lastDiff || !equal(lastDiff.result, diff.result)) {\n c.callback(c.lastDiff = diff, lastDiff);\n }\n };\n return InMemoryCache;\n}(ApolloCache));\nexport { InMemoryCache };\n//# sourceMappingURL=inMemoryCache.js.map","import { __extends } from \"tslib\";\nimport \"../utilities/globals/index.js\";\nimport { isNonEmptyArray } from \"../utilities/index.js\";\nexport function isApolloError(err) {\n return err.hasOwnProperty('graphQLErrors');\n}\nvar generateErrorMessage = function (err) {\n var message = '';\n if (isNonEmptyArray(err.graphQLErrors) || isNonEmptyArray(err.clientErrors)) {\n var errors = (err.graphQLErrors || [])\n .concat(err.clientErrors || []);\n errors.forEach(function (error) {\n var errorMessage = error\n ? error.message\n : 'Error message not found.';\n message += \"\".concat(errorMessage, \"\\n\");\n });\n }\n if (err.networkError) {\n message += \"\".concat(err.networkError.message, \"\\n\");\n }\n message = message.replace(/\\n$/, '');\n return message;\n};\nvar ApolloError = (function (_super) {\n __extends(ApolloError, _super);\n function ApolloError(_a) {\n var graphQLErrors = _a.graphQLErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo;\n var _this = _super.call(this, errorMessage) || this;\n _this.graphQLErrors = graphQLErrors || [];\n _this.clientErrors = clientErrors || [];\n _this.networkError = networkError || null;\n _this.message = errorMessage || generateErrorMessage(_this);\n _this.extraInfo = extraInfo;\n _this.__proto__ = ApolloError.prototype;\n return _this;\n }\n return ApolloError;\n}(Error));\nexport { ApolloError };\n//# sourceMappingURL=index.js.map","export var NetworkStatus;\n(function (NetworkStatus) {\n NetworkStatus[NetworkStatus[\"loading\"] = 1] = \"loading\";\n NetworkStatus[NetworkStatus[\"setVariables\"] = 2] = \"setVariables\";\n NetworkStatus[NetworkStatus[\"fetchMore\"] = 3] = \"fetchMore\";\n NetworkStatus[NetworkStatus[\"refetch\"] = 4] = \"refetch\";\n NetworkStatus[NetworkStatus[\"poll\"] = 6] = \"poll\";\n NetworkStatus[NetworkStatus[\"ready\"] = 7] = \"ready\";\n NetworkStatus[NetworkStatus[\"error\"] = 8] = \"error\";\n})(NetworkStatus || (NetworkStatus = {}));\nexport function isNetworkRequestInFlight(networkStatus) {\n return networkStatus ? networkStatus < 7 : false;\n}\n//# sourceMappingURL=networkStatus.js.map","import { __assign, __extends } from \"tslib\";\nimport { invariant } from \"../utilities/globals/index.js\";\nimport { equal } from '@wry/equality';\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport { compact, cloneDeep, getOperationDefinition, Observable, iterateObserversSafely, isNonEmptyArray, fixObservableSubclass, getQueryDefinition, } from \"../utilities/index.js\";\nvar assign = Object.assign, hasOwnProperty = Object.hasOwnProperty;\nvar warnedAboutUpdateQuery = false;\nvar ObservableQuery = (function (_super) {\n __extends(ObservableQuery, _super);\n function ObservableQuery(_a) {\n var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;\n var _this = _super.call(this, function (observer) {\n try {\n var subObserver = observer._subscription._observer;\n if (subObserver && !subObserver.error) {\n subObserver.error = defaultSubscriptionObserverErrorCallback;\n }\n }\n catch (_a) { }\n var first = !_this.observers.size;\n _this.observers.add(observer);\n var last = _this.last;\n if (last && last.error) {\n observer.error && observer.error(last.error);\n }\n else if (last && last.result) {\n observer.next && observer.next(last.result);\n }\n if (first) {\n _this.reobserve().catch(function () { });\n }\n return function () {\n if (_this.observers.delete(observer) && !_this.observers.size) {\n _this.tearDownQuery();\n }\n };\n }) || this;\n _this.observers = new Set();\n _this.subscriptions = new Set();\n _this.isTornDown = false;\n _this.options = options;\n _this.queryId = queryInfo.queryId || queryManager.generateQueryId();\n var opDef = getOperationDefinition(options.query);\n _this.queryName = opDef && opDef.name && opDef.name.value;\n _this.initialFetchPolicy = options.fetchPolicy || \"cache-first\";\n _this.queryManager = queryManager;\n _this.queryInfo = queryInfo;\n return _this;\n }\n Object.defineProperty(ObservableQuery.prototype, \"variables\", {\n get: function () {\n return this.options.variables;\n },\n enumerable: false,\n configurable: true\n });\n ObservableQuery.prototype.result = function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n var observer = {\n next: function (result) {\n resolve(result);\n _this.observers.delete(observer);\n if (!_this.observers.size) {\n _this.queryManager.removeQuery(_this.queryId);\n }\n setTimeout(function () {\n subscription.unsubscribe();\n }, 0);\n },\n error: reject,\n };\n var subscription = _this.subscribe(observer);\n });\n };\n ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) {\n if (saveAsLastResult === void 0) { saveAsLastResult = true; }\n var lastResult = this.getLastResult(true);\n var networkStatus = this.queryInfo.networkStatus ||\n (lastResult && lastResult.networkStatus) ||\n NetworkStatus.ready;\n var result = __assign(__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });\n var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? \"cache-first\" : _a;\n if (fetchPolicy === 'network-only' ||\n fetchPolicy === 'no-cache' ||\n fetchPolicy === 'standby' ||\n this.queryManager.transform(this.options.query).hasForcedResolvers) {\n }\n else {\n var diff = this.queryInfo.getDiff();\n if (diff.complete || this.options.returnPartialData) {\n result.data = diff.result;\n }\n if (equal(result.data, {})) {\n result.data = void 0;\n }\n if (diff.complete) {\n delete result.partial;\n if (diff.complete &&\n result.networkStatus === NetworkStatus.loading &&\n (fetchPolicy === 'cache-first' ||\n fetchPolicy === 'cache-only')) {\n result.networkStatus = NetworkStatus.ready;\n result.loading = false;\n }\n }\n else {\n result.partial = true;\n }\n if (__DEV__ &&\n !diff.complete &&\n !this.options.partialRefetch &&\n !result.loading &&\n !result.data &&\n !result.error) {\n logMissingFieldErrors(diff.missing);\n }\n }\n if (saveAsLastResult) {\n this.updateLastResult(result);\n }\n return result;\n };\n ObservableQuery.prototype.isDifferentFromLastResult = function (newResult) {\n return !this.last || !equal(this.last.result, newResult);\n };\n ObservableQuery.prototype.getLast = function (key, variablesMustMatch) {\n var last = this.last;\n if (last &&\n last[key] &&\n (!variablesMustMatch || equal(last.variables, this.variables))) {\n return last[key];\n }\n };\n ObservableQuery.prototype.getLastResult = function (variablesMustMatch) {\n return this.getLast(\"result\", variablesMustMatch);\n };\n ObservableQuery.prototype.getLastError = function (variablesMustMatch) {\n return this.getLast(\"error\", variablesMustMatch);\n };\n ObservableQuery.prototype.resetLastResults = function () {\n delete this.last;\n this.isTornDown = false;\n };\n ObservableQuery.prototype.resetQueryStoreErrors = function () {\n this.queryManager.resetErrors(this.queryId);\n };\n ObservableQuery.prototype.refetch = function (variables) {\n var _a;\n var reobserveOptions = {\n pollInterval: 0,\n };\n var fetchPolicy = this.options.fetchPolicy;\n if (fetchPolicy === 'standby' || fetchPolicy === 'cache-and-network') {\n reobserveOptions.fetchPolicy = fetchPolicy;\n }\n else if (fetchPolicy === 'no-cache') {\n reobserveOptions.fetchPolicy = 'no-cache';\n }\n else {\n reobserveOptions.fetchPolicy = 'network-only';\n }\n if (__DEV__ && variables && hasOwnProperty.call(variables, \"variables\")) {\n var queryDef = getQueryDefinition(this.options.query);\n var vars = queryDef.variableDefinitions;\n if (!vars || !vars.some(function (v) { return v.variable.name.value === \"variables\"; })) {\n __DEV__ && invariant.warn(\"Called refetch(\".concat(JSON.stringify(variables), \") for query \").concat(((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || JSON.stringify(queryDef), \", which does not declare a $variables variable.\\nDid you mean to call refetch(variables) instead of refetch({ variables })?\"));\n }\n }\n if (variables && !equal(this.options.variables, variables)) {\n reobserveOptions.variables = this.options.variables = __assign(__assign({}, this.options.variables), variables);\n }\n this.queryInfo.resetLastWrite();\n return this.reobserve(reobserveOptions, NetworkStatus.refetch);\n };\n ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {\n var _this = this;\n var combinedOptions = __assign(__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : __assign(__assign(__assign({}, this.options), fetchMoreOptions), { variables: __assign(__assign({}, this.options.variables), fetchMoreOptions.variables) }))), { fetchPolicy: \"no-cache\" });\n var qid = this.queryManager.generateQueryId();\n if (combinedOptions.notifyOnNetworkStatusChange) {\n this.queryInfo.networkStatus = NetworkStatus.fetchMore;\n this.observe();\n }\n return this.queryManager.fetchQuery(qid, combinedOptions, NetworkStatus.fetchMore).then(function (fetchMoreResult) {\n var data = fetchMoreResult.data;\n var updateQuery = fetchMoreOptions.updateQuery;\n if (updateQuery) {\n if (__DEV__ &&\n !warnedAboutUpdateQuery) {\n __DEV__ && invariant.warn(\"The updateQuery callback for fetchMore is deprecated, and will be removed\\nin the next major version of Apollo Client.\\n\\nPlease convert updateQuery functions to field policies with appropriate\\nread and merge functions, or use/adapt a helper function (such as\\nconcatPagination, offsetLimitPagination, or relayStylePagination) from\\n@apollo/client/utilities.\\n\\nThe field policy system handles pagination more effectively than a\\nhand-written updateQuery function, and you only need to define the policy\\nonce, rather than every time you call fetchMore.\");\n warnedAboutUpdateQuery = true;\n }\n _this.updateQuery(function (previous) { return updateQuery(previous, {\n fetchMoreResult: data,\n variables: combinedOptions.variables,\n }); });\n }\n else {\n _this.queryManager.cache.writeQuery({\n query: combinedOptions.query,\n variables: combinedOptions.variables,\n data: data,\n });\n }\n return fetchMoreResult;\n }).finally(function () {\n _this.queryManager.stopQuery(qid);\n _this.reobserve();\n });\n };\n ObservableQuery.prototype.subscribeToMore = function (options) {\n var _this = this;\n var subscription = this.queryManager\n .startGraphQLSubscription({\n query: options.document,\n variables: options.variables,\n context: options.context,\n })\n .subscribe({\n next: function (subscriptionData) {\n var updateQuery = options.updateQuery;\n if (updateQuery) {\n _this.updateQuery(function (previous, _a) {\n var variables = _a.variables;\n return updateQuery(previous, {\n subscriptionData: subscriptionData,\n variables: variables,\n });\n });\n }\n },\n error: function (err) {\n if (options.onError) {\n options.onError(err);\n return;\n }\n __DEV__ && invariant.error('Unhandled GraphQL subscription error', err);\n },\n });\n this.subscriptions.add(subscription);\n return function () {\n if (_this.subscriptions.delete(subscription)) {\n subscription.unsubscribe();\n }\n };\n };\n ObservableQuery.prototype.setOptions = function (newOptions) {\n return this.reobserve(newOptions);\n };\n ObservableQuery.prototype.setVariables = function (variables) {\n if (equal(this.variables, variables)) {\n return this.observers.size\n ? this.result()\n : Promise.resolve();\n }\n this.options.variables = variables;\n if (!this.observers.size) {\n return Promise.resolve();\n }\n return this.reobserve({\n fetchPolicy: this.initialFetchPolicy,\n variables: variables,\n }, NetworkStatus.setVariables);\n };\n ObservableQuery.prototype.updateQuery = function (mapFn) {\n var queryManager = this.queryManager;\n var result = queryManager.cache.diff({\n query: this.options.query,\n variables: this.variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n var newResult = mapFn(result, {\n variables: this.variables,\n });\n if (newResult) {\n queryManager.cache.writeQuery({\n query: this.options.query,\n data: newResult,\n variables: this.variables,\n });\n queryManager.broadcastQueries();\n }\n };\n ObservableQuery.prototype.startPolling = function (pollInterval) {\n this.options.pollInterval = pollInterval;\n this.updatePolling();\n };\n ObservableQuery.prototype.stopPolling = function () {\n this.options.pollInterval = 0;\n this.updatePolling();\n };\n ObservableQuery.prototype.fetch = function (options, newNetworkStatus) {\n this.queryManager.setObservableQuery(this);\n return this.queryManager.fetchQueryObservable(this.queryId, options, newNetworkStatus);\n };\n ObservableQuery.prototype.updatePolling = function () {\n var _this = this;\n if (this.queryManager.ssrMode) {\n return;\n }\n var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval;\n if (!pollInterval) {\n if (pollingInfo) {\n clearTimeout(pollingInfo.timeout);\n delete this.pollingInfo;\n }\n return;\n }\n if (pollingInfo &&\n pollingInfo.interval === pollInterval) {\n return;\n }\n __DEV__ ? invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : invariant(pollInterval, 10);\n var info = pollingInfo || (this.pollingInfo = {});\n info.interval = pollInterval;\n var maybeFetch = function () {\n if (_this.pollingInfo) {\n if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus)) {\n _this.reobserve({\n fetchPolicy: \"network-only\",\n }, NetworkStatus.poll).then(poll, poll);\n }\n else {\n poll();\n }\n }\n ;\n };\n var poll = function () {\n var info = _this.pollingInfo;\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n poll();\n };\n ObservableQuery.prototype.updateLastResult = function (newResult, variables) {\n if (variables === void 0) { variables = this.variables; }\n this.last = __assign(__assign({}, this.last), { result: this.queryManager.assumeImmutableResults\n ? newResult\n : cloneDeep(newResult), variables: variables });\n if (!isNonEmptyArray(newResult.errors)) {\n delete this.last.error;\n }\n return this.last;\n };\n ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) {\n var _this = this;\n this.isTornDown = false;\n var useDisposableConcast = newNetworkStatus === NetworkStatus.refetch ||\n newNetworkStatus === NetworkStatus.fetchMore ||\n newNetworkStatus === NetworkStatus.poll;\n var oldVariables = this.options.variables;\n var options = useDisposableConcast\n ? compact(this.options, newOptions)\n : assign(this.options, compact(newOptions));\n if (!useDisposableConcast) {\n this.updatePolling();\n if (newOptions &&\n newOptions.variables &&\n !newOptions.fetchPolicy &&\n !equal(newOptions.variables, oldVariables)) {\n options.fetchPolicy = this.initialFetchPolicy;\n if (newNetworkStatus === void 0) {\n newNetworkStatus = NetworkStatus.setVariables;\n }\n }\n }\n var variables = options.variables && __assign({}, options.variables);\n var concast = this.fetch(options, newNetworkStatus);\n var observer = {\n next: function (result) {\n _this.reportResult(result, variables);\n },\n error: function (error) {\n _this.reportError(error, variables);\n },\n };\n if (!useDisposableConcast) {\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer, true);\n }\n this.concast = concast;\n this.observer = observer;\n }\n concast.addObserver(observer);\n return concast.promise;\n };\n ObservableQuery.prototype.observe = function () {\n this.reportResult(this.getCurrentResult(false), this.variables);\n };\n ObservableQuery.prototype.reportResult = function (result, variables) {\n if (this.getLastError() || this.isDifferentFromLastResult(result)) {\n this.updateLastResult(result, variables);\n iterateObserversSafely(this.observers, 'next', result);\n }\n };\n ObservableQuery.prototype.reportError = function (error, variables) {\n var errorResult = __assign(__assign({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: NetworkStatus.error, loading: false });\n this.updateLastResult(errorResult, variables);\n iterateObserversSafely(this.observers, 'error', this.last.error = error);\n };\n ObservableQuery.prototype.hasObservers = function () {\n return this.observers.size > 0;\n };\n ObservableQuery.prototype.tearDownQuery = function () {\n if (this.isTornDown)\n return;\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n delete this.concast;\n delete this.observer;\n }\n this.stopPolling();\n this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });\n this.subscriptions.clear();\n this.queryManager.stopQuery(this.queryId);\n this.observers.clear();\n this.isTornDown = true;\n };\n return ObservableQuery;\n}(Observable));\nexport { ObservableQuery };\nfixObservableSubclass(ObservableQuery);\nfunction defaultSubscriptionObserverErrorCallback(error) {\n __DEV__ && invariant.error('Unhandled error', error.message, error.stack);\n}\nexport function logMissingFieldErrors(missing) {\n if (__DEV__ && missing) {\n __DEV__ && invariant.debug(\"Missing cache result fields: \".concat(JSON.stringify(missing)), missing);\n }\n}\nexport function applyNextFetchPolicy(options) {\n var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? \"cache-first\" : _a, nextFetchPolicy = options.nextFetchPolicy;\n if (nextFetchPolicy) {\n options.fetchPolicy = typeof nextFetchPolicy === \"function\"\n ? nextFetchPolicy.call(options, fetchPolicy)\n : nextFetchPolicy;\n }\n}\n//# sourceMappingURL=ObservableQuery.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { invariant } from \"../utilities/globals/index.js\";\nimport { visit, BREAK, } from 'graphql';\nimport { argumentsObjectFromField, buildQueryFromSelectionSet, createFragmentMap, getFragmentDefinitions, getMainDefinition, hasDirectives, isField, isInlineFragment, mergeDeep, mergeDeepArray, removeClientSetsFromDocument, resultKeyNameFromField, shouldInclude, } from \"../utilities/index.js\";\nimport { cacheSlot } from \"../cache/index.js\";\nvar LocalState = (function () {\n function LocalState(_a) {\n var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;\n this.cache = cache;\n if (client) {\n this.client = client;\n }\n if (resolvers) {\n this.addResolvers(resolvers);\n }\n if (fragmentMatcher) {\n this.setFragmentMatcher(fragmentMatcher);\n }\n }\n LocalState.prototype.addResolvers = function (resolvers) {\n var _this = this;\n this.resolvers = this.resolvers || {};\n if (Array.isArray(resolvers)) {\n resolvers.forEach(function (resolverGroup) {\n _this.resolvers = mergeDeep(_this.resolvers, resolverGroup);\n });\n }\n else {\n this.resolvers = mergeDeep(this.resolvers, resolvers);\n }\n };\n LocalState.prototype.setResolvers = function (resolvers) {\n this.resolvers = {};\n this.addResolvers(resolvers);\n };\n LocalState.prototype.getResolvers = function () {\n return this.resolvers || {};\n };\n LocalState.prototype.runResolvers = function (_a) {\n var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b;\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_c) {\n if (document) {\n return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (__assign(__assign({}, remoteResult), { data: localResult.result })); })];\n }\n return [2, remoteResult];\n });\n });\n };\n LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) {\n this.fragmentMatcher = fragmentMatcher;\n };\n LocalState.prototype.getFragmentMatcher = function () {\n return this.fragmentMatcher;\n };\n LocalState.prototype.clientQuery = function (document) {\n if (hasDirectives(['client'], document)) {\n if (this.resolvers) {\n return document;\n }\n }\n return null;\n };\n LocalState.prototype.serverQuery = function (document) {\n return removeClientSetsFromDocument(document);\n };\n LocalState.prototype.prepareContext = function (context) {\n var cache = this.cache;\n return __assign(__assign({}, context), { cache: cache, getCacheKey: function (obj) {\n return cache.identify(obj);\n } });\n };\n LocalState.prototype.addExportedVariables = function (document, variables, context) {\n if (variables === void 0) { variables = {}; }\n if (context === void 0) { context = {}; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (document) {\n return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (__assign(__assign({}, variables), data.exportedVariables)); })];\n }\n return [2, __assign({}, variables)];\n });\n });\n };\n LocalState.prototype.shouldForceResolvers = function (document) {\n var forceResolvers = false;\n visit(document, {\n Directive: {\n enter: function (node) {\n if (node.name.value === 'client' && node.arguments) {\n forceResolvers = node.arguments.some(function (arg) {\n return arg.name.value === 'always' &&\n arg.value.kind === 'BooleanValue' &&\n arg.value.value === true;\n });\n if (forceResolvers) {\n return BREAK;\n }\n }\n },\n },\n });\n return forceResolvers;\n };\n LocalState.prototype.buildRootValueFromCache = function (document, variables) {\n return this.cache.diff({\n query: buildQueryFromSelectionSet(document),\n variables: variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n };\n LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) {\n if (context === void 0) { context = {}; }\n if (variables === void 0) { variables = {}; }\n if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; }\n if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; }\n return __awaiter(this, void 0, void 0, function () {\n var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext;\n return __generator(this, function (_b) {\n mainDefinition = getMainDefinition(document);\n fragments = getFragmentDefinitions(document);\n fragmentMap = createFragmentMap(fragments);\n definitionOperation = mainDefinition\n .operation;\n defaultOperationType = definitionOperation\n ? definitionOperation.charAt(0).toUpperCase() +\n definitionOperation.slice(1)\n : 'Query';\n _a = this, cache = _a.cache, client = _a.client;\n execContext = {\n fragmentMap: fragmentMap,\n context: __assign(__assign({}, context), { cache: cache, client: client }),\n variables: variables,\n fragmentMatcher: fragmentMatcher,\n defaultOperationType: defaultOperationType,\n exportedVariables: {},\n onlyRunForcedResolvers: onlyRunForcedResolvers,\n };\n return [2, this.resolveSelectionSet(mainDefinition.selectionSet, rootValue, execContext).then(function (result) { return ({\n result: result,\n exportedVariables: execContext.exportedVariables,\n }); })];\n });\n });\n };\n LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) {\n return __awaiter(this, void 0, void 0, function () {\n var fragmentMap, context, variables, resultsToMerge, execute;\n var _this = this;\n return __generator(this, function (_a) {\n fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables;\n resultsToMerge = [rootValue];\n execute = function (selection) { return __awaiter(_this, void 0, void 0, function () {\n var fragment, typeCondition;\n return __generator(this, function (_a) {\n if (!shouldInclude(selection, variables)) {\n return [2];\n }\n if (isField(selection)) {\n return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) {\n var _a;\n if (typeof fieldResult !== 'undefined') {\n resultsToMerge.push((_a = {},\n _a[resultKeyNameFromField(selection)] = fieldResult,\n _a));\n }\n })];\n }\n if (isInlineFragment(selection)) {\n fragment = selection;\n }\n else {\n fragment = fragmentMap[selection.name.value];\n __DEV__ ? invariant(fragment, \"No fragment named \".concat(selection.name.value)) : invariant(fragment, 9);\n }\n if (fragment && fragment.typeCondition) {\n typeCondition = fragment.typeCondition.name.value;\n if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {\n return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) {\n resultsToMerge.push(fragmentResult);\n })];\n }\n }\n return [2];\n });\n }); };\n return [2, Promise.all(selectionSet.selections.map(execute)).then(function () {\n return mergeDeepArray(resultsToMerge);\n })];\n });\n });\n };\n LocalState.prototype.resolveField = function (field, rootValue, execContext) {\n return __awaiter(this, void 0, void 0, function () {\n var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve;\n var _this = this;\n return __generator(this, function (_a) {\n variables = execContext.variables;\n fieldName = field.name.value;\n aliasedFieldName = resultKeyNameFromField(field);\n aliasUsed = fieldName !== aliasedFieldName;\n defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName];\n resultPromise = Promise.resolve(defaultResult);\n if (!execContext.onlyRunForcedResolvers ||\n this.shouldForceResolvers(field)) {\n resolverType = rootValue.__typename || execContext.defaultOperationType;\n resolverMap = this.resolvers && this.resolvers[resolverType];\n if (resolverMap) {\n resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];\n if (resolve) {\n resultPromise = Promise.resolve(cacheSlot.withValue(this.cache, resolve, [\n rootValue,\n argumentsObjectFromField(field, variables),\n execContext.context,\n { field: field, fragmentMap: execContext.fragmentMap },\n ]));\n }\n }\n }\n return [2, resultPromise.then(function (result) {\n if (result === void 0) { result = defaultResult; }\n if (field.directives) {\n field.directives.forEach(function (directive) {\n if (directive.name.value === 'export' && directive.arguments) {\n directive.arguments.forEach(function (arg) {\n if (arg.name.value === 'as' && arg.value.kind === 'StringValue') {\n execContext.exportedVariables[arg.value.value] = result;\n }\n });\n }\n });\n }\n if (!field.selectionSet) {\n return result;\n }\n if (result == null) {\n return result;\n }\n if (Array.isArray(result)) {\n return _this.resolveSubSelectedArray(field, result, execContext);\n }\n if (field.selectionSet) {\n return _this.resolveSelectionSet(field.selectionSet, result, execContext);\n }\n })];\n });\n });\n };\n LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) {\n var _this = this;\n return Promise.all(result.map(function (item) {\n if (item === null) {\n return null;\n }\n if (Array.isArray(item)) {\n return _this.resolveSubSelectedArray(field, item, execContext);\n }\n if (field.selectionSet) {\n return _this.resolveSelectionSet(field.selectionSet, item, execContext);\n }\n }));\n };\n return LocalState;\n}());\nexport { LocalState };\n//# sourceMappingURL=LocalState.js.map","import { __assign } from \"tslib\";\nimport { equal } from \"@wry/equality\";\nimport { isNonEmptyArray, graphQLResultHasError, canUseWeakMap, } from \"../utilities/index.js\";\nimport { NetworkStatus, isNetworkRequestInFlight, } from \"./networkStatus.js\";\n;\nvar destructiveMethodCounts = new (canUseWeakMap ? WeakMap : Map)();\nfunction wrapDestructiveCacheMethod(cache, methodName) {\n var original = cache[methodName];\n if (typeof original === \"function\") {\n cache[methodName] = function () {\n destructiveMethodCounts.set(cache, (destructiveMethodCounts.get(cache) + 1) % 1e15);\n return original.apply(this, arguments);\n };\n }\n}\nfunction cancelNotifyTimeout(info) {\n if (info[\"notifyTimeout\"]) {\n clearTimeout(info[\"notifyTimeout\"]);\n info[\"notifyTimeout\"] = void 0;\n }\n}\nvar QueryInfo = (function () {\n function QueryInfo(queryManager, queryId) {\n if (queryId === void 0) { queryId = queryManager.generateQueryId(); }\n this.queryId = queryId;\n this.listeners = new Set();\n this.document = null;\n this.lastRequestId = 1;\n this.subscriptions = new Set();\n this.stopped = false;\n this.dirty = false;\n this.observableQuery = null;\n var cache = this.cache = queryManager.cache;\n if (!destructiveMethodCounts.has(cache)) {\n destructiveMethodCounts.set(cache, 0);\n wrapDestructiveCacheMethod(cache, \"evict\");\n wrapDestructiveCacheMethod(cache, \"modify\");\n wrapDestructiveCacheMethod(cache, \"reset\");\n }\n }\n QueryInfo.prototype.init = function (query) {\n var networkStatus = query.networkStatus || NetworkStatus.loading;\n if (this.variables &&\n this.networkStatus !== NetworkStatus.loading &&\n !equal(this.variables, query.variables)) {\n networkStatus = NetworkStatus.setVariables;\n }\n if (!equal(query.variables, this.variables)) {\n this.lastDiff = void 0;\n }\n Object.assign(this, {\n document: query.document,\n variables: query.variables,\n networkError: null,\n graphQLErrors: this.graphQLErrors || [],\n networkStatus: networkStatus,\n });\n if (query.observableQuery) {\n this.setObservableQuery(query.observableQuery);\n }\n if (query.lastRequestId) {\n this.lastRequestId = query.lastRequestId;\n }\n return this;\n };\n QueryInfo.prototype.reset = function () {\n cancelNotifyTimeout(this);\n this.lastDiff = void 0;\n this.dirty = false;\n };\n QueryInfo.prototype.getDiff = function (variables) {\n if (variables === void 0) { variables = this.variables; }\n var options = this.getDiffOptions(variables);\n if (this.lastDiff && equal(options, this.lastDiff.options)) {\n return this.lastDiff.diff;\n }\n this.updateWatch(this.variables = variables);\n var oq = this.observableQuery;\n if (oq && oq.options.fetchPolicy === \"no-cache\") {\n return { complete: false };\n }\n var diff = this.cache.diff(options);\n this.updateLastDiff(diff, options);\n return diff;\n };\n QueryInfo.prototype.updateLastDiff = function (diff, options) {\n this.lastDiff = diff ? {\n diff: diff,\n options: options || this.getDiffOptions(),\n } : void 0;\n };\n QueryInfo.prototype.getDiffOptions = function (variables) {\n var _a;\n if (variables === void 0) { variables = this.variables; }\n return {\n query: this.document,\n variables: variables,\n returnPartialData: true,\n optimistic: true,\n canonizeResults: (_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.canonizeResults,\n };\n };\n QueryInfo.prototype.setDiff = function (diff) {\n var _this = this;\n var oldDiff = this.lastDiff && this.lastDiff.diff;\n this.updateLastDiff(diff);\n if (!this.dirty &&\n !equal(oldDiff && oldDiff.result, diff && diff.result)) {\n this.dirty = true;\n if (!this.notifyTimeout) {\n this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0);\n }\n }\n };\n QueryInfo.prototype.setObservableQuery = function (oq) {\n var _this = this;\n if (oq === this.observableQuery)\n return;\n if (this.oqListener) {\n this.listeners.delete(this.oqListener);\n }\n this.observableQuery = oq;\n if (oq) {\n oq[\"queryInfo\"] = this;\n this.listeners.add(this.oqListener = function () {\n if (_this.getDiff().fromOptimisticTransaction) {\n oq[\"observe\"]();\n }\n else {\n oq.reobserve();\n }\n });\n }\n else {\n delete this.oqListener;\n }\n };\n QueryInfo.prototype.notify = function () {\n var _this = this;\n cancelNotifyTimeout(this);\n if (this.shouldNotify()) {\n this.listeners.forEach(function (listener) { return listener(_this); });\n }\n this.dirty = false;\n };\n QueryInfo.prototype.shouldNotify = function () {\n if (!this.dirty || !this.listeners.size) {\n return false;\n }\n if (isNetworkRequestInFlight(this.networkStatus) &&\n this.observableQuery) {\n var fetchPolicy = this.observableQuery.options.fetchPolicy;\n if (fetchPolicy !== \"cache-only\" &&\n fetchPolicy !== \"cache-and-network\") {\n return false;\n }\n }\n return true;\n };\n QueryInfo.prototype.stop = function () {\n if (!this.stopped) {\n this.stopped = true;\n this.reset();\n this.cancel();\n this.cancel = QueryInfo.prototype.cancel;\n this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });\n var oq = this.observableQuery;\n if (oq)\n oq.stopPolling();\n }\n };\n QueryInfo.prototype.cancel = function () { };\n QueryInfo.prototype.updateWatch = function (variables) {\n var _this = this;\n if (variables === void 0) { variables = this.variables; }\n var oq = this.observableQuery;\n if (oq && oq.options.fetchPolicy === \"no-cache\") {\n return;\n }\n var watchOptions = __assign(__assign({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } });\n if (!this.lastWatch ||\n !equal(watchOptions, this.lastWatch)) {\n this.cancel();\n this.cancel = this.cache.watch(this.lastWatch = watchOptions);\n }\n };\n QueryInfo.prototype.resetLastWrite = function () {\n this.lastWrite = void 0;\n };\n QueryInfo.prototype.shouldWrite = function (result, variables) {\n var lastWrite = this.lastWrite;\n return !(lastWrite &&\n lastWrite.dmCount === destructiveMethodCounts.get(this.cache) &&\n equal(variables, lastWrite.variables) &&\n equal(result.data, lastWrite.result.data));\n };\n QueryInfo.prototype.markResult = function (result, options, cacheWriteBehavior) {\n var _this = this;\n this.graphQLErrors = isNonEmptyArray(result.errors) ? result.errors : [];\n this.reset();\n if (options.fetchPolicy === 'no-cache') {\n this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables));\n }\n else if (cacheWriteBehavior !== 0) {\n if (shouldWriteResult(result, options.errorPolicy)) {\n this.cache.performTransaction(function (cache) {\n if (_this.shouldWrite(result, options.variables)) {\n cache.writeQuery({\n query: _this.document,\n data: result.data,\n variables: options.variables,\n overwrite: cacheWriteBehavior === 1,\n });\n _this.lastWrite = {\n result: result,\n variables: options.variables,\n dmCount: destructiveMethodCounts.get(_this.cache),\n };\n }\n else {\n if (_this.lastDiff &&\n _this.lastDiff.diff.complete) {\n result.data = _this.lastDiff.diff.result;\n return;\n }\n }\n var diffOptions = _this.getDiffOptions(options.variables);\n var diff = cache.diff(diffOptions);\n if (!_this.stopped) {\n _this.updateWatch(options.variables);\n }\n _this.updateLastDiff(diff, diffOptions);\n if (diff.complete) {\n result.data = diff.result;\n }\n });\n }\n else {\n this.lastWrite = void 0;\n }\n }\n };\n QueryInfo.prototype.markReady = function () {\n this.networkError = null;\n return this.networkStatus = NetworkStatus.ready;\n };\n QueryInfo.prototype.markError = function (error) {\n this.networkStatus = NetworkStatus.error;\n this.lastWrite = void 0;\n this.reset();\n if (error.graphQLErrors) {\n this.graphQLErrors = error.graphQLErrors;\n }\n if (error.networkError) {\n this.networkError = error.networkError;\n }\n return error;\n };\n return QueryInfo;\n}());\nexport { QueryInfo };\nexport function shouldWriteResult(result, errorPolicy) {\n if (errorPolicy === void 0) { errorPolicy = \"none\"; }\n var ignoreErrors = errorPolicy === \"ignore\" ||\n errorPolicy === \"all\";\n var writeWithErrors = !graphQLResultHasError(result);\n if (!writeWithErrors && ignoreErrors && result.data) {\n writeWithErrors = true;\n }\n return writeWithErrors;\n}\n//# sourceMappingURL=QueryInfo.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { invariant, InvariantError } from \"../utilities/globals/index.js\";\nimport { equal } from '@wry/equality';\nimport { execute } from \"../link/core/index.js\";\nimport { canonicalStringify } from \"../cache/index.js\";\nimport { getDefaultValues, getOperationDefinition, getOperationName, hasClientExports, graphQLResultHasError, removeConnectionDirectiveFromDocument, canUseWeakMap, Observable, asyncMap, isNonEmptyArray, Concast, makeUniqueId, isDocumentNode, isNonNullObject, } from \"../utilities/index.js\";\nimport { ApolloError, isApolloError } from \"../errors/index.js\";\nimport { ObservableQuery, applyNextFetchPolicy, logMissingFieldErrors } from \"./ObservableQuery.js\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport { LocalState } from \"./LocalState.js\";\nimport { QueryInfo, shouldWriteResult, } from \"./QueryInfo.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar QueryManager = (function () {\n function QueryManager(_a) {\n var cache = _a.cache, link = _a.link, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, assumeImmutableResults = _a.assumeImmutableResults;\n this.clientAwareness = {};\n this.queries = new Map();\n this.fetchCancelFns = new Map();\n this.transformCache = new (canUseWeakMap ? WeakMap : Map)();\n this.queryIdCounter = 1;\n this.requestIdCounter = 1;\n this.mutationIdCounter = 1;\n this.inFlightLinkObservables = new Map();\n this.cache = cache;\n this.link = link;\n this.queryDeduplication = queryDeduplication;\n this.clientAwareness = clientAwareness;\n this.localState = localState || new LocalState({ cache: cache });\n this.ssrMode = ssrMode;\n this.assumeImmutableResults = !!assumeImmutableResults;\n if ((this.onBroadcast = onBroadcast)) {\n this.mutationStore = Object.create(null);\n }\n }\n QueryManager.prototype.stop = function () {\n var _this = this;\n this.queries.forEach(function (_info, queryId) {\n _this.stopQueryNoBroadcast(queryId);\n });\n this.cancelPendingFetches(__DEV__ ? new InvariantError('QueryManager stopped while query was in flight') : new InvariantError(11));\n };\n QueryManager.prototype.cancelPendingFetches = function (error) {\n this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });\n this.fetchCancelFns.clear();\n };\n QueryManager.prototype.mutate = function (_a) {\n var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _b = _a.refetchQueries, refetchQueries = _b === void 0 ? [] : _b, _c = _a.awaitRefetchQueries, awaitRefetchQueries = _c === void 0 ? false : _c, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _d = _a.errorPolicy, errorPolicy = _d === void 0 ? 'none' : _d, _e = _a.fetchPolicy, fetchPolicy = _e === void 0 ? 'network-only' : _e, keepRootFields = _a.keepRootFields, context = _a.context;\n return __awaiter(this, void 0, void 0, function () {\n var mutationId, mutationStoreValue, self;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n __DEV__ ? invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : invariant(mutation, 12);\n __DEV__ ? invariant(fetchPolicy === 'network-only' ||\n fetchPolicy === 'no-cache', \"Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.\") : invariant(fetchPolicy === 'network-only' ||\n fetchPolicy === 'no-cache', 13);\n mutationId = this.generateMutationId();\n mutation = this.transform(mutation).document;\n variables = this.getVariables(mutation, variables);\n if (!this.transform(mutation).hasClientExports) return [3, 2];\n return [4, this.localState.addExportedVariables(mutation, variables, context)];\n case 1:\n variables = (_f.sent());\n _f.label = 2;\n case 2:\n mutationStoreValue = this.mutationStore &&\n (this.mutationStore[mutationId] = {\n mutation: mutation,\n variables: variables,\n loading: true,\n error: null,\n });\n if (optimisticResponse) {\n this.markMutationOptimistic(optimisticResponse, {\n mutationId: mutationId,\n document: mutation,\n variables: variables,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n context: context,\n updateQueries: updateQueries,\n update: updateWithProxyFn,\n keepRootFields: keepRootFields,\n });\n }\n this.broadcastQueries();\n self = this;\n return [2, new Promise(function (resolve, reject) {\n return asyncMap(self.getObservableFromLink(mutation, __assign(__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) {\n if (graphQLResultHasError(result) && errorPolicy === 'none') {\n throw new ApolloError({\n graphQLErrors: result.errors,\n });\n }\n if (mutationStoreValue) {\n mutationStoreValue.loading = false;\n mutationStoreValue.error = null;\n }\n var storeResult = __assign({}, result);\n if (typeof refetchQueries === \"function\") {\n refetchQueries = refetchQueries(storeResult);\n }\n if (errorPolicy === 'ignore' &&\n graphQLResultHasError(storeResult)) {\n delete storeResult.errors;\n }\n return self.markMutationResult({\n mutationId: mutationId,\n result: storeResult,\n document: mutation,\n variables: variables,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n context: context,\n update: updateWithProxyFn,\n updateQueries: updateQueries,\n awaitRefetchQueries: awaitRefetchQueries,\n refetchQueries: refetchQueries,\n removeOptimistic: optimisticResponse ? mutationId : void 0,\n onQueryUpdated: onQueryUpdated,\n keepRootFields: keepRootFields,\n });\n }).subscribe({\n next: function (storeResult) {\n self.broadcastQueries();\n resolve(storeResult);\n },\n error: function (err) {\n if (mutationStoreValue) {\n mutationStoreValue.loading = false;\n mutationStoreValue.error = err;\n }\n if (optimisticResponse) {\n self.cache.removeOptimistic(mutationId);\n }\n self.broadcastQueries();\n reject(err instanceof ApolloError ? err : new ApolloError({\n networkError: err,\n }));\n },\n });\n })];\n }\n });\n });\n };\n QueryManager.prototype.markMutationResult = function (mutation, cache) {\n var _this = this;\n if (cache === void 0) { cache = this.cache; }\n var result = mutation.result;\n var cacheWrites = [];\n var skipCache = mutation.fetchPolicy === \"no-cache\";\n if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) {\n cacheWrites.push({\n result: result.data,\n dataId: 'ROOT_MUTATION',\n query: mutation.document,\n variables: mutation.variables,\n });\n var updateQueries_1 = mutation.updateQueries;\n if (updateQueries_1) {\n this.queries.forEach(function (_a, queryId) {\n var observableQuery = _a.observableQuery;\n var queryName = observableQuery && observableQuery.queryName;\n if (!queryName || !hasOwnProperty.call(updateQueries_1, queryName)) {\n return;\n }\n var updater = updateQueries_1[queryName];\n var _b = _this.queries.get(queryId), document = _b.document, variables = _b.variables;\n var _c = cache.diff({\n query: document,\n variables: variables,\n returnPartialData: true,\n optimistic: false,\n }), currentQueryResult = _c.result, complete = _c.complete;\n if (complete && currentQueryResult) {\n var nextQueryResult = updater(currentQueryResult, {\n mutationResult: result,\n queryName: document && getOperationName(document) || void 0,\n queryVariables: variables,\n });\n if (nextQueryResult) {\n cacheWrites.push({\n result: nextQueryResult,\n dataId: 'ROOT_QUERY',\n query: document,\n variables: variables,\n });\n }\n }\n });\n }\n }\n if (cacheWrites.length > 0 ||\n mutation.refetchQueries ||\n mutation.update ||\n mutation.onQueryUpdated ||\n mutation.removeOptimistic) {\n var results_1 = [];\n this.refetchQueries({\n updateCache: function (cache) {\n if (!skipCache) {\n cacheWrites.forEach(function (write) { return cache.write(write); });\n }\n var update = mutation.update;\n if (update) {\n if (!skipCache) {\n var diff = cache.diff({\n id: \"ROOT_MUTATION\",\n query: _this.transform(mutation.document).asQuery,\n variables: mutation.variables,\n optimistic: false,\n returnPartialData: true,\n });\n if (diff.complete) {\n result = __assign(__assign({}, result), { data: diff.result });\n }\n }\n update(cache, result, {\n context: mutation.context,\n variables: mutation.variables,\n });\n }\n if (!skipCache && !mutation.keepRootFields) {\n cache.modify({\n id: 'ROOT_MUTATION',\n fields: function (value, _a) {\n var fieldName = _a.fieldName, DELETE = _a.DELETE;\n return fieldName === \"__typename\" ? value : DELETE;\n },\n });\n }\n },\n include: mutation.refetchQueries,\n optimistic: false,\n removeOptimistic: mutation.removeOptimistic,\n onQueryUpdated: mutation.onQueryUpdated || null,\n }).forEach(function (result) { return results_1.push(result); });\n if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) {\n return Promise.all(results_1).then(function () { return result; });\n }\n }\n return Promise.resolve(result);\n };\n QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) {\n var _this = this;\n var data = typeof optimisticResponse === \"function\"\n ? optimisticResponse(mutation.variables)\n : optimisticResponse;\n return this.cache.recordOptimisticTransaction(function (cache) {\n try {\n _this.markMutationResult(__assign(__assign({}, mutation), { result: { data: data } }), cache);\n }\n catch (error) {\n __DEV__ && invariant.error(error);\n }\n }, mutation.mutationId);\n };\n QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) {\n return this.fetchQueryObservable(queryId, options, networkStatus).promise;\n };\n QueryManager.prototype.getQueryStore = function () {\n var store = Object.create(null);\n this.queries.forEach(function (info, queryId) {\n store[queryId] = {\n variables: info.variables,\n networkStatus: info.networkStatus,\n networkError: info.networkError,\n graphQLErrors: info.graphQLErrors,\n };\n });\n return store;\n };\n QueryManager.prototype.resetErrors = function (queryId) {\n var queryInfo = this.queries.get(queryId);\n if (queryInfo) {\n queryInfo.networkError = undefined;\n queryInfo.graphQLErrors = [];\n }\n };\n QueryManager.prototype.transform = function (document) {\n var transformCache = this.transformCache;\n if (!transformCache.has(document)) {\n var transformed = this.cache.transformDocument(document);\n var forLink = removeConnectionDirectiveFromDocument(this.cache.transformForLink(transformed));\n var clientQuery = this.localState.clientQuery(transformed);\n var serverQuery = forLink && this.localState.serverQuery(forLink);\n var cacheEntry_1 = {\n document: transformed,\n hasClientExports: hasClientExports(transformed),\n hasForcedResolvers: this.localState.shouldForceResolvers(transformed),\n clientQuery: clientQuery,\n serverQuery: serverQuery,\n defaultVars: getDefaultValues(getOperationDefinition(transformed)),\n asQuery: __assign(__assign({}, transformed), { definitions: transformed.definitions.map(function (def) {\n if (def.kind === \"OperationDefinition\" &&\n def.operation !== \"query\") {\n return __assign(__assign({}, def), { operation: \"query\" });\n }\n return def;\n }) })\n };\n var add = function (doc) {\n if (doc && !transformCache.has(doc)) {\n transformCache.set(doc, cacheEntry_1);\n }\n };\n add(document);\n add(transformed);\n add(clientQuery);\n add(serverQuery);\n }\n return transformCache.get(document);\n };\n QueryManager.prototype.getVariables = function (document, variables) {\n return __assign(__assign({}, this.transform(document).defaultVars), variables);\n };\n QueryManager.prototype.watchQuery = function (options) {\n options = __assign(__assign({}, options), { variables: this.getVariables(options.query, options.variables) });\n if (typeof options.notifyOnNetworkStatusChange === 'undefined') {\n options.notifyOnNetworkStatusChange = false;\n }\n var queryInfo = new QueryInfo(this);\n var observable = new ObservableQuery({\n queryManager: this,\n queryInfo: queryInfo,\n options: options,\n });\n this.queries.set(observable.queryId, queryInfo);\n queryInfo.init({\n document: options.query,\n observableQuery: observable,\n variables: options.variables,\n });\n return observable;\n };\n QueryManager.prototype.query = function (options, queryId) {\n var _this = this;\n if (queryId === void 0) { queryId = this.generateQueryId(); }\n __DEV__ ? invariant(options.query, 'query option is required. You must specify your GraphQL document ' +\n 'in the query option.') : invariant(options.query, 14);\n __DEV__ ? invariant(options.query.kind === 'Document', 'You must wrap the query string in a \"gql\" tag.') : invariant(options.query.kind === 'Document', 15);\n __DEV__ ? invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : invariant(!options.returnPartialData, 16);\n __DEV__ ? invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : invariant(!options.pollInterval, 17);\n return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });\n };\n QueryManager.prototype.generateQueryId = function () {\n return String(this.queryIdCounter++);\n };\n QueryManager.prototype.generateRequestId = function () {\n return this.requestIdCounter++;\n };\n QueryManager.prototype.generateMutationId = function () {\n return String(this.mutationIdCounter++);\n };\n QueryManager.prototype.stopQueryInStore = function (queryId) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.broadcastQueries();\n };\n QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) {\n var queryInfo = this.queries.get(queryId);\n if (queryInfo)\n queryInfo.stop();\n };\n QueryManager.prototype.clearStore = function (options) {\n if (options === void 0) { options = {\n discardWatches: true,\n }; }\n this.cancelPendingFetches(__DEV__ ? new InvariantError('Store reset while query was in flight (not completed in link chain)') : new InvariantError(18));\n this.queries.forEach(function (queryInfo) {\n if (queryInfo.observableQuery) {\n queryInfo.networkStatus = NetworkStatus.loading;\n }\n else {\n queryInfo.stop();\n }\n });\n if (this.mutationStore) {\n this.mutationStore = Object.create(null);\n }\n return this.cache.reset(options);\n };\n QueryManager.prototype.getObservableQueries = function (include) {\n var _this = this;\n if (include === void 0) { include = \"active\"; }\n var queries = new Map();\n var queryNamesAndDocs = new Map();\n var legacyQueryOptions = new Set();\n if (Array.isArray(include)) {\n include.forEach(function (desc) {\n if (typeof desc === \"string\") {\n queryNamesAndDocs.set(desc, false);\n }\n else if (isDocumentNode(desc)) {\n queryNamesAndDocs.set(_this.transform(desc).document, false);\n }\n else if (isNonNullObject(desc) && desc.query) {\n legacyQueryOptions.add(desc);\n }\n });\n }\n this.queries.forEach(function (_a, queryId) {\n var oq = _a.observableQuery, document = _a.document;\n if (oq) {\n if (include === \"all\") {\n queries.set(queryId, oq);\n return;\n }\n var queryName = oq.queryName, fetchPolicy = oq.options.fetchPolicy;\n if (fetchPolicy === \"standby\" ||\n (include === \"active\" && !oq.hasObservers())) {\n return;\n }\n if (include === \"active\" ||\n (queryName && queryNamesAndDocs.has(queryName)) ||\n (document && queryNamesAndDocs.has(document))) {\n queries.set(queryId, oq);\n if (queryName)\n queryNamesAndDocs.set(queryName, true);\n if (document)\n queryNamesAndDocs.set(document, true);\n }\n }\n });\n if (legacyQueryOptions.size) {\n legacyQueryOptions.forEach(function (options) {\n var queryId = makeUniqueId(\"legacyOneTimeQuery\");\n var queryInfo = _this.getQuery(queryId).init({\n document: options.query,\n variables: options.variables,\n });\n var oq = new ObservableQuery({\n queryManager: _this,\n queryInfo: queryInfo,\n options: __assign(__assign({}, options), { fetchPolicy: \"network-only\" }),\n });\n invariant(oq.queryId === queryId);\n queryInfo.setObservableQuery(oq);\n queries.set(queryId, oq);\n });\n }\n if (__DEV__ && queryNamesAndDocs.size) {\n queryNamesAndDocs.forEach(function (included, nameOrDoc) {\n if (!included) {\n __DEV__ && invariant.warn(\"Unknown query \".concat(typeof nameOrDoc === \"string\" ? \"named \" : \"\").concat(JSON.stringify(nameOrDoc, null, 2), \" requested in refetchQueries options.include array\"));\n }\n });\n }\n return queries;\n };\n QueryManager.prototype.reFetchObservableQueries = function (includeStandby) {\n var _this = this;\n if (includeStandby === void 0) { includeStandby = false; }\n var observableQueryPromises = [];\n this.getObservableQueries(includeStandby ? \"all\" : \"active\").forEach(function (observableQuery, queryId) {\n var fetchPolicy = observableQuery.options.fetchPolicy;\n observableQuery.resetLastResults();\n if (includeStandby ||\n (fetchPolicy !== \"standby\" &&\n fetchPolicy !== \"cache-only\")) {\n observableQueryPromises.push(observableQuery.refetch());\n }\n _this.getQuery(queryId).setDiff(null);\n });\n this.broadcastQueries();\n return Promise.all(observableQueryPromises);\n };\n QueryManager.prototype.setObservableQuery = function (observableQuery) {\n this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery);\n };\n QueryManager.prototype.startGraphQLSubscription = function (_a) {\n var _this = this;\n var query = _a.query, fetchPolicy = _a.fetchPolicy, errorPolicy = _a.errorPolicy, variables = _a.variables, _b = _a.context, context = _b === void 0 ? {} : _b;\n query = this.transform(query).document;\n variables = this.getVariables(query, variables);\n var makeObservable = function (variables) {\n return _this.getObservableFromLink(query, context, variables).map(function (result) {\n if (fetchPolicy !== 'no-cache') {\n if (shouldWriteResult(result, errorPolicy)) {\n _this.cache.write({\n query: query,\n result: result.data,\n dataId: 'ROOT_SUBSCRIPTION',\n variables: variables,\n });\n }\n _this.broadcastQueries();\n }\n if (graphQLResultHasError(result)) {\n throw new ApolloError({\n graphQLErrors: result.errors,\n });\n }\n return result;\n });\n };\n if (this.transform(query).hasClientExports) {\n var observablePromise_1 = this.localState.addExportedVariables(query, variables, context).then(makeObservable);\n return new Observable(function (observer) {\n var sub = null;\n observablePromise_1.then(function (observable) { return sub = observable.subscribe(observer); }, observer.error);\n return function () { return sub && sub.unsubscribe(); };\n });\n }\n return makeObservable(variables);\n };\n QueryManager.prototype.stopQuery = function (queryId) {\n this.stopQueryNoBroadcast(queryId);\n this.broadcastQueries();\n };\n QueryManager.prototype.stopQueryNoBroadcast = function (queryId) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.removeQuery(queryId);\n };\n QueryManager.prototype.removeQuery = function (queryId) {\n this.fetchCancelFns.delete(queryId);\n this.getQuery(queryId).stop();\n this.queries.delete(queryId);\n };\n QueryManager.prototype.broadcastQueries = function () {\n if (this.onBroadcast)\n this.onBroadcast();\n this.queries.forEach(function (info) { return info.notify(); });\n };\n QueryManager.prototype.getLocalState = function () {\n return this.localState;\n };\n QueryManager.prototype.getObservableFromLink = function (query, context, variables, deduplication) {\n var _this = this;\n var _a;\n if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; }\n var observable;\n var serverQuery = this.transform(query).serverQuery;\n if (serverQuery) {\n var _b = this, inFlightLinkObservables_1 = _b.inFlightLinkObservables, link = _b.link;\n var operation = {\n query: serverQuery,\n variables: variables,\n operationName: getOperationName(serverQuery) || void 0,\n context: this.prepareContext(__assign(__assign({}, context), { forceFetch: !deduplication })),\n };\n context = operation.context;\n if (deduplication) {\n var byVariables_1 = inFlightLinkObservables_1.get(serverQuery) || new Map();\n inFlightLinkObservables_1.set(serverQuery, byVariables_1);\n var varJson_1 = canonicalStringify(variables);\n observable = byVariables_1.get(varJson_1);\n if (!observable) {\n var concast = new Concast([\n execute(link, operation)\n ]);\n byVariables_1.set(varJson_1, observable = concast);\n concast.cleanup(function () {\n if (byVariables_1.delete(varJson_1) &&\n byVariables_1.size < 1) {\n inFlightLinkObservables_1.delete(serverQuery);\n }\n });\n }\n }\n else {\n observable = new Concast([\n execute(link, operation)\n ]);\n }\n }\n else {\n observable = new Concast([\n Observable.of({ data: {} })\n ]);\n context = this.prepareContext(context);\n }\n var clientQuery = this.transform(query).clientQuery;\n if (clientQuery) {\n observable = asyncMap(observable, function (result) {\n return _this.localState.runResolvers({\n document: clientQuery,\n remoteResult: result,\n context: context,\n variables: variables,\n });\n });\n }\n return observable;\n };\n QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) {\n var requestId = queryInfo.lastRequestId = this.generateRequestId();\n return asyncMap(this.getObservableFromLink(queryInfo.document, options.context, options.variables), function (result) {\n var hasErrors = isNonEmptyArray(result.errors);\n if (requestId >= queryInfo.lastRequestId) {\n if (hasErrors && options.errorPolicy === \"none\") {\n throw queryInfo.markError(new ApolloError({\n graphQLErrors: result.errors,\n }));\n }\n queryInfo.markResult(result, options, cacheWriteBehavior);\n queryInfo.markReady();\n }\n var aqr = {\n data: result.data,\n loading: false,\n networkStatus: queryInfo.networkStatus || NetworkStatus.ready,\n };\n if (hasErrors && options.errorPolicy !== \"ignore\") {\n aqr.errors = result.errors;\n }\n return aqr;\n }, function (networkError) {\n var error = isApolloError(networkError)\n ? networkError\n : new ApolloError({ networkError: networkError });\n if (requestId >= queryInfo.lastRequestId) {\n queryInfo.markError(error);\n }\n throw error;\n });\n };\n QueryManager.prototype.fetchQueryObservable = function (queryId, options, networkStatus) {\n var _this = this;\n if (networkStatus === void 0) { networkStatus = NetworkStatus.loading; }\n var query = this.transform(options.query).document;\n var variables = this.getVariables(query, options.variables);\n var queryInfo = this.getQuery(queryId);\n var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? \"cache-first\" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? \"none\" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e;\n var normalized = Object.assign({}, options, {\n query: query,\n variables: variables,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n returnPartialData: returnPartialData,\n notifyOnNetworkStatusChange: notifyOnNetworkStatusChange,\n context: context,\n });\n var fromVariables = function (variables) {\n normalized.variables = variables;\n return _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);\n };\n this.fetchCancelFns.set(queryId, function (reason) {\n setTimeout(function () { return concast.cancel(reason); });\n });\n var concast = new Concast(this.transform(normalized.query).hasClientExports\n ? this.localState.addExportedVariables(normalized.query, normalized.variables, normalized.context).then(fromVariables)\n : fromVariables(normalized.variables));\n concast.cleanup(function () {\n _this.fetchCancelFns.delete(queryId);\n applyNextFetchPolicy(options);\n });\n return concast;\n };\n QueryManager.prototype.refetchQueries = function (_a) {\n var _this = this;\n var updateCache = _a.updateCache, include = _a.include, _b = _a.optimistic, optimistic = _b === void 0 ? false : _b, _c = _a.removeOptimistic, removeOptimistic = _c === void 0 ? optimistic ? makeUniqueId(\"refetchQueries\") : void 0 : _c, onQueryUpdated = _a.onQueryUpdated;\n var includedQueriesById = new Map();\n if (include) {\n this.getObservableQueries(include).forEach(function (oq, queryId) {\n includedQueriesById.set(queryId, {\n oq: oq,\n lastDiff: _this.getQuery(queryId).getDiff(),\n });\n });\n }\n var results = new Map;\n if (updateCache) {\n this.cache.batch({\n update: updateCache,\n optimistic: optimistic && removeOptimistic || false,\n removeOptimistic: removeOptimistic,\n onWatchUpdated: function (watch, diff, lastDiff) {\n var oq = watch.watcher instanceof QueryInfo &&\n watch.watcher.observableQuery;\n if (oq) {\n if (onQueryUpdated) {\n includedQueriesById.delete(oq.queryId);\n var result = onQueryUpdated(oq, diff, lastDiff);\n if (result === true) {\n result = oq.refetch();\n }\n if (result !== false) {\n results.set(oq, result);\n }\n return result;\n }\n if (onQueryUpdated !== null) {\n includedQueriesById.set(oq.queryId, { oq: oq, lastDiff: lastDiff, diff: diff });\n }\n }\n },\n });\n }\n if (includedQueriesById.size) {\n includedQueriesById.forEach(function (_a, queryId) {\n var oq = _a.oq, lastDiff = _a.lastDiff, diff = _a.diff;\n var result;\n if (onQueryUpdated) {\n if (!diff) {\n var info = oq[\"queryInfo\"];\n info.reset();\n diff = info.getDiff();\n }\n result = onQueryUpdated(oq, diff, lastDiff);\n }\n if (!onQueryUpdated || result === true) {\n result = oq.refetch();\n }\n if (result !== false) {\n results.set(oq, result);\n }\n if (queryId.indexOf(\"legacyOneTimeQuery\") >= 0) {\n _this.stopQueryNoBroadcast(queryId);\n }\n });\n }\n if (removeOptimistic) {\n this.cache.removeOptimistic(removeOptimistic);\n }\n return results;\n };\n QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a, networkStatus) {\n var _this = this;\n var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange;\n var oldNetworkStatus = queryInfo.networkStatus;\n queryInfo.init({\n document: query,\n variables: variables,\n networkStatus: networkStatus,\n });\n var readCache = function () { return queryInfo.getDiff(variables); };\n var resultsFromCache = function (diff, networkStatus) {\n if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || NetworkStatus.loading; }\n var data = diff.result;\n if (__DEV__ &&\n !returnPartialData &&\n !equal(data, {})) {\n logMissingFieldErrors(diff.missing);\n }\n var fromData = function (data) { return Observable.of(__assign({ data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true }))); };\n if (data && _this.transform(query).hasForcedResolvers) {\n return _this.localState.runResolvers({\n document: query,\n remoteResult: { data: data },\n context: context,\n variables: variables,\n onlyRunForcedResolvers: true,\n }).then(function (resolved) { return fromData(resolved.data || void 0); });\n }\n return fromData(data);\n };\n var cacheWriteBehavior = fetchPolicy === \"no-cache\" ? 0 :\n (networkStatus === NetworkStatus.refetch &&\n refetchWritePolicy !== \"merge\") ? 1\n : 2;\n var resultsFromLink = function () {\n return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, {\n variables: variables,\n context: context,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n });\n };\n var shouldNotify = notifyOnNetworkStatusChange &&\n typeof oldNetworkStatus === \"number\" &&\n oldNetworkStatus !== networkStatus &&\n isNetworkRequestInFlight(networkStatus);\n switch (fetchPolicy) {\n default:\n case \"cache-first\": {\n var diff = readCache();\n if (diff.complete) {\n return [\n resultsFromCache(diff, queryInfo.markReady()),\n ];\n }\n if (returnPartialData || shouldNotify) {\n return [\n resultsFromCache(diff),\n resultsFromLink(),\n ];\n }\n return [\n resultsFromLink(),\n ];\n }\n case \"cache-and-network\": {\n var diff = readCache();\n if (diff.complete || returnPartialData || shouldNotify) {\n return [\n resultsFromCache(diff),\n resultsFromLink(),\n ];\n }\n return [\n resultsFromLink(),\n ];\n }\n case \"cache-only\":\n return [\n resultsFromCache(readCache(), queryInfo.markReady()),\n ];\n case \"network-only\":\n if (shouldNotify) {\n return [\n resultsFromCache(readCache()),\n resultsFromLink(),\n ];\n }\n return [resultsFromLink()];\n case \"no-cache\":\n if (shouldNotify) {\n return [\n resultsFromCache(queryInfo.getDiff()),\n resultsFromLink(),\n ];\n }\n return [resultsFromLink()];\n case \"standby\":\n return [];\n }\n };\n QueryManager.prototype.getQuery = function (queryId) {\n if (queryId && !this.queries.has(queryId)) {\n this.queries.set(queryId, new QueryInfo(this, queryId));\n }\n return this.queries.get(queryId);\n };\n QueryManager.prototype.prepareContext = function (context) {\n if (context === void 0) { context = {}; }\n var newContext = this.localState.prepareContext(context);\n return __assign(__assign({}, newContext), { clientAwareness: this.clientAwareness });\n };\n return QueryManager;\n}());\nexport { QueryManager };\n//# sourceMappingURL=QueryManager.js.map","import { __assign } from \"tslib\";\nimport { invariant, InvariantError } from \"../utilities/globals/index.js\";\nimport { ApolloLink, execute } from \"../link/core/index.js\";\nimport { compact } from \"../utilities/index.js\";\nimport { version } from \"../version.js\";\nimport { HttpLink } from \"../link/http/index.js\";\nimport { QueryManager } from \"./QueryManager.js\";\nimport { LocalState, } from \"./LocalState.js\";\nvar hasSuggestedDevtools = false;\nexport function mergeOptions(defaults, options) {\n return compact(defaults, options, options.variables && {\n variables: __assign(__assign({}, defaults.variables), options.variables),\n });\n}\nvar ApolloClient = (function () {\n function ApolloClient(options) {\n var _this = this;\n this.defaultOptions = {};\n this.resetStoreCallbacks = [];\n this.clearStoreCallbacks = [];\n var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, _c = options.connectToDevTools, connectToDevTools = _c === void 0 ? typeof window === 'object' &&\n !window.__APOLLO_CLIENT__ &&\n __DEV__ : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? false : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version;\n var link = options.link;\n if (!link) {\n link = uri\n ? new HttpLink({ uri: uri, credentials: credentials, headers: headers })\n : ApolloLink.empty();\n }\n if (!cache) {\n throw __DEV__ ? new InvariantError(\"To initialize Apollo Client, you must specify a 'cache' property \" +\n \"in the options object. \\n\" +\n \"For more information, please visit: https://go.apollo.dev/c/docs\") : new InvariantError(7);\n }\n this.link = link;\n this.cache = cache;\n this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0;\n this.queryDeduplication = queryDeduplication;\n this.defaultOptions = defaultOptions || {};\n this.typeDefs = typeDefs;\n if (ssrForceFetchDelay) {\n setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay);\n }\n this.watchQuery = this.watchQuery.bind(this);\n this.query = this.query.bind(this);\n this.mutate = this.mutate.bind(this);\n this.resetStore = this.resetStore.bind(this);\n this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);\n if (connectToDevTools && typeof window === 'object') {\n window.__APOLLO_CLIENT__ = this;\n }\n if (!hasSuggestedDevtools && __DEV__) {\n hasSuggestedDevtools = true;\n if (typeof window !== 'undefined' &&\n window.document &&\n window.top === window.self &&\n !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {\n var nav = window.navigator;\n var ua = nav && nav.userAgent;\n var url = void 0;\n if (typeof ua === \"string\") {\n if (ua.indexOf(\"Chrome/\") > -1) {\n url = \"https://chrome.google.com/webstore/detail/\" +\n \"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm\";\n }\n else if (ua.indexOf(\"Firefox/\") > -1) {\n url = \"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/\";\n }\n }\n if (url) {\n __DEV__ && invariant.log(\"Download the Apollo DevTools for a better development \" +\n \"experience: \" + url);\n }\n }\n }\n this.version = version;\n this.localState = new LocalState({\n cache: cache,\n client: this,\n resolvers: resolvers,\n fragmentMatcher: fragmentMatcher,\n });\n this.queryManager = new QueryManager({\n cache: this.cache,\n link: this.link,\n queryDeduplication: queryDeduplication,\n ssrMode: ssrMode,\n clientAwareness: {\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n },\n localState: this.localState,\n assumeImmutableResults: assumeImmutableResults,\n onBroadcast: connectToDevTools ? function () {\n if (_this.devToolsHookCb) {\n _this.devToolsHookCb({\n action: {},\n state: {\n queries: _this.queryManager.getQueryStore(),\n mutations: _this.queryManager.mutationStore || {},\n },\n dataWithOptimisticResults: _this.cache.extract(true),\n });\n }\n } : void 0,\n });\n }\n ApolloClient.prototype.stop = function () {\n this.queryManager.stop();\n };\n ApolloClient.prototype.watchQuery = function (options) {\n if (this.defaultOptions.watchQuery) {\n options = mergeOptions(this.defaultOptions.watchQuery, options);\n }\n if (this.disableNetworkFetches &&\n (options.fetchPolicy === 'network-only' ||\n options.fetchPolicy === 'cache-and-network')) {\n options = __assign(__assign({}, options), { fetchPolicy: 'cache-first' });\n }\n return this.queryManager.watchQuery(options);\n };\n ApolloClient.prototype.query = function (options) {\n if (this.defaultOptions.query) {\n options = mergeOptions(this.defaultOptions.query, options);\n }\n __DEV__ ? invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' +\n 'client.query can only return a single result. Please use client.watchQuery ' +\n 'to receive multiple results from the cache and the network, or consider ' +\n 'using a different fetchPolicy, such as cache-first or network-only.') : invariant(options.fetchPolicy !== 'cache-and-network', 8);\n if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') {\n options = __assign(__assign({}, options), { fetchPolicy: 'cache-first' });\n }\n return this.queryManager.query(options);\n };\n ApolloClient.prototype.mutate = function (options) {\n if (this.defaultOptions.mutate) {\n options = mergeOptions(this.defaultOptions.mutate, options);\n }\n return this.queryManager.mutate(options);\n };\n ApolloClient.prototype.subscribe = function (options) {\n return this.queryManager.startGraphQLSubscription(options);\n };\n ApolloClient.prototype.readQuery = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = false; }\n return this.cache.readQuery(options, optimistic);\n };\n ApolloClient.prototype.readFragment = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = false; }\n return this.cache.readFragment(options, optimistic);\n };\n ApolloClient.prototype.writeQuery = function (options) {\n this.cache.writeQuery(options);\n this.queryManager.broadcastQueries();\n };\n ApolloClient.prototype.writeFragment = function (options) {\n this.cache.writeFragment(options);\n this.queryManager.broadcastQueries();\n };\n ApolloClient.prototype.__actionHookForDevTools = function (cb) {\n this.devToolsHookCb = cb;\n };\n ApolloClient.prototype.__requestRaw = function (payload) {\n return execute(this.link, payload);\n };\n ApolloClient.prototype.resetStore = function () {\n var _this = this;\n return Promise.resolve()\n .then(function () { return _this.queryManager.clearStore({\n discardWatches: false,\n }); })\n .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); })\n .then(function () { return _this.reFetchObservableQueries(); });\n };\n ApolloClient.prototype.clearStore = function () {\n var _this = this;\n return Promise.resolve()\n .then(function () { return _this.queryManager.clearStore({\n discardWatches: true,\n }); })\n .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); });\n };\n ApolloClient.prototype.onResetStore = function (cb) {\n var _this = this;\n this.resetStoreCallbacks.push(cb);\n return function () {\n _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; });\n };\n };\n ApolloClient.prototype.onClearStore = function (cb) {\n var _this = this;\n this.clearStoreCallbacks.push(cb);\n return function () {\n _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; });\n };\n };\n ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) {\n return this.queryManager.reFetchObservableQueries(includeStandby);\n };\n ApolloClient.prototype.refetchQueries = function (options) {\n var map = this.queryManager.refetchQueries(options);\n var queries = [];\n var results = [];\n map.forEach(function (result, obsQuery) {\n queries.push(obsQuery);\n results.push(result);\n });\n var result = Promise.all(results);\n result.queries = queries;\n result.results = results;\n result.catch(function (error) {\n __DEV__ && invariant.debug(\"In client.refetchQueries, Promise.all promise rejected with error \".concat(error));\n });\n return result;\n };\n ApolloClient.prototype.getObservableQueries = function (include) {\n if (include === void 0) { include = \"active\"; }\n return this.queryManager.getObservableQueries(include);\n };\n ApolloClient.prototype.extract = function (optimistic) {\n return this.cache.extract(optimistic);\n };\n ApolloClient.prototype.restore = function (serializedState) {\n return this.cache.restore(serializedState);\n };\n ApolloClient.prototype.addResolvers = function (resolvers) {\n this.localState.addResolvers(resolvers);\n };\n ApolloClient.prototype.setResolvers = function (resolvers) {\n this.localState.setResolvers(resolvers);\n };\n ApolloClient.prototype.getResolvers = function () {\n return this.localState.getResolvers();\n };\n ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) {\n this.localState.setFragmentMatcher(fragmentMatcher);\n };\n ApolloClient.prototype.setLink = function (newLink) {\n this.link = this.queryManager.link = newLink;\n };\n return ApolloClient;\n}());\nexport { ApolloClient };\n//# sourceMappingURL=ApolloClient.js.map","import { __assign } from \"tslib\";\nimport { parse } from 'graphql';\nvar docCache = new Map();\nvar fragmentSourceMap = new Map();\nvar printFragmentWarnings = true;\nvar experimentalFragmentVariables = false;\nfunction normalize(string) {\n return string.replace(/[\\s,]+/g, ' ').trim();\n}\nfunction cacheKeyFromLoc(loc) {\n return normalize(loc.source.body.substring(loc.start, loc.end));\n}\nfunction processFragments(ast) {\n var seenKeys = new Set();\n var definitions = [];\n ast.definitions.forEach(function (fragmentDefinition) {\n if (fragmentDefinition.kind === 'FragmentDefinition') {\n var fragmentName = fragmentDefinition.name.value;\n var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);\n var sourceKeySet = fragmentSourceMap.get(fragmentName);\n if (sourceKeySet && !sourceKeySet.has(sourceKey)) {\n if (printFragmentWarnings) {\n console.warn(\"Warning: fragment with name \" + fragmentName + \" already exists.\\n\"\n + \"graphql-tag enforces all fragment names across your application to be unique; read more about\\n\"\n + \"this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names\");\n }\n }\n else if (!sourceKeySet) {\n fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);\n }\n sourceKeySet.add(sourceKey);\n if (!seenKeys.has(sourceKey)) {\n seenKeys.add(sourceKey);\n definitions.push(fragmentDefinition);\n }\n }\n else {\n definitions.push(fragmentDefinition);\n }\n });\n return __assign(__assign({}, ast), { definitions: definitions });\n}\nfunction stripLoc(doc) {\n var workSet = new Set(doc.definitions);\n workSet.forEach(function (node) {\n if (node.loc)\n delete node.loc;\n Object.keys(node).forEach(function (key) {\n var value = node[key];\n if (value && typeof value === 'object') {\n workSet.add(value);\n }\n });\n });\n var loc = doc.loc;\n if (loc) {\n delete loc.startToken;\n delete loc.endToken;\n }\n return doc;\n}\nfunction parseDocument(source) {\n var cacheKey = normalize(source);\n if (!docCache.has(cacheKey)) {\n var parsed = parse(source, {\n experimentalFragmentVariables: experimentalFragmentVariables,\n allowLegacyFragmentVariables: experimentalFragmentVariables\n });\n if (!parsed || parsed.kind !== 'Document') {\n throw new Error('Not a valid GraphQL document.');\n }\n docCache.set(cacheKey, stripLoc(processFragments(parsed)));\n }\n return docCache.get(cacheKey);\n}\nexport function gql(literals) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (typeof literals === 'string') {\n literals = [literals];\n }\n var result = literals[0];\n args.forEach(function (arg, i) {\n if (arg && arg.kind === 'Document') {\n result += arg.loc.source.body;\n }\n else {\n result += arg;\n }\n result += literals[i + 1];\n });\n return parseDocument(result);\n}\nexport function resetCaches() {\n docCache.clear();\n fragmentSourceMap.clear();\n}\nexport function disableFragmentWarnings() {\n printFragmentWarnings = false;\n}\nexport function enableExperimentalFragmentVariables() {\n experimentalFragmentVariables = true;\n}\nexport function disableExperimentalFragmentVariables() {\n experimentalFragmentVariables = false;\n}\nvar extras = {\n gql: gql,\n resetCaches: resetCaches,\n disableFragmentWarnings: disableFragmentWarnings,\n enableExperimentalFragmentVariables: enableExperimentalFragmentVariables,\n disableExperimentalFragmentVariables: disableExperimentalFragmentVariables\n};\n(function (gql_1) {\n gql_1.gql = extras.gql, gql_1.resetCaches = extras.resetCaches, gql_1.disableFragmentWarnings = extras.disableFragmentWarnings, gql_1.enableExperimentalFragmentVariables = extras.enableExperimentalFragmentVariables, gql_1.disableExperimentalFragmentVariables = extras.disableExperimentalFragmentVariables;\n})(gql || (gql = {}));\ngql[\"default\"] = gql;\nexport default gql;\n//# sourceMappingURL=index.js.map","import { DEV } from \"../utilities/globals/index.js\";\nexport { ApolloClient, mergeOptions, } from \"./ApolloClient.js\";\nexport { ObservableQuery, applyNextFetchPolicy, } from \"./ObservableQuery.js\";\nexport { NetworkStatus } from \"./networkStatus.js\";\nexport * from \"./types.js\";\nexport { isApolloError, ApolloError } from \"../errors/index.js\";\nexport { Cache, ApolloCache, InMemoryCache, MissingFieldError, defaultDataIdFromObject, makeVar, } from \"../cache/index.js\";\nexport * from \"../cache/inmemory/types.js\";\nexport * from \"../link/core/index.js\";\nexport * from \"../link/http/index.js\";\nexport { fromError, toPromise, fromPromise, throwServerError, } from \"../link/utils/index.js\";\nexport { Observable, isReference, makeReference, } from \"../utilities/index.js\";\nimport { setVerbosity } from \"ts-invariant\";\nexport { setVerbosity as setLogVerbosity };\nsetVerbosity(DEV ? \"log\" : \"silent\");\nexport { gql, resetCaches, disableFragmentWarnings, enableExperimentalFragmentVariables, disableExperimentalFragmentVariables, } from 'graphql-tag';\n//# sourceMappingURL=index.js.map","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","/** @license React v17.0.2\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=require(\"object-assign\"),n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;\nif(\"function\"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w(\"react.element\");p=w(\"react.portal\");exports.Fragment=w(\"react.fragment\");exports.StrictMode=w(\"react.strict_mode\");exports.Profiler=w(\"react.profiler\");q=w(\"react.provider\");r=w(\"react.context\");t=w(\"react.forward_ref\");exports.Suspense=w(\"react.suspense\");u=w(\"react.memo\");v=w(\"react.lazy\")}var x=\"function\"===typeof Symbol&&Symbol.iterator;\nfunction y(a){if(null===a||\"object\"!==typeof a)return null;a=x&&a[x]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}function z(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;c, or pass an ApolloClient' +\n 'ApolloClient instance in via options.') : invariant(!!client, 29);\n return client;\n}\n//# sourceMappingURL=useApolloClient.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nexport var DocumentType;\n(function (DocumentType) {\n DocumentType[DocumentType[\"Query\"] = 0] = \"Query\";\n DocumentType[DocumentType[\"Mutation\"] = 1] = \"Mutation\";\n DocumentType[DocumentType[\"Subscription\"] = 2] = \"Subscription\";\n})(DocumentType || (DocumentType = {}));\nvar cache = new Map();\nexport function operationName(type) {\n var name;\n switch (type) {\n case DocumentType.Query:\n name = 'Query';\n break;\n case DocumentType.Mutation:\n name = 'Mutation';\n break;\n case DocumentType.Subscription:\n name = 'Subscription';\n break;\n }\n return name;\n}\nexport function parser(document) {\n var cached = cache.get(document);\n if (cached)\n return cached;\n var variables, type, name;\n __DEV__ ? invariant(!!document && !!document.kind, \"Argument of \".concat(document, \" passed to parser was not a valid GraphQL \") +\n \"DocumentNode. You may need to use 'graphql-tag' or another method \" +\n \"to convert your operation into a document\") : invariant(!!document && !!document.kind, 30);\n var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; });\n var queries = document.definitions.filter(function (x) {\n return x.kind === 'OperationDefinition' && x.operation === 'query';\n });\n var mutations = document.definitions.filter(function (x) {\n return x.kind === 'OperationDefinition' && x.operation === 'mutation';\n });\n var subscriptions = document.definitions.filter(function (x) {\n return x.kind === 'OperationDefinition' && x.operation === 'subscription';\n });\n __DEV__ ? invariant(!fragments.length ||\n (queries.length || mutations.length || subscriptions.length), \"Passing only a fragment to 'graphql' is not yet supported. \" +\n \"You must include a query, subscription or mutation as well\") : invariant(!fragments.length ||\n (queries.length || mutations.length || subscriptions.length), 31);\n __DEV__ ? invariant(queries.length + mutations.length + subscriptions.length <= 1, \"react-apollo only supports a query, subscription, or a mutation per HOC. \" +\n \"\".concat(document, \" had \").concat(queries.length, \" queries, \").concat(subscriptions.length, \" \") +\n \"subscriptions and \".concat(mutations.length, \" mutations. \") +\n \"You can use 'compose' to join multiple operation types to a component\") : invariant(queries.length + mutations.length + subscriptions.length <= 1, 32);\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length)\n type = DocumentType.Subscription;\n var definitions = queries.length\n ? queries\n : mutations.length\n ? mutations\n : subscriptions;\n __DEV__ ? invariant(definitions.length === 1, \"react-apollo only supports one definition per HOC. \".concat(document, \" had \") +\n \"\".concat(definitions.length, \" definitions. \") +\n \"You can use 'compose' to join multiple operation types to a component\") : invariant(definitions.length === 1, 33);\n var definition = definitions[0];\n variables = definition.variableDefinitions || [];\n if (definition.name && definition.name.kind === 'Name') {\n name = definition.name.value;\n }\n else {\n name = 'data';\n }\n var payload = { name: name, type: type, variables: variables };\n cache.set(document, payload);\n return payload;\n}\nexport function verifyDocumentType(document, type) {\n var operation = parser(document);\n var requiredOperationName = operationName(type);\n var usedOperationName = operationName(operation.type);\n __DEV__ ? invariant(operation.type === type, \"Running a \".concat(requiredOperationName, \" requires a graphql \") +\n \"\".concat(requiredOperationName, \", but a \").concat(usedOperationName, \" was used instead.\")) : invariant(operation.type === type, 34);\n}\n//# sourceMappingURL=index.js.map","import { __assign, __rest } from \"tslib\";\nimport { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { equal } from '@wry/equality';\nimport { mergeOptions } from \"../../core/index.js\";\nimport { getApolloContext } from \"../context/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\nimport { NetworkStatus, } from \"../../core/index.js\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nexport function useQuery(query, options) {\n var _a;\n var context = useContext(getApolloContext());\n var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);\n var defaultWatchQueryOptions = client.defaultOptions.watchQuery;\n verifyDocumentType(query, DocumentType.Query);\n var _b = useState(function () {\n var watchQueryOptions = createWatchQueryOptions(query, options, defaultWatchQueryOptions);\n var obsQuery = null;\n if (context.renderPromises) {\n obsQuery = context.renderPromises.getSSRObservable(watchQueryOptions);\n }\n if (!obsQuery) {\n obsQuery = client.watchQuery(watchQueryOptions);\n if (context.renderPromises) {\n context.renderPromises.registerSSRObservable(obsQuery, watchQueryOptions);\n }\n }\n if (context.renderPromises &&\n (options === null || options === void 0 ? void 0 : options.ssr) !== false &&\n !(options === null || options === void 0 ? void 0 : options.skip) &&\n obsQuery.getCurrentResult().loading) {\n context.renderPromises.addQueryPromise({\n getOptions: function () { return createWatchQueryOptions(query, options, defaultWatchQueryOptions); },\n fetchData: function () { return new Promise(function (resolve) {\n var sub = obsQuery.subscribe({\n next: function (result) {\n if (!result.loading) {\n resolve();\n sub.unsubscribe();\n }\n },\n error: function () {\n resolve();\n sub.unsubscribe();\n },\n complete: function () {\n resolve();\n },\n });\n }); },\n }, function () { return null; });\n }\n return obsQuery;\n }), obsQuery = _b[0], setObsQuery = _b[1];\n var _c = useState(function () {\n var _a, _b;\n var result = obsQuery.getCurrentResult();\n if (!result.loading && options) {\n if (result.error) {\n (_a = options.onError) === null || _a === void 0 ? void 0 : _a.call(options, result.error);\n }\n else if (result.data) {\n (_b = options.onCompleted) === null || _b === void 0 ? void 0 : _b.call(options, result.data);\n }\n }\n return result;\n }), result = _c[0], setResult = _c[1];\n var ref = useRef({\n client: client,\n query: query,\n options: options,\n result: result,\n previousData: void 0,\n watchQueryOptions: createWatchQueryOptions(query, options, defaultWatchQueryOptions),\n });\n useEffect(function () {\n var _a, _b;\n var watchQueryOptions = createWatchQueryOptions(query, options, defaultWatchQueryOptions);\n var nextResult;\n if (ref.current.client !== client || !equal(ref.current.query, query)) {\n var obsQuery_1 = client.watchQuery(watchQueryOptions);\n setObsQuery(obsQuery_1);\n nextResult = obsQuery_1.getCurrentResult();\n }\n else if (!equal(ref.current.watchQueryOptions, watchQueryOptions)) {\n obsQuery.setOptions(watchQueryOptions).catch(function () { });\n nextResult = obsQuery.getCurrentResult();\n ref.current.watchQueryOptions = watchQueryOptions;\n }\n if (nextResult) {\n var previousResult = ref.current.result;\n if (previousResult.data) {\n ref.current.previousData = previousResult.data;\n }\n setResult(ref.current.result = nextResult);\n if (!nextResult.loading && options) {\n if (nextResult.error) {\n (_a = options.onError) === null || _a === void 0 ? void 0 : _a.call(options, nextResult.error);\n }\n else if (nextResult.data) {\n (_b = options.onCompleted) === null || _b === void 0 ? void 0 : _b.call(options, nextResult.data);\n }\n }\n }\n Object.assign(ref.current, { client: client, query: query });\n }, [obsQuery, client, query, options]);\n useEffect(function () {\n if (context.renderPromises) {\n return;\n }\n var subscription = obsQuery.subscribe(onNext, onError);\n function onNext() {\n var _a, _b;\n var previousResult = ref.current.result;\n var result = obsQuery.getCurrentResult();\n if (previousResult &&\n previousResult.loading === result.loading &&\n previousResult.networkStatus === result.networkStatus &&\n equal(previousResult.data, result.data)) {\n return;\n }\n if (previousResult.data) {\n ref.current.previousData = previousResult.data;\n }\n setResult(ref.current.result = result);\n if (!result.loading) {\n (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, result.data);\n }\n }\n function onError(error) {\n var _a, _b;\n var last = obsQuery[\"last\"];\n subscription.unsubscribe();\n try {\n obsQuery.resetLastResults();\n subscription = obsQuery.subscribe(onNext, onError);\n }\n finally {\n obsQuery[\"last\"] = last;\n }\n if (!error.hasOwnProperty('graphQLErrors')) {\n throw error;\n }\n var previousResult = ref.current.result;\n if ((previousResult && previousResult.loading) ||\n !equal(error, previousResult.error)) {\n setResult(ref.current.result = {\n data: previousResult.data,\n error: error,\n loading: false,\n networkStatus: NetworkStatus.error,\n });\n (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);\n }\n }\n return function () { return subscription.unsubscribe(); };\n }, [obsQuery, context.renderPromises, client.disableNetworkFetches]);\n var partial;\n (_a = result, partial = _a.partial, result = __rest(_a, [\"partial\"]));\n {\n if (partial &&\n (options === null || options === void 0 ? void 0 : options.partialRefetch) &&\n !result.loading &&\n (!result.data || Object.keys(result.data).length === 0) &&\n obsQuery.options.fetchPolicy !== 'cache-only') {\n result = __assign(__assign({}, result), { loading: true, networkStatus: NetworkStatus.refetch });\n obsQuery.refetch();\n }\n if (context.renderPromises &&\n (options === null || options === void 0 ? void 0 : options.ssr) !== false &&\n !(options === null || options === void 0 ? void 0 : options.skip) &&\n result.loading) {\n obsQuery.setOptions(createWatchQueryOptions(query, options, defaultWatchQueryOptions)).catch(function () { });\n }\n Object.assign(ref.current, { options: options });\n }\n if ((context.renderPromises || client.disableNetworkFetches) &&\n (options === null || options === void 0 ? void 0 : options.ssr) === false) {\n result = ref.current.result = {\n loading: true,\n data: void 0,\n error: void 0,\n networkStatus: NetworkStatus.loading,\n };\n }\n else if ((options === null || options === void 0 ? void 0 : options.skip) || (options === null || options === void 0 ? void 0 : options.fetchPolicy) === 'standby') {\n result = {\n loading: false,\n data: void 0,\n error: void 0,\n networkStatus: NetworkStatus.ready,\n };\n }\n if (result.errors && result.errors.length) {\n result = __assign(__assign({}, result), { error: result.error || new ApolloError({ graphQLErrors: result.errors }) });\n }\n var obsQueryFields = useMemo(function () { return ({\n refetch: obsQuery.refetch.bind(obsQuery),\n fetchMore: obsQuery.fetchMore.bind(obsQuery),\n updateQuery: obsQuery.updateQuery.bind(obsQuery),\n startPolling: obsQuery.startPolling.bind(obsQuery),\n stopPolling: obsQuery.stopPolling.bind(obsQuery),\n subscribeToMore: obsQuery.subscribeToMore.bind(obsQuery),\n }); }, [obsQuery]);\n return __assign(__assign(__assign({}, obsQueryFields), { variables: createWatchQueryOptions(query, options, defaultWatchQueryOptions).variables, client: client, called: true, previousData: ref.current.previousData }), result);\n}\nfunction createWatchQueryOptions(query, options, defaultOptions) {\n var _a;\n if (options === void 0) { options = {}; }\n var skip = options.skip, ssr = options.ssr, onCompleted = options.onCompleted, onError = options.onError, displayName = options.displayName, otherOptions = __rest(options, [\"skip\", \"ssr\", \"onCompleted\", \"onError\", \"displayName\"]);\n var watchQueryOptions = __assign({ query: query }, otherOptions);\n if (defaultOptions) {\n watchQueryOptions = mergeOptions(defaultOptions, watchQueryOptions);\n }\n if (skip) {\n watchQueryOptions.fetchPolicy = 'standby';\n }\n else if (((_a = watchQueryOptions.context) === null || _a === void 0 ? void 0 : _a.renderPromises) &&\n (watchQueryOptions.fetchPolicy === 'network-only' ||\n watchQueryOptions.fetchPolicy === 'cache-and-network')) {\n watchQueryOptions.fetchPolicy = 'cache-first';\n }\n else if (!watchQueryOptions.fetchPolicy) {\n watchQueryOptions.fetchPolicy = 'cache-first';\n }\n if (!watchQueryOptions.variables) {\n watchQueryOptions.variables = {};\n }\n return watchQueryOptions;\n}\n//# sourceMappingURL=useQuery.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { useCallback, useEffect, useState } from 'react';\nimport { useQuery } from \"./useQuery.js\";\nvar EAGER_METHODS = [\n 'refetch',\n 'fetchMore',\n 'updateQuery',\n 'startPolling',\n 'subscribeToMore',\n];\nexport function useLazyQuery(query, options) {\n var _a = useState({\n called: false,\n resolves: [],\n }), execution = _a[0], setExecution = _a[1];\n var execute = useCallback(function (executeOptions) {\n var resolve;\n var promise = new Promise(function (resolve1) { return (resolve = resolve1); });\n setExecution(function (execution) {\n if (execution.called) {\n result && result.refetch(executeOptions === null || executeOptions === void 0 ? void 0 : executeOptions.variables);\n }\n return {\n called: true,\n resolves: __spreadArray(__spreadArray([], execution.resolves, true), [resolve], false),\n options: executeOptions,\n };\n });\n return promise;\n }, []);\n var result = useQuery(query, __assign(__assign(__assign({}, options), execution.options), { fetchPolicy: execution.called ? options === null || options === void 0 ? void 0 : options.fetchPolicy : 'standby', skip: undefined }));\n useEffect(function () {\n var resolves = execution.resolves;\n if (!result.loading && resolves.length) {\n setExecution(function (execution) { return (__assign(__assign({}, execution), { resolves: [] })); });\n resolves.forEach(function (resolve) { return resolve(result); });\n }\n }, [result, execution]);\n if (!execution.called) {\n result = __assign(__assign({}, result), { loading: false, data: void 0, error: void 0, called: false });\n var _loop_1 = function (key) {\n var method = result[key];\n result[key] = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n setExecution(function (execution) { return (__assign(__assign({}, execution), { called: true })); });\n return method.apply(void 0, args);\n };\n };\n for (var _i = 0, EAGER_METHODS_1 = EAGER_METHODS; _i < EAGER_METHODS_1.length; _i++) {\n var key = EAGER_METHODS_1[_i];\n _loop_1(key);\n }\n }\n return [execute, result];\n}\n//# sourceMappingURL=useLazyQuery.js.map","import { __assign } from \"tslib\";\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { mergeOptions, } from \"../../core/index.js\";\nimport { equal } from '@wry/equality';\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nexport function useMutation(mutation, options) {\n var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);\n verifyDocumentType(mutation, DocumentType.Mutation);\n var _a = useState({\n called: false,\n loading: false,\n client: client,\n }), result = _a[0], setResult = _a[1];\n var ref = useRef({\n result: result,\n mutationId: 0,\n isMounted: true,\n client: client,\n mutation: mutation,\n options: options,\n });\n {\n Object.assign(ref.current, { client: client, options: options, mutation: mutation });\n }\n var execute = useCallback(function (executeOptions) {\n if (executeOptions === void 0) { executeOptions = {}; }\n var _a = ref.current, client = _a.client, options = _a.options, mutation = _a.mutation;\n var baseOptions = __assign(__assign({}, options), { mutation: mutation });\n if (!ref.current.result.loading && !baseOptions.ignoreResults) {\n setResult(ref.current.result = {\n loading: true,\n error: void 0,\n data: void 0,\n called: true,\n client: client,\n });\n }\n var mutationId = ++ref.current.mutationId;\n var clientOptions = mergeOptions(baseOptions, executeOptions);\n return client.mutate(clientOptions).then(function (response) {\n var _a, _b;\n var data = response.data, errors = response.errors;\n var error = errors && errors.length > 0\n ? new ApolloError({ graphQLErrors: errors })\n : void 0;\n if (mutationId === ref.current.mutationId &&\n !clientOptions.ignoreResults) {\n var result_1 = {\n called: true,\n loading: false,\n data: data,\n error: error,\n client: client,\n };\n if (ref.current.isMounted && !equal(ref.current.result, result_1)) {\n setResult(ref.current.result = result_1);\n }\n }\n (_a = baseOptions.onCompleted) === null || _a === void 0 ? void 0 : _a.call(baseOptions, response.data);\n (_b = executeOptions.onCompleted) === null || _b === void 0 ? void 0 : _b.call(executeOptions, response.data);\n return response;\n }).catch(function (error) {\n var _a, _b;\n if (mutationId === ref.current.mutationId &&\n ref.current.isMounted) {\n var result_2 = {\n loading: false,\n error: error,\n data: void 0,\n called: true,\n client: client,\n };\n if (!equal(ref.current.result, result_2)) {\n setResult(ref.current.result = result_2);\n }\n }\n if (baseOptions.onError || clientOptions.onError) {\n (_a = baseOptions.onError) === null || _a === void 0 ? void 0 : _a.call(baseOptions, error);\n (_b = executeOptions.onError) === null || _b === void 0 ? void 0 : _b.call(executeOptions, error);\n return { data: void 0, errors: error };\n }\n throw error;\n });\n }, []);\n var reset = useCallback(function () {\n setResult({ called: false, loading: false, client: client });\n }, []);\n useEffect(function () { return function () {\n ref.current.isMounted = false;\n }; }, []);\n return [execute, __assign({ reset: reset }, result)];\n}\n//# sourceMappingURL=useMutation.js.map","/* eslint-disable local-rules/disallow-side-effects */\n/**\n * Keep references on console methods to avoid triggering patched behaviors\n *\n * NB: in some setup, console could already be patched by another SDK.\n * In this case, some display messages can be sent by the other SDK\n * but we should be safe from infinite loop nonetheless.\n */\nexport var ConsoleApiName = {\n log: 'log',\n debug: 'debug',\n info: 'info',\n warn: 'warn',\n error: 'error',\n};\n/**\n * When building JS bundles, some users might use a plugin[1] or configuration[2] to remove\n * \"console.*\" references. This causes some issue as we expect `console.*` to be defined.\n * As a workaround, let's use a variable alias, so those expressions won't be taken into account by\n * simple static analysis.\n *\n * [1]: https://babeljs.io/docs/babel-plugin-transform-remove-console/\n * [2]: https://github.com/terser/terser#compress-options (look for drop_console)\n */\nexport var globalConsole = console;\nexport var originalConsoleMethods = {};\nObject.keys(ConsoleApiName).forEach(function (name) {\n originalConsoleMethods[name] = globalConsole[name];\n});\nvar PREFIX = 'Datadog Browser SDK:';\nexport var display = {\n debug: originalConsoleMethods.debug.bind(globalConsole, PREFIX),\n log: originalConsoleMethods.log.bind(globalConsole, PREFIX),\n info: originalConsoleMethods.info.bind(globalConsole, PREFIX),\n warn: originalConsoleMethods.warn.bind(globalConsole, PREFIX),\n error: originalConsoleMethods.error.bind(globalConsole, PREFIX),\n};\nexport var DOCS_ORIGIN = 'https://docs.datadoghq.com';\n//# sourceMappingURL=display.js.map","import { display } from './display';\nexport function catchUserErrors(fn, errorMsg) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n try {\n return fn.apply(void 0, args);\n }\n catch (err) {\n display.error(errorMsg, err);\n }\n };\n}\n//# sourceMappingURL=catchUserErrors.js.map","/**\n * LIMITATION:\n * For NPM setup, this feature flag singleton is shared between RUM and Logs product.\n * This means that an experimental flag set on the RUM product will be set on the Logs product.\n * So keep in mind that in certain configurations, your experimental feature flag may affect other products.\n *\n * FORMAT:\n * All feature flags should be snake_cased\n */\n// We want to use a real enum (i.e. not a const enum) here, to be able to check whether an arbitrary\n// string is an expected feature flag\n// eslint-disable-next-line no-restricted-syntax\nexport var ExperimentalFeature;\n(function (ExperimentalFeature) {\n ExperimentalFeature[\"WRITABLE_RESOURCE_GRAPHQL\"] = \"writable_resource_graphql\";\n ExperimentalFeature[\"CUSTOM_VITALS\"] = \"custom_vitals\";\n ExperimentalFeature[\"TOLERANT_RESOURCE_TIMINGS\"] = \"tolerant_resource_timings\";\n ExperimentalFeature[\"MICRO_FRONTEND\"] = \"micro_frontend\";\n})(ExperimentalFeature || (ExperimentalFeature = {}));\nvar enabledExperimentalFeatures = new Set();\nexport function addExperimentalFeatures(enabledFeatures) {\n enabledFeatures.forEach(function (flag) {\n enabledExperimentalFeatures.add(flag);\n });\n}\nexport function isExperimentalFeatureEnabled(featureName) {\n return enabledExperimentalFeatures.has(featureName);\n}\nexport function resetExperimentalFeatures() {\n enabledExperimentalFeatures.clear();\n}\nexport function getExperimentalFeatures() {\n return enabledExperimentalFeatures;\n}\n//# sourceMappingURL=experimentalFeatures.js.map","/**\n * Return true if the draw is successful\n * @param threshold between 0 and 100\n */\nexport function performDraw(threshold) {\n return threshold !== 0 && Math.random() * 100 <= threshold;\n}\nexport function round(num, decimals) {\n return +num.toFixed(decimals);\n}\nexport function isPercentage(value) {\n return isNumber(value) && value >= 0 && value <= 100;\n}\nexport function isNumber(value) {\n return typeof value === 'number';\n}\n//# sourceMappingURL=numberUtils.js.map","import { isNumber, round } from './numberUtils';\nexport var ONE_SECOND = 1000;\nexport var ONE_MINUTE = 60 * ONE_SECOND;\nexport var ONE_HOUR = 60 * ONE_MINUTE;\nexport var ONE_DAY = 24 * ONE_HOUR;\nexport var ONE_YEAR = 365 * ONE_DAY;\nexport function relativeToClocks(relative) {\n return { relative: relative, timeStamp: getCorrectedTimeStamp(relative) };\n}\nexport function timeStampToClocks(timeStamp) {\n return { relative: getRelativeTime(timeStamp), timeStamp: timeStamp };\n}\nfunction getCorrectedTimeStamp(relativeTime) {\n var correctedOrigin = (dateNow() - performance.now());\n // apply correction only for positive drift\n if (correctedOrigin > getNavigationStart()) {\n return Math.round(addDuration(correctedOrigin, relativeTime));\n }\n return getTimeStamp(relativeTime);\n}\nexport function currentDrift() {\n return Math.round(dateNow() - addDuration(getNavigationStart(), performance.now()));\n}\nexport function toServerDuration(duration) {\n if (!isNumber(duration)) {\n return duration;\n }\n return round(duration * 1e6, 0);\n}\nexport function dateNow() {\n // Do not use `Date.now` because sometimes websites are wrongly \"polyfilling\" it. For example, we\n // had some users using a very old version of `datejs`, which patched `Date.now` to return a Date\n // instance instead of a timestamp[1]. Those users are unlikely to fix this, so let's handle this\n // case ourselves.\n // [1]: https://github.com/datejs/Datejs/blob/97f5c7c58c5bc5accdab8aa7602b6ac56462d778/src/core-debug.js#L14-L16\n return new Date().getTime();\n}\nexport function timeStampNow() {\n return dateNow();\n}\nexport function relativeNow() {\n return performance.now();\n}\nexport function clocksNow() {\n return { relative: relativeNow(), timeStamp: timeStampNow() };\n}\nexport function clocksOrigin() {\n return { relative: 0, timeStamp: getNavigationStart() };\n}\nexport function elapsed(start, end) {\n return (end - start);\n}\nexport function addDuration(a, b) {\n return a + b;\n}\n/**\n * Get the time since the navigation was started.\n *\n * Note: this does not use `performance.timeOrigin` because it doesn't seem to reflect the actual\n * time on which the navigation has started: it may be much farther in the past, at least in Firefox 71.\n * Related issue in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1429926\n */\nexport function getRelativeTime(timestamp) {\n return (timestamp - getNavigationStart());\n}\nexport function getTimeStamp(relativeTime) {\n return Math.round(addDuration(getNavigationStart(), relativeTime));\n}\nexport function looksLikeRelativeTime(time) {\n return time < ONE_YEAR;\n}\n/**\n * Navigation start slightly change on some rare cases\n */\nvar navigationStart;\nfunction getNavigationStart() {\n if (navigationStart === undefined) {\n navigationStart = performance.timing.navigationStart;\n }\n return navigationStart;\n}\nexport function resetNavigationStart() {\n navigationStart = undefined;\n}\n//# sourceMappingURL=timeUtils.js.map","export var ONE_KIBI_BYTE = 1024;\nexport var ONE_MEBI_BYTE = 1024 * ONE_KIBI_BYTE;\n// eslint-disable-next-line no-control-regex\nvar HAS_MULTI_BYTES_CHARACTERS = /[^\\u0000-\\u007F]/;\nexport function computeBytesCount(candidate) {\n // Accurate bytes count computations can degrade performances when there is a lot of events to process\n if (!HAS_MULTI_BYTES_CHARACTERS.test(candidate)) {\n return candidate.length;\n }\n if (window.TextEncoder !== undefined) {\n return new TextEncoder().encode(candidate).length;\n }\n return new Blob([candidate]).size;\n}\nexport function concatBuffers(buffers) {\n var length = buffers.reduce(function (total, buffer) { return total + buffer.length; }, 0);\n var result = new Uint8Array(length);\n var offset = 0;\n for (var _i = 0, buffers_1 = buffers; _i < buffers_1.length; _i++) {\n var buffer = buffers_1[_i];\n result.set(buffer, offset);\n offset += buffer.length;\n }\n return result;\n}\n//# sourceMappingURL=byteUtils.js.map","export function includes(candidate, search) {\n return candidate.indexOf(search) !== -1;\n}\nexport function arrayFrom(arrayLike) {\n if (Array.from) {\n return Array.from(arrayLike);\n }\n var array = [];\n if (arrayLike instanceof Set) {\n arrayLike.forEach(function (item) { return array.push(item); });\n }\n else {\n for (var i = 0; i < arrayLike.length; i++) {\n array.push(arrayLike[i]);\n }\n }\n return array;\n}\nexport function find(array, predicate) {\n for (var i = 0; i < array.length; i += 1) {\n var item = array[i];\n if (predicate(item, i)) {\n return item;\n }\n }\n return undefined;\n}\nexport function findLast(array, predicate) {\n for (var i = array.length - 1; i >= 0; i -= 1) {\n var item = array[i];\n if (predicate(item, i, array)) {\n return item;\n }\n }\n return undefined;\n}\nexport function forEach(list, callback) {\n Array.prototype.forEach.call(list, callback);\n}\nexport function objectValues(object) {\n return Object.keys(object).map(function (key) { return object[key]; });\n}\nexport function objectEntries(object) {\n return Object.keys(object).map(function (key) { return [key, object[key]]; });\n}\nexport function startsWith(candidate, search) {\n return candidate.slice(0, search.length) === search;\n}\nexport function endsWith(candidate, search) {\n return candidate.slice(-search.length) === search;\n}\nexport function assign(target) {\n var toAssign = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n toAssign[_i - 1] = arguments[_i];\n }\n toAssign.forEach(function (source) {\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n });\n return target;\n}\n//# sourceMappingURL=polyfills.js.map","import { assign } from './polyfills';\nexport function shallowClone(object) {\n return assign({}, object);\n}\nexport function objectHasValue(object, value) {\n return Object.keys(object).some(function (key) { return object[key] === value; });\n}\nexport function isEmptyObject(object) {\n return Object.keys(object).length === 0;\n}\nexport function mapValues(object, fn) {\n var newObject = {};\n for (var _i = 0, _a = Object.keys(object); _i < _a.length; _i++) {\n var key = _a[_i];\n newObject[key] = fn(object[key]);\n }\n return newObject;\n}\n//# sourceMappingURL=objectUtils.js.map","/**\n * inspired by https://mathiasbynens.be/notes/globalthis\n */\nexport function getGlobalObject() {\n if (typeof globalThis === 'object') {\n return globalThis;\n }\n Object.defineProperty(Object.prototype, '_dd_temp_', {\n get: function () {\n return this;\n },\n configurable: true,\n });\n // @ts-ignore _dd_temp is defined using defineProperty\n var globalObject = _dd_temp_;\n // @ts-ignore _dd_temp is defined using defineProperty\n delete Object.prototype._dd_temp_;\n if (typeof globalObject !== 'object') {\n // on safari _dd_temp_ is available on window but not globally\n // fallback on other browser globals check\n if (typeof self === 'object') {\n globalObject = self;\n }\n else if (typeof window === 'object') {\n globalObject = window;\n }\n else {\n globalObject = {};\n }\n }\n return globalObject;\n}\n//# sourceMappingURL=getGlobalObject.js.map","import { getGlobalObject } from './getGlobalObject';\n/**\n * Gets the original value for a DOM API that was potentially patched by Zone.js.\n *\n * Zone.js[1] is a library that patches a bunch of JS and DOM APIs. It usually stores the original\n * value of the patched functions/constructors/methods in a hidden property prefixed by\n * __zone_symbol__.\n *\n * In multiple occasions, we observed that Zone.js is the culprit of important issues leading to\n * browser resource exhaustion (memory leak, high CPU usage). This method is used as a workaround to\n * use the original DOM API instead of the one patched by Zone.js.\n *\n * [1]: https://github.com/angular/angular/tree/main/packages/zone.js\n */\nexport function getZoneJsOriginalValue(target, name) {\n var browserWindow = getGlobalObject();\n var original;\n if (browserWindow.Zone && typeof browserWindow.Zone.__symbol__ === 'function') {\n original = target[browserWindow.Zone.__symbol__(name)];\n }\n if (!original) {\n original = target[name];\n }\n return original;\n}\n//# sourceMappingURL=getZoneJsOriginalValue.js.map","var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nimport { display } from './display';\nvar onMonitorErrorCollected;\nvar debugMode = false;\nexport function startMonitorErrorCollection(newOnMonitorErrorCollected) {\n onMonitorErrorCollected = newOnMonitorErrorCollected;\n}\nexport function setDebugMode(newDebugMode) {\n debugMode = newDebugMode;\n}\nexport function resetMonitor() {\n onMonitorErrorCollected = undefined;\n debugMode = false;\n}\nexport function monitored(_, __, descriptor) {\n var originalMethod = descriptor.value;\n descriptor.value = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var decorated = onMonitorErrorCollected ? monitor(originalMethod) : originalMethod;\n return decorated.apply(this, args);\n };\n}\nexport function monitor(fn) {\n return function () {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return callMonitored(fn, this, arguments);\n }; // consider output type has input type\n}\nexport function callMonitored(fn, context, args) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return fn.apply(context, args);\n }\n catch (e) {\n displayIfDebugEnabled(e);\n if (onMonitorErrorCollected) {\n try {\n onMonitorErrorCollected(e);\n }\n catch (e) {\n displayIfDebugEnabled(e);\n }\n }\n }\n}\nexport function displayIfDebugEnabled() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (debugMode) {\n display.error.apply(display, __spreadArray(['[MONITOR]'], args, false));\n }\n}\n//# sourceMappingURL=monitor.js.map","import { getZoneJsOriginalValue } from './getZoneJsOriginalValue';\nimport { monitor } from './monitor';\nimport { getGlobalObject } from './getGlobalObject';\nexport function setTimeout(callback, delay) {\n return getZoneJsOriginalValue(getGlobalObject(), 'setTimeout')(monitor(callback), delay);\n}\nexport function clearTimeout(timeoutId) {\n getZoneJsOriginalValue(getGlobalObject(), 'clearTimeout')(timeoutId);\n}\nexport function setInterval(callback, delay) {\n return getZoneJsOriginalValue(getGlobalObject(), 'setInterval')(monitor(callback), delay);\n}\nexport function clearInterval(timeoutId) {\n getZoneJsOriginalValue(getGlobalObject(), 'clearInterval')(timeoutId);\n}\n//# sourceMappingURL=timer.js.map","var Observable = /** @class */ (function () {\n function Observable(onFirstSubscribe) {\n this.onFirstSubscribe = onFirstSubscribe;\n this.observers = [];\n }\n Observable.prototype.subscribe = function (f) {\n var _this = this;\n if (!this.observers.length && this.onFirstSubscribe) {\n this.onLastUnsubscribe = this.onFirstSubscribe(this) || undefined;\n }\n this.observers.push(f);\n return {\n unsubscribe: function () {\n _this.observers = _this.observers.filter(function (other) { return f !== other; });\n if (!_this.observers.length && _this.onLastUnsubscribe) {\n _this.onLastUnsubscribe();\n }\n },\n };\n };\n Observable.prototype.notify = function (data) {\n this.observers.forEach(function (observer) { return observer(data); });\n };\n return Observable;\n}());\nexport { Observable };\nexport function mergeObservables() {\n var observables = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n observables[_i] = arguments[_i];\n }\n return new Observable(function (globalObservable) {\n var subscriptions = observables.map(function (observable) {\n return observable.subscribe(function (data) { return globalObservable.notify(data); });\n });\n return function () { return subscriptions.forEach(function (subscription) { return subscription.unsubscribe(); }); };\n });\n}\n//# sourceMappingURL=observable.js.map","import { setTimeout, clearTimeout } from '../timer';\n// use lodash API\nexport function throttle(fn, wait, options) {\n var needLeadingExecution = options && options.leading !== undefined ? options.leading : true;\n var needTrailingExecution = options && options.trailing !== undefined ? options.trailing : true;\n var inWaitPeriod = false;\n var pendingExecutionWithParameters;\n var pendingTimeoutId;\n return {\n throttled: function () {\n var parameters = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n parameters[_i] = arguments[_i];\n }\n if (inWaitPeriod) {\n pendingExecutionWithParameters = parameters;\n return;\n }\n if (needLeadingExecution) {\n fn.apply(void 0, parameters);\n }\n else {\n pendingExecutionWithParameters = parameters;\n }\n inWaitPeriod = true;\n pendingTimeoutId = setTimeout(function () {\n if (needTrailingExecution && pendingExecutionWithParameters) {\n fn.apply(void 0, pendingExecutionWithParameters);\n }\n inWaitPeriod = false;\n pendingExecutionWithParameters = undefined;\n }, wait);\n },\n cancel: function () {\n clearTimeout(pendingTimeoutId);\n inWaitPeriod = false;\n pendingExecutionWithParameters = undefined;\n },\n };\n}\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nexport function noop() { }\n//# sourceMappingURL=functionUtils.js.map","/**\n * UUID v4\n * from https://gist.github.com/jed/982883\n */\nexport function generateUUID(placeholder) {\n return placeholder\n ? // eslint-disable-next-line no-bitwise\n (parseInt(placeholder, 10) ^ ((Math.random() * 16) >> (parseInt(placeholder, 10) / 4))).toString(16)\n : \"\".concat(1e7, \"-\").concat(1e3, \"-\").concat(4e3, \"-\").concat(8e3, \"-\").concat(1e11).replace(/[018]/g, generateUUID);\n}\nvar COMMA_SEPARATED_KEY_VALUE = /([\\w-]+)\\s*=\\s*([^;]+)/g;\nexport function findCommaSeparatedValue(rawString, name) {\n COMMA_SEPARATED_KEY_VALUE.lastIndex = 0;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n var match = COMMA_SEPARATED_KEY_VALUE.exec(rawString);\n if (match) {\n if (match[1] === name) {\n return match[2];\n }\n }\n else {\n break;\n }\n }\n}\nexport function findCommaSeparatedValues(rawString) {\n var result = new Map();\n COMMA_SEPARATED_KEY_VALUE.lastIndex = 0;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n var match = COMMA_SEPARATED_KEY_VALUE.exec(rawString);\n if (match) {\n result.set(match[1], match[2]);\n }\n else {\n break;\n }\n }\n return result;\n}\nexport function safeTruncate(candidate, length, suffix) {\n if (suffix === void 0) { suffix = ''; }\n var lastChar = candidate.charCodeAt(length - 1);\n var isLastCharSurrogatePair = lastChar >= 0xd800 && lastChar <= 0xdbff;\n var correctedLength = isLastCharSurrogatePair ? length + 1 : length;\n if (candidate.length <= correctedLength) {\n return candidate;\n }\n return \"\".concat(candidate.slice(0, correctedLength)).concat(suffix);\n}\n//# sourceMappingURL=stringUtils.js.map","export function isIE() {\n return detectBrowserCached() === 0 /* Browser.IE */;\n}\nexport function isChromium() {\n return detectBrowserCached() === 1 /* Browser.CHROMIUM */;\n}\nexport function isSafari() {\n return detectBrowserCached() === 2 /* Browser.SAFARI */;\n}\nvar browserCache;\nfunction detectBrowserCached() {\n return browserCache !== null && browserCache !== void 0 ? browserCache : (browserCache = detectBrowser());\n}\n// Exported only for tests\nexport function detectBrowser(browserWindow) {\n var _a;\n if (browserWindow === void 0) { browserWindow = window; }\n var userAgent = browserWindow.navigator.userAgent;\n if (browserWindow.chrome || /HeadlessChrome/.test(userAgent)) {\n return 1 /* Browser.CHROMIUM */;\n }\n if (\n // navigator.vendor is deprecated, but it is the most resilient way we found to detect\n // \"Apple maintained browsers\" (AKA Safari). If one day it gets removed, we still have the\n // useragent test as a semi-working fallback.\n ((_a = browserWindow.navigator.vendor) === null || _a === void 0 ? void 0 : _a.indexOf('Apple')) === 0 ||\n (/safari/i.test(userAgent) && !/chrome|android/i.test(userAgent))) {\n return 2 /* Browser.SAFARI */;\n }\n if (browserWindow.document.documentMode) {\n return 0 /* Browser.IE */;\n }\n return 3 /* Browser.OTHER */;\n}\n//# sourceMappingURL=browserDetection.js.map","import { display } from '../tools/display';\nimport { ONE_MINUTE, ONE_SECOND } from '../tools/utils/timeUtils';\nimport { findCommaSeparatedValue, findCommaSeparatedValues, generateUUID } from '../tools/utils/stringUtils';\nexport function setCookie(name, value, expireDelay, options) {\n var date = new Date();\n date.setTime(date.getTime() + expireDelay);\n var expires = \"expires=\".concat(date.toUTCString());\n var sameSite = options && options.crossSite ? 'none' : 'strict';\n var domain = options && options.domain ? \";domain=\".concat(options.domain) : '';\n var secure = options && options.secure ? ';secure' : '';\n var partitioned = options && options.partitioned ? ';partitioned' : '';\n document.cookie = \"\".concat(name, \"=\").concat(value, \";\").concat(expires, \";path=/;samesite=\").concat(sameSite).concat(domain).concat(secure).concat(partitioned);\n}\nexport function getCookie(name) {\n return findCommaSeparatedValue(document.cookie, name);\n}\nvar initCookieParsed;\n/**\n * Returns a cached value of the cookie. Use this during SDK initialization (and whenever possible)\n * to avoid accessing document.cookie multiple times.\n */\nexport function getInitCookie(name) {\n if (!initCookieParsed) {\n initCookieParsed = findCommaSeparatedValues(document.cookie);\n }\n return initCookieParsed.get(name);\n}\nexport function resetInitCookies() {\n initCookieParsed = undefined;\n}\nexport function deleteCookie(name, options) {\n setCookie(name, '', 0, options);\n}\nexport function areCookiesAuthorized(options) {\n if (document.cookie === undefined || document.cookie === null) {\n return false;\n }\n try {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n var testCookieName = \"dd_cookie_test_\".concat(generateUUID());\n var testCookieValue = 'test';\n setCookie(testCookieName, testCookieValue, ONE_MINUTE, options);\n var isCookieCorrectlySet = getCookie(testCookieName) === testCookieValue;\n deleteCookie(testCookieName, options);\n return isCookieCorrectlySet;\n }\n catch (error) {\n display.error(error);\n return false;\n }\n}\n/**\n * No API to retrieve it, number of levels for subdomain and suffix are unknown\n * strategy: find the minimal domain on which cookies are allowed to be set\n * https://web.dev/same-site-same-origin/#site\n */\nvar getCurrentSiteCache;\nexport function getCurrentSite() {\n if (getCurrentSiteCache === undefined) {\n // Use a unique cookie name to avoid issues when the SDK is initialized multiple times during\n // the test cookie lifetime\n var testCookieName = \"dd_site_test_\".concat(generateUUID());\n var testCookieValue = 'test';\n var domainLevels = window.location.hostname.split('.');\n var candidateDomain = domainLevels.pop();\n while (domainLevels.length && !getCookie(testCookieName)) {\n candidateDomain = \"\".concat(domainLevels.pop(), \".\").concat(candidateDomain);\n setCookie(testCookieName, testCookieValue, ONE_SECOND, { domain: candidateDomain });\n }\n deleteCookie(testCookieName, { domain: candidateDomain });\n getCurrentSiteCache = candidateDomain;\n }\n return getCurrentSiteCache;\n}\n//# sourceMappingURL=cookie.js.map","export var SESSION_STORE_KEY = '_dd_s';\n//# sourceMappingURL=sessionStoreStrategy.js.map","import { ONE_HOUR, ONE_MINUTE } from '../../tools/utils/timeUtils';\nexport var SESSION_TIME_OUT_DELAY = 4 * ONE_HOUR;\nexport var SESSION_EXPIRATION_DELAY = 15 * ONE_MINUTE;\n//# sourceMappingURL=sessionConstants.js.map","import { isEmptyObject } from '../../tools/utils/objectUtils';\nimport { objectEntries } from '../../tools/utils/polyfills';\nimport { dateNow } from '../../tools/utils/timeUtils';\nimport { SESSION_EXPIRATION_DELAY, SESSION_TIME_OUT_DELAY } from './sessionConstants';\nvar SESSION_ENTRY_REGEXP = /^([a-zA-Z]+)=([a-z0-9-]+)$/;\nvar SESSION_ENTRY_SEPARATOR = '&';\nexport var EXPIRED = '1';\nexport function getExpiredSessionState() {\n return {\n isExpired: EXPIRED,\n };\n}\nexport function isSessionInNotStartedState(session) {\n return isEmptyObject(session);\n}\nexport function isSessionStarted(session) {\n return !isSessionInNotStartedState(session);\n}\nexport function isSessionInExpiredState(session) {\n return session.isExpired !== undefined || !isActiveSession(session);\n}\n// An active session is a session in either `Tracked` or `NotTracked` state\nfunction isActiveSession(sessionState) {\n // created and expire can be undefined for versions which was not storing them\n // these checks could be removed when older versions will not be available/live anymore\n return ((sessionState.created === undefined || dateNow() - Number(sessionState.created) < SESSION_TIME_OUT_DELAY) &&\n (sessionState.expire === undefined || dateNow() < Number(sessionState.expire)));\n}\nexport function expandSessionState(session) {\n session.expire = String(dateNow() + SESSION_EXPIRATION_DELAY);\n}\nexport function toSessionString(session) {\n return objectEntries(session)\n .map(function (_a) {\n var key = _a[0], value = _a[1];\n return \"\".concat(key, \"=\").concat(value);\n })\n .join(SESSION_ENTRY_SEPARATOR);\n}\nexport function toSessionState(sessionString) {\n var session = {};\n if (isValidSessionString(sessionString)) {\n sessionString.split(SESSION_ENTRY_SEPARATOR).forEach(function (entry) {\n var matches = SESSION_ENTRY_REGEXP.exec(entry);\n if (matches !== null) {\n var key = matches[1], value = matches[2];\n session[key] = value;\n }\n });\n }\n return session;\n}\nfunction isValidSessionString(sessionString) {\n return (!!sessionString &&\n (sessionString.indexOf(SESSION_ENTRY_SEPARATOR) !== -1 || SESSION_ENTRY_REGEXP.test(sessionString)));\n}\n//# sourceMappingURL=sessionState.js.map","import { getInitCookie } from '../../browser/cookie';\nimport { SESSION_STORE_KEY } from './storeStrategies/sessionStoreStrategy';\nimport { expandSessionState, isSessionStarted } from './sessionState';\nexport var OLD_SESSION_COOKIE_NAME = '_dd';\nexport var OLD_RUM_COOKIE_NAME = '_dd_r';\nexport var OLD_LOGS_COOKIE_NAME = '_dd_l';\n// duplicate values to avoid dependency issues\nexport var RUM_SESSION_KEY = 'rum';\nexport var LOGS_SESSION_KEY = 'logs';\n/**\n * This migration should remain in the codebase as long as older versions are available/live\n * to allow older sdk versions to be upgraded to newer versions without compatibility issues.\n */\nexport function tryOldCookiesMigration(cookieStoreStrategy) {\n var sessionString = getInitCookie(SESSION_STORE_KEY);\n if (!sessionString) {\n var oldSessionId = getInitCookie(OLD_SESSION_COOKIE_NAME);\n var oldRumType = getInitCookie(OLD_RUM_COOKIE_NAME);\n var oldLogsType = getInitCookie(OLD_LOGS_COOKIE_NAME);\n var session = {};\n if (oldSessionId) {\n session.id = oldSessionId;\n }\n if (oldLogsType && /^[01]$/.test(oldLogsType)) {\n session[LOGS_SESSION_KEY] = oldLogsType;\n }\n if (oldRumType && /^[012]$/.test(oldRumType)) {\n session[RUM_SESSION_KEY] = oldRumType;\n }\n if (isSessionStarted(session)) {\n expandSessionState(session);\n cookieStoreStrategy.persistSession(session);\n }\n }\n}\n//# sourceMappingURL=oldCookiesMigration.js.map","import { isChromium } from '../../../tools/utils/browserDetection';\nimport { getCurrentSite, areCookiesAuthorized, getCookie, setCookie } from '../../../browser/cookie';\nimport { tryOldCookiesMigration } from '../oldCookiesMigration';\nimport { SESSION_EXPIRATION_DELAY, SESSION_TIME_OUT_DELAY } from '../sessionConstants';\nimport { toSessionString, toSessionState, getExpiredSessionState } from '../sessionState';\nimport { SESSION_STORE_KEY } from './sessionStoreStrategy';\nexport function selectCookieStrategy(initConfiguration) {\n var cookieOptions = buildCookieOptions(initConfiguration);\n return areCookiesAuthorized(cookieOptions) ? { type: 'Cookie', cookieOptions: cookieOptions } : undefined;\n}\nexport function initCookieStrategy(cookieOptions) {\n var cookieStore = {\n /**\n * Lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.\n */\n isLockEnabled: isChromium(),\n persistSession: persistSessionCookie(cookieOptions),\n retrieveSession: retrieveSessionCookie,\n expireSession: function () { return expireSessionCookie(cookieOptions); },\n };\n tryOldCookiesMigration(cookieStore);\n return cookieStore;\n}\nfunction persistSessionCookie(options) {\n return function (session) {\n setCookie(SESSION_STORE_KEY, toSessionString(session), SESSION_EXPIRATION_DELAY, options);\n };\n}\nfunction expireSessionCookie(options) {\n setCookie(SESSION_STORE_KEY, toSessionString(getExpiredSessionState()), SESSION_TIME_OUT_DELAY, options);\n}\nfunction retrieveSessionCookie() {\n var sessionString = getCookie(SESSION_STORE_KEY);\n return toSessionState(sessionString);\n}\nexport function buildCookieOptions(initConfiguration) {\n var cookieOptions = {};\n cookieOptions.secure =\n !!initConfiguration.useSecureSessionCookie ||\n !!initConfiguration.usePartitionedCrossSiteSessionCookie ||\n !!initConfiguration.useCrossSiteSessionCookie;\n cookieOptions.crossSite =\n !!initConfiguration.usePartitionedCrossSiteSessionCookie || !!initConfiguration.useCrossSiteSessionCookie;\n cookieOptions.partitioned = !!initConfiguration.usePartitionedCrossSiteSessionCookie;\n if (initConfiguration.trackSessionAcrossSubdomains) {\n cookieOptions.domain = getCurrentSite();\n }\n return cookieOptions;\n}\n//# sourceMappingURL=sessionInCookie.js.map","import { generateUUID } from '../../../tools/utils/stringUtils';\nimport { toSessionString, toSessionState, getExpiredSessionState } from '../sessionState';\nimport { SESSION_STORE_KEY } from './sessionStoreStrategy';\nvar LOCAL_STORAGE_TEST_KEY = '_dd_test_';\nexport function selectLocalStorageStrategy() {\n try {\n var id = generateUUID();\n var testKey = \"\".concat(LOCAL_STORAGE_TEST_KEY).concat(id);\n localStorage.setItem(testKey, id);\n var retrievedId = localStorage.getItem(testKey);\n localStorage.removeItem(testKey);\n return id === retrievedId ? { type: 'LocalStorage' } : undefined;\n }\n catch (e) {\n return undefined;\n }\n}\nexport function initLocalStorageStrategy() {\n return {\n isLockEnabled: false,\n persistSession: persistInLocalStorage,\n retrieveSession: retrieveSessionFromLocalStorage,\n expireSession: expireSessionFromLocalStorage,\n };\n}\nfunction persistInLocalStorage(sessionState) {\n localStorage.setItem(SESSION_STORE_KEY, toSessionString(sessionState));\n}\nfunction retrieveSessionFromLocalStorage() {\n var sessionString = localStorage.getItem(SESSION_STORE_KEY);\n return toSessionState(sessionString);\n}\nfunction expireSessionFromLocalStorage() {\n persistInLocalStorage(getExpiredSessionState());\n}\n//# sourceMappingURL=sessionInLocalStorage.js.map","import { setTimeout } from '../../tools/timer';\nimport { generateUUID } from '../../tools/utils/stringUtils';\nimport { assign } from '../../tools/utils/polyfills';\nimport { expandSessionState, isSessionInExpiredState } from './sessionState';\nexport var LOCK_RETRY_DELAY = 10;\nexport var LOCK_MAX_TRIES = 100;\nvar bufferedOperations = [];\nvar ongoingOperations;\nexport function processSessionStoreOperations(operations, sessionStoreStrategy, numberOfRetries) {\n var _a;\n if (numberOfRetries === void 0) { numberOfRetries = 0; }\n var isLockEnabled = sessionStoreStrategy.isLockEnabled, persistSession = sessionStoreStrategy.persistSession, expireSession = sessionStoreStrategy.expireSession;\n var persistWithLock = function (session) { return persistSession(assign({}, session, { lock: currentLock })); };\n var retrieveStore = function () {\n var session = sessionStoreStrategy.retrieveSession();\n var lock = session.lock;\n if (session.lock) {\n delete session.lock;\n }\n return {\n session: session,\n lock: lock,\n };\n };\n if (!ongoingOperations) {\n ongoingOperations = operations;\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations);\n return;\n }\n if (isLockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {\n next(sessionStoreStrategy);\n return;\n }\n var currentLock;\n var currentStore = retrieveStore();\n if (isLockEnabled) {\n // if someone has lock, retry later\n if (currentStore.lock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries);\n return;\n }\n // acquire lock\n currentLock = generateUUID();\n persistWithLock(currentStore.session);\n // if lock is not acquired, retry later\n currentStore = retrieveStore();\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries);\n return;\n }\n }\n var processedSession = operations.process(currentStore.session);\n if (isLockEnabled) {\n // if lock corrupted after process, retry later\n currentStore = retrieveStore();\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries);\n return;\n }\n }\n if (processedSession) {\n if (isSessionInExpiredState(processedSession)) {\n expireSession();\n }\n else {\n expandSessionState(processedSession);\n isLockEnabled ? persistWithLock(processedSession) : persistSession(processedSession);\n }\n }\n if (isLockEnabled) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isSessionInExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentStore = retrieveStore();\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries);\n return;\n }\n persistSession(currentStore.session);\n processedSession = currentStore.session;\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date session state value => the value could have been modified by another tab\n (_a = operations.after) === null || _a === void 0 ? void 0 : _a.call(operations, processedSession || currentStore.session);\n next(sessionStoreStrategy);\n}\nfunction retryLater(operations, sessionStore, currentNumberOfRetries) {\n setTimeout(function () {\n processSessionStoreOperations(operations, sessionStore, currentNumberOfRetries + 1);\n }, LOCK_RETRY_DELAY);\n}\nfunction next(sessionStore) {\n ongoingOperations = undefined;\n var nextOperations = bufferedOperations.shift();\n if (nextOperations) {\n processSessionStoreOperations(nextOperations, sessionStore);\n }\n}\n//# sourceMappingURL=sessionStoreOperations.js.map","import { clearInterval, setInterval } from '../../tools/timer';\nimport { Observable } from '../../tools/observable';\nimport { ONE_SECOND, dateNow } from '../../tools/utils/timeUtils';\nimport { throttle } from '../../tools/utils/functionUtils';\nimport { generateUUID } from '../../tools/utils/stringUtils';\nimport { selectCookieStrategy, initCookieStrategy } from './storeStrategies/sessionInCookie';\nimport { getExpiredSessionState, isSessionInExpiredState, isSessionInNotStartedState, isSessionStarted, } from './sessionState';\nimport { initLocalStorageStrategy, selectLocalStorageStrategy } from './storeStrategies/sessionInLocalStorage';\nimport { processSessionStoreOperations } from './sessionStoreOperations';\n/**\n * Every second, the storage will be polled to check for any change that can occur\n * to the session state in another browser tab, or another window.\n * This value has been determined from our previous cookie-only implementation.\n */\nexport var STORAGE_POLL_DELAY = ONE_SECOND;\n/**\n * Checks if cookies are available as the preferred storage\n * Else, checks if LocalStorage is allowed and available\n */\nexport function selectSessionStoreStrategyType(initConfiguration) {\n var sessionStoreStrategyType = selectCookieStrategy(initConfiguration);\n if (!sessionStoreStrategyType && initConfiguration.allowFallbackToLocalStorage) {\n sessionStoreStrategyType = selectLocalStorageStrategy();\n }\n return sessionStoreStrategyType;\n}\n/**\n * Different session concepts:\n * - tracked, the session has an id and is updated along the user navigation\n * - not tracked, the session does not have an id but it is updated along the user navigation\n * - inactive, no session in store or session expired, waiting for a renew session\n */\nexport function startSessionStore(sessionStoreStrategyType, productKey, computeSessionState) {\n var renewObservable = new Observable();\n var expireObservable = new Observable();\n var sessionStoreStrategy = sessionStoreStrategyType.type === 'Cookie'\n ? initCookieStrategy(sessionStoreStrategyType.cookieOptions)\n : initLocalStorageStrategy();\n var expireSession = sessionStoreStrategy.expireSession;\n var watchSessionTimeoutId = setInterval(watchSession, STORAGE_POLL_DELAY);\n var sessionCache;\n startSession();\n var _a = throttle(function () {\n processSessionStoreOperations({\n process: function (sessionState) {\n if (isSessionInNotStartedState(sessionState)) {\n return;\n }\n var synchronizedSession = synchronizeSession(sessionState);\n expandOrRenewSessionState(synchronizedSession);\n return synchronizedSession;\n },\n after: function (sessionState) {\n if (isSessionStarted(sessionState) && !hasSessionInCache()) {\n renewSessionInCache(sessionState);\n }\n sessionCache = sessionState;\n },\n }, sessionStoreStrategy);\n }, STORAGE_POLL_DELAY), throttledExpandOrRenewSession = _a.throttled, cancelExpandOrRenewSession = _a.cancel;\n function expandSession() {\n processSessionStoreOperations({\n process: function (sessionState) { return (hasSessionInCache() ? synchronizeSession(sessionState) : undefined); },\n }, sessionStoreStrategy);\n }\n /**\n * allows two behaviors:\n * - if the session is active, synchronize the session cache without updating the session store\n * - if the session is not active, clear the session store and expire the session cache\n */\n function watchSession() {\n processSessionStoreOperations({\n process: function (sessionState) { return (isSessionInExpiredState(sessionState) ? getExpiredSessionState() : undefined); },\n after: synchronizeSession,\n }, sessionStoreStrategy);\n }\n function synchronizeSession(sessionState) {\n if (isSessionInExpiredState(sessionState)) {\n sessionState = getExpiredSessionState();\n }\n if (hasSessionInCache()) {\n if (isSessionInCacheOutdated(sessionState)) {\n expireSessionInCache();\n }\n else {\n sessionCache = sessionState;\n }\n }\n return sessionState;\n }\n function startSession() {\n processSessionStoreOperations({\n process: function (sessionState) {\n if (isSessionInNotStartedState(sessionState)) {\n return getExpiredSessionState();\n }\n },\n after: function (sessionState) {\n sessionCache = sessionState;\n },\n }, sessionStoreStrategy);\n }\n function expandOrRenewSessionState(sessionState) {\n if (isSessionInNotStartedState(sessionState)) {\n return false;\n }\n var _a = computeSessionState(sessionState[productKey]), trackingType = _a.trackingType, isTracked = _a.isTracked;\n sessionState[productKey] = trackingType;\n delete sessionState.isExpired;\n if (isTracked && !sessionState.id) {\n sessionState.id = generateUUID();\n sessionState.created = String(dateNow());\n }\n }\n function hasSessionInCache() {\n return sessionCache[productKey] !== undefined;\n }\n function isSessionInCacheOutdated(sessionState) {\n return sessionCache.id !== sessionState.id || sessionCache[productKey] !== sessionState[productKey];\n }\n function expireSessionInCache() {\n sessionCache = getExpiredSessionState();\n expireObservable.notify();\n }\n function renewSessionInCache(sessionState) {\n sessionCache = sessionState;\n renewObservable.notify();\n }\n return {\n expandOrRenewSession: throttledExpandOrRenewSession,\n expandSession: expandSession,\n getSession: function () { return sessionCache; },\n renewObservable: renewObservable,\n expireObservable: expireObservable,\n restartSession: startSession,\n expire: function () {\n cancelExpandOrRenewSession();\n expireSession();\n synchronizeSession(getExpiredSessionState());\n },\n stop: function () {\n clearInterval(watchSessionTimeoutId);\n },\n };\n}\n//# sourceMappingURL=sessionStore.js.map","import { Observable } from '../tools/observable';\nexport var TrackingConsent = {\n GRANTED: 'granted',\n NOT_GRANTED: 'not-granted',\n};\nexport function createTrackingConsentState(currentConsent) {\n var observable = new Observable();\n return {\n tryToInit: function (trackingConsent) {\n if (!currentConsent) {\n currentConsent = trackingConsent;\n }\n },\n update: function (trackingConsent) {\n currentConsent = trackingConsent;\n observable.notify();\n },\n isGranted: function () {\n return currentConsent === TrackingConsent.GRANTED;\n },\n observable: observable,\n };\n}\n//# sourceMappingURL=trackingConsent.js.map","import { noop } from '../utils/functionUtils';\n/**\n * Custom implementation of JSON.stringify that ignores some toJSON methods. We need to do that\n * because some sites badly override toJSON on certain objects. Removing all toJSON methods from\n * nested values would be too costly, so we just detach them from the root value, and native classes\n * used to build JSON values (Array and Object).\n *\n * Note: this still assumes that JSON.stringify is correct.\n */\nexport function jsonStringify(value, replacer, space) {\n if (typeof value !== 'object' || value === null) {\n return JSON.stringify(value);\n }\n // Note: The order matter here. We need to detach toJSON methods on parent classes before their\n // subclasses.\n var restoreObjectPrototypeToJson = detachToJsonMethod(Object.prototype);\n var restoreArrayPrototypeToJson = detachToJsonMethod(Array.prototype);\n var restoreValuePrototypeToJson = detachToJsonMethod(Object.getPrototypeOf(value));\n var restoreValueToJson = detachToJsonMethod(value);\n try {\n return JSON.stringify(value, replacer, space);\n }\n catch (_a) {\n return '';\n }\n finally {\n restoreObjectPrototypeToJson();\n restoreArrayPrototypeToJson();\n restoreValuePrototypeToJson();\n restoreValueToJson();\n }\n}\nexport function detachToJsonMethod(value) {\n var object = value;\n var objectToJson = object.toJSON;\n if (objectToJson) {\n delete object.toJSON;\n return function () {\n object.toJSON = objectToJson;\n };\n }\n return noop;\n}\n//# sourceMappingURL=jsonStringify.js.map","import { jsonStringify } from '../serialisation/jsonStringify';\nexport function normalizeUrl(url) {\n return buildUrl(url, location.href).href;\n}\nexport function isValidUrl(url) {\n try {\n return !!buildUrl(url);\n }\n catch (_a) {\n return false;\n }\n}\nexport function getPathName(url) {\n var pathname = buildUrl(url).pathname;\n return pathname[0] === '/' ? pathname : \"/\".concat(pathname);\n}\nexport function buildUrl(url, base) {\n var supportedURL = getSupportedUrl();\n if (supportedURL) {\n try {\n return base !== undefined ? new supportedURL(url, base) : new supportedURL(url);\n }\n catch (error) {\n throw new Error(\"Failed to construct URL: \".concat(String(error), \" \").concat(jsonStringify({ url: url, base: base })));\n }\n }\n if (base === undefined && !/:/.test(url)) {\n throw new Error(\"Invalid URL: '\".concat(url, \"'\"));\n }\n var doc = document;\n var anchorElement = doc.createElement('a');\n if (base !== undefined) {\n doc = document.implementation.createHTMLDocument('');\n var baseElement = doc.createElement('base');\n baseElement.href = base;\n doc.head.appendChild(baseElement);\n doc.body.appendChild(anchorElement);\n }\n anchorElement.href = url;\n return anchorElement;\n}\nvar originalURL = URL;\nvar isURLSupported;\nfunction getSupportedUrl() {\n if (isURLSupported === undefined) {\n try {\n var url = new originalURL('http://test/path');\n isURLSupported = url.href === 'http://test/path';\n }\n catch (_a) {\n isURLSupported = false;\n }\n }\n return isURLSupported ? originalURL : undefined;\n}\n//# sourceMappingURL=urlPolyfill.js.map","export var INTAKE_SITE_STAGING = 'datad0g.com';\nexport var INTAKE_SITE_FED_STAGING = 'dd0g-gov.com';\nexport var INTAKE_SITE_US1 = 'datadoghq.com';\nexport var INTAKE_SITE_EU1 = 'datadoghq.eu';\nexport var INTAKE_SITE_US1_FED = 'ddog-gov.com';\nexport var PCI_INTAKE_HOST_US1 = 'pci.browser-intake-datadoghq.com';\n//# sourceMappingURL=intakeSites.js.map","import { timeStampNow } from '../../tools/utils/timeUtils';\nimport { normalizeUrl } from '../../tools/utils/urlPolyfill';\nimport { generateUUID } from '../../tools/utils/stringUtils';\nimport { INTAKE_SITE_US1, INTAKE_SITE_FED_STAGING, PCI_INTAKE_HOST_US1 } from './intakeSites';\nexport function createEndpointBuilder(initConfiguration, trackType, configurationTags) {\n var buildUrlWithParameters = createEndpointUrlWithParametersBuilder(initConfiguration, trackType);\n return {\n build: function (api, payload) {\n var parameters = buildEndpointParameters(initConfiguration, trackType, configurationTags, api, payload);\n return buildUrlWithParameters(parameters);\n },\n urlPrefix: buildUrlWithParameters(''),\n trackType: trackType,\n };\n}\n/**\n * Create a function used to build a full endpoint url from provided parameters. The goal of this\n * function is to pre-compute some parts of the URL to avoid re-computing everything on every\n * request, as only parameters are changing.\n */\nfunction createEndpointUrlWithParametersBuilder(initConfiguration, trackType) {\n var path = \"/api/v2/\".concat(trackType);\n var proxy = initConfiguration.proxy;\n if (typeof proxy === 'string') {\n var normalizedProxyUrl_1 = normalizeUrl(proxy);\n return function (parameters) { return \"\".concat(normalizedProxyUrl_1, \"?ddforward=\").concat(encodeURIComponent(\"\".concat(path, \"?\").concat(parameters))); };\n }\n if (typeof proxy === 'function') {\n return function (parameters) { return proxy({ path: path, parameters: parameters }); };\n }\n var host = buildEndpointHost(trackType, initConfiguration);\n return function (parameters) { return \"https://\".concat(host).concat(path, \"?\").concat(parameters); };\n}\nfunction buildEndpointHost(trackType, initConfiguration) {\n var _a = initConfiguration.site, site = _a === void 0 ? INTAKE_SITE_US1 : _a, internalAnalyticsSubdomain = initConfiguration.internalAnalyticsSubdomain;\n if (trackType === 'logs' && initConfiguration.usePciIntake && site === INTAKE_SITE_US1) {\n return PCI_INTAKE_HOST_US1;\n }\n if (internalAnalyticsSubdomain && site === INTAKE_SITE_US1) {\n return \"\".concat(internalAnalyticsSubdomain, \".\").concat(INTAKE_SITE_US1);\n }\n if (site === INTAKE_SITE_FED_STAGING) {\n return \"http-intake.logs.\".concat(site);\n }\n var domainParts = site.split('.');\n var extension = domainParts.pop();\n return \"browser-intake-\".concat(domainParts.join('-'), \".\").concat(extension);\n}\n/**\n * Build parameters to be used for an intake request. Parameters should be re-built for each\n * request, as they change randomly.\n */\nfunction buildEndpointParameters(_a, trackType, configurationTags, api, _b) {\n var clientToken = _a.clientToken, internalAnalyticsSubdomain = _a.internalAnalyticsSubdomain;\n var retry = _b.retry, encoding = _b.encoding;\n var tags = [\"sdk_version:\".concat(\"5.20.0\"), \"api:\".concat(api)].concat(configurationTags);\n if (retry) {\n tags.push(\"retry_count:\".concat(retry.count), \"retry_after:\".concat(retry.lastFailureStatus));\n }\n var parameters = [\n 'ddsource=browser',\n \"ddtags=\".concat(encodeURIComponent(tags.join(','))),\n \"dd-api-key=\".concat(clientToken),\n \"dd-evp-origin-version=\".concat(encodeURIComponent(\"5.20.0\")),\n 'dd-evp-origin=browser',\n \"dd-request-id=\".concat(generateUUID()),\n ];\n if (encoding) {\n parameters.push(\"dd-evp-encoding=\".concat(encoding));\n }\n if (trackType === 'rum') {\n parameters.push(\"batch_time=\".concat(timeStampNow()));\n }\n if (internalAnalyticsSubdomain) {\n parameters.reverse();\n }\n return parameters.join('&');\n}\n//# sourceMappingURL=endpointBuilder.js.map","import { DOCS_ORIGIN, display } from '../../tools/display';\nexport var TAG_SIZE_LIMIT = 200;\nexport function buildTags(configuration) {\n var env = configuration.env, service = configuration.service, version = configuration.version, datacenter = configuration.datacenter;\n var tags = [];\n if (env) {\n tags.push(buildTag('env', env));\n }\n if (service) {\n tags.push(buildTag('service', service));\n }\n if (version) {\n tags.push(buildTag('version', version));\n }\n if (datacenter) {\n tags.push(buildTag('datacenter', datacenter));\n }\n return tags;\n}\nvar FORBIDDEN_CHARACTERS = /[^a-z0-9_:./-]/;\nexport function buildTag(key, rawValue) {\n // See https://docs.datadoghq.com/getting_started/tagging/#defining-tags for tags syntax. Note\n // that the backend may not follow the exact same rules, so we only want to display an informal\n // warning.\n var valueSizeLimit = TAG_SIZE_LIMIT - key.length - 1;\n if (rawValue.length > valueSizeLimit || FORBIDDEN_CHARACTERS.test(rawValue)) {\n display.warn(\"\".concat(key, \" value doesn't meet tag requirements and will be sanitized. More details: \").concat(DOCS_ORIGIN, \"/getting_started/tagging/#defining-tags\"));\n }\n // Let the backend do most of the sanitization, but still make sure multiple tags can't be crafted\n // by forging a value containing commas.\n var sanitizedValue = rawValue.replace(/,/g, '_');\n return \"\".concat(key, \":\").concat(sanitizedValue);\n}\n//# sourceMappingURL=tags.js.map","import { objectValues, assign } from '../../tools/utils/polyfills';\nimport { createEndpointBuilder } from './endpointBuilder';\nimport { buildTags } from './tags';\nimport { INTAKE_SITE_US1, PCI_INTAKE_HOST_US1 } from './intakeSites';\nexport function computeTransportConfiguration(initConfiguration) {\n var site = initConfiguration.site || INTAKE_SITE_US1;\n var tags = buildTags(initConfiguration);\n var endpointBuilders = computeEndpointBuilders(initConfiguration, tags);\n var intakeUrlPrefixes = computeIntakeUrlPrefixes(endpointBuilders, site);\n var replicaConfiguration = computeReplicaConfiguration(initConfiguration, intakeUrlPrefixes, tags);\n return assign({\n isIntakeUrl: function (url) { return intakeUrlPrefixes.some(function (intakeEndpoint) { return url.indexOf(intakeEndpoint) === 0; }); },\n replica: replicaConfiguration,\n site: site,\n }, endpointBuilders);\n}\nfunction computeEndpointBuilders(initConfiguration, tags) {\n return {\n logsEndpointBuilder: createEndpointBuilder(initConfiguration, 'logs', tags),\n rumEndpointBuilder: createEndpointBuilder(initConfiguration, 'rum', tags),\n sessionReplayEndpointBuilder: createEndpointBuilder(initConfiguration, 'replay', tags),\n };\n}\nfunction computeReplicaConfiguration(initConfiguration, intakeUrlPrefixes, tags) {\n if (!initConfiguration.replica) {\n return;\n }\n var replicaConfiguration = assign({}, initConfiguration, {\n site: INTAKE_SITE_US1,\n clientToken: initConfiguration.replica.clientToken,\n });\n var replicaEndpointBuilders = {\n logsEndpointBuilder: createEndpointBuilder(replicaConfiguration, 'logs', tags),\n rumEndpointBuilder: createEndpointBuilder(replicaConfiguration, 'rum', tags),\n };\n intakeUrlPrefixes.push.apply(intakeUrlPrefixes, objectValues(replicaEndpointBuilders).map(function (builder) { return builder.urlPrefix; }));\n return assign({ applicationId: initConfiguration.replica.applicationId }, replicaEndpointBuilders);\n}\nfunction computeIntakeUrlPrefixes(endpointBuilders, site) {\n var intakeUrlPrefixes = objectValues(endpointBuilders).map(function (builder) { return builder.urlPrefix; });\n if (site === INTAKE_SITE_US1) {\n intakeUrlPrefixes.push(\"https://\".concat(PCI_INTAKE_HOST_US1, \"/\"));\n }\n return intakeUrlPrefixes;\n}\n//# sourceMappingURL=transportConfiguration.js.map","import { catchUserErrors } from '../../tools/catchUserErrors';\nimport { DOCS_ORIGIN, display } from '../../tools/display';\nimport { ExperimentalFeature, addExperimentalFeatures } from '../../tools/experimentalFeatures';\nimport { ONE_SECOND } from '../../tools/utils/timeUtils';\nimport { isPercentage } from '../../tools/utils/numberUtils';\nimport { ONE_KIBI_BYTE } from '../../tools/utils/byteUtils';\nimport { objectHasValue } from '../../tools/utils/objectUtils';\nimport { assign } from '../../tools/utils/polyfills';\nimport { selectSessionStoreStrategyType } from '../session/sessionStore';\nimport { TrackingConsent } from '../trackingConsent';\nimport { computeTransportConfiguration } from './transportConfiguration';\nexport var DefaultPrivacyLevel = {\n ALLOW: 'allow',\n MASK: 'mask',\n MASK_USER_INPUT: 'mask-user-input',\n};\nexport var TraceContextInjection = {\n ALL: 'all',\n SAMPLED: 'sampled',\n};\nfunction checkIfString(tag, tagName) {\n if (tag !== undefined && tag !== null && typeof tag !== 'string') {\n display.error(\"\".concat(tagName, \" must be defined as a string\"));\n return false;\n }\n return true;\n}\nfunction isDatadogSite(site) {\n return /(datadog|ddog|datad0g|dd0g)/.test(site);\n}\nexport function validateAndBuildConfiguration(initConfiguration) {\n var _a, _b, _c, _d, _e;\n if (!initConfiguration || !initConfiguration.clientToken) {\n display.error('Client Token is not configured, we will not send any data.');\n return;\n }\n if (initConfiguration.sessionSampleRate !== undefined && !isPercentage(initConfiguration.sessionSampleRate)) {\n display.error('Session Sample Rate should be a number between 0 and 100');\n return;\n }\n if (initConfiguration.telemetrySampleRate !== undefined && !isPercentage(initConfiguration.telemetrySampleRate)) {\n display.error('Telemetry Sample Rate should be a number between 0 and 100');\n return;\n }\n if (initConfiguration.telemetryConfigurationSampleRate !== undefined &&\n !isPercentage(initConfiguration.telemetryConfigurationSampleRate)) {\n display.error('Telemetry Configuration Sample Rate should be a number between 0 and 100');\n return;\n }\n if (initConfiguration.telemetryUsageSampleRate !== undefined &&\n !isPercentage(initConfiguration.telemetryUsageSampleRate)) {\n display.error('Telemetry Usage Sample Rate should be a number between 0 and 100');\n return;\n }\n if (!checkIfString(initConfiguration.version, 'Version')) {\n return;\n }\n if (!checkIfString(initConfiguration.env, 'Env')) {\n return;\n }\n if (!checkIfString(initConfiguration.service, 'Service')) {\n return;\n }\n if (initConfiguration.trackingConsent !== undefined &&\n !objectHasValue(TrackingConsent, initConfiguration.trackingConsent)) {\n display.error('Tracking Consent should be either \"granted\" or \"not-granted\"');\n return;\n }\n if (initConfiguration.site && !isDatadogSite(initConfiguration.site)) {\n display.error(\"Site should be a valid Datadog site. Learn more here: \".concat(DOCS_ORIGIN, \"/getting_started/site/.\"));\n return;\n }\n // Set the experimental feature flags as early as possible, so we can use them in most places\n if (Array.isArray(initConfiguration.enableExperimentalFeatures)) {\n addExperimentalFeatures(initConfiguration.enableExperimentalFeatures.filter(function (flag) {\n return objectHasValue(ExperimentalFeature, flag);\n }));\n }\n return assign({\n beforeSend: initConfiguration.beforeSend && catchUserErrors(initConfiguration.beforeSend, 'beforeSend threw an error:'),\n sessionStoreStrategyType: selectSessionStoreStrategyType(initConfiguration),\n sessionSampleRate: (_a = initConfiguration.sessionSampleRate) !== null && _a !== void 0 ? _a : 100,\n telemetrySampleRate: (_b = initConfiguration.telemetrySampleRate) !== null && _b !== void 0 ? _b : 20,\n telemetryConfigurationSampleRate: (_c = initConfiguration.telemetryConfigurationSampleRate) !== null && _c !== void 0 ? _c : 5,\n telemetryUsageSampleRate: (_d = initConfiguration.telemetryUsageSampleRate) !== null && _d !== void 0 ? _d : 5,\n service: initConfiguration.service || undefined,\n silentMultipleInit: !!initConfiguration.silentMultipleInit,\n allowUntrustedEvents: !!initConfiguration.allowUntrustedEvents,\n trackingConsent: (_e = initConfiguration.trackingConsent) !== null && _e !== void 0 ? _e : TrackingConsent.GRANTED,\n /**\n * beacon payload max queue size implementation is 64kb\n * ensure that we leave room for logs, rum and potential other users\n */\n batchBytesLimit: 16 * ONE_KIBI_BYTE,\n eventRateLimiterThreshold: 3000,\n maxTelemetryEventsPerPage: 15,\n /**\n * flush automatically, aim to be lower than ALB connection timeout\n * to maximize connection reuse.\n */\n flushTimeout: (30 * ONE_SECOND),\n /**\n * Logs intake limit\n */\n batchMessagesLimit: 50,\n messageBytesLimit: 256 * ONE_KIBI_BYTE,\n }, computeTransportConfiguration(initConfiguration));\n}\nexport function serializeConfiguration(initConfiguration) {\n return {\n session_sample_rate: initConfiguration.sessionSampleRate,\n telemetry_sample_rate: initConfiguration.telemetrySampleRate,\n telemetry_configuration_sample_rate: initConfiguration.telemetryConfigurationSampleRate,\n telemetry_usage_sample_rate: initConfiguration.telemetryUsageSampleRate,\n use_before_send: !!initConfiguration.beforeSend,\n use_cross_site_session_cookie: initConfiguration.useCrossSiteSessionCookie,\n use_partitioned_cross_site_session_cookie: initConfiguration.usePartitionedCrossSiteSessionCookie,\n use_secure_session_cookie: initConfiguration.useSecureSessionCookie,\n use_proxy: !!initConfiguration.proxy,\n silent_multiple_init: initConfiguration.silentMultipleInit,\n track_session_across_subdomains: initConfiguration.trackSessionAcrossSubdomains,\n allow_fallback_to_local_storage: !!initConfiguration.allowFallbackToLocalStorage,\n store_contexts_across_pages: !!initConfiguration.storeContextsAcrossPages,\n allow_untrusted_events: !!initConfiguration.allowUntrustedEvents,\n tracking_consent: initConfiguration.trackingConsent,\n };\n}\n//# sourceMappingURL=configuration.js.map","/**\n * Cross-browser stack trace computation.\n *\n * Reference implementation: https://github.com/csnover/TraceKit/blob/04530298073c3823de72deb0b97e7b38ca7bcb59/tracekit.js\n */\nimport { startsWith } from '../utils/polyfills';\nvar UNKNOWN_FUNCTION = '?';\nexport function computeStackTrace(ex) {\n var stack = [];\n var stackProperty = tryToGetString(ex, 'stack');\n var exString = String(ex);\n if (stackProperty && startsWith(stackProperty, exString)) {\n stackProperty = stackProperty.slice(exString.length);\n }\n if (stackProperty) {\n stackProperty.split('\\n').forEach(function (line) {\n var stackFrame = parseChromeLine(line) || parseChromeAnonymousLine(line) || parseWinLine(line) || parseGeckoLine(line);\n if (stackFrame) {\n if (!stackFrame.func && stackFrame.line) {\n stackFrame.func = UNKNOWN_FUNCTION;\n }\n stack.push(stackFrame);\n }\n });\n }\n return {\n message: tryToGetString(ex, 'message'),\n name: tryToGetString(ex, 'name'),\n stack: stack,\n };\n}\nvar fileUrl = '((?:file|https?|blob|chrome-extension|native|eval|webpack|snippet||\\\\w+\\\\.|\\\\/).*?)';\nvar filePosition = '(?::(\\\\d+))';\nvar CHROME_LINE_RE = new RegExp(\"^\\\\s*at (.*?) ?\\\\(\".concat(fileUrl).concat(filePosition, \"?\").concat(filePosition, \"?\\\\)?\\\\s*$\"), 'i');\nvar CHROME_EVAL_RE = new RegExp(\"\\\\((\\\\S*)\".concat(filePosition).concat(filePosition, \"\\\\)\"));\nfunction parseChromeLine(line) {\n var parts = CHROME_LINE_RE.exec(line);\n if (!parts) {\n return;\n }\n var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line\n var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n var submatch = CHROME_EVAL_RE.exec(parts[2]);\n if (isEval && submatch) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = submatch[1]; // url\n parts[3] = submatch[2]; // line\n parts[4] = submatch[3]; // column\n }\n return {\n args: isNative ? [parts[2]] : [],\n column: parts[4] ? +parts[4] : undefined,\n func: parts[1] || UNKNOWN_FUNCTION,\n line: parts[3] ? +parts[3] : undefined,\n url: !isNative ? parts[2] : undefined,\n };\n}\nvar CHROME_ANONYMOUS_FUNCTION_RE = new RegExp(\"^\\\\s*at ?\".concat(fileUrl).concat(filePosition, \"?\").concat(filePosition, \"??\\\\s*$\"), 'i');\nfunction parseChromeAnonymousLine(line) {\n var parts = CHROME_ANONYMOUS_FUNCTION_RE.exec(line);\n if (!parts) {\n return;\n }\n return {\n args: [],\n column: parts[3] ? +parts[3] : undefined,\n func: UNKNOWN_FUNCTION,\n line: parts[2] ? +parts[2] : undefined,\n url: parts[1],\n };\n}\nvar WINJS_LINE_RE = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\nfunction parseWinLine(line) {\n var parts = WINJS_LINE_RE.exec(line);\n if (!parts) {\n return;\n }\n return {\n args: [],\n column: parts[4] ? +parts[4] : undefined,\n func: parts[1] || UNKNOWN_FUNCTION,\n line: +parts[3],\n url: parts[2],\n };\n}\nvar GECKO_LINE_RE = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nvar GECKO_EVAL_RE = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\nfunction parseGeckoLine(line) {\n var parts = GECKO_LINE_RE.exec(line);\n if (!parts) {\n return;\n }\n var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n var submatch = GECKO_EVAL_RE.exec(parts[3]);\n if (isEval && submatch) {\n // throw out eval line/column and use top-most line number\n parts[3] = submatch[1];\n parts[4] = submatch[2];\n parts[5] = undefined; // no column when eval\n }\n return {\n args: parts[2] ? parts[2].split(',') : [],\n column: parts[5] ? +parts[5] : undefined,\n func: parts[1] || UNKNOWN_FUNCTION,\n line: parts[4] ? +parts[4] : undefined,\n url: parts[3],\n };\n}\nfunction tryToGetString(candidate, property) {\n if (typeof candidate !== 'object' || !candidate || !(property in candidate)) {\n return undefined;\n }\n var value = candidate[property];\n return typeof value === 'string' ? value : undefined;\n}\nexport function computeStackTraceFromOnErrorMessage(messageObj, url, line, column) {\n var stack = [{ url: url, column: column, line: line }];\n var _a = tryToParseMessage(messageObj), name = _a.name, message = _a.message;\n return {\n name: name,\n message: message,\n stack: stack,\n };\n}\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types\nvar ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\\s\\S]*)$/;\nfunction tryToParseMessage(messageObj) {\n var _a;\n var name;\n var message;\n if ({}.toString.call(messageObj) === '[object String]') {\n ;\n _a = ERROR_TYPES_RE.exec(messageObj), name = _a[1], message = _a[2];\n }\n return { name: name, message: message };\n}\n//# sourceMappingURL=computeStackTrace.js.map","import { callMonitored } from '../monitor';\nimport { noop } from '../utils/functionUtils';\nimport { computeStackTrace } from './computeStackTrace';\n/**\n * Creates a stacktrace without SDK internal frames.\n * Constraints:\n * - Has to be called at the utmost position of the call stack.\n * - No monitored function should encapsulate it, that is why we need to use callMonitored inside it.\n */\nexport function createHandlingStack() {\n /**\n * Skip the two internal frames:\n * - SDK API (console.error, ...)\n * - this function\n * in order to keep only the user calls\n */\n var internalFramesToSkip = 2;\n var error = new Error();\n var formattedStack;\n // IE needs to throw the error to fill in the stack trace\n if (!error.stack) {\n try {\n throw error;\n }\n catch (e) {\n noop();\n }\n }\n callMonitored(function () {\n var stackTrace = computeStackTrace(error);\n stackTrace.stack = stackTrace.stack.slice(internalFramesToSkip);\n formattedStack = toStackTraceString(stackTrace);\n });\n return formattedStack;\n}\nexport function toStackTraceString(stack) {\n var result = formatErrorMessage(stack);\n stack.stack.forEach(function (frame) {\n var func = frame.func === '?' ? '' : frame.func;\n var args = frame.args && frame.args.length > 0 ? \"(\".concat(frame.args.join(', '), \")\") : '';\n var line = frame.line ? \":\".concat(frame.line) : '';\n var column = frame.line && frame.column ? \":\".concat(frame.column) : '';\n result += \"\\n at \".concat(func).concat(args, \" @ \").concat(frame.url).concat(line).concat(column);\n });\n return result;\n}\nexport function formatErrorMessage(stack) {\n return \"\".concat(stack.name || 'Error', \": \").concat(stack.message);\n}\n//# sourceMappingURL=handlingStack.js.map","import { setTimeout } from './timer';\nimport { callMonitored } from './monitor';\nimport { noop } from './utils/functionUtils';\nimport { arrayFrom, startsWith } from './utils/polyfills';\nimport { createHandlingStack } from './stackTrace/handlingStack';\n/**\n * Instruments a method on a object, calling the given callback before the original method is\n * invoked. The callback receives an object with information about the method call.\n *\n * This function makes sure that we are \"good citizens\" regarding third party instrumentations: when\n * removing the instrumentation, the original method is usually restored, but if a third party\n * instrumentation was set after ours, we keep it in place and just replace our instrumentation with\n * a noop.\n *\n * Note: it is generally better to instrument methods that are \"owned\" by the object instead of ones\n * that are inherited from the prototype chain. Example:\n * * do: `instrumentMethod(Array.prototype, 'push', ...)`\n * * don't: `instrumentMethod([], 'push', ...)`\n *\n * This method is also used to set event handler properties (ex: window.onerror = ...), as it has\n * the same requirements as instrumenting a method:\n * * if the event handler is already set by a third party, we need to call it and not just blindly\n * override it.\n * * if the event handler is set by a third party after us, we need to keep it in place when\n * removing ours.\n *\n * @example\n *\n * instrumentMethod(window, 'fetch', ({ target, parameters, onPostCall }) => {\n * console.log('Before calling fetch on', target, 'with parameters', parameters)\n *\n * onPostCall((result) => {\n * console.log('After fetch calling on', target, 'with parameters', parameters, 'and result', result)\n * })\n * })\n */\nexport function instrumentMethod(targetPrototype, method, onPreCall, _a) {\n var _b = _a === void 0 ? {} : _a, computeHandlingStack = _b.computeHandlingStack;\n var original = targetPrototype[method];\n if (typeof original !== 'function') {\n if (startsWith(method, 'on')) {\n original = noop;\n }\n else {\n return { stop: noop };\n }\n }\n var stopped = false;\n var instrumentation = function () {\n if (stopped) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call\n return original.apply(this, arguments);\n }\n var parameters = arrayFrom(arguments);\n var postCallCallback;\n callMonitored(onPreCall, null, [\n {\n target: this,\n parameters: parameters,\n onPostCall: function (callback) {\n postCallCallback = callback;\n },\n handlingStack: computeHandlingStack ? createHandlingStack() : undefined,\n },\n ]);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n var result = original.apply(this, parameters);\n if (postCallCallback) {\n callMonitored(postCallCallback, null, [result]);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return result;\n };\n targetPrototype[method] = instrumentation;\n return {\n stop: function () {\n stopped = true;\n // If the instrumentation has been removed by a third party, keep the last one\n if (targetPrototype[method] === instrumentation) {\n targetPrototype[method] = original;\n }\n },\n };\n}\nexport function instrumentSetter(targetPrototype, property, after) {\n var originalDescriptor = Object.getOwnPropertyDescriptor(targetPrototype, property);\n if (!originalDescriptor || !originalDescriptor.set || !originalDescriptor.configurable) {\n return { stop: noop };\n }\n var stoppedInstrumentation = noop;\n var instrumentation = function (target, value) {\n // put hooked setter into event loop to avoid of set latency\n setTimeout(function () {\n if (instrumentation !== stoppedInstrumentation) {\n after(target, value);\n }\n }, 0);\n };\n var instrumentationWrapper = function (value) {\n originalDescriptor.set.call(this, value);\n instrumentation(this, value);\n };\n Object.defineProperty(targetPrototype, property, {\n set: instrumentationWrapper,\n });\n return {\n stop: function () {\n var _a;\n if (((_a = Object.getOwnPropertyDescriptor(targetPrototype, property)) === null || _a === void 0 ? void 0 : _a.set) === instrumentationWrapper) {\n Object.defineProperty(targetPrototype, property, originalDescriptor);\n }\n instrumentation = stoppedInstrumentation;\n },\n };\n}\n//# sourceMappingURL=instrumentMethod.js.map","import { display } from '../display';\nimport { ONE_KIBI_BYTE } from '../utils/byteUtils';\nimport { detachToJsonMethod } from './jsonStringify';\n// The maximum size of a single event is 256KiB. By default, we ensure that user-provided data\n// going through sanitize fits inside our events, while leaving room for other contexts, metadata, ...\nvar SANITIZE_DEFAULT_MAX_CHARACTER_COUNT = 220 * ONE_KIBI_BYTE;\n// Symbol for the root element of the JSONPath used for visited objects\nvar JSON_PATH_ROOT_ELEMENT = '$';\n// When serializing (using JSON.stringify) a key of an object, { key: 42 } gets wrapped in quotes as \"key\".\n// With the separator (:), we need to add 3 characters to the count.\nvar KEY_DECORATION_LENGTH = 3;\nexport function sanitize(source, maxCharacterCount) {\n var _a;\n if (maxCharacterCount === void 0) { maxCharacterCount = SANITIZE_DEFAULT_MAX_CHARACTER_COUNT; }\n // Unbind any toJSON function we may have on [] or {} prototypes\n var restoreObjectPrototypeToJson = detachToJsonMethod(Object.prototype);\n var restoreArrayPrototypeToJson = detachToJsonMethod(Array.prototype);\n // Initial call to sanitizeProcessor - will populate containerQueue if source is an Array or a plain Object\n var containerQueue = [];\n var visitedObjectsWithPath = new WeakMap();\n var sanitizedData = sanitizeProcessor(source, JSON_PATH_ROOT_ELEMENT, undefined, containerQueue, visitedObjectsWithPath);\n var accumulatedCharacterCount = ((_a = JSON.stringify(sanitizedData)) === null || _a === void 0 ? void 0 : _a.length) || 0;\n if (accumulatedCharacterCount > maxCharacterCount) {\n warnOverCharacterLimit(maxCharacterCount, 'discarded', source);\n return undefined;\n }\n while (containerQueue.length > 0 && accumulatedCharacterCount < maxCharacterCount) {\n var containerToProcess = containerQueue.shift();\n var separatorLength = 0; // 0 for the first element, 1 for subsequent elements\n // Arrays and Objects have to be handled distinctly to ensure\n // we do not pick up non-numerical properties from Arrays\n if (Array.isArray(containerToProcess.source)) {\n for (var key = 0; key < containerToProcess.source.length; key++) {\n var targetData = sanitizeProcessor(containerToProcess.source[key], containerToProcess.path, key, containerQueue, visitedObjectsWithPath);\n if (targetData !== undefined) {\n accumulatedCharacterCount += JSON.stringify(targetData).length;\n }\n else {\n // When an element of an Array (targetData) is undefined, it is serialized as null:\n // JSON.stringify([undefined]) => '[null]' - This accounts for 4 characters\n accumulatedCharacterCount += 4;\n }\n accumulatedCharacterCount += separatorLength;\n separatorLength = 1;\n if (accumulatedCharacterCount > maxCharacterCount) {\n warnOverCharacterLimit(maxCharacterCount, 'truncated', source);\n break;\n }\n ;\n containerToProcess.target[key] = targetData;\n }\n }\n else {\n for (var key in containerToProcess.source) {\n if (Object.prototype.hasOwnProperty.call(containerToProcess.source, key)) {\n var targetData = sanitizeProcessor(containerToProcess.source[key], containerToProcess.path, key, containerQueue, visitedObjectsWithPath);\n // When a property of an object has an undefined value, it will be dropped during serialization:\n // JSON.stringify({a:undefined}) => '{}'\n if (targetData !== undefined) {\n accumulatedCharacterCount +=\n JSON.stringify(targetData).length + separatorLength + key.length + KEY_DECORATION_LENGTH;\n separatorLength = 1;\n }\n if (accumulatedCharacterCount > maxCharacterCount) {\n warnOverCharacterLimit(maxCharacterCount, 'truncated', source);\n break;\n }\n ;\n containerToProcess.target[key] = targetData;\n }\n }\n }\n }\n // Rebind detached toJSON functions\n restoreObjectPrototypeToJson();\n restoreArrayPrototypeToJson();\n return sanitizedData;\n}\n/**\n * Internal function to factorize the process common to the\n * initial call to sanitize, and iterations for Arrays and Objects\n *\n */\nfunction sanitizeProcessor(source, parentPath, key, queue, visitedObjectsWithPath) {\n // Start by handling toJSON, as we want to sanitize its output\n var sourceToSanitize = tryToApplyToJSON(source);\n if (!sourceToSanitize || typeof sourceToSanitize !== 'object') {\n return sanitizePrimitivesAndFunctions(sourceToSanitize);\n }\n var sanitizedSource = sanitizeObjects(sourceToSanitize);\n if (sanitizedSource !== '[Object]' && sanitizedSource !== '[Array]' && sanitizedSource !== '[Error]') {\n return sanitizedSource;\n }\n // Handle potential cyclic references\n // We need to use source as sourceToSanitize could be a reference to a new object\n // At this stage, we know the source is an object type\n var sourceAsObject = source;\n if (visitedObjectsWithPath.has(sourceAsObject)) {\n return \"[Reference seen at \".concat(visitedObjectsWithPath.get(sourceAsObject), \"]\");\n }\n // Add processed source to queue\n var currentPath = key !== undefined ? \"\".concat(parentPath, \".\").concat(key) : parentPath;\n var target = Array.isArray(sourceToSanitize) ? [] : {};\n visitedObjectsWithPath.set(sourceAsObject, currentPath);\n queue.push({ source: sourceToSanitize, target: target, path: currentPath });\n return target;\n}\n/**\n * Handles sanitization of simple, non-object types\n *\n */\nfunction sanitizePrimitivesAndFunctions(value) {\n // BigInt cannot be serialized by JSON.stringify(), convert it to a string representation\n if (typeof value === 'bigint') {\n return \"[BigInt] \".concat(value.toString());\n }\n // Functions cannot be serialized by JSON.stringify(). Moreover, if a faulty toJSON is present, it needs to be converted\n // so it won't prevent stringify from serializing later\n if (typeof value === 'function') {\n return \"[Function] \".concat(value.name || 'unknown');\n }\n // JSON.stringify() does not serialize symbols.\n if (typeof value === 'symbol') {\n return \"[Symbol] \".concat(value.description || value.toString());\n }\n return value;\n}\n/**\n * Handles sanitization of object types\n *\n * LIMITATIONS\n * - If a class defines a toStringTag Symbol, it will fall in the catch-all method and prevent enumeration of properties.\n * To avoid this, a toJSON method can be defined.\n * - IE11 does not return a distinct type for objects such as Map, WeakMap, ... These objects will pass through and their\n * properties enumerated if any.\n *\n */\nfunction sanitizeObjects(value) {\n try {\n // Handle events - Keep a simple implementation to avoid breaking changes\n if (value instanceof Event) {\n return {\n isTrusted: value.isTrusted,\n };\n }\n // Handle all remaining object types in a generic way\n var result = Object.prototype.toString.call(value);\n var match = result.match(/\\[object (.*)\\]/);\n if (match && match[1]) {\n return \"[\".concat(match[1], \"]\");\n }\n }\n catch (_a) {\n // If the previous serialization attempts failed, and we cannot convert using\n // Object.prototype.toString, declare the value unserializable\n }\n return '[Unserializable]';\n}\n/**\n * Checks if a toJSON function exists and tries to execute it\n *\n */\nfunction tryToApplyToJSON(value) {\n var object = value;\n if (object && typeof object.toJSON === 'function') {\n try {\n return object.toJSON();\n }\n catch (_a) {\n // If toJSON fails, we continue by trying to serialize the value manually\n }\n }\n return value;\n}\n/**\n * Helper function to display the warning when the accumulated character count is over the limit\n */\nfunction warnOverCharacterLimit(maxCharacterCount, changeType, source) {\n display.warn(\"The data provided has been \".concat(changeType, \" as it is over the limit of \").concat(maxCharacterCount, \" characters:\"), source);\n}\n//# sourceMappingURL=sanitize.js.map","import { sanitize } from '../../tools/serialisation/sanitize';\nimport { jsonStringify } from '../../tools/serialisation/jsonStringify';\nimport { computeStackTrace } from '../../tools/stackTrace/computeStackTrace';\nimport { toStackTraceString } from '../../tools/stackTrace/handlingStack';\nexport var NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error';\nexport function computeRawError(_a) {\n var stackTrace = _a.stackTrace, originalError = _a.originalError, handlingStack = _a.handlingStack, startClocks = _a.startClocks, nonErrorPrefix = _a.nonErrorPrefix, source = _a.source, handling = _a.handling;\n var isErrorInstance = originalError instanceof Error;\n var message = computeMessage(stackTrace, isErrorInstance, nonErrorPrefix, originalError);\n var stack = hasUsableStack(isErrorInstance, stackTrace)\n ? toStackTraceString(stackTrace)\n : NO_ERROR_STACK_PRESENT_MESSAGE;\n var causes = isErrorInstance ? flattenErrorCauses(originalError, source) : undefined;\n var type = stackTrace === null || stackTrace === void 0 ? void 0 : stackTrace.name;\n var fingerprint = tryToGetFingerprint(originalError);\n return {\n startClocks: startClocks,\n source: source,\n handling: handling,\n handlingStack: handlingStack,\n originalError: originalError,\n type: type,\n message: message,\n stack: stack,\n causes: causes,\n fingerprint: fingerprint,\n };\n}\nfunction computeMessage(stackTrace, isErrorInstance, nonErrorPrefix, originalError) {\n // Favor stackTrace message only if tracekit has really been able to extract something meaningful (message + name)\n // TODO rework tracekit integration to avoid scattering error building logic\n return (stackTrace === null || stackTrace === void 0 ? void 0 : stackTrace.message) && (stackTrace === null || stackTrace === void 0 ? void 0 : stackTrace.name)\n ? stackTrace.message\n : !isErrorInstance\n ? \"\".concat(nonErrorPrefix, \" \").concat(jsonStringify(sanitize(originalError)))\n : 'Empty message';\n}\nfunction hasUsableStack(isErrorInstance, stackTrace) {\n if (stackTrace === undefined) {\n return false;\n }\n if (isErrorInstance) {\n return true;\n }\n // handle cases where tracekit return stack = [] or stack = [{url: undefined, line: undefined, column: undefined}]\n // TODO rework tracekit integration to avoid generating those unusable stack\n return stackTrace.stack.length > 0 && (stackTrace.stack.length > 1 || stackTrace.stack[0].url !== undefined);\n}\nexport function tryToGetFingerprint(originalError) {\n return originalError instanceof Error && 'dd_fingerprint' in originalError\n ? String(originalError.dd_fingerprint)\n : undefined;\n}\nexport function getFileFromStackTraceString(stack) {\n var _a;\n return (_a = /@ (.+)/.exec(stack)) === null || _a === void 0 ? void 0 : _a[1];\n}\nexport function flattenErrorCauses(error, parentSource) {\n var currentError = error;\n var causes = [];\n while ((currentError === null || currentError === void 0 ? void 0 : currentError.cause) instanceof Error && causes.length < 10) {\n var stackTrace = computeStackTrace(currentError.cause);\n causes.push({\n message: currentError.cause.message,\n source: parentSource,\n type: stackTrace === null || stackTrace === void 0 ? void 0 : stackTrace.name,\n stack: stackTrace && toStackTraceString(stackTrace),\n });\n currentError = currentError.cause;\n }\n return causes.length ? causes : undefined;\n}\n//# sourceMappingURL=error.js.map","export var ErrorSource = {\n AGENT: 'agent',\n CONSOLE: 'console',\n CUSTOM: 'custom',\n LOGGER: 'logger',\n NETWORK: 'network',\n SOURCE: 'source',\n REPORT: 'report',\n};\n//# sourceMappingURL=error.types.js.map","import { instrumentMethod } from '../../tools/instrumentMethod';\nimport { clocksNow } from '../../tools/utils/timeUtils';\nimport { computeStackTrace, computeStackTraceFromOnErrorMessage } from '../../tools/stackTrace/computeStackTrace';\nimport { computeRawError } from './error';\nimport { ErrorSource } from './error.types';\nexport function trackRuntimeError(errorObservable) {\n var handleRuntimeError = function (stackTrace, originalError) {\n var rawError = computeRawError({\n stackTrace: stackTrace,\n originalError: originalError,\n startClocks: clocksNow(),\n nonErrorPrefix: \"Uncaught\" /* NonErrorPrefix.UNCAUGHT */,\n source: ErrorSource.SOURCE,\n handling: \"unhandled\" /* ErrorHandling.UNHANDLED */,\n });\n errorObservable.notify(rawError);\n };\n var stopInstrumentingOnError = instrumentOnError(handleRuntimeError).stop;\n var stopInstrumentingOnUnhandledRejection = instrumentUnhandledRejection(handleRuntimeError).stop;\n return {\n stop: function () {\n stopInstrumentingOnError();\n stopInstrumentingOnUnhandledRejection();\n },\n };\n}\nexport function instrumentOnError(callback) {\n return instrumentMethod(window, 'onerror', function (_a) {\n var _b = _a.parameters, messageObj = _b[0], url = _b[1], line = _b[2], column = _b[3], errorObj = _b[4];\n var stackTrace;\n if (errorObj instanceof Error) {\n stackTrace = computeStackTrace(errorObj);\n }\n else {\n stackTrace = computeStackTraceFromOnErrorMessage(messageObj, url, line, column);\n }\n callback(stackTrace, errorObj !== null && errorObj !== void 0 ? errorObj : messageObj);\n });\n}\nexport function instrumentUnhandledRejection(callback) {\n return instrumentMethod(window, 'onunhandledrejection', function (_a) {\n var e = _a.parameters[0];\n var reason = e.reason || 'Empty reason';\n var stack = computeStackTrace(reason);\n callback(stack, reason);\n });\n}\n//# sourceMappingURL=trackRuntimeError.js.map","import { catchUserErrors } from '../tools/catchUserErrors';\nimport { setDebugMode } from '../tools/monitor';\nimport { assign } from '../tools/utils/polyfills';\nimport { display } from '../tools/display';\nexport function makePublicApi(stub) {\n var publicApi = assign({\n version: \"5.20.0\",\n // This API method is intentionally not monitored, since the only thing executed is the\n // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and\n // we don't want to interfere with the user uncaught exceptions.\n onReady: function (callback) {\n callback();\n },\n }, stub);\n // Add a \"hidden\" property to set debug mode. We define it that way to hide it\n // as much as possible but of course it's not a real protection.\n Object.defineProperty(publicApi, '_setDebug', {\n get: function () {\n return setDebugMode;\n },\n enumerable: false,\n });\n return publicApi;\n}\nexport function defineGlobal(global, name, api) {\n var existingGlobalVariable = global[name];\n if (existingGlobalVariable && !existingGlobalVariable.q && existingGlobalVariable.version) {\n display.warn('SDK is loaded more than once. This is unsupported and might have unexpected behavior.');\n }\n global[name] = api;\n if (existingGlobalVariable && existingGlobalVariable.q) {\n existingGlobalVariable.q.forEach(function (fn) { return catchUserErrors(fn, 'onReady callback threw an error:')(); });\n }\n}\n//# sourceMappingURL=init.js.map","import { display } from '../tools/display';\nexport function displayAlreadyInitializedError(sdkName, initConfiguration) {\n if (!initConfiguration.silentMultipleInit) {\n display.error(\"\".concat(sdkName, \" is already initialized.\"));\n }\n}\n//# sourceMappingURL=displayAlreadyInitializedError.js.map","import { monitor } from '../tools/monitor';\nimport { getZoneJsOriginalValue } from '../tools/getZoneJsOriginalValue';\n// We want to use a real enum (i.e. not a const enum) here, to be able to iterate over it to automatically add _ddIsTrusted in e2e tests\n// eslint-disable-next-line no-restricted-syntax\nexport var DOM_EVENT;\n(function (DOM_EVENT) {\n DOM_EVENT[\"BEFORE_UNLOAD\"] = \"beforeunload\";\n DOM_EVENT[\"CLICK\"] = \"click\";\n DOM_EVENT[\"DBL_CLICK\"] = \"dblclick\";\n DOM_EVENT[\"KEY_DOWN\"] = \"keydown\";\n DOM_EVENT[\"LOAD\"] = \"load\";\n DOM_EVENT[\"POP_STATE\"] = \"popstate\";\n DOM_EVENT[\"SCROLL\"] = \"scroll\";\n DOM_EVENT[\"TOUCH_START\"] = \"touchstart\";\n DOM_EVENT[\"TOUCH_END\"] = \"touchend\";\n DOM_EVENT[\"TOUCH_MOVE\"] = \"touchmove\";\n DOM_EVENT[\"VISIBILITY_CHANGE\"] = \"visibilitychange\";\n DOM_EVENT[\"PAGE_SHOW\"] = \"pageshow\";\n DOM_EVENT[\"FREEZE\"] = \"freeze\";\n DOM_EVENT[\"RESUME\"] = \"resume\";\n DOM_EVENT[\"DOM_CONTENT_LOADED\"] = \"DOMContentLoaded\";\n DOM_EVENT[\"POINTER_DOWN\"] = \"pointerdown\";\n DOM_EVENT[\"POINTER_UP\"] = \"pointerup\";\n DOM_EVENT[\"POINTER_CANCEL\"] = \"pointercancel\";\n DOM_EVENT[\"HASH_CHANGE\"] = \"hashchange\";\n DOM_EVENT[\"PAGE_HIDE\"] = \"pagehide\";\n DOM_EVENT[\"MOUSE_DOWN\"] = \"mousedown\";\n DOM_EVENT[\"MOUSE_UP\"] = \"mouseup\";\n DOM_EVENT[\"MOUSE_MOVE\"] = \"mousemove\";\n DOM_EVENT[\"FOCUS\"] = \"focus\";\n DOM_EVENT[\"BLUR\"] = \"blur\";\n DOM_EVENT[\"CONTEXT_MENU\"] = \"contextmenu\";\n DOM_EVENT[\"RESIZE\"] = \"resize\";\n DOM_EVENT[\"CHANGE\"] = \"change\";\n DOM_EVENT[\"INPUT\"] = \"input\";\n DOM_EVENT[\"PLAY\"] = \"play\";\n DOM_EVENT[\"PAUSE\"] = \"pause\";\n DOM_EVENT[\"SECURITY_POLICY_VIOLATION\"] = \"securitypolicyviolation\";\n DOM_EVENT[\"SELECTION_CHANGE\"] = \"selectionchange\";\n DOM_EVENT[\"STORAGE\"] = \"storage\";\n})(DOM_EVENT || (DOM_EVENT = {}));\n/**\n * Add an event listener to an event target object (Window, Element, mock object...). This provides\n * a few conveniences compared to using `element.addEventListener` directly:\n *\n * * supports IE11 by: using an option object only if needed and emulating the `once` option\n *\n * * wraps the listener with a `monitor` function\n *\n * * returns a `stop` function to remove the listener\n */\nexport function addEventListener(configuration, eventTarget, eventName, listener, options) {\n return addEventListeners(configuration, eventTarget, [eventName], listener, options);\n}\n/**\n * Add event listeners to an event target object (Window, Element, mock object...). This provides\n * a few conveniences compared to using `element.addEventListener` directly:\n *\n * * supports IE11 by: using an option object only if needed and emulating the `once` option\n *\n * * wraps the listener with a `monitor` function\n *\n * * returns a `stop` function to remove the listener\n *\n * * with `once: true`, the listener will be called at most once, even if different events are listened\n */\nexport function addEventListeners(configuration, eventTarget, eventNames, listener, _a) {\n var _b = _a === void 0 ? {} : _a, once = _b.once, capture = _b.capture, passive = _b.passive;\n var listenerWithMonitor = monitor(function (event) {\n if (!event.isTrusted && !event.__ddIsTrusted && !configuration.allowUntrustedEvents) {\n return;\n }\n if (once) {\n stop();\n }\n listener(event);\n });\n var options = passive ? { capture: capture, passive: passive } : capture;\n var add = getZoneJsOriginalValue(eventTarget, 'addEventListener');\n eventNames.forEach(function (eventName) { return add.call(eventTarget, eventName, listenerWithMonitor, options); });\n function stop() {\n var remove = getZoneJsOriginalValue(eventTarget, 'removeEventListener');\n eventNames.forEach(function (eventName) { return remove.call(eventTarget, eventName, listenerWithMonitor, options); });\n }\n return {\n stop: stop,\n };\n}\n//# sourceMappingURL=addEventListener.js.map","import { toStackTraceString } from '../../tools/stackTrace/handlingStack';\nimport { monitor } from '../../tools/monitor';\nimport { mergeObservables, Observable } from '../../tools/observable';\nimport { addEventListener, DOM_EVENT } from '../../browser/addEventListener';\nimport { includes } from '../../tools/utils/polyfills';\nimport { safeTruncate } from '../../tools/utils/stringUtils';\nexport var RawReportType = {\n intervention: 'intervention',\n deprecation: 'deprecation',\n cspViolation: 'csp_violation',\n};\nexport function initReportObservable(configuration, apis) {\n var observables = [];\n if (includes(apis, RawReportType.cspViolation)) {\n observables.push(createCspViolationReportObservable(configuration));\n }\n var reportTypes = apis.filter(function (api) { return api !== RawReportType.cspViolation; });\n if (reportTypes.length) {\n observables.push(createReportObservable(reportTypes));\n }\n return mergeObservables.apply(void 0, observables);\n}\nfunction createReportObservable(reportTypes) {\n return new Observable(function (observable) {\n if (!window.ReportingObserver) {\n return;\n }\n var handleReports = monitor(function (reports, _) {\n return reports.forEach(function (report) {\n observable.notify(buildRawReportFromReport(report));\n });\n });\n var observer = new window.ReportingObserver(handleReports, {\n types: reportTypes,\n buffered: true,\n });\n observer.observe();\n return function () {\n observer.disconnect();\n };\n });\n}\nfunction createCspViolationReportObservable(configuration) {\n return new Observable(function (observable) {\n var stop = addEventListener(configuration, document, DOM_EVENT.SECURITY_POLICY_VIOLATION, function (event) {\n observable.notify(buildRawReportFromCspViolation(event));\n }).stop;\n return stop;\n });\n}\nfunction buildRawReportFromReport(report) {\n var type = report.type, body = report.body;\n return {\n type: type,\n subtype: body.id,\n message: \"\".concat(type, \": \").concat(body.message),\n originalReport: report,\n stack: buildStack(body.id, body.message, body.sourceFile, body.lineNumber, body.columnNumber),\n };\n}\nfunction buildRawReportFromCspViolation(event) {\n var type = RawReportType.cspViolation;\n var message = \"'\".concat(event.blockedURI, \"' blocked by '\").concat(event.effectiveDirective, \"' directive\");\n return {\n type: RawReportType.cspViolation,\n subtype: event.effectiveDirective,\n message: \"\".concat(type, \": \").concat(message),\n stack: buildStack(event.effectiveDirective, event.originalPolicy\n ? \"\".concat(message, \" of the policy \\\"\").concat(safeTruncate(event.originalPolicy, 100, '...'), \"\\\"\")\n : 'no policy', event.sourceFile, event.lineNumber, event.columnNumber),\n originalReport: event,\n };\n}\nfunction buildStack(name, message, sourceFile, lineNumber, columnNumber) {\n return sourceFile\n ? toStackTraceString({\n name: name,\n message: message,\n stack: [\n {\n func: '?',\n url: sourceFile,\n line: lineNumber !== null && lineNumber !== void 0 ? lineNumber : undefined,\n column: columnNumber !== null && columnNumber !== void 0 ? columnNumber : undefined,\n },\n ],\n })\n : undefined;\n}\n//# sourceMappingURL=reportObservable.js.map","export function sendToExtension(type, payload) {\n var callback = window.__ddBrowserSdkExtensionCallback;\n if (callback) {\n callback({ type: type, payload: payload });\n }\n}\n//# sourceMappingURL=sendToExtension.js.map","/**\n * Similar to `typeof`, but distinguish plain objects from `null` and arrays\n */\nexport function getType(value) {\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return 'array';\n }\n return typeof value;\n}\n//# sourceMappingURL=typeUtils.js.map","import { getType } from './utils/typeUtils';\n/**\n * Iterate over source and affect its sub values into destination, recursively.\n * If the source and destination can't be merged, return source.\n */\nexport function mergeInto(destination, source, circularReferenceChecker) {\n if (circularReferenceChecker === void 0) { circularReferenceChecker = createCircularReferenceChecker(); }\n // ignore the source if it is undefined\n if (source === undefined) {\n return destination;\n }\n if (typeof source !== 'object' || source === null) {\n // primitive values - just return source\n return source;\n }\n else if (source instanceof Date) {\n return new Date(source.getTime());\n }\n else if (source instanceof RegExp) {\n var flags = source.flags ||\n // old browsers compatibility\n [\n source.global ? 'g' : '',\n source.ignoreCase ? 'i' : '',\n source.multiline ? 'm' : '',\n source.sticky ? 'y' : '',\n source.unicode ? 'u' : '',\n ].join('');\n return new RegExp(source.source, flags);\n }\n if (circularReferenceChecker.hasAlreadyBeenSeen(source)) {\n // remove circular references\n return undefined;\n }\n else if (Array.isArray(source)) {\n var merged_1 = Array.isArray(destination) ? destination : [];\n for (var i = 0; i < source.length; ++i) {\n merged_1[i] = mergeInto(merged_1[i], source[i], circularReferenceChecker);\n }\n return merged_1;\n }\n var merged = getType(destination) === 'object' ? destination : {};\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n merged[key] = mergeInto(merged[key], source[key], circularReferenceChecker);\n }\n }\n return merged;\n}\n/**\n * A simplistic implementation of a deep clone algorithm.\n * Caveats:\n * - It doesn't maintain prototype chains - don't use with instances of custom classes.\n * - It doesn't handle Map and Set\n */\nexport function deepClone(value) {\n return mergeInto(undefined, value);\n}\nexport function combine() {\n var sources = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n sources[_i] = arguments[_i];\n }\n var destination;\n for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {\n var source = sources_1[_a];\n // Ignore any undefined or null sources.\n if (source === undefined || source === null) {\n continue;\n }\n destination = mergeInto(destination, source);\n }\n return destination;\n}\nfunction createCircularReferenceChecker() {\n if (typeof WeakSet !== 'undefined') {\n var set_1 = new WeakSet();\n return {\n hasAlreadyBeenSeen: function (value) {\n var has = set_1.has(value);\n if (!has) {\n set_1.add(value);\n }\n return has;\n },\n };\n }\n var array = [];\n return {\n hasAlreadyBeenSeen: function (value) {\n var has = array.indexOf(value) >= 0;\n if (!has) {\n array.push(value);\n }\n return has;\n },\n };\n}\n//# sourceMappingURL=mergeInto.js.map","export function getConnectivity() {\n var _a;\n var navigator = window.navigator;\n return {\n status: navigator.onLine ? 'connected' : 'not_connected',\n interfaces: navigator.connection && navigator.connection.type ? [navigator.connection.type] : undefined,\n effective_type: (_a = navigator.connection) === null || _a === void 0 ? void 0 : _a.effectiveType,\n };\n}\n//# sourceMappingURL=connectivity.js.map","import { arrayFrom } from './polyfills';\nexport function removeDuplicates(array) {\n var set = new Set();\n array.forEach(function (item) { return set.add(item); });\n return arrayFrom(set);\n}\nexport function removeItem(array, item) {\n var index = array.indexOf(item);\n if (index >= 0) {\n array.splice(index, 1);\n }\n}\n//# sourceMappingURL=arrayUtils.js.map","import { removeItem } from './utils/arrayUtils';\nvar BUFFER_LIMIT = 500;\nvar BoundedBuffer = /** @class */ (function () {\n function BoundedBuffer() {\n this.buffer = [];\n }\n BoundedBuffer.prototype.add = function (callback) {\n var length = this.buffer.push(callback);\n if (length > BUFFER_LIMIT) {\n this.buffer.splice(0, 1);\n }\n };\n BoundedBuffer.prototype.remove = function (callback) {\n removeItem(this.buffer, callback);\n };\n BoundedBuffer.prototype.drain = function (arg) {\n this.buffer.forEach(function (callback) { return callback(arg); });\n this.buffer.length = 0;\n };\n return BoundedBuffer;\n}());\nexport { BoundedBuffer };\n//# sourceMappingURL=boundedBuffer.js.map","export var TelemetryType = {\n log: 'log',\n configuration: 'configuration',\n usage: 'usage',\n};\n//# sourceMappingURL=rawTelemetryEvent.types.js.map","import { ConsoleApiName } from '../../tools/display';\nimport { NO_ERROR_STACK_PRESENT_MESSAGE } from '../error/error';\nimport { toStackTraceString } from '../../tools/stackTrace/handlingStack';\nimport { getExperimentalFeatures } from '../../tools/experimentalFeatures';\nimport { INTAKE_SITE_STAGING, INTAKE_SITE_US1_FED } from '../configuration';\nimport { Observable } from '../../tools/observable';\nimport { timeStampNow } from '../../tools/utils/timeUtils';\nimport { displayIfDebugEnabled, startMonitorErrorCollection } from '../../tools/monitor';\nimport { sendToExtension } from '../../tools/sendToExtension';\nimport { startsWith, arrayFrom, includes, assign } from '../../tools/utils/polyfills';\nimport { performDraw } from '../../tools/utils/numberUtils';\nimport { jsonStringify } from '../../tools/serialisation/jsonStringify';\nimport { combine } from '../../tools/mergeInto';\nimport { computeStackTrace } from '../../tools/stackTrace/computeStackTrace';\nimport { getConnectivity } from '../connectivity';\nimport { BoundedBuffer } from '../../tools/boundedBuffer';\nimport { TelemetryType } from './rawTelemetryEvent.types';\nvar ALLOWED_FRAME_URLS = [\n 'https://www.datadoghq-browser-agent.com',\n 'https://www.datad0g-browser-agent.com',\n 'https://d3uc069fcn7uxw.cloudfront.net',\n 'https://d20xtzwzcl0ceb.cloudfront.net',\n 'http://localhost',\n '',\n];\nvar TELEMETRY_EXCLUDED_SITES = [INTAKE_SITE_US1_FED];\n// eslint-disable-next-line local-rules/disallow-side-effects\nvar preStartTelemetryBuffer = new BoundedBuffer();\nvar onRawTelemetryEventCollected = function (event) {\n preStartTelemetryBuffer.add(function () { return onRawTelemetryEventCollected(event); });\n};\nexport function startTelemetry(telemetryService, configuration) {\n var _a;\n var contextProvider;\n var observable = new Observable();\n var alreadySentEvents = new Set();\n var telemetryEnabled = !includes(TELEMETRY_EXCLUDED_SITES, configuration.site) && performDraw(configuration.telemetrySampleRate);\n var telemetryEnabledPerType = (_a = {},\n _a[TelemetryType.log] = telemetryEnabled,\n _a[TelemetryType.configuration] = telemetryEnabled && performDraw(configuration.telemetryConfigurationSampleRate),\n _a[TelemetryType.usage] = telemetryEnabled && performDraw(configuration.telemetryUsageSampleRate),\n _a);\n var runtimeEnvInfo = getRuntimeEnvInfo();\n onRawTelemetryEventCollected = function (rawEvent) {\n var stringifiedEvent = jsonStringify(rawEvent);\n if (telemetryEnabledPerType[rawEvent.type] &&\n alreadySentEvents.size < configuration.maxTelemetryEventsPerPage &&\n !alreadySentEvents.has(stringifiedEvent)) {\n var event_1 = toTelemetryEvent(telemetryService, rawEvent, runtimeEnvInfo);\n observable.notify(event_1);\n sendToExtension('telemetry', event_1);\n alreadySentEvents.add(stringifiedEvent);\n }\n };\n startMonitorErrorCollection(addTelemetryError);\n function toTelemetryEvent(telemetryService, event, runtimeEnvInfo) {\n return combine({\n type: 'telemetry',\n date: timeStampNow(),\n service: telemetryService,\n version: \"5.20.0\",\n source: 'browser',\n _dd: {\n format_version: 2,\n },\n telemetry: combine(event, {\n runtime_env: runtimeEnvInfo,\n connectivity: getConnectivity(),\n }),\n experimental_features: arrayFrom(getExperimentalFeatures()),\n }, contextProvider !== undefined ? contextProvider() : {});\n }\n return {\n setContextProvider: function (provider) {\n contextProvider = provider;\n },\n observable: observable,\n enabled: telemetryEnabled,\n };\n}\nfunction getRuntimeEnvInfo() {\n return {\n is_local_file: window.location.protocol === 'file:',\n is_worker: 'WorkerGlobalScope' in self,\n };\n}\nexport function startFakeTelemetry() {\n var events = [];\n onRawTelemetryEventCollected = function (event) {\n events.push(event);\n };\n return events;\n}\n// need to be called after telemetry context is provided and observers are registered\nexport function drainPreStartTelemetry() {\n preStartTelemetryBuffer.drain();\n}\nexport function resetTelemetry() {\n preStartTelemetryBuffer = new BoundedBuffer();\n onRawTelemetryEventCollected = function (event) {\n preStartTelemetryBuffer.add(function () { return onRawTelemetryEventCollected(event); });\n };\n}\n/**\n * Avoid mixing telemetry events from different data centers\n * but keep replicating staging events for reliability\n */\nexport function isTelemetryReplicationAllowed(configuration) {\n return configuration.site === INTAKE_SITE_STAGING;\n}\nexport function addTelemetryDebug(message, context) {\n displayIfDebugEnabled(ConsoleApiName.debug, message, context);\n onRawTelemetryEventCollected(assign({\n type: TelemetryType.log,\n message: message,\n status: \"debug\" /* StatusType.debug */,\n }, context));\n}\nexport function addTelemetryError(e, context) {\n onRawTelemetryEventCollected(assign({\n type: TelemetryType.log,\n status: \"error\" /* StatusType.error */,\n }, formatError(e), context));\n}\nexport function addTelemetryConfiguration(configuration) {\n onRawTelemetryEventCollected({\n type: TelemetryType.configuration,\n configuration: configuration,\n });\n}\nexport function addTelemetryUsage(usage) {\n onRawTelemetryEventCollected({\n type: TelemetryType.usage,\n usage: usage,\n });\n}\nexport function formatError(e) {\n if (e instanceof Error) {\n var stackTrace = computeStackTrace(e);\n return {\n error: {\n kind: stackTrace.name,\n stack: toStackTraceString(scrubCustomerFrames(stackTrace)),\n },\n message: stackTrace.message,\n };\n }\n return {\n error: {\n stack: NO_ERROR_STACK_PRESENT_MESSAGE,\n },\n message: \"\".concat(\"Uncaught\" /* NonErrorPrefix.UNCAUGHT */, \" \").concat(jsonStringify(e)),\n };\n}\nexport function scrubCustomerFrames(stackTrace) {\n stackTrace.stack = stackTrace.stack.filter(function (frame) { return !frame.url || ALLOWED_FRAME_URLS.some(function (allowedFrameUrl) { return startsWith(frame.url, allowedFrameUrl); }); });\n return stackTrace;\n}\n//# sourceMappingURL=telemetry.js.map","import { setInterval, clearInterval } from './timer';\nimport { removeItem } from './utils/arrayUtils';\nimport { addDuration, relativeNow, ONE_MINUTE } from './utils/timeUtils';\nvar END_OF_TIMES = Infinity;\nexport var CLEAR_OLD_VALUES_INTERVAL = ONE_MINUTE;\n/**\n * Store and keep track of values spans. This whole class assumes that values are added in\n * chronological order (i.e. all entries have an increasing start time).\n */\nvar ValueHistory = /** @class */ (function () {\n function ValueHistory(expireDelay, maxEntries) {\n var _this = this;\n this.expireDelay = expireDelay;\n this.maxEntries = maxEntries;\n this.entries = [];\n this.clearOldValuesInterval = setInterval(function () { return _this.clearOldValues(); }, CLEAR_OLD_VALUES_INTERVAL);\n }\n /**\n * Add a value to the history associated with a start time. Returns a reference to this newly\n * added entry that can be removed or closed.\n */\n ValueHistory.prototype.add = function (value, startTime) {\n var _this = this;\n var entry = {\n value: value,\n startTime: startTime,\n endTime: END_OF_TIMES,\n remove: function () {\n removeItem(_this.entries, entry);\n },\n close: function (endTime) {\n entry.endTime = endTime;\n },\n };\n if (this.maxEntries && this.entries.length >= this.maxEntries) {\n this.entries.pop();\n }\n this.entries.unshift(entry);\n return entry;\n };\n /**\n * Return the latest value that was active during `startTime`, or the currently active value\n * if no `startTime` is provided. This method assumes that entries are not overlapping.\n *\n * If `option.returnInactive` is true, returns the value at `startTime` (active or not).\n */\n ValueHistory.prototype.find = function (startTime, options) {\n if (startTime === void 0) { startTime = END_OF_TIMES; }\n if (options === void 0) { options = { returnInactive: false }; }\n for (var _i = 0, _a = this.entries; _i < _a.length; _i++) {\n var entry = _a[_i];\n if (entry.startTime <= startTime) {\n if (options.returnInactive || startTime <= entry.endTime) {\n return entry.value;\n }\n break;\n }\n }\n };\n /**\n * Helper function to close the currently active value, if any. This method assumes that entries\n * are not overlapping.\n */\n ValueHistory.prototype.closeActive = function (endTime) {\n var latestEntry = this.entries[0];\n if (latestEntry && latestEntry.endTime === END_OF_TIMES) {\n latestEntry.close(endTime);\n }\n };\n /**\n * Return all values with an active period overlapping with the duration,\n * or all values that were active during `startTime` if no duration is provided,\n * or all currently active values if no `startTime` is provided.\n */\n ValueHistory.prototype.findAll = function (startTime, duration) {\n if (startTime === void 0) { startTime = END_OF_TIMES; }\n if (duration === void 0) { duration = 0; }\n var endTime = addDuration(startTime, duration);\n return this.entries\n .filter(function (entry) { return entry.startTime <= endTime && startTime <= entry.endTime; })\n .map(function (entry) { return entry.value; });\n };\n /**\n * Remove all entries from this collection.\n */\n ValueHistory.prototype.reset = function () {\n this.entries = [];\n };\n /**\n * Stop internal garbage collection of past entries.\n */\n ValueHistory.prototype.stop = function () {\n clearInterval(this.clearOldValuesInterval);\n };\n ValueHistory.prototype.clearOldValues = function () {\n var oldTimeThreshold = relativeNow() - this.expireDelay;\n while (this.entries.length > 0 && this.entries[this.entries.length - 1].endTime < oldTimeThreshold) {\n this.entries.pop();\n }\n };\n return ValueHistory;\n}());\nexport { ValueHistory };\n//# sourceMappingURL=valueHistory.js.map","import { Observable } from '../../tools/observable';\nimport { ValueHistory } from '../../tools/valueHistory';\nimport { relativeNow, clocksOrigin, ONE_MINUTE } from '../../tools/utils/timeUtils';\nimport { DOM_EVENT, addEventListener, addEventListeners } from '../../browser/addEventListener';\nimport { clearInterval, setInterval } from '../../tools/timer';\nimport { SESSION_TIME_OUT_DELAY } from './sessionConstants';\nimport { startSessionStore } from './sessionStore';\nexport var VISIBILITY_CHECK_DELAY = ONE_MINUTE;\nvar SESSION_CONTEXT_TIMEOUT_DELAY = SESSION_TIME_OUT_DELAY;\nvar stopCallbacks = [];\nexport function startSessionManager(configuration, productKey, computeSessionState, trackingConsentState) {\n var renewObservable = new Observable();\n var expireObservable = new Observable();\n // TODO - Improve configuration type and remove assertion\n var sessionStore = startSessionStore(configuration.sessionStoreStrategyType, productKey, computeSessionState);\n stopCallbacks.push(function () { return sessionStore.stop(); });\n var sessionContextHistory = new ValueHistory(SESSION_CONTEXT_TIMEOUT_DELAY);\n stopCallbacks.push(function () { return sessionContextHistory.stop(); });\n sessionStore.renewObservable.subscribe(function () {\n sessionContextHistory.add(buildSessionContext(), relativeNow());\n renewObservable.notify();\n });\n sessionStore.expireObservable.subscribe(function () {\n expireObservable.notify();\n sessionContextHistory.closeActive(relativeNow());\n });\n // We expand/renew session unconditionally as tracking consent is always granted when the session\n // manager is started.\n sessionStore.expandOrRenewSession();\n sessionContextHistory.add(buildSessionContext(), clocksOrigin().relative);\n trackingConsentState.observable.subscribe(function () {\n if (trackingConsentState.isGranted()) {\n sessionStore.expandOrRenewSession();\n }\n else {\n sessionStore.expire();\n }\n });\n trackActivity(configuration, function () {\n if (trackingConsentState.isGranted()) {\n sessionStore.expandOrRenewSession();\n }\n });\n trackVisibility(configuration, function () { return sessionStore.expandSession(); });\n trackResume(configuration, function () { return sessionStore.restartSession(); });\n function buildSessionContext() {\n return {\n id: sessionStore.getSession().id,\n trackingType: sessionStore.getSession()[productKey],\n };\n }\n return {\n findSession: function (startTime, options) { return sessionContextHistory.find(startTime, options); },\n renewObservable: renewObservable,\n expireObservable: expireObservable,\n expire: sessionStore.expire,\n };\n}\nexport function stopSessionManager() {\n stopCallbacks.forEach(function (e) { return e(); });\n stopCallbacks = [];\n}\nfunction trackActivity(configuration, expandOrRenewSession) {\n var stop = addEventListeners(configuration, window, [DOM_EVENT.CLICK, DOM_EVENT.TOUCH_START, DOM_EVENT.KEY_DOWN, DOM_EVENT.SCROLL], expandOrRenewSession, { capture: true, passive: true }).stop;\n stopCallbacks.push(stop);\n}\nfunction trackVisibility(configuration, expandSession) {\n var expandSessionWhenVisible = function () {\n if (document.visibilityState === 'visible') {\n expandSession();\n }\n };\n var stop = addEventListener(configuration, document, DOM_EVENT.VISIBILITY_CHANGE, expandSessionWhenVisible).stop;\n stopCallbacks.push(stop);\n var visibilityCheckInterval = setInterval(expandSessionWhenVisible, VISIBILITY_CHECK_DELAY);\n stopCallbacks.push(function () {\n clearInterval(visibilityCheckInterval);\n });\n}\nfunction trackResume(configuration, cb) {\n var stop = addEventListener(configuration, window, DOM_EVENT.RESUME, cb, { capture: true }).stop;\n stopCallbacks.push(stop);\n}\n//# sourceMappingURL=sessionManager.js.map","export function isServerError(status) {\n return status >= 500;\n}\nexport function tryToClone(response) {\n try {\n return response.clone();\n }\n catch (e) {\n // clone can throw if the response has already been used by another instrumentation or is disturbed\n return;\n }\n}\n//# sourceMappingURL=responseUtils.js.map","import { setTimeout } from '../tools/timer';\nimport { clocksNow, ONE_MINUTE, ONE_SECOND } from '../tools/utils/timeUtils';\nimport { ONE_MEBI_BYTE, ONE_KIBI_BYTE } from '../tools/utils/byteUtils';\nimport { isServerError } from '../tools/utils/responseUtils';\nimport { ErrorSource } from '../domain/error/error.types';\nexport var MAX_ONGOING_BYTES_COUNT = 80 * ONE_KIBI_BYTE;\nexport var MAX_ONGOING_REQUESTS = 32;\nexport var MAX_QUEUE_BYTES_COUNT = 3 * ONE_MEBI_BYTE;\nexport var MAX_BACKOFF_TIME = ONE_MINUTE;\nexport var INITIAL_BACKOFF_TIME = ONE_SECOND;\nexport function sendWithRetryStrategy(payload, state, sendStrategy, trackType, reportError) {\n if (state.transportStatus === 0 /* TransportStatus.UP */ &&\n state.queuedPayloads.size() === 0 &&\n state.bandwidthMonitor.canHandle(payload)) {\n send(payload, state, sendStrategy, {\n onSuccess: function () { return retryQueuedPayloads(0 /* RetryReason.AFTER_SUCCESS */, state, sendStrategy, trackType, reportError); },\n onFailure: function () {\n state.queuedPayloads.enqueue(payload);\n scheduleRetry(state, sendStrategy, trackType, reportError);\n },\n });\n }\n else {\n state.queuedPayloads.enqueue(payload);\n }\n}\nfunction scheduleRetry(state, sendStrategy, trackType, reportError) {\n if (state.transportStatus !== 2 /* TransportStatus.DOWN */) {\n return;\n }\n setTimeout(function () {\n var payload = state.queuedPayloads.first();\n send(payload, state, sendStrategy, {\n onSuccess: function () {\n state.queuedPayloads.dequeue();\n state.currentBackoffTime = INITIAL_BACKOFF_TIME;\n retryQueuedPayloads(1 /* RetryReason.AFTER_RESUME */, state, sendStrategy, trackType, reportError);\n },\n onFailure: function () {\n state.currentBackoffTime = Math.min(MAX_BACKOFF_TIME, state.currentBackoffTime * 2);\n scheduleRetry(state, sendStrategy, trackType, reportError);\n },\n });\n }, state.currentBackoffTime);\n}\nfunction send(payload, state, sendStrategy, _a) {\n var onSuccess = _a.onSuccess, onFailure = _a.onFailure;\n state.bandwidthMonitor.add(payload);\n sendStrategy(payload, function (response) {\n state.bandwidthMonitor.remove(payload);\n if (!shouldRetryRequest(response)) {\n state.transportStatus = 0 /* TransportStatus.UP */;\n onSuccess();\n }\n else {\n // do not consider transport down if another ongoing request could succeed\n state.transportStatus =\n state.bandwidthMonitor.ongoingRequestCount > 0 ? 1 /* TransportStatus.FAILURE_DETECTED */ : 2 /* TransportStatus.DOWN */;\n payload.retry = {\n count: payload.retry ? payload.retry.count + 1 : 1,\n lastFailureStatus: response.status,\n };\n onFailure();\n }\n });\n}\nfunction retryQueuedPayloads(reason, state, sendStrategy, trackType, reportError) {\n if (reason === 0 /* RetryReason.AFTER_SUCCESS */ && state.queuedPayloads.isFull() && !state.queueFullReported) {\n reportError({\n message: \"Reached max \".concat(trackType, \" events size queued for upload: \").concat(MAX_QUEUE_BYTES_COUNT / ONE_MEBI_BYTE, \"MiB\"),\n source: ErrorSource.AGENT,\n startClocks: clocksNow(),\n });\n state.queueFullReported = true;\n }\n var previousQueue = state.queuedPayloads;\n state.queuedPayloads = newPayloadQueue();\n while (previousQueue.size() > 0) {\n sendWithRetryStrategy(previousQueue.dequeue(), state, sendStrategy, trackType, reportError);\n }\n}\nfunction shouldRetryRequest(response) {\n return (response.type !== 'opaque' &&\n ((response.status === 0 && !navigator.onLine) ||\n response.status === 408 ||\n response.status === 429 ||\n isServerError(response.status)));\n}\nexport function newRetryState() {\n return {\n transportStatus: 0 /* TransportStatus.UP */,\n currentBackoffTime: INITIAL_BACKOFF_TIME,\n bandwidthMonitor: newBandwidthMonitor(),\n queuedPayloads: newPayloadQueue(),\n queueFullReported: false,\n };\n}\nfunction newPayloadQueue() {\n var queue = [];\n return {\n bytesCount: 0,\n enqueue: function (payload) {\n if (this.isFull()) {\n return;\n }\n queue.push(payload);\n this.bytesCount += payload.bytesCount;\n },\n first: function () {\n return queue[0];\n },\n dequeue: function () {\n var payload = queue.shift();\n if (payload) {\n this.bytesCount -= payload.bytesCount;\n }\n return payload;\n },\n size: function () {\n return queue.length;\n },\n isFull: function () {\n return this.bytesCount >= MAX_QUEUE_BYTES_COUNT;\n },\n };\n}\nfunction newBandwidthMonitor() {\n return {\n ongoingRequestCount: 0,\n ongoingByteCount: 0,\n canHandle: function (payload) {\n return (this.ongoingRequestCount === 0 ||\n (this.ongoingByteCount + payload.bytesCount <= MAX_ONGOING_BYTES_COUNT &&\n this.ongoingRequestCount < MAX_ONGOING_REQUESTS));\n },\n add: function (payload) {\n this.ongoingRequestCount += 1;\n this.ongoingByteCount += payload.bytesCount;\n },\n remove: function (payload) {\n this.ongoingRequestCount -= 1;\n this.ongoingByteCount -= payload.bytesCount;\n },\n };\n}\n//# sourceMappingURL=sendWithRetryStrategy.js.map","import { addTelemetryError } from '../domain/telemetry';\nimport { monitor } from '../tools/monitor';\nimport { addEventListener } from '../browser/addEventListener';\nimport { newRetryState, sendWithRetryStrategy } from './sendWithRetryStrategy';\nexport function createHttpRequest(configuration, endpointBuilder, bytesLimit, reportError) {\n var retryState = newRetryState();\n var sendStrategyForRetry = function (payload, onResponse) {\n return fetchKeepAliveStrategy(configuration, endpointBuilder, bytesLimit, payload, onResponse);\n };\n return {\n send: function (payload) {\n sendWithRetryStrategy(payload, retryState, sendStrategyForRetry, endpointBuilder.trackType, reportError);\n },\n /**\n * Since fetch keepalive behaves like regular fetch on Firefox,\n * keep using sendBeaconStrategy on exit\n */\n sendOnExit: function (payload) {\n sendBeaconStrategy(configuration, endpointBuilder, bytesLimit, payload);\n },\n };\n}\nfunction sendBeaconStrategy(configuration, endpointBuilder, bytesLimit, payload) {\n var canUseBeacon = !!navigator.sendBeacon && payload.bytesCount < bytesLimit;\n if (canUseBeacon) {\n try {\n var beaconUrl = endpointBuilder.build('beacon', payload);\n var isQueued = navigator.sendBeacon(beaconUrl, payload.data);\n if (isQueued) {\n return;\n }\n }\n catch (e) {\n reportBeaconError(e);\n }\n }\n var xhrUrl = endpointBuilder.build('xhr', payload);\n sendXHR(configuration, xhrUrl, payload.data);\n}\nvar hasReportedBeaconError = false;\nfunction reportBeaconError(e) {\n if (!hasReportedBeaconError) {\n hasReportedBeaconError = true;\n addTelemetryError(e);\n }\n}\nexport function fetchKeepAliveStrategy(configuration, endpointBuilder, bytesLimit, payload, onResponse) {\n var canUseKeepAlive = isKeepAliveSupported() && payload.bytesCount < bytesLimit;\n if (canUseKeepAlive) {\n var fetchUrl = endpointBuilder.build('fetch', payload);\n fetch(fetchUrl, { method: 'POST', body: payload.data, keepalive: true, mode: 'cors' }).then(monitor(function (response) { return onResponse === null || onResponse === void 0 ? void 0 : onResponse({ status: response.status, type: response.type }); }), monitor(function () {\n var xhrUrl = endpointBuilder.build('xhr', payload);\n // failed to queue the request\n sendXHR(configuration, xhrUrl, payload.data, onResponse);\n }));\n }\n else {\n var xhrUrl = endpointBuilder.build('xhr', payload);\n sendXHR(configuration, xhrUrl, payload.data, onResponse);\n }\n}\nfunction isKeepAliveSupported() {\n // Request can throw, cf https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#errors\n try {\n return window.Request && 'keepalive' in new Request('http://a');\n }\n catch (_a) {\n return false;\n }\n}\nexport function sendXHR(configuration, url, data, onResponse) {\n var request = new XMLHttpRequest();\n request.open('POST', url, true);\n if (data instanceof Blob) {\n // When using a Blob instance, IE does not use its 'type' to define the 'Content-Type' header\n // automatically, so the intake request ends up being rejected with an HTTP status 415\n // Defining the header manually fixes this issue.\n request.setRequestHeader('Content-Type', data.type);\n }\n addEventListener(configuration, request, 'loadend', function () {\n onResponse === null || onResponse === void 0 ? void 0 : onResponse({ status: request.status });\n }, {\n // prevent multiple onResponse callbacks\n // if the xhr instance is reused by a third party\n once: true,\n });\n request.send(data);\n}\n//# sourceMappingURL=httpRequest.js.map","import { endsWith, includes } from '../tools/utils/polyfills';\nimport { getGlobalObject } from '../tools/getGlobalObject';\nexport function getEventBridge() {\n var eventBridgeGlobal = getEventBridgeGlobal();\n if (!eventBridgeGlobal) {\n return;\n }\n return {\n getCapabilities: function () {\n var _a;\n return JSON.parse(((_a = eventBridgeGlobal.getCapabilities) === null || _a === void 0 ? void 0 : _a.call(eventBridgeGlobal)) || '[]');\n },\n getPrivacyLevel: function () {\n var _a;\n return (_a = eventBridgeGlobal.getPrivacyLevel) === null || _a === void 0 ? void 0 : _a.call(eventBridgeGlobal);\n },\n getAllowedWebViewHosts: function () {\n return JSON.parse(eventBridgeGlobal.getAllowedWebViewHosts());\n },\n send: function (eventType, event, viewId) {\n var view = viewId ? { id: viewId } : undefined;\n eventBridgeGlobal.send(JSON.stringify({ eventType: eventType, event: event, view: view }));\n },\n };\n}\nexport function bridgeSupports(capability) {\n var bridge = getEventBridge();\n return !!bridge && includes(bridge.getCapabilities(), capability);\n}\nexport function canUseEventBridge(currentHost) {\n var _a;\n if (currentHost === void 0) { currentHost = (_a = getGlobalObject().location) === null || _a === void 0 ? void 0 : _a.hostname; }\n var bridge = getEventBridge();\n return (!!bridge &&\n bridge\n .getAllowedWebViewHosts()\n .some(function (allowedHost) { return currentHost === allowedHost || endsWith(currentHost, \".\".concat(allowedHost)); }));\n}\nfunction getEventBridgeGlobal() {\n return getGlobalObject().DatadogEventBridge;\n}\n//# sourceMappingURL=eventBridge.js.map","import { Observable } from '../tools/observable';\nimport { objectValues, includes } from '../tools/utils/polyfills';\nimport { addEventListeners, addEventListener, DOM_EVENT } from './addEventListener';\nexport var PageExitReason = {\n HIDDEN: 'visibility_hidden',\n UNLOADING: 'before_unload',\n PAGEHIDE: 'page_hide',\n FROZEN: 'page_frozen',\n};\nexport function createPageExitObservable(configuration) {\n return new Observable(function (observable) {\n var stopListeners = addEventListeners(configuration, window, [DOM_EVENT.VISIBILITY_CHANGE, DOM_EVENT.FREEZE], function (event) {\n if (event.type === DOM_EVENT.VISIBILITY_CHANGE && document.visibilityState === 'hidden') {\n /**\n * Only event that guarantee to fire on mobile devices when the page transitions to background state\n * (e.g. when user switches to a different application, goes to homescreen, etc), or is being unloaded.\n */\n observable.notify({ reason: PageExitReason.HIDDEN });\n }\n else if (event.type === DOM_EVENT.FREEZE) {\n /**\n * After transitioning in background a tab can be freezed to preserve resources. (cf: https://developer.chrome.com/blog/page-lifecycle-api)\n * Allow to collect events happening between hidden and frozen state.\n */\n observable.notify({ reason: PageExitReason.FROZEN });\n }\n }, { capture: true }).stop;\n var stopBeforeUnloadListener = addEventListener(configuration, window, DOM_EVENT.BEFORE_UNLOAD, function () {\n observable.notify({ reason: PageExitReason.UNLOADING });\n }).stop;\n return function () {\n stopListeners();\n stopBeforeUnloadListener();\n };\n });\n}\nexport function isPageExitReason(reason) {\n return includes(objectValues(PageExitReason), reason);\n}\n//# sourceMappingURL=pageExitObservable.js.map","import { DOCS_ORIGIN, display } from '../tools/display';\nimport { objectValues } from '../tools/utils/polyfills';\nimport { isPageExitReason } from '../browser/pageExitObservable';\nimport { jsonStringify } from '../tools/serialisation/jsonStringify';\nimport { computeBytesCount } from '../tools/utils/byteUtils';\nvar Batch = /** @class */ (function () {\n function Batch(encoder, request, flushController, messageBytesLimit) {\n var _this = this;\n this.encoder = encoder;\n this.request = request;\n this.flushController = flushController;\n this.messageBytesLimit = messageBytesLimit;\n this.upsertBuffer = {};\n this.flushSubscription = this.flushController.flushObservable.subscribe(function (event) { return _this.flush(event); });\n }\n Batch.prototype.add = function (message) {\n this.addOrUpdate(message);\n };\n Batch.prototype.upsert = function (message, key) {\n this.addOrUpdate(message, key);\n };\n Batch.prototype.stop = function () {\n this.flushSubscription.unsubscribe();\n };\n Batch.prototype.flush = function (event) {\n var upsertMessages = objectValues(this.upsertBuffer).join('\\n');\n this.upsertBuffer = {};\n var isPageExit = isPageExitReason(event.reason);\n var send = isPageExit ? this.request.sendOnExit : this.request.send;\n if (isPageExit &&\n // Note: checking that the encoder is async is not strictly needed, but it's an optimization:\n // if the encoder is async we need to send two requests in some cases (one for encoded data\n // and the other for non-encoded data). But if it's not async, we don't have to worry about\n // it and always send a single request.\n this.encoder.isAsync) {\n var encoderResult = this.encoder.finishSync();\n // Send encoded messages\n if (encoderResult.outputBytesCount) {\n send(formatPayloadFromEncoder(encoderResult));\n }\n // Send messages that are not yet encoded at this point\n var pendingMessages = [encoderResult.pendingData, upsertMessages].filter(Boolean).join('\\n');\n if (pendingMessages) {\n send({\n data: pendingMessages,\n bytesCount: computeBytesCount(pendingMessages),\n });\n }\n }\n else {\n if (upsertMessages) {\n this.encoder.write(this.encoder.isEmpty ? upsertMessages : \"\\n\".concat(upsertMessages));\n }\n this.encoder.finish(function (encoderResult) {\n send(formatPayloadFromEncoder(encoderResult));\n });\n }\n };\n Batch.prototype.addOrUpdate = function (message, key) {\n var serializedMessage = jsonStringify(message);\n var estimatedMessageBytesCount = this.encoder.estimateEncodedBytesCount(serializedMessage);\n if (estimatedMessageBytesCount >= this.messageBytesLimit) {\n display.warn(\"Discarded a message whose size was bigger than the maximum allowed size \".concat(this.messageBytesLimit, \"KB. More details: \").concat(DOCS_ORIGIN, \"/real_user_monitoring/browser/troubleshooting/#technical-limitations\"));\n return;\n }\n if (this.hasMessageFor(key)) {\n this.remove(key);\n }\n this.push(serializedMessage, estimatedMessageBytesCount, key);\n };\n Batch.prototype.push = function (serializedMessage, estimatedMessageBytesCount, key) {\n var _this = this;\n this.flushController.notifyBeforeAddMessage(estimatedMessageBytesCount);\n if (key !== undefined) {\n this.upsertBuffer[key] = serializedMessage;\n this.flushController.notifyAfterAddMessage();\n }\n else {\n this.encoder.write(this.encoder.isEmpty ? serializedMessage : \"\\n\".concat(serializedMessage), function (realMessageBytesCount) {\n _this.flushController.notifyAfterAddMessage(realMessageBytesCount - estimatedMessageBytesCount);\n });\n }\n };\n Batch.prototype.remove = function (key) {\n var removedMessage = this.upsertBuffer[key];\n delete this.upsertBuffer[key];\n var messageBytesCount = this.encoder.estimateEncodedBytesCount(removedMessage);\n this.flushController.notifyAfterRemoveMessage(messageBytesCount);\n };\n Batch.prototype.hasMessageFor = function (key) {\n return key !== undefined && this.upsertBuffer[key] !== undefined;\n };\n return Batch;\n}());\nexport { Batch };\nfunction formatPayloadFromEncoder(encoderResult) {\n var data;\n if (typeof encoderResult.output === 'string') {\n data = encoderResult.output;\n }\n else {\n data = new Blob([encoderResult.output], {\n // This will set the 'Content-Type: text/plain' header. Reasoning:\n // * The intake rejects the request if there is no content type.\n // * The browser will issue CORS preflight requests if we set it to 'application/json', which\n // could induce higher intake load (and maybe has other impacts).\n // * Also it's not quite JSON, since we are concatenating multiple JSON objects separated by\n // new lines.\n type: 'text/plain',\n });\n }\n return {\n data: data,\n bytesCount: encoderResult.outputBytesCount,\n encoding: encoderResult.encoding,\n };\n}\n//# sourceMappingURL=batch.js.map","import { Observable } from '../tools/observable';\nimport { clearTimeout, setTimeout } from '../tools/timer';\n/**\n * Returns a \"flush controller\", responsible of notifying when flushing a pool of pending data needs\n * to happen. The implementation is designed to support both synchronous and asynchronous usages,\n * but relies on invariants described in each method documentation to keep a coherent state.\n */\nexport function createFlushController(_a) {\n var messagesLimit = _a.messagesLimit, bytesLimit = _a.bytesLimit, durationLimit = _a.durationLimit, pageExitObservable = _a.pageExitObservable, sessionExpireObservable = _a.sessionExpireObservable;\n var pageExitSubscription = pageExitObservable.subscribe(function (event) { return flush(event.reason); });\n var sessionExpireSubscription = sessionExpireObservable.subscribe(function () { return flush('session_expire'); });\n var flushObservable = new Observable(function () { return function () {\n pageExitSubscription.unsubscribe();\n sessionExpireSubscription.unsubscribe();\n }; });\n var currentBytesCount = 0;\n var currentMessagesCount = 0;\n function flush(flushReason) {\n if (currentMessagesCount === 0) {\n return;\n }\n var messagesCount = currentMessagesCount;\n var bytesCount = currentBytesCount;\n currentMessagesCount = 0;\n currentBytesCount = 0;\n cancelDurationLimitTimeout();\n flushObservable.notify({\n reason: flushReason,\n messagesCount: messagesCount,\n bytesCount: bytesCount,\n });\n }\n var durationLimitTimeoutId;\n function scheduleDurationLimitTimeout() {\n if (durationLimitTimeoutId === undefined) {\n durationLimitTimeoutId = setTimeout(function () {\n flush('duration_limit');\n }, durationLimit);\n }\n }\n function cancelDurationLimitTimeout() {\n clearTimeout(durationLimitTimeoutId);\n durationLimitTimeoutId = undefined;\n }\n return {\n flushObservable: flushObservable,\n get messagesCount() {\n return currentMessagesCount;\n },\n /**\n * Notifies that a message will be added to a pool of pending messages waiting to be flushed.\n *\n * This function needs to be called synchronously, right before adding the message, so no flush\n * event can happen after `notifyBeforeAddMessage` and before adding the message.\n *\n * @param estimatedMessageBytesCount: an estimation of the message bytes count once it is\n * actually added.\n */\n notifyBeforeAddMessage: function (estimatedMessageBytesCount) {\n if (currentBytesCount + estimatedMessageBytesCount >= bytesLimit) {\n flush('bytes_limit');\n }\n // Consider the message to be added now rather than in `notifyAfterAddMessage`, because if no\n // message was added yet and `notifyAfterAddMessage` is called asynchronously, we still want\n // to notify when a flush is needed (for example on page exit).\n currentMessagesCount += 1;\n currentBytesCount += estimatedMessageBytesCount;\n scheduleDurationLimitTimeout();\n },\n /**\n * Notifies that a message *was* added to a pool of pending messages waiting to be flushed.\n *\n * This function can be called asynchronously after the message was added, but in this case it\n * should not be called if a flush event occurred in between.\n *\n * @param messageBytesCountDiff: the difference between the estimated message bytes count and\n * its actual bytes count once added to the pool.\n */\n notifyAfterAddMessage: function (messageBytesCountDiff) {\n if (messageBytesCountDiff === void 0) { messageBytesCountDiff = 0; }\n currentBytesCount += messageBytesCountDiff;\n if (currentMessagesCount >= messagesLimit) {\n flush('messages_limit');\n }\n else if (currentBytesCount >= bytesLimit) {\n flush('bytes_limit');\n }\n },\n /**\n * Notifies that a message was removed from a pool of pending messages waiting to be flushed.\n *\n * This function needs to be called synchronously, right after removing the message, so no flush\n * event can happen after removing the message and before `notifyAfterRemoveMessage`.\n *\n * @param messageBytesCount: the message bytes count that was added to the pool. Should\n * correspond to the sum of bytes counts passed to `notifyBeforeAddMessage` and\n * `notifyAfterAddMessage`.\n */\n notifyAfterRemoveMessage: function (messageBytesCount) {\n currentBytesCount -= messageBytesCount;\n currentMessagesCount -= 1;\n if (currentMessagesCount === 0) {\n cancelDurationLimitTimeout();\n }\n },\n };\n}\n//# sourceMappingURL=flushController.js.map","import { Batch } from './batch';\nimport { createHttpRequest } from './httpRequest';\nimport { createFlushController } from './flushController';\nexport function startBatchWithReplica(configuration, primary, replica, reportError, pageExitObservable, sessionExpireObservable) {\n var primaryBatch = createBatch(configuration, primary);\n var replicaBatch = replica && createBatch(configuration, replica);\n function createBatch(configuration, _a) {\n var endpoint = _a.endpoint, encoder = _a.encoder;\n return new Batch(encoder, createHttpRequest(configuration, endpoint, configuration.batchBytesLimit, reportError), createFlushController({\n messagesLimit: configuration.batchMessagesLimit,\n bytesLimit: configuration.batchBytesLimit,\n durationLimit: configuration.flushTimeout,\n pageExitObservable: pageExitObservable,\n sessionExpireObservable: sessionExpireObservable,\n }), configuration.messageBytesLimit);\n }\n return {\n flushObservable: primaryBatch.flushController.flushObservable,\n add: function (message, replicated) {\n if (replicated === void 0) { replicated = true; }\n primaryBatch.add(message);\n if (replicaBatch && replicated) {\n replicaBatch.add(replica.transformMessage ? replica.transformMessage(message) : message);\n }\n },\n upsert: function (message, key) {\n primaryBatch.upsert(message, key);\n if (replicaBatch) {\n replicaBatch.upsert(replica.transformMessage ? replica.transformMessage(message) : message, key);\n }\n },\n stop: function () {\n primaryBatch.stop();\n replicaBatch === null || replicaBatch === void 0 ? void 0 : replicaBatch.stop();\n },\n };\n}\n//# sourceMappingURL=startBatchWithReplica.js.map","import { computeBytesCount } from './utils/byteUtils';\nexport function createIdentityEncoder() {\n var output = '';\n var outputBytesCount = 0;\n return {\n isAsync: false,\n get isEmpty() {\n return !output;\n },\n write: function (data, callback) {\n var additionalEncodedBytesCount = computeBytesCount(data);\n outputBytesCount += additionalEncodedBytesCount;\n output += data;\n if (callback) {\n callback(additionalEncodedBytesCount);\n }\n },\n finish: function (callback) {\n callback(this.finishSync());\n },\n finishSync: function () {\n var result = {\n output: output,\n outputBytesCount: outputBytesCount,\n rawBytesCount: outputBytesCount,\n pendingData: '',\n };\n output = '';\n outputBytesCount = 0;\n return result;\n },\n estimateEncodedBytesCount: function (data) {\n return data.length;\n },\n };\n}\n//# sourceMappingURL=encoder.js.map","var AbstractLifeCycle = /** @class */ (function () {\n function AbstractLifeCycle() {\n this.callbacks = {};\n }\n AbstractLifeCycle.prototype.notify = function (eventType, data) {\n var eventCallbacks = this.callbacks[eventType];\n if (eventCallbacks) {\n eventCallbacks.forEach(function (callback) { return callback(data); });\n }\n };\n AbstractLifeCycle.prototype.subscribe = function (eventType, callback) {\n var _this = this;\n if (!this.callbacks[eventType]) {\n this.callbacks[eventType] = [];\n }\n this.callbacks[eventType].push(callback);\n return {\n unsubscribe: function () {\n _this.callbacks[eventType] = _this.callbacks[eventType].filter(function (other) { return callback !== other; });\n },\n };\n };\n return AbstractLifeCycle;\n}());\nexport { AbstractLifeCycle };\n//# sourceMappingURL=abstractLifeCycle.js.map","import { setTimeout } from '../../tools/timer';\nimport { clocksNow, ONE_MINUTE } from '../../tools/utils/timeUtils';\nimport { ErrorSource } from '../error/error.types';\nexport function createEventRateLimiter(eventType, limit, onLimitReached) {\n var eventCount = 0;\n var allowNextEvent = false;\n return {\n isLimitReached: function () {\n if (eventCount === 0) {\n setTimeout(function () {\n eventCount = 0;\n }, ONE_MINUTE);\n }\n eventCount += 1;\n if (eventCount <= limit || allowNextEvent) {\n allowNextEvent = false;\n return false;\n }\n if (eventCount === limit + 1) {\n allowNextEvent = true;\n try {\n onLimitReached({\n message: \"Reached max number of \".concat(eventType, \"s by minute: \").concat(limit),\n source: ErrorSource.AGENT,\n startClocks: clocksNow(),\n });\n }\n finally {\n allowNextEvent = false;\n }\n }\n return true;\n },\n };\n}\n//# sourceMappingURL=createEventRateLimiter.js.map","import { DOM_EVENT, addEventListener } from './addEventListener';\nexport function runOnReadyState(configuration, expectedReadyState, callback) {\n if (document.readyState === expectedReadyState || document.readyState === 'complete') {\n callback();\n }\n else {\n var eventName = expectedReadyState === 'complete' ? DOM_EVENT.LOAD : DOM_EVENT.DOM_CONTENT_LOADED;\n addEventListener(configuration, window, eventName, callback, { once: true });\n }\n}\n//# sourceMappingURL=runOnReadyState.js.map","import { instrumentMethod } from '../tools/instrumentMethod';\nimport { Observable } from '../tools/observable';\nimport { elapsed, clocksNow, timeStampNow } from '../tools/utils/timeUtils';\nimport { normalizeUrl } from '../tools/utils/urlPolyfill';\nimport { shallowClone } from '../tools/utils/objectUtils';\nimport { addEventListener } from './addEventListener';\nvar xhrObservable;\nvar xhrContexts = new WeakMap();\nexport function initXhrObservable(configuration) {\n if (!xhrObservable) {\n xhrObservable = createXhrObservable(configuration);\n }\n return xhrObservable;\n}\nfunction createXhrObservable(configuration) {\n return new Observable(function (observable) {\n var stopInstrumentingStart = instrumentMethod(XMLHttpRequest.prototype, 'open', openXhr).stop;\n var stopInstrumentingSend = instrumentMethod(XMLHttpRequest.prototype, 'send', function (call) {\n sendXhr(call, configuration, observable);\n }, { computeHandlingStack: true }).stop;\n var stopInstrumentingAbort = instrumentMethod(XMLHttpRequest.prototype, 'abort', abortXhr).stop;\n return function () {\n stopInstrumentingStart();\n stopInstrumentingSend();\n stopInstrumentingAbort();\n };\n });\n}\nfunction openXhr(_a) {\n var xhr = _a.target, _b = _a.parameters, method = _b[0], url = _b[1];\n xhrContexts.set(xhr, {\n state: 'open',\n method: String(method).toUpperCase(),\n url: normalizeUrl(String(url)),\n });\n}\nfunction sendXhr(_a, configuration, observable) {\n var xhr = _a.target, handlingStack = _a.handlingStack;\n var context = xhrContexts.get(xhr);\n if (!context) {\n return;\n }\n var startContext = context;\n startContext.state = 'start';\n startContext.startClocks = clocksNow();\n startContext.isAborted = false;\n startContext.xhr = xhr;\n startContext.handlingStack = handlingStack;\n var hasBeenReported = false;\n var stopInstrumentingOnReadyStateChange = instrumentMethod(xhr, 'onreadystatechange', function () {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n // Try to report the XHR as soon as possible, because the XHR may be mutated by the\n // application during a future event. For example, Angular is calling .abort() on\n // completed requests during an onreadystatechange event, so the status becomes '0'\n // before the request is collected.\n onEnd();\n }\n }).stop;\n var onEnd = function () {\n unsubscribeLoadEndListener();\n stopInstrumentingOnReadyStateChange();\n if (hasBeenReported) {\n return;\n }\n hasBeenReported = true;\n var completeContext = context;\n completeContext.state = 'complete';\n completeContext.duration = elapsed(startContext.startClocks.timeStamp, timeStampNow());\n completeContext.status = xhr.status;\n observable.notify(shallowClone(completeContext));\n };\n var unsubscribeLoadEndListener = addEventListener(configuration, xhr, 'loadend', onEnd).stop;\n observable.notify(startContext);\n}\nfunction abortXhr(_a) {\n var xhr = _a.target;\n var context = xhrContexts.get(xhr);\n if (context) {\n context.isAborted = true;\n }\n}\n//# sourceMappingURL=xhrObservable.js.map","import { instrumentMethod } from '../tools/instrumentMethod';\nimport { monitor } from '../tools/monitor';\nimport { Observable } from '../tools/observable';\nimport { clocksNow } from '../tools/utils/timeUtils';\nimport { normalizeUrl } from '../tools/utils/urlPolyfill';\nvar fetchObservable;\nexport function initFetchObservable() {\n if (!fetchObservable) {\n fetchObservable = createFetchObservable();\n }\n return fetchObservable;\n}\nfunction createFetchObservable() {\n return new Observable(function (observable) {\n if (!window.fetch) {\n return;\n }\n var stop = instrumentMethod(window, 'fetch', function (call) { return beforeSend(call, observable); }, {\n computeHandlingStack: true,\n }).stop;\n return stop;\n });\n}\nfunction beforeSend(_a, observable) {\n var parameters = _a.parameters, onPostCall = _a.onPostCall, handlingStack = _a.handlingStack;\n var input = parameters[0], init = parameters[1];\n var methodFromParams = init && init.method;\n if (methodFromParams === undefined && input instanceof Request) {\n methodFromParams = input.method;\n }\n var method = methodFromParams !== undefined ? String(methodFromParams).toUpperCase() : 'GET';\n var url = input instanceof Request ? input.url : normalizeUrl(String(input));\n var startClocks = clocksNow();\n var context = {\n state: 'start',\n init: init,\n input: input,\n method: method,\n startClocks: startClocks,\n url: url,\n handlingStack: handlingStack,\n };\n observable.notify(context);\n // Those properties can be changed by observable subscribers\n parameters[0] = context.input;\n parameters[1] = context.init;\n onPostCall(function (responsePromise) { return afterSend(observable, responsePromise, context); });\n}\nfunction afterSend(observable, responsePromise, startContext) {\n var reportFetch = function (response) {\n var context = startContext;\n context.state = 'resolve';\n if ('stack' in response || response instanceof Error) {\n context.status = 0;\n context.isAborted = response instanceof DOMException && response.code === DOMException.ABORT_ERR;\n context.error = response;\n }\n else if ('status' in response) {\n context.response = response;\n context.responseType = response.type;\n context.status = response.status;\n context.isAborted = false;\n }\n observable.notify(context);\n };\n responsePromise.then(monitor(reportFetch), monitor(reportFetch));\n}\n//# sourceMappingURL=fetchObservable.js.map","import { flattenErrorCauses, tryToGetFingerprint } from '../error/error';\nimport { mergeObservables, Observable } from '../../tools/observable';\nimport { ConsoleApiName, globalConsole } from '../../tools/display';\nimport { callMonitored } from '../../tools/monitor';\nimport { sanitize } from '../../tools/serialisation/sanitize';\nimport { find } from '../../tools/utils/polyfills';\nimport { jsonStringify } from '../../tools/serialisation/jsonStringify';\nimport { computeStackTrace } from '../../tools/stackTrace/computeStackTrace';\nimport { createHandlingStack, toStackTraceString, formatErrorMessage } from '../../tools/stackTrace/handlingStack';\nvar consoleObservablesByApi = {};\nexport function initConsoleObservable(apis) {\n var consoleObservables = apis.map(function (api) {\n if (!consoleObservablesByApi[api]) {\n consoleObservablesByApi[api] = createConsoleObservable(api);\n }\n return consoleObservablesByApi[api];\n });\n return mergeObservables.apply(void 0, consoleObservables);\n}\nexport function resetConsoleObservable() {\n consoleObservablesByApi = {};\n}\nfunction createConsoleObservable(api) {\n return new Observable(function (observable) {\n var originalConsoleApi = globalConsole[api];\n globalConsole[api] = function () {\n var params = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n params[_i] = arguments[_i];\n }\n originalConsoleApi.apply(console, params);\n var handlingStack = createHandlingStack();\n callMonitored(function () {\n observable.notify(buildConsoleLog(params, api, handlingStack));\n });\n };\n return function () {\n globalConsole[api] = originalConsoleApi;\n };\n });\n}\nfunction buildConsoleLog(params, api, handlingStack) {\n var message = params.map(function (param) { return formatConsoleParameters(param); }).join(' ');\n var stack;\n var fingerprint;\n var causes;\n if (api === ConsoleApiName.error) {\n var firstErrorParam = find(params, function (param) { return param instanceof Error; });\n stack = firstErrorParam ? toStackTraceString(computeStackTrace(firstErrorParam)) : undefined;\n fingerprint = tryToGetFingerprint(firstErrorParam);\n causes = firstErrorParam ? flattenErrorCauses(firstErrorParam, 'console') : undefined;\n }\n return {\n api: api,\n message: message,\n stack: stack,\n handlingStack: handlingStack,\n fingerprint: fingerprint,\n causes: causes,\n };\n}\nfunction formatConsoleParameters(param) {\n if (typeof param === 'string') {\n return sanitize(param);\n }\n if (param instanceof Error) {\n return formatErrorMessage(computeStackTrace(param));\n }\n return jsonStringify(sanitize(param), undefined, 2);\n}\n//# sourceMappingURL=consoleObservable.js.map","import { deepClone } from '../../tools/mergeInto';\nimport { getType } from '../../tools/utils/typeUtils';\nimport { sanitize } from '../../tools/serialisation/sanitize';\nimport { Observable } from '../../tools/observable';\nexport function createContextManager(customerDataTracker) {\n var context = {};\n var changeObservable = new Observable();\n var contextManager = {\n getContext: function () { return deepClone(context); },\n setContext: function (newContext) {\n if (getType(newContext) === 'object') {\n context = sanitize(newContext);\n customerDataTracker.updateCustomerData(context);\n }\n else {\n contextManager.clearContext();\n }\n changeObservable.notify();\n },\n setContextProperty: function (key, property) {\n context[key] = sanitize(property);\n customerDataTracker.updateCustomerData(context);\n changeObservable.notify();\n },\n removeContextProperty: function (key) {\n delete context[key];\n customerDataTracker.updateCustomerData(context);\n changeObservable.notify();\n },\n clearContext: function () {\n context = {};\n customerDataTracker.resetCustomerData();\n changeObservable.notify();\n },\n changeObservable: changeObservable,\n };\n return contextManager;\n}\n//# sourceMappingURL=contextManager.js.map","import { addEventListener, DOM_EVENT } from '../../browser/addEventListener';\nimport { combine } from '../../tools/mergeInto';\nvar CONTEXT_STORE_KEY_PREFIX = '_dd_c';\nvar storageListeners = [];\nexport function storeContextManager(configuration, contextManager, productKey, customerDataType) {\n var storageKey = buildStorageKey(productKey, customerDataType);\n storageListeners.push(addEventListener(configuration, window, DOM_EVENT.STORAGE, function (_a) {\n var key = _a.key;\n if (storageKey === key) {\n synchronizeWithStorage();\n }\n }));\n contextManager.changeObservable.subscribe(dumpToStorage);\n contextManager.setContext(combine(getFromStorage(), contextManager.getContext()));\n function synchronizeWithStorage() {\n contextManager.setContext(getFromStorage());\n }\n function dumpToStorage() {\n localStorage.setItem(storageKey, JSON.stringify(contextManager.getContext()));\n }\n function getFromStorage() {\n var rawContext = localStorage.getItem(storageKey);\n return rawContext !== null ? JSON.parse(rawContext) : {};\n }\n}\nexport function buildStorageKey(productKey, customerDataType) {\n return \"\".concat(CONTEXT_STORE_KEY_PREFIX, \"_\").concat(productKey, \"_\").concat(customerDataType);\n}\nexport function removeStorageListeners() {\n storageListeners.map(function (listener) { return listener.stop(); });\n}\n//# sourceMappingURL=storeContextManager.js.map","import { ONE_KIBI_BYTE, computeBytesCount } from '../../tools/utils/byteUtils';\nimport { throttle } from '../../tools/utils/functionUtils';\nimport { jsonStringify } from '../../tools/serialisation/jsonStringify';\nimport { DOCS_ORIGIN, display } from '../../tools/display';\nimport { isEmptyObject } from '../../tools/utils/objectUtils';\n// RUM and logs batch bytes limit is 16KB\n// ensure that we leave room for other event attributes and maintain a decent amount of event per batch\n// (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB\nexport var CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE;\n// We observed that the compression ratio is around 8 in general, but we also want to keep a margin\n// because some data might not be compressed (ex: last view update on page exit). We chose 16KiB\n// because it is also the limit of the 'batchBytesCount' that we use for RUM and Logs data, but this\n// is a bit arbitrary.\nexport var CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT = 16 * ONE_KIBI_BYTE;\nexport var BYTES_COMPUTATION_THROTTLING_DELAY = 200;\nexport function createCustomerDataTrackerManager(compressionStatus) {\n if (compressionStatus === void 0) { compressionStatus = 2 /* CustomerDataCompressionStatus.Disabled */; }\n var customerDataTrackers = new Map();\n var alreadyWarned = false;\n function checkCustomerDataLimit(initialBytesCount) {\n if (initialBytesCount === void 0) { initialBytesCount = 0; }\n if (alreadyWarned || compressionStatus === 0 /* CustomerDataCompressionStatus.Unknown */) {\n return;\n }\n var bytesCountLimit = compressionStatus === 2 /* CustomerDataCompressionStatus.Disabled */\n ? CUSTOMER_DATA_BYTES_LIMIT\n : CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT;\n var bytesCount = initialBytesCount;\n customerDataTrackers.forEach(function (tracker) {\n bytesCount += tracker.getBytesCount();\n });\n if (bytesCount > bytesCountLimit) {\n displayCustomerDataLimitReachedWarning(bytesCountLimit);\n alreadyWarned = true;\n }\n }\n return {\n /**\n * Creates a detached tracker. The manager will not store a reference to that tracker, and the\n * bytes count will be counted independently from other detached trackers.\n *\n * This is particularly useful when we don't know when the tracker will be unused, so we don't\n * leak memory (ex: when used in Logger instances).\n */\n createDetachedTracker: function () {\n var tracker = createCustomerDataTracker(function () { return checkCustomerDataLimit(tracker.getBytesCount()); });\n return tracker;\n },\n /**\n * Creates a tracker if it doesn't exist, and returns it.\n */\n getOrCreateTracker: function (type) {\n if (!customerDataTrackers.has(type)) {\n customerDataTrackers.set(type, createCustomerDataTracker(checkCustomerDataLimit));\n }\n return customerDataTrackers.get(type);\n },\n setCompressionStatus: function (newCompressionStatus) {\n if (compressionStatus === 0 /* CustomerDataCompressionStatus.Unknown */) {\n compressionStatus = newCompressionStatus;\n checkCustomerDataLimit();\n }\n },\n getCompressionStatus: function () { return compressionStatus; },\n stop: function () {\n customerDataTrackers.forEach(function (tracker) { return tracker.stop(); });\n customerDataTrackers.clear();\n },\n };\n}\nexport function createCustomerDataTracker(checkCustomerDataLimit) {\n var bytesCountCache = 0;\n // Throttle the bytes computation to minimize the impact on performance.\n // Especially useful if the user call context APIs synchronously multiple times in a row\n var _a = throttle(function (context) {\n bytesCountCache = computeBytesCount(jsonStringify(context));\n checkCustomerDataLimit();\n }, BYTES_COMPUTATION_THROTTLING_DELAY), computeBytesCountThrottled = _a.throttled, cancelComputeBytesCount = _a.cancel;\n var resetBytesCount = function () {\n cancelComputeBytesCount();\n bytesCountCache = 0;\n };\n return {\n updateCustomerData: function (context) {\n if (isEmptyObject(context)) {\n resetBytesCount();\n }\n else {\n computeBytesCountThrottled(context);\n }\n },\n resetCustomerData: resetBytesCount,\n getBytesCount: function () { return bytesCountCache; },\n stop: function () {\n cancelComputeBytesCount();\n },\n };\n}\nfunction displayCustomerDataLimitReachedWarning(bytesCountLimit) {\n display.warn(\"Customer data exceeds the recommended \".concat(bytesCountLimit / ONE_KIBI_BYTE, \"KiB threshold. More details: \").concat(DOCS_ORIGIN, \"/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-threshold-warning\"));\n}\n//# sourceMappingURL=customerDataTracker.js.map","import { monitor } from './monitor';\nimport { noop } from './utils/functionUtils';\n/**\n * Read bytes from a ReadableStream until at least `limit` bytes have been read (or until the end of\n * the stream). The callback is invoked with the at most `limit` bytes, and indicates that the limit\n * has been exceeded if more bytes were available.\n */\nexport function readBytesFromStream(stream, callback, options) {\n var reader = stream.getReader();\n var chunks = [];\n var readBytesCount = 0;\n readMore();\n function readMore() {\n reader.read().then(monitor(function (result) {\n if (result.done) {\n onDone();\n return;\n }\n if (options.collectStreamBody) {\n chunks.push(result.value);\n }\n readBytesCount += result.value.length;\n if (readBytesCount > options.bytesLimit) {\n onDone();\n }\n else {\n readMore();\n }\n }), monitor(function (error) { return callback(error); }));\n }\n function onDone() {\n reader.cancel().catch(\n // we don't care if cancel fails, but we still need to catch the error to avoid reporting it\n // as an unhandled rejection\n noop);\n var bytes;\n var limitExceeded;\n if (options.collectStreamBody) {\n var completeBuffer_1;\n if (chunks.length === 1) {\n // optimization: if the response is small enough to fit in a single buffer (provided by the browser), just\n // use it directly.\n completeBuffer_1 = chunks[0];\n }\n else {\n // else, we need to copy buffers into a larger buffer to concatenate them.\n completeBuffer_1 = new Uint8Array(readBytesCount);\n var offset_1 = 0;\n chunks.forEach(function (chunk) {\n completeBuffer_1.set(chunk, offset_1);\n offset_1 += chunk.length;\n });\n }\n bytes = completeBuffer_1.slice(0, options.bytesLimit);\n limitExceeded = completeBuffer_1.length > options.bytesLimit;\n }\n callback(undefined, bytes, limitExceeded);\n }\n}\n//# sourceMappingURL=readBytesFromStream.js.map","import { getInitCookie } from '../../browser/cookie';\nexport var SYNTHETICS_TEST_ID_COOKIE_NAME = 'datadog-synthetics-public-id';\nexport var SYNTHETICS_RESULT_ID_COOKIE_NAME = 'datadog-synthetics-result-id';\nexport var SYNTHETICS_INJECTS_RUM_COOKIE_NAME = 'datadog-synthetics-injects-rum';\nexport function willSyntheticsInjectRum() {\n return Boolean(window._DATADOG_SYNTHETICS_INJECTS_RUM || getInitCookie(SYNTHETICS_INJECTS_RUM_COOKIE_NAME));\n}\nexport function getSyntheticsTestId() {\n var value = window._DATADOG_SYNTHETICS_PUBLIC_ID || getInitCookie(SYNTHETICS_TEST_ID_COOKIE_NAME);\n return typeof value === 'string' ? value : undefined;\n}\nexport function getSyntheticsResultId() {\n var value = window._DATADOG_SYNTHETICS_RESULT_ID || getInitCookie(SYNTHETICS_RESULT_ID_COOKIE_NAME);\n return typeof value === 'string' ? value : undefined;\n}\n//# sourceMappingURL=syntheticsWorkerValues.js.map","import { display } from '../../tools/display';\nimport { getType } from '../../tools/utils/typeUtils';\nimport { assign } from '../../tools/utils/polyfills';\n/**\n * Clone input data and ensure known user properties (id, name, email)\n * are strings, as defined here:\n * https://docs.datadoghq.com/logs/log_configuration/attributes_naming_convention/#user-related-attributes\n */\nexport function sanitizeUser(newUser) {\n // We shallow clone only to prevent mutation of user data.\n var user = assign({}, newUser);\n var keys = ['id', 'name', 'email'];\n keys.forEach(function (key) {\n if (key in user) {\n user[key] = String(user[key]);\n }\n });\n return user;\n}\n/**\n * Simple check to ensure user is valid\n */\nexport function checkUser(newUser) {\n var isValid = getType(newUser) === 'object';\n if (!isValid) {\n display.error('Unsupported user:', newUser);\n }\n return isValid;\n}\n//# sourceMappingURL=user.js.map","import { startsWith } from './utils/polyfills';\nimport { display } from './display';\nimport { getType } from './utils/typeUtils';\nexport function isMatchOption(item) {\n var itemType = getType(item);\n return itemType === 'string' || itemType === 'function' || item instanceof RegExp;\n}\n/**\n * Returns true if value can be matched by at least one of the provided MatchOptions.\n * When comparing strings, setting useStartsWith to true will compare the value with the start of\n * the option, instead of requiring an exact match.\n */\nexport function matchList(list, value, useStartsWith) {\n if (useStartsWith === void 0) { useStartsWith = false; }\n return list.some(function (item) {\n try {\n if (typeof item === 'function') {\n return item(value);\n }\n else if (item instanceof RegExp) {\n return item.test(value);\n }\n else if (typeof item === 'string') {\n return useStartsWith ? startsWith(value, item) : item === value;\n }\n }\n catch (e) {\n display.error(e);\n }\n return false;\n });\n}\n//# sourceMappingURL=matchOption.js.map","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { clocksNow, computeRawError, computeStackTrace, combine, createContextManager, ErrorSource, monitored, sanitize, } from '@datadog/browser-core';\nexport var StatusType = {\n debug: 'debug',\n error: 'error',\n info: 'info',\n warn: 'warn',\n};\nexport var HandlerType = {\n console: 'console',\n http: 'http',\n silent: 'silent',\n};\nexport var STATUSES = Object.keys(StatusType);\nvar Logger = /** @class */ (function () {\n function Logger(handleLogStrategy, customerDataTracker, name, handlerType, level, loggerContext) {\n if (handlerType === void 0) { handlerType = HandlerType.http; }\n if (level === void 0) { level = StatusType.debug; }\n if (loggerContext === void 0) { loggerContext = {}; }\n this.handleLogStrategy = handleLogStrategy;\n this.handlerType = handlerType;\n this.level = level;\n this.contextManager = createContextManager(customerDataTracker);\n this.contextManager.setContext(loggerContext);\n if (name) {\n this.contextManager.setContextProperty('logger', { name: name });\n }\n }\n Logger.prototype.log = function (message, messageContext, status, error) {\n if (status === void 0) { status = StatusType.info; }\n var errorContext;\n if (error !== undefined && error !== null) {\n var stackTrace = error instanceof Error ? computeStackTrace(error) : undefined;\n var rawError = computeRawError({\n stackTrace: stackTrace,\n originalError: error,\n nonErrorPrefix: \"Provided\" /* NonErrorPrefix.PROVIDED */,\n source: ErrorSource.LOGGER,\n handling: \"handled\" /* ErrorHandling.HANDLED */,\n startClocks: clocksNow(),\n });\n errorContext = {\n stack: rawError.stack,\n kind: rawError.type,\n message: rawError.message,\n causes: rawError.causes,\n };\n }\n var sanitizedMessageContext = sanitize(messageContext);\n var context = errorContext\n ? combine({ error: errorContext }, sanitizedMessageContext)\n : sanitizedMessageContext;\n this.handleLogStrategy({\n message: sanitize(message),\n context: context,\n status: status,\n }, this);\n };\n Logger.prototype.debug = function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.debug, error);\n };\n Logger.prototype.info = function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.info, error);\n };\n Logger.prototype.warn = function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.warn, error);\n };\n Logger.prototype.error = function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.error, error);\n };\n Logger.prototype.setContext = function (context) {\n this.contextManager.setContext(context);\n };\n Logger.prototype.getContext = function () {\n return this.contextManager.getContext();\n };\n Logger.prototype.setContextProperty = function (key, value) {\n this.contextManager.setContextProperty(key, value);\n };\n Logger.prototype.removeContextProperty = function (key) {\n this.contextManager.removeContextProperty(key);\n };\n Logger.prototype.clearContext = function () {\n this.contextManager.clearContext();\n };\n Logger.prototype.setHandler = function (handler) {\n this.handlerType = handler;\n };\n Logger.prototype.getHandler = function () {\n return this.handlerType;\n };\n Logger.prototype.setLevel = function (level) {\n this.level = level;\n };\n Logger.prototype.getLevel = function () {\n return this.level;\n };\n __decorate([\n monitored\n ], Logger.prototype, \"log\", null);\n return Logger;\n}());\nexport { Logger };\n//# sourceMappingURL=logger.js.map","export function buildCommonContext(globalContextManager, userContextManager) {\n return {\n view: {\n referrer: document.referrer,\n url: window.location.href,\n },\n context: globalContextManager.getContext(),\n user: userContextManager.getContext(),\n };\n}\n//# sourceMappingURL=commonContext.js.map","import { serializeConfiguration, assign, ONE_KIBI_BYTE, validateAndBuildConfiguration, display, removeDuplicates, ConsoleApiName, RawReportType, includes, objectValues, } from '@datadog/browser-core';\n/**\n * arbitrary value, byte precision not needed\n */\nexport var DEFAULT_REQUEST_ERROR_RESPONSE_LENGTH_LIMIT = 32 * ONE_KIBI_BYTE;\nexport function validateAndBuildLogsConfiguration(initConfiguration) {\n if (initConfiguration.usePciIntake === true && initConfiguration.site && initConfiguration.site !== 'datadoghq.com') {\n display.warn('PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.');\n }\n var baseConfiguration = validateAndBuildConfiguration(initConfiguration);\n var forwardConsoleLogs = validateAndBuildForwardOption(initConfiguration.forwardConsoleLogs, objectValues(ConsoleApiName), 'Forward Console Logs');\n var forwardReports = validateAndBuildForwardOption(initConfiguration.forwardReports, objectValues(RawReportType), 'Forward Reports');\n if (!baseConfiguration || !forwardConsoleLogs || !forwardReports) {\n return;\n }\n if (initConfiguration.forwardErrorsToLogs && !includes(forwardConsoleLogs, ConsoleApiName.error)) {\n forwardConsoleLogs.push(ConsoleApiName.error);\n }\n return assign({\n forwardErrorsToLogs: initConfiguration.forwardErrorsToLogs !== false,\n forwardConsoleLogs: forwardConsoleLogs,\n forwardReports: forwardReports,\n requestErrorResponseLengthLimit: DEFAULT_REQUEST_ERROR_RESPONSE_LENGTH_LIMIT,\n sendLogsAfterSessionExpiration: !!initConfiguration.sendLogsAfterSessionExpiration,\n }, baseConfiguration);\n}\nexport function validateAndBuildForwardOption(option, allowedValues, label) {\n if (option === undefined) {\n return [];\n }\n if (!(option === 'all' || (Array.isArray(option) && option.every(function (api) { return includes(allowedValues, api); })))) {\n display.error(\"\".concat(label, \" should be \\\"all\\\" or an array with allowed values \\\"\").concat(allowedValues.join('\", \"'), \"\\\"\"));\n return;\n }\n return option === 'all' ? allowedValues : removeDuplicates(option);\n}\nexport function serializeLogsConfiguration(configuration) {\n var baseSerializedInitConfiguration = serializeConfiguration(configuration);\n return assign({\n forward_errors_to_logs: configuration.forwardErrorsToLogs,\n forward_console_logs: configuration.forwardConsoleLogs,\n forward_reports: configuration.forwardReports,\n use_pci_intake: configuration.usePciIntake,\n send_logs_after_session_expiration: configuration.sendLogsAfterSessionExpiration,\n }, baseSerializedInitConfiguration);\n}\n//# sourceMappingURL=configuration.js.map","import { BoundedBuffer, assign, canUseEventBridge, display, displayAlreadyInitializedError, noop, timeStampNow, } from '@datadog/browser-core';\nimport { validateAndBuildLogsConfiguration, } from '../domain/configuration';\nexport function createPreStartStrategy(getCommonContext, trackingConsentState, doStartLogs) {\n var bufferApiCalls = new BoundedBuffer();\n var cachedInitConfiguration;\n var cachedConfiguration;\n var trackingConsentStateSubscription = trackingConsentState.observable.subscribe(tryStartLogs);\n function tryStartLogs() {\n if (!cachedConfiguration || !cachedInitConfiguration || !trackingConsentState.isGranted()) {\n return;\n }\n trackingConsentStateSubscription.unsubscribe();\n var startLogsResult = doStartLogs(cachedInitConfiguration, cachedConfiguration);\n bufferApiCalls.drain(startLogsResult);\n }\n return {\n init: function (initConfiguration) {\n if (!initConfiguration) {\n display.error('Missing configuration');\n return;\n }\n if (canUseEventBridge()) {\n initConfiguration = overrideInitConfigurationForBridge(initConfiguration);\n }\n // Expose the initial configuration regardless of initialization success.\n cachedInitConfiguration = initConfiguration;\n if (cachedConfiguration) {\n displayAlreadyInitializedError('DD_LOGS', initConfiguration);\n return;\n }\n var configuration = validateAndBuildLogsConfiguration(initConfiguration);\n if (!configuration) {\n return;\n }\n cachedConfiguration = configuration;\n trackingConsentState.tryToInit(configuration.trackingConsent);\n tryStartLogs();\n },\n get initConfiguration() {\n return cachedInitConfiguration;\n },\n getInternalContext: noop,\n handleLog: function (message, statusType, context, date) {\n if (context === void 0) { context = getCommonContext(); }\n if (date === void 0) { date = timeStampNow(); }\n bufferApiCalls.add(function (startLogsResult) { return startLogsResult.handleLog(message, statusType, context, date); });\n },\n };\n}\nfunction overrideInitConfigurationForBridge(initConfiguration) {\n return assign({}, initConfiguration, { clientToken: 'empty' });\n}\n//# sourceMappingURL=preStartLogs.js.map","import { addTelemetryUsage, assign, createContextManager, makePublicApi, monitor, checkUser, sanitizeUser, sanitize, createCustomerDataTrackerManager, storeContextManager, displayAlreadyInitializedError, deepClone, createTrackingConsentState, } from '@datadog/browser-core';\nimport { Logger } from '../domain/logger';\nimport { buildCommonContext } from '../domain/contexts/commonContext';\nimport { createPreStartStrategy } from './preStartLogs';\nvar LOGS_STORAGE_KEY = 'logs';\nexport function makeLogsPublicApi(startLogsImpl) {\n var customerDataTrackerManager = createCustomerDataTrackerManager();\n var globalContextManager = createContextManager(customerDataTrackerManager.getOrCreateTracker(2 /* CustomerDataType.GlobalContext */));\n var userContextManager = createContextManager(customerDataTrackerManager.getOrCreateTracker(1 /* CustomerDataType.User */));\n var trackingConsentState = createTrackingConsentState();\n function getCommonContext() {\n return buildCommonContext(globalContextManager, userContextManager);\n }\n var strategy = createPreStartStrategy(getCommonContext, trackingConsentState, function (initConfiguration, configuration) {\n if (initConfiguration.storeContextsAcrossPages) {\n storeContextManager(configuration, globalContextManager, LOGS_STORAGE_KEY, 2 /* CustomerDataType.GlobalContext */);\n storeContextManager(configuration, userContextManager, LOGS_STORAGE_KEY, 1 /* CustomerDataType.User */);\n }\n var startLogsResult = startLogsImpl(initConfiguration, configuration, getCommonContext, trackingConsentState);\n strategy = createPostStartStrategy(initConfiguration, startLogsResult);\n return startLogsResult;\n });\n var customLoggers = {};\n var mainLogger = new Logger(function () {\n var params = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n params[_i] = arguments[_i];\n }\n return strategy.handleLog.apply(strategy, params);\n }, customerDataTrackerManager.createDetachedTracker());\n return makePublicApi({\n logger: mainLogger,\n init: monitor(function (initConfiguration) { return strategy.init(initConfiguration); }),\n setTrackingConsent: monitor(function (trackingConsent) {\n trackingConsentState.update(trackingConsent);\n addTelemetryUsage({ feature: 'set-tracking-consent', tracking_consent: trackingConsent });\n }),\n getGlobalContext: monitor(function () { return globalContextManager.getContext(); }),\n setGlobalContext: monitor(function (context) { return globalContextManager.setContext(context); }),\n setGlobalContextProperty: monitor(function (key, value) { return globalContextManager.setContextProperty(key, value); }),\n removeGlobalContextProperty: monitor(function (key) { return globalContextManager.removeContextProperty(key); }),\n clearGlobalContext: monitor(function () { return globalContextManager.clearContext(); }),\n createLogger: monitor(function (name, conf) {\n if (conf === void 0) { conf = {}; }\n customLoggers[name] = new Logger(function () {\n var params = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n params[_i] = arguments[_i];\n }\n return strategy.handleLog.apply(strategy, params);\n }, customerDataTrackerManager.createDetachedTracker(), sanitize(name), conf.handler, conf.level, sanitize(conf.context));\n return customLoggers[name];\n }),\n getLogger: monitor(function (name) { return customLoggers[name]; }),\n getInitConfiguration: monitor(function () { return deepClone(strategy.initConfiguration); }),\n getInternalContext: monitor(function (startTime) { return strategy.getInternalContext(startTime); }),\n setUser: monitor(function (newUser) {\n if (checkUser(newUser)) {\n userContextManager.setContext(sanitizeUser(newUser));\n }\n }),\n getUser: monitor(function () { return userContextManager.getContext(); }),\n setUserProperty: monitor(function (key, property) {\n var _a;\n var sanitizedProperty = sanitizeUser((_a = {}, _a[key] = property, _a))[key];\n userContextManager.setContextProperty(key, sanitizedProperty);\n }),\n removeUserProperty: monitor(function (key) { return userContextManager.removeContextProperty(key); }),\n clearUser: monitor(function () { return userContextManager.clearContext(); }),\n });\n}\nfunction createPostStartStrategy(initConfiguration, startLogsResult) {\n return assign({\n init: function (initConfiguration) {\n displayAlreadyInitializedError('DD_LOGS', initConfiguration);\n },\n initConfiguration: initConfiguration,\n }, startLogsResult);\n}\n//# sourceMappingURL=logsPublicApi.js.map","import { Observable, performDraw, startSessionManager } from '@datadog/browser-core';\nexport var LOGS_SESSION_KEY = 'logs';\nexport function startLogsSessionManager(configuration, trackingConsentState) {\n var sessionManager = startSessionManager(configuration, LOGS_SESSION_KEY, function (rawTrackingType) { return computeSessionState(configuration, rawTrackingType); }, trackingConsentState);\n return {\n findTrackedSession: function (startTime, options) {\n if (options === void 0) { options = { returnInactive: false }; }\n var session = sessionManager.findSession(startTime, options);\n return session && session.trackingType === \"1\" /* LoggerTrackingType.TRACKED */\n ? {\n id: session.id,\n }\n : undefined;\n },\n expireObservable: sessionManager.expireObservable,\n };\n}\nexport function startLogsSessionManagerStub(configuration) {\n var isTracked = computeTrackingType(configuration) === \"1\" /* LoggerTrackingType.TRACKED */;\n var session = isTracked ? {} : undefined;\n return {\n findTrackedSession: function () { return session; },\n expireObservable: new Observable(),\n };\n}\nfunction computeTrackingType(configuration) {\n if (!performDraw(configuration.sessionSampleRate)) {\n return \"0\" /* LoggerTrackingType.NOT_TRACKED */;\n }\n return \"1\" /* LoggerTrackingType.TRACKED */;\n}\nfunction computeSessionState(configuration, rawSessionType) {\n var trackingType = hasValidLoggerSession(rawSessionType) ? rawSessionType : computeTrackingType(configuration);\n return {\n trackingType: trackingType,\n isTracked: trackingType === \"1\" /* LoggerTrackingType.TRACKED */,\n };\n}\nfunction hasValidLoggerSession(trackingType) {\n return trackingType === \"0\" /* LoggerTrackingType.NOT_TRACKED */ || trackingType === \"1\" /* LoggerTrackingType.TRACKED */;\n}\n//# sourceMappingURL=logsSessionManager.js.map","import { willSyntheticsInjectRum, addTelemetryDebug, getSyntheticsTestId, getSyntheticsResultId, } from '@datadog/browser-core';\nvar logsSentBeforeRumInjectionTelemetryAdded = false;\nexport function getRUMInternalContext(startTime) {\n var browserWindow = window;\n if (willSyntheticsInjectRum()) {\n var context = getInternalContextFromRumGlobal(browserWindow.DD_RUM_SYNTHETICS);\n if (!context && !logsSentBeforeRumInjectionTelemetryAdded) {\n logsSentBeforeRumInjectionTelemetryAdded = true;\n addTelemetryDebug('Logs sent before RUM is injected by the synthetics worker', {\n testId: getSyntheticsTestId(),\n resultId: getSyntheticsResultId(),\n });\n }\n return context;\n }\n return getInternalContextFromRumGlobal(browserWindow.DD_RUM);\n function getInternalContextFromRumGlobal(rumGlobal) {\n if (rumGlobal && rumGlobal.getInternalContext) {\n return rumGlobal.getInternalContext(startTime);\n }\n }\n}\nexport function resetRUMInternalContext() {\n logsSentBeforeRumInjectionTelemetryAdded = false;\n}\n//# sourceMappingURL=rumInternalContext.js.map","import { ErrorSource, combine, createEventRateLimiter, getRelativeTime, isEmptyObject } from '@datadog/browser-core';\nimport { STATUSES } from './logger';\nimport { getRUMInternalContext } from './contexts/rumInternalContext';\nexport function startLogsAssembly(sessionManager, configuration, lifeCycle, getCommonContext, reportError) {\n var statusWithCustom = STATUSES.concat(['custom']);\n var logRateLimiters = {};\n statusWithCustom.forEach(function (status) {\n logRateLimiters[status] = createEventRateLimiter(status, configuration.eventRateLimiterThreshold, reportError);\n });\n lifeCycle.subscribe(0 /* LifeCycleEventType.RAW_LOG_COLLECTED */, function (_a) {\n var _b, _c;\n var rawLogsEvent = _a.rawLogsEvent, _d = _a.messageContext, messageContext = _d === void 0 ? undefined : _d, _e = _a.savedCommonContext, savedCommonContext = _e === void 0 ? undefined : _e, domainContext = _a.domainContext;\n var startTime = getRelativeTime(rawLogsEvent.date);\n var session = sessionManager.findTrackedSession(startTime);\n if (!session &&\n (!configuration.sendLogsAfterSessionExpiration ||\n !sessionManager.findTrackedSession(startTime, { returnInactive: true }))) {\n return;\n }\n var commonContext = savedCommonContext || getCommonContext();\n var log = combine({\n service: configuration.service,\n session_id: session === null || session === void 0 ? void 0 : session.id,\n // Insert user first to allow overrides from global context\n usr: !isEmptyObject(commonContext.user) ? commonContext.user : undefined,\n view: commonContext.view,\n }, commonContext.context, getRUMInternalContext(startTime), rawLogsEvent, messageContext);\n if (((_b = configuration.beforeSend) === null || _b === void 0 ? void 0 : _b.call(configuration, log, domainContext)) === false ||\n (log.origin !== ErrorSource.AGENT &&\n ((_c = logRateLimiters[log.status]) !== null && _c !== void 0 ? _c : logRateLimiters['custom']).isLimitReached())) {\n return;\n }\n lifeCycle.notify(1 /* LifeCycleEventType.LOG_COLLECTED */, log);\n });\n}\n//# sourceMappingURL=assembly.js.map","var _a;\nimport { timeStampNow, ConsoleApiName, ErrorSource, initConsoleObservable } from '@datadog/browser-core';\nimport { StatusType } from '../logger';\nexport var LogStatusForApi = (_a = {},\n _a[ConsoleApiName.log] = StatusType.info,\n _a[ConsoleApiName.debug] = StatusType.debug,\n _a[ConsoleApiName.info] = StatusType.info,\n _a[ConsoleApiName.warn] = StatusType.warn,\n _a[ConsoleApiName.error] = StatusType.error,\n _a);\nexport function startConsoleCollection(configuration, lifeCycle) {\n var consoleSubscription = initConsoleObservable(configuration.forwardConsoleLogs).subscribe(function (log) {\n lifeCycle.notify(0 /* LifeCycleEventType.RAW_LOG_COLLECTED */, {\n rawLogsEvent: {\n date: timeStampNow(),\n message: log.message,\n origin: ErrorSource.CONSOLE,\n error: log.api === ConsoleApiName.error\n ? {\n stack: log.stack,\n fingerprint: log.fingerprint,\n causes: log.causes,\n }\n : undefined,\n status: LogStatusForApi[log.api],\n },\n });\n });\n return {\n stop: function () {\n consoleSubscription.unsubscribe();\n },\n };\n}\n//# sourceMappingURL=consoleCollection.js.map","var _a;\nimport { timeStampNow, ErrorSource, RawReportType, getFileFromStackTraceString, initReportObservable, } from '@datadog/browser-core';\nimport { StatusType } from '../logger';\nvar LogStatusForReport = (_a = {},\n _a[RawReportType.cspViolation] = StatusType.error,\n _a[RawReportType.intervention] = StatusType.error,\n _a[RawReportType.deprecation] = StatusType.warn,\n _a);\nexport function startReportCollection(configuration, lifeCycle) {\n var reportSubscription = initReportObservable(configuration, configuration.forwardReports).subscribe(function (report) {\n var message = report.message;\n var status = LogStatusForReport[report.type];\n var error;\n if (status === StatusType.error) {\n error = {\n kind: report.subtype,\n stack: report.stack,\n };\n }\n else if (report.stack) {\n message += \" Found in \".concat(getFileFromStackTraceString(report.stack));\n }\n lifeCycle.notify(0 /* LifeCycleEventType.RAW_LOG_COLLECTED */, {\n rawLogsEvent: {\n date: timeStampNow(),\n message: message,\n origin: ErrorSource.REPORT,\n error: error,\n status: status,\n },\n });\n });\n return {\n stop: function () {\n reportSubscription.unsubscribe();\n },\n };\n}\n//# sourceMappingURL=reportCollection.js.map","import { ErrorSource, initXhrObservable, initFetchObservable, computeStackTrace, toStackTraceString, monitor, noop, readBytesFromStream, tryToClone, isServerError, } from '@datadog/browser-core';\nimport { StatusType } from '../logger';\nexport function startNetworkErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop };\n }\n var xhrSubscription = initXhrObservable(configuration).subscribe(function (context) {\n if (context.state === 'complete') {\n handleResponse(\"xhr\" /* RequestType.XHR */, context);\n }\n });\n var fetchSubscription = initFetchObservable().subscribe(function (context) {\n if (context.state === 'resolve') {\n handleResponse(\"fetch\" /* RequestType.FETCH */, context);\n }\n });\n function handleResponse(type, request) {\n if (!configuration.isIntakeUrl(request.url) && (isRejected(request) || isServerError(request.status))) {\n if ('xhr' in request) {\n computeXhrResponseData(request.xhr, configuration, onResponseDataAvailable);\n }\n else if (request.response) {\n computeFetchResponseText(request.response, configuration, onResponseDataAvailable);\n }\n else if (request.error) {\n computeFetchErrorText(request.error, configuration, onResponseDataAvailable);\n }\n }\n function onResponseDataAvailable(responseData) {\n var domainContext = {\n isAborted: request.isAborted,\n };\n lifeCycle.notify(0 /* LifeCycleEventType.RAW_LOG_COLLECTED */, {\n rawLogsEvent: {\n message: \"\".concat(format(type), \" error \").concat(request.method, \" \").concat(request.url),\n date: request.startClocks.timeStamp,\n error: {\n stack: responseData || 'Failed to load',\n },\n http: {\n method: request.method, // Cast resource method because of case mismatch cf issue RUMF-1152\n status_code: request.status,\n url: request.url,\n },\n status: StatusType.error,\n origin: ErrorSource.NETWORK,\n },\n domainContext: domainContext,\n });\n }\n }\n return {\n stop: function () {\n xhrSubscription.unsubscribe();\n fetchSubscription.unsubscribe();\n },\n };\n}\n// TODO: ideally, computeXhrResponseData should always call the callback with a string instead of\n// `unknown`. But to keep backward compatibility, in the case of XHR with a `responseType` different\n// than \"text\", the response data should be whatever `xhr.response` is. This is a bit confusing as\n// Logs event 'stack' is expected to be a string. This should be changed in a future major version\n// as it could be a breaking change.\nexport function computeXhrResponseData(xhr, configuration, callback) {\n if (typeof xhr.response === 'string') {\n callback(truncateResponseText(xhr.response, configuration));\n }\n else {\n callback(xhr.response);\n }\n}\nexport function computeFetchErrorText(error, configuration, callback) {\n callback(truncateResponseText(toStackTraceString(computeStackTrace(error)), configuration));\n}\nexport function computeFetchResponseText(response, configuration, callback) {\n var clonedResponse = tryToClone(response);\n if (!clonedResponse || !clonedResponse.body) {\n // if the clone failed or if the body is null, let's not try to read it.\n callback();\n }\n else if (!window.TextDecoder) {\n // If the browser doesn't support TextDecoder, let's read the whole response then truncate it.\n //\n // This should only be the case on early versions of Edge (before they migrated to Chromium).\n // Even if it could be possible to implement a workaround for the missing TextDecoder API (using\n // a Blob and FileReader), we found another issue preventing us from reading only the first\n // bytes from the response: contrary to other browsers, when reading from the cloned response,\n // if the original response gets canceled, the cloned response is also canceled and we can't\n // know about it. In the following illustration, the promise returned by `reader.read()` may\n // never be fulfilled:\n //\n // fetch('/').then((response) => {\n // const reader = response.clone().body.getReader()\n // readMore()\n // function readMore() {\n // reader.read().then(\n // (result) => {\n // if (result.done) {\n // console.log('done')\n // } else {\n // readMore()\n // }\n // },\n // () => console.log('error')\n // )\n // }\n // response.body.getReader().cancel()\n // })\n clonedResponse.text().then(monitor(function (text) { return callback(truncateResponseText(text, configuration)); }), monitor(function (error) { return callback(\"Unable to retrieve response: \".concat(error)); }));\n }\n else {\n truncateResponseStream(clonedResponse.body, configuration.requestErrorResponseLengthLimit, function (error, responseText) {\n if (error) {\n callback(\"Unable to retrieve response: \".concat(error));\n }\n else {\n callback(responseText);\n }\n });\n }\n}\nfunction isRejected(request) {\n return request.status === 0 && request.responseType !== 'opaque';\n}\nfunction truncateResponseText(responseText, configuration) {\n if (responseText.length > configuration.requestErrorResponseLengthLimit) {\n return \"\".concat(responseText.substring(0, configuration.requestErrorResponseLengthLimit), \"...\");\n }\n return responseText;\n}\nfunction format(type) {\n if (\"xhr\" /* RequestType.XHR */ === type) {\n return 'XHR';\n }\n return 'Fetch';\n}\nfunction truncateResponseStream(stream, bytesLimit, callback) {\n readBytesFromStream(stream, function (error, bytes, limitExceeded) {\n if (error) {\n callback(error);\n }\n else {\n var responseText = new TextDecoder().decode(bytes);\n if (limitExceeded) {\n responseText += '...';\n }\n callback(undefined, responseText);\n }\n }, {\n bytesLimit: bytesLimit,\n collectStreamBody: true,\n });\n}\n//# sourceMappingURL=networkErrorCollection.js.map","import { noop, ErrorSource, trackRuntimeError, Observable } from '@datadog/browser-core';\nimport { StatusType } from '../logger';\nexport function startRuntimeErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop };\n }\n var rawErrorObservable = new Observable();\n var stopRuntimeErrorTracking = trackRuntimeError(rawErrorObservable).stop;\n var rawErrorSubscription = rawErrorObservable.subscribe(function (rawError) {\n lifeCycle.notify(0 /* LifeCycleEventType.RAW_LOG_COLLECTED */, {\n rawLogsEvent: {\n message: rawError.message,\n date: rawError.startClocks.timeStamp,\n error: {\n kind: rawError.type,\n stack: rawError.stack,\n causes: rawError.causes,\n },\n origin: ErrorSource.SOURCE,\n status: StatusType.error,\n },\n });\n });\n return {\n stop: function () {\n stopRuntimeErrorTracking();\n rawErrorSubscription.unsubscribe();\n },\n };\n}\n//# sourceMappingURL=runtimeErrorCollection.js.map","import { AbstractLifeCycle } from '@datadog/browser-core';\nexport var LifeCycle = (AbstractLifeCycle);\n//# sourceMappingURL=lifeCycle.js.map","var _a;\nimport { includes, combine, ErrorSource, timeStampNow, originalConsoleMethods, globalConsole, } from '@datadog/browser-core';\nimport { StatusType, HandlerType } from '../logger';\nexport var STATUS_PRIORITIES = (_a = {},\n _a[StatusType.debug] = 0,\n _a[StatusType.info] = 1,\n _a[StatusType.warn] = 2,\n _a[StatusType.error] = 3,\n _a);\nexport function startLoggerCollection(lifeCycle) {\n function handleLog(logsMessage, logger, savedCommonContext, savedDate) {\n var messageContext = combine(logger.getContext(), logsMessage.context);\n if (isAuthorized(logsMessage.status, HandlerType.console, logger)) {\n displayInConsole(logsMessage, messageContext);\n }\n if (isAuthorized(logsMessage.status, HandlerType.http, logger)) {\n lifeCycle.notify(0 /* LifeCycleEventType.RAW_LOG_COLLECTED */, {\n rawLogsEvent: {\n date: savedDate || timeStampNow(),\n message: logsMessage.message,\n status: logsMessage.status,\n origin: ErrorSource.LOGGER,\n },\n messageContext: messageContext,\n savedCommonContext: savedCommonContext,\n });\n }\n }\n return {\n handleLog: handleLog,\n };\n}\nexport function isAuthorized(status, handlerType, logger) {\n var loggerHandler = logger.getHandler();\n var sanitizedHandlerType = Array.isArray(loggerHandler) ? loggerHandler : [loggerHandler];\n return (STATUS_PRIORITIES[status] >= STATUS_PRIORITIES[logger.getLevel()] && includes(sanitizedHandlerType, handlerType));\n}\nfunction displayInConsole(logsMessage, messageContext) {\n originalConsoleMethods[logsMessage.status].call(globalConsole, logsMessage.message, messageContext);\n}\n//# sourceMappingURL=loggerCollection.js.map","import { createIdentityEncoder, startBatchWithReplica } from '@datadog/browser-core';\nexport function startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable, session) {\n var batch = startBatchWithReplica(configuration, {\n endpoint: configuration.logsEndpointBuilder,\n encoder: createIdentityEncoder(),\n }, configuration.replica && {\n endpoint: configuration.replica.logsEndpointBuilder,\n encoder: createIdentityEncoder(),\n }, reportError, pageExitObservable, session.expireObservable);\n lifeCycle.subscribe(1 /* LifeCycleEventType.LOG_COLLECTED */, function (serverLogsEvent) {\n batch.add(serverLogsEvent);\n });\n return batch;\n}\n//# sourceMappingURL=startLogsBatch.js.map","import { getEventBridge } from '@datadog/browser-core';\nexport function startLogsBridge(lifeCycle) {\n var bridge = getEventBridge();\n lifeCycle.subscribe(1 /* LifeCycleEventType.LOG_COLLECTED */, function (serverLogsEvent) {\n bridge.send('log', serverLogsEvent);\n });\n}\n//# sourceMappingURL=startLogsBridge.js.map","export function startInternalContext(sessionManager) {\n return {\n get: function (startTime) {\n var trackedSession = sessionManager.findTrackedSession(startTime);\n if (trackedSession) {\n return {\n session_id: trackedSession.id,\n };\n }\n },\n };\n}\n//# sourceMappingURL=internalContext.js.map","import { ErrorSource, addTelemetryDebug } from '@datadog/browser-core';\nimport { StatusType } from './logger';\nexport function startReportError(lifeCycle) {\n return function (error) {\n lifeCycle.notify(0 /* LifeCycleEventType.RAW_LOG_COLLECTED */, {\n rawLogsEvent: {\n message: error.message,\n date: error.startClocks.timeStamp,\n origin: ErrorSource.AGENT,\n status: StatusType.error,\n },\n });\n addTelemetryDebug('Error reported to customer', { 'error.message': error.message });\n };\n}\n//# sourceMappingURL=reportError.js.map","import { startTelemetry, canUseEventBridge, getEventBridge, startBatchWithReplica, createIdentityEncoder, isTelemetryReplicationAllowed, addTelemetryConfiguration, drainPreStartTelemetry, } from '@datadog/browser-core';\nimport { getRUMInternalContext } from './contexts/rumInternalContext';\nimport { serializeLogsConfiguration } from './configuration';\nexport function startLogsTelemetry(initConfiguration, configuration, reportError, pageExitObservable, session) {\n var telemetry = startTelemetry(\"browser-logs-sdk\" /* TelemetryService.LOGS */, configuration);\n telemetry.setContextProvider(function () {\n var _a, _b, _c, _d, _e, _f;\n return ({\n application: {\n id: (_a = getRUMInternalContext()) === null || _a === void 0 ? void 0 : _a.application_id,\n },\n session: {\n id: (_b = session.findTrackedSession()) === null || _b === void 0 ? void 0 : _b.id,\n },\n view: {\n id: (_d = (_c = getRUMInternalContext()) === null || _c === void 0 ? void 0 : _c.view) === null || _d === void 0 ? void 0 : _d.id,\n },\n action: {\n id: (_f = (_e = getRUMInternalContext()) === null || _e === void 0 ? void 0 : _e.user_action) === null || _f === void 0 ? void 0 : _f.id,\n },\n });\n });\n var cleanupTasks = [];\n if (canUseEventBridge()) {\n var bridge_1 = getEventBridge();\n var telemetrySubscription_1 = telemetry.observable.subscribe(function (event) { return bridge_1.send('internal_telemetry', event); });\n cleanupTasks.push(function () { return telemetrySubscription_1.unsubscribe(); });\n }\n else {\n var telemetryBatch_1 = startBatchWithReplica(configuration, {\n endpoint: configuration.rumEndpointBuilder,\n encoder: createIdentityEncoder(),\n }, configuration.replica && {\n endpoint: configuration.replica.rumEndpointBuilder,\n encoder: createIdentityEncoder(),\n }, reportError, pageExitObservable, session.expireObservable);\n cleanupTasks.push(function () { return telemetryBatch_1.stop(); });\n var telemetrySubscription_2 = telemetry.observable.subscribe(function (event) {\n return telemetryBatch_1.add(event, isTelemetryReplicationAllowed(configuration));\n });\n cleanupTasks.push(function () { return telemetrySubscription_2.unsubscribe(); });\n }\n drainPreStartTelemetry();\n addTelemetryConfiguration(serializeLogsConfiguration(initConfiguration));\n return {\n telemetry: telemetry,\n stop: function () {\n cleanupTasks.forEach(function (task) { return task(); });\n },\n };\n}\n//# sourceMappingURL=logsTelemetry.js.map","import { sendToExtension, createPageExitObservable, willSyntheticsInjectRum, canUseEventBridge, } from '@datadog/browser-core';\nimport { startLogsSessionManager, startLogsSessionManagerStub } from '../domain/logsSessionManager';\nimport { startLogsAssembly } from '../domain/assembly';\nimport { startConsoleCollection } from '../domain/console/consoleCollection';\nimport { startReportCollection } from '../domain/report/reportCollection';\nimport { startNetworkErrorCollection } from '../domain/networkError/networkErrorCollection';\nimport { startRuntimeErrorCollection } from '../domain/runtimeError/runtimeErrorCollection';\nimport { LifeCycle } from '../domain/lifeCycle';\nimport { startLoggerCollection } from '../domain/logger/loggerCollection';\nimport { startLogsBatch } from '../transport/startLogsBatch';\nimport { startLogsBridge } from '../transport/startLogsBridge';\nimport { startInternalContext } from '../domain/contexts/internalContext';\nimport { startReportError } from '../domain/reportError';\nimport { startLogsTelemetry } from '../domain/logsTelemetry';\nexport function startLogs(initConfiguration, configuration, getCommonContext, \n// `startLogs` and its subcomponents assume tracking consent is granted initially and starts\n// collecting logs unconditionally. As such, `startLogs` should be called with a\n// `trackingConsentState` set to \"granted\".\ntrackingConsentState) {\n var lifeCycle = new LifeCycle();\n var cleanupTasks = [];\n lifeCycle.subscribe(1 /* LifeCycleEventType.LOG_COLLECTED */, function (log) { return sendToExtension('logs', log); });\n var reportError = startReportError(lifeCycle);\n var pageExitObservable = createPageExitObservable(configuration);\n var session = configuration.sessionStoreStrategyType && !canUseEventBridge() && !willSyntheticsInjectRum()\n ? startLogsSessionManager(configuration, trackingConsentState)\n : startLogsSessionManagerStub(configuration);\n var stopLogsTelemetry = startLogsTelemetry(initConfiguration, configuration, reportError, pageExitObservable, session).stop;\n cleanupTasks.push(function () { return stopLogsTelemetry(); });\n startNetworkErrorCollection(configuration, lifeCycle);\n startRuntimeErrorCollection(configuration, lifeCycle);\n startConsoleCollection(configuration, lifeCycle);\n startReportCollection(configuration, lifeCycle);\n var handleLog = startLoggerCollection(lifeCycle).handleLog;\n startLogsAssembly(session, configuration, lifeCycle, getCommonContext, reportError);\n if (!canUseEventBridge()) {\n var stopLogsBatch_1 = startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable, session).stop;\n cleanupTasks.push(function () { return stopLogsBatch_1(); });\n }\n else {\n startLogsBridge(lifeCycle);\n }\n var internalContext = startInternalContext(session);\n return {\n handleLog: handleLog,\n getInternalContext: internalContext.get,\n stop: function () {\n cleanupTasks.forEach(function (task) { return task(); });\n },\n };\n}\n//# sourceMappingURL=startLogs.js.map","import { defineGlobal, getGlobalObject } from '@datadog/browser-core';\nimport { makeLogsPublicApi } from '../boot/logsPublicApi';\nimport { startLogs } from '../boot/startLogs';\nexport { Logger, StatusType, HandlerType } from '../domain/logger';\nexport var datadogLogs = makeLogsPublicApi(startLogs);\ndefineGlobal(getGlobalObject(), 'DD_LOGS', datadogLogs);\n//# sourceMappingURL=main.js.map","export function buildCommonContext(globalContextManager, userContextManager, recorderApi) {\n return {\n context: globalContextManager.getContext(),\n user: userContextManager.getContext(),\n hasReplay: recorderApi.isRecording() ? true : undefined,\n };\n}\n//# sourceMappingURL=commonContext.js.map","import { objectEntries, shallowClone, performDraw, isNumber, assign, find, getType, isMatchOption, matchList, TraceContextInjection, } from '@datadog/browser-core';\nexport function isTracingOption(item) {\n var expectedItem = item;\n return (getType(expectedItem) === 'object' &&\n isMatchOption(expectedItem.match) &&\n Array.isArray(expectedItem.propagatorTypes));\n}\n/**\n * Clear tracing information to avoid incomplete traces. Ideally, we should do it when the\n * request did not reach the server, but the browser does not expose this. So, we clear tracing\n * information if the request ended with status 0 without being aborted by the application.\n *\n * Reasoning:\n *\n * * Applications are usually aborting requests after a bit of time, for example when the user is\n * typing (autocompletion) or navigating away (in a SPA). With a performant device and good\n * network conditions, the request is likely to reach the server before being canceled.\n *\n * * Requests aborted otherwise (ex: lack of internet, CORS issue, blocked by a privacy extension)\n * are likely to finish quickly and without reaching the server.\n *\n * Of course, it might not be the case every time, but it should limit having incomplete traces a\n * bit.\n * */\nexport function clearTracingIfNeeded(context) {\n if (context.status === 0 && !context.isAborted) {\n context.traceId = undefined;\n context.spanId = undefined;\n context.traceSampled = undefined;\n }\n}\nexport function startTracer(configuration, sessionManager) {\n return {\n clearTracingIfNeeded: clearTracingIfNeeded,\n traceFetch: function (context) {\n return injectHeadersIfTracingAllowed(configuration, context, sessionManager, function (tracingHeaders) {\n var _a;\n if (context.input instanceof Request && !((_a = context.init) === null || _a === void 0 ? void 0 : _a.headers)) {\n context.input = new Request(context.input);\n Object.keys(tracingHeaders).forEach(function (key) {\n ;\n context.input.headers.append(key, tracingHeaders[key]);\n });\n }\n else {\n context.init = shallowClone(context.init);\n var headers_1 = [];\n if (context.init.headers instanceof Headers) {\n context.init.headers.forEach(function (value, key) {\n headers_1.push([key, value]);\n });\n }\n else if (Array.isArray(context.init.headers)) {\n context.init.headers.forEach(function (header) {\n headers_1.push(header);\n });\n }\n else if (context.init.headers) {\n Object.keys(context.init.headers).forEach(function (key) {\n headers_1.push([key, context.init.headers[key]]);\n });\n }\n context.init.headers = headers_1.concat(objectEntries(tracingHeaders));\n }\n });\n },\n traceXhr: function (context, xhr) {\n return injectHeadersIfTracingAllowed(configuration, context, sessionManager, function (tracingHeaders) {\n Object.keys(tracingHeaders).forEach(function (name) {\n xhr.setRequestHeader(name, tracingHeaders[name]);\n });\n });\n },\n };\n}\nfunction injectHeadersIfTracingAllowed(configuration, context, sessionManager, inject) {\n if (!isTracingSupported() || !sessionManager.findTrackedSession()) {\n return;\n }\n var tracingOption = find(configuration.allowedTracingUrls, function (tracingOption) {\n return matchList([tracingOption.match], context.url, true);\n });\n if (!tracingOption) {\n return;\n }\n context.traceSampled = !isNumber(configuration.traceSampleRate) || performDraw(configuration.traceSampleRate);\n if (!context.traceSampled && configuration.traceContextInjection !== TraceContextInjection.ALL) {\n return;\n }\n context.traceId = new TraceIdentifier();\n context.spanId = new TraceIdentifier();\n inject(makeTracingHeaders(context.traceId, context.spanId, context.traceSampled, tracingOption.propagatorTypes));\n}\nexport function isTracingSupported() {\n return getCrypto() !== undefined;\n}\nfunction getCrypto() {\n return window.crypto || window.msCrypto;\n}\n/**\n * When trace is not sampled, set priority to '0' instead of not adding the tracing headers\n * to prepare the implementation for sampling delegation.\n */\nfunction makeTracingHeaders(traceId, spanId, traceSampled, propagatorTypes) {\n var tracingHeaders = {};\n propagatorTypes.forEach(function (propagatorType) {\n switch (propagatorType) {\n case 'datadog': {\n assign(tracingHeaders, {\n 'x-datadog-origin': 'rum',\n 'x-datadog-parent-id': spanId.toDecimalString(),\n 'x-datadog-sampling-priority': traceSampled ? '1' : '0',\n 'x-datadog-trace-id': traceId.toDecimalString(),\n });\n break;\n }\n // https://www.w3.org/TR/trace-context/\n case 'tracecontext': {\n assign(tracingHeaders, {\n traceparent: \"00-0000000000000000\".concat(traceId.toPaddedHexadecimalString(), \"-\").concat(spanId.toPaddedHexadecimalString(), \"-0\").concat(traceSampled ? '1' : '0'),\n });\n break;\n }\n // https://github.com/openzipkin/b3-propagation\n case 'b3': {\n assign(tracingHeaders, {\n b3: \"\".concat(traceId.toPaddedHexadecimalString(), \"-\").concat(spanId.toPaddedHexadecimalString(), \"-\").concat(traceSampled ? '1' : '0'),\n });\n break;\n }\n case 'b3multi': {\n assign(tracingHeaders, {\n 'X-B3-TraceId': traceId.toPaddedHexadecimalString(),\n 'X-B3-SpanId': spanId.toPaddedHexadecimalString(),\n 'X-B3-Sampled': traceSampled ? '1' : '0',\n });\n break;\n }\n }\n });\n return tracingHeaders;\n}\n/* eslint-disable no-bitwise */\nvar TraceIdentifier = /** @class */ (function () {\n function TraceIdentifier() {\n this.buffer = new Uint8Array(8);\n getCrypto().getRandomValues(this.buffer);\n this.buffer[0] = this.buffer[0] & 0x7f; // force 63-bit\n }\n TraceIdentifier.prototype.toString = function (radix) {\n var high = this.readInt32(0);\n var low = this.readInt32(4);\n var str = '';\n do {\n var mod = (high % radix) * 4294967296 + low;\n high = Math.floor(high / radix);\n low = Math.floor(mod / radix);\n str = (mod % radix).toString(radix) + str;\n } while (high || low);\n return str;\n };\n /**\n * Format used everywhere except the trace intake\n */\n TraceIdentifier.prototype.toDecimalString = function () {\n return this.toString(10);\n };\n /**\n * Format used by OTel headers\n */\n TraceIdentifier.prototype.toPaddedHexadecimalString = function () {\n var traceId = this.toString(16);\n return Array(17 - traceId.length).join('0') + traceId;\n };\n TraceIdentifier.prototype.readInt32 = function (offset) {\n return (this.buffer[offset] * 16777216 +\n (this.buffer[offset + 1] << 16) +\n (this.buffer[offset + 2] << 8) +\n this.buffer[offset + 3]);\n };\n return TraceIdentifier;\n}());\nexport { TraceIdentifier };\n/* eslint-enable no-bitwise */\n//# sourceMappingURL=tracer.js.map","import { getType, arrayFrom, isMatchOption, serializeConfiguration, assign, DefaultPrivacyLevel, TraceContextInjection, display, isPercentage, objectHasValue, validateAndBuildConfiguration, } from '@datadog/browser-core';\nimport { isTracingOption } from './tracing/tracer';\nexport var DEFAULT_PROPAGATOR_TYPES = ['tracecontext', 'datadog'];\nexport function validateAndBuildRumConfiguration(initConfiguration) {\n var _a, _b;\n if (!initConfiguration.applicationId) {\n display.error('Application ID is not configured, no RUM data will be collected.');\n return;\n }\n if (initConfiguration.sessionReplaySampleRate !== undefined &&\n !isPercentage(initConfiguration.sessionReplaySampleRate)) {\n display.error('Session Replay Sample Rate should be a number between 0 and 100');\n return;\n }\n if (initConfiguration.traceSampleRate !== undefined && !isPercentage(initConfiguration.traceSampleRate)) {\n display.error('Trace Sample Rate should be a number between 0 and 100');\n return;\n }\n if (initConfiguration.excludedActivityUrls !== undefined && !Array.isArray(initConfiguration.excludedActivityUrls)) {\n display.error('Excluded Activity Urls should be an array');\n return;\n }\n var allowedTracingUrls = validateAndBuildTracingOptions(initConfiguration);\n if (!allowedTracingUrls) {\n return;\n }\n var baseConfiguration = validateAndBuildConfiguration(initConfiguration);\n if (!baseConfiguration) {\n return;\n }\n return assign({\n applicationId: initConfiguration.applicationId,\n version: initConfiguration.version || undefined,\n actionNameAttribute: initConfiguration.actionNameAttribute,\n sessionReplaySampleRate: (_a = initConfiguration.sessionReplaySampleRate) !== null && _a !== void 0 ? _a : 0,\n startSessionReplayRecordingManually: !!initConfiguration.startSessionReplayRecordingManually,\n traceSampleRate: initConfiguration.traceSampleRate,\n allowedTracingUrls: allowedTracingUrls,\n excludedActivityUrls: (_b = initConfiguration.excludedActivityUrls) !== null && _b !== void 0 ? _b : [],\n workerUrl: initConfiguration.workerUrl,\n compressIntakeRequests: !!initConfiguration.compressIntakeRequests,\n trackUserInteractions: !!initConfiguration.trackUserInteractions,\n trackViewsManually: !!initConfiguration.trackViewsManually,\n trackResources: !!initConfiguration.trackResources,\n trackLongTasks: !!initConfiguration.trackLongTasks,\n subdomain: initConfiguration.subdomain,\n defaultPrivacyLevel: objectHasValue(DefaultPrivacyLevel, initConfiguration.defaultPrivacyLevel)\n ? initConfiguration.defaultPrivacyLevel\n : DefaultPrivacyLevel.MASK,\n customerDataTelemetrySampleRate: 1,\n traceContextInjection: objectHasValue(TraceContextInjection, initConfiguration.traceContextInjection)\n ? initConfiguration.traceContextInjection\n : TraceContextInjection.ALL,\n }, baseConfiguration);\n}\n/**\n * Validates allowedTracingUrls and converts match options to tracing options\n */\nfunction validateAndBuildTracingOptions(initConfiguration) {\n if (initConfiguration.allowedTracingUrls !== undefined) {\n if (!Array.isArray(initConfiguration.allowedTracingUrls)) {\n display.error('Allowed Tracing URLs should be an array');\n return;\n }\n if (initConfiguration.allowedTracingUrls.length !== 0 && initConfiguration.service === undefined) {\n display.error('Service needs to be configured when tracing is enabled');\n return;\n }\n // Convert from (MatchOption | TracingOption) to TracingOption, remove unknown properties\n var tracingOptions_1 = [];\n initConfiguration.allowedTracingUrls.forEach(function (option) {\n if (isMatchOption(option)) {\n tracingOptions_1.push({ match: option, propagatorTypes: DEFAULT_PROPAGATOR_TYPES });\n }\n else if (isTracingOption(option)) {\n tracingOptions_1.push(option);\n }\n else {\n display.warn('Allowed Tracing Urls parameters should be a string, RegExp, function, or an object. Ignoring parameter', option);\n }\n });\n return tracingOptions_1;\n }\n return [];\n}\n/**\n * Combines the selected tracing propagators from the different options in allowedTracingUrls\n */\nfunction getSelectedTracingPropagators(configuration) {\n var usedTracingPropagators = new Set();\n if (Array.isArray(configuration.allowedTracingUrls) && configuration.allowedTracingUrls.length > 0) {\n configuration.allowedTracingUrls.forEach(function (option) {\n if (isMatchOption(option)) {\n DEFAULT_PROPAGATOR_TYPES.forEach(function (propagatorType) { return usedTracingPropagators.add(propagatorType); });\n }\n else if (getType(option) === 'object' && Array.isArray(option.propagatorTypes)) {\n // Ensure we have an array, as we cannot rely on types yet (configuration is provided by users)\n option.propagatorTypes.forEach(function (propagatorType) { return usedTracingPropagators.add(propagatorType); });\n }\n });\n }\n return arrayFrom(usedTracingPropagators);\n}\nexport function serializeRumConfiguration(configuration) {\n var baseSerializedConfiguration = serializeConfiguration(configuration);\n return assign({\n session_replay_sample_rate: configuration.sessionReplaySampleRate,\n start_session_replay_recording_manually: configuration.startSessionReplayRecordingManually,\n trace_sample_rate: configuration.traceSampleRate,\n trace_context_injection: configuration.traceContextInjection,\n action_name_attribute: configuration.actionNameAttribute,\n use_allowed_tracing_urls: Array.isArray(configuration.allowedTracingUrls) && configuration.allowedTracingUrls.length > 0,\n selected_tracing_propagators: getSelectedTracingPropagators(configuration),\n default_privacy_level: configuration.defaultPrivacyLevel,\n use_excluded_activity_urls: Array.isArray(configuration.excludedActivityUrls) && configuration.excludedActivityUrls.length > 0,\n use_worker_url: !!configuration.workerUrl,\n compress_intake_requests: configuration.compressIntakeRequests,\n track_views_manually: configuration.trackViewsManually,\n track_user_interactions: configuration.trackUserInteractions,\n track_resources: configuration.trackResources,\n track_long_task: configuration.trackLongTasks,\n }, baseSerializedConfiguration);\n}\n//# sourceMappingURL=configuration.js.map","import { BoundedBuffer, display, canUseEventBridge, displayAlreadyInitializedError, willSyntheticsInjectRum, noop, timeStampNow, clocksNow, assign, getEventBridge, } from '@datadog/browser-core';\nimport { validateAndBuildRumConfiguration, } from '../domain/configuration';\nexport function createPreStartStrategy(_a, getCommonContext, trackingConsentState, doStartRum) {\n var ignoreInitIfSyntheticsWillInjectRum = _a.ignoreInitIfSyntheticsWillInjectRum, startDeflateWorker = _a.startDeflateWorker;\n var bufferApiCalls = new BoundedBuffer();\n var firstStartViewCall;\n var deflateWorker;\n var cachedInitConfiguration;\n var cachedConfiguration;\n var trackingConsentStateSubscription = trackingConsentState.observable.subscribe(tryStartRum);\n function tryStartRum() {\n if (!cachedInitConfiguration || !cachedConfiguration || !trackingConsentState.isGranted()) {\n return;\n }\n trackingConsentStateSubscription.unsubscribe();\n var initialViewOptions;\n if (cachedConfiguration.trackViewsManually) {\n if (!firstStartViewCall) {\n return;\n }\n // An initial view is always created when starting RUM.\n // When tracking views automatically, any startView call before RUM start creates an extra\n // view.\n // When tracking views manually, we use the ViewOptions from the first startView call as the\n // initial view options, and we remove the actual startView call so we don't create an extra\n // view.\n bufferApiCalls.remove(firstStartViewCall.callback);\n initialViewOptions = firstStartViewCall.options;\n }\n var startRumResult = doStartRum(cachedInitConfiguration, cachedConfiguration, deflateWorker, initialViewOptions);\n bufferApiCalls.drain(startRumResult);\n }\n return {\n init: function (initConfiguration) {\n if (!initConfiguration) {\n display.error('Missing configuration');\n return;\n }\n var eventBridgeAvailable = canUseEventBridge();\n if (eventBridgeAvailable) {\n initConfiguration = overrideInitConfigurationForBridge(initConfiguration);\n }\n // Expose the initial configuration regardless of initialization success.\n cachedInitConfiguration = initConfiguration;\n if (cachedConfiguration) {\n displayAlreadyInitializedError('DD_RUM', initConfiguration);\n return;\n }\n // If we are in a Synthetics test configured to automatically inject a RUM instance, we want\n // to completely discard the customer application RUM instance by ignoring their init() call.\n // But, we should not ignore the init() call from the Synthetics-injected RUM instance, so the\n // internal `ignoreInitIfSyntheticsWillInjectRum` option is here to bypass this condition.\n if (ignoreInitIfSyntheticsWillInjectRum && willSyntheticsInjectRum()) {\n return;\n }\n var configuration = validateAndBuildRumConfiguration(initConfiguration);\n if (!configuration) {\n return;\n }\n if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {\n display.warn('No storage available for session. We will not send any data.');\n return;\n }\n if (configuration.compressIntakeRequests && !eventBridgeAvailable && startDeflateWorker) {\n deflateWorker = startDeflateWorker(configuration, 'Datadog RUM', \n // Worker initialization can fail asynchronously, especially in Firefox where even CSP\n // issues are reported asynchronously. For now, the SDK will continue its execution even if\n // data won't be sent to Datadog. We could improve this behavior in the future.\n noop);\n if (!deflateWorker) {\n // `startDeflateWorker` should have logged an error message explaining the issue\n return;\n }\n }\n cachedConfiguration = configuration;\n trackingConsentState.tryToInit(configuration.trackingConsent);\n tryStartRum();\n },\n get initConfiguration() {\n return cachedInitConfiguration;\n },\n getInternalContext: noop,\n stopSession: noop,\n addTiming: function (name, time) {\n if (time === void 0) { time = timeStampNow(); }\n bufferApiCalls.add(function (startRumResult) { return startRumResult.addTiming(name, time); });\n },\n startView: function (options, startClocks) {\n if (startClocks === void 0) { startClocks = clocksNow(); }\n var callback = function (startRumResult) {\n startRumResult.startView(options, startClocks);\n };\n bufferApiCalls.add(callback);\n if (!firstStartViewCall) {\n firstStartViewCall = { options: options, callback: callback };\n tryStartRum();\n }\n },\n addAction: function (action, commonContext) {\n if (commonContext === void 0) { commonContext = getCommonContext(); }\n bufferApiCalls.add(function (startRumResult) { return startRumResult.addAction(action, commonContext); });\n },\n addError: function (providedError, commonContext) {\n if (commonContext === void 0) { commonContext = getCommonContext(); }\n bufferApiCalls.add(function (startRumResult) { return startRumResult.addError(providedError, commonContext); });\n },\n addFeatureFlagEvaluation: function (key, value) {\n bufferApiCalls.add(function (startRumResult) { return startRumResult.addFeatureFlagEvaluation(key, value); });\n },\n startDurationVital: function (vitalStart) {\n bufferApiCalls.add(function (startRumResult) { return startRumResult.startDurationVital(vitalStart); });\n },\n stopDurationVital: function (vitalStart) {\n bufferApiCalls.add(function (startRumResult) { return startRumResult.stopDurationVital(vitalStart); });\n },\n };\n}\nfunction overrideInitConfigurationForBridge(initConfiguration) {\n var _a, _b;\n return assign({}, initConfiguration, {\n applicationId: '00000000-aaaa-0000-aaaa-000000000000',\n clientToken: 'empty',\n sessionSampleRate: 100,\n defaultPrivacyLevel: (_a = initConfiguration.defaultPrivacyLevel) !== null && _a !== void 0 ? _a : (_b = getEventBridge()) === null || _b === void 0 ? void 0 : _b.getPrivacyLevel(),\n });\n}\n//# sourceMappingURL=preStartRum.js.map","import { addTelemetryUsage, timeStampToClocks, isExperimentalFeatureEnabled, ExperimentalFeature, assign, createContextManager, deepClone, makePublicApi, monitor, clocksNow, callMonitored, createHandlingStack, checkUser, sanitizeUser, sanitize, createIdentityEncoder, createCustomerDataTrackerManager, storeContextManager, displayAlreadyInitializedError, createTrackingConsentState, } from '@datadog/browser-core';\nimport { buildCommonContext } from '../domain/contexts/commonContext';\nimport { createPreStartStrategy } from './preStartRum';\nvar RUM_STORAGE_KEY = 'rum';\nexport function makeRumPublicApi(startRumImpl, recorderApi, options) {\n if (options === void 0) { options = {}; }\n var customerDataTrackerManager = createCustomerDataTrackerManager(0 /* CustomerDataCompressionStatus.Unknown */);\n var globalContextManager = createContextManager(customerDataTrackerManager.getOrCreateTracker(2 /* CustomerDataType.GlobalContext */));\n var userContextManager = createContextManager(customerDataTrackerManager.getOrCreateTracker(1 /* CustomerDataType.User */));\n var trackingConsentState = createTrackingConsentState();\n function getCommonContext() {\n return buildCommonContext(globalContextManager, userContextManager, recorderApi);\n }\n var strategy = createPreStartStrategy(options, getCommonContext, trackingConsentState, function (initConfiguration, configuration, deflateWorker, initialViewOptions) {\n if (isExperimentalFeatureEnabled(ExperimentalFeature.CUSTOM_VITALS)) {\n /**\n * Start a custom duration vital\n * stored in @vital.custom.\n *\n * @param name name of the custom vital\n * @param options.context custom context attached to the vital\n * @param options.startTime epoch timestamp of the start of the custom vital (if not set, will use current time)\n */\n ;\n rumPublicApi.startDurationVital = monitor(function (name, options) {\n strategy.startDurationVital({\n name: sanitize(name),\n startClocks: (options === null || options === void 0 ? void 0 : options.startTime) ? timeStampToClocks(options.startTime) : clocksNow(),\n context: sanitize(options === null || options === void 0 ? void 0 : options.context),\n });\n addTelemetryUsage({ feature: 'start-duration-vital' });\n });\n rumPublicApi.stopDurationVital = monitor(function (name, options) {\n strategy.stopDurationVital({\n name: sanitize(name),\n stopClocks: (options === null || options === void 0 ? void 0 : options.stopTime) ? timeStampToClocks(options.stopTime) : clocksNow(),\n context: sanitize(options === null || options === void 0 ? void 0 : options.context),\n });\n });\n }\n if (initConfiguration.storeContextsAcrossPages) {\n storeContextManager(configuration, globalContextManager, RUM_STORAGE_KEY, 2 /* CustomerDataType.GlobalContext */);\n storeContextManager(configuration, userContextManager, RUM_STORAGE_KEY, 1 /* CustomerDataType.User */);\n }\n customerDataTrackerManager.setCompressionStatus(deflateWorker ? 1 /* CustomerDataCompressionStatus.Enabled */ : 2 /* CustomerDataCompressionStatus.Disabled */);\n var startRumResult = startRumImpl(initConfiguration, configuration, recorderApi, customerDataTrackerManager, getCommonContext, initialViewOptions, deflateWorker && options.createDeflateEncoder\n ? function (streamId) { return options.createDeflateEncoder(configuration, deflateWorker, streamId); }\n : createIdentityEncoder, trackingConsentState);\n recorderApi.onRumStart(startRumResult.lifeCycle, configuration, startRumResult.session, startRumResult.viewContexts, deflateWorker);\n strategy = createPostStartStrategy(initConfiguration, startRumResult);\n return startRumResult;\n });\n var startView = monitor(function (options) {\n var sanitizedOptions = typeof options === 'object' ? options : { name: options };\n strategy.startView(sanitizedOptions);\n addTelemetryUsage({ feature: 'start-view' });\n });\n var rumPublicApi = makePublicApi({\n init: monitor(function (initConfiguration) { return strategy.init(initConfiguration); }),\n setTrackingConsent: monitor(function (trackingConsent) {\n trackingConsentState.update(trackingConsent);\n addTelemetryUsage({ feature: 'set-tracking-consent', tracking_consent: trackingConsent });\n }),\n setGlobalContext: monitor(function (context) {\n globalContextManager.setContext(context);\n addTelemetryUsage({ feature: 'set-global-context' });\n }),\n getGlobalContext: monitor(function () { return globalContextManager.getContext(); }),\n setGlobalContextProperty: monitor(function (key, value) {\n globalContextManager.setContextProperty(key, value);\n addTelemetryUsage({ feature: 'set-global-context' });\n }),\n removeGlobalContextProperty: monitor(function (key) { return globalContextManager.removeContextProperty(key); }),\n clearGlobalContext: monitor(function () { return globalContextManager.clearContext(); }),\n getInternalContext: monitor(function (startTime) { return strategy.getInternalContext(startTime); }),\n getInitConfiguration: monitor(function () { return deepClone(strategy.initConfiguration); }),\n addAction: function (name, context) {\n var handlingStack = createHandlingStack();\n callMonitored(function () {\n strategy.addAction({\n name: sanitize(name),\n context: sanitize(context),\n startClocks: clocksNow(),\n type: \"custom\" /* ActionType.CUSTOM */,\n handlingStack: handlingStack,\n });\n addTelemetryUsage({ feature: 'add-action' });\n });\n },\n addError: function (error, context) {\n var handlingStack = createHandlingStack();\n callMonitored(function () {\n strategy.addError({\n error: error, // Do not sanitize error here, it is needed unserialized by computeRawError()\n handlingStack: handlingStack,\n context: sanitize(context),\n startClocks: clocksNow(),\n });\n addTelemetryUsage({ feature: 'add-error' });\n });\n },\n addTiming: monitor(function (name, time) {\n // TODO: next major decide to drop relative time support or update its behaviour\n strategy.addTiming(sanitize(name), time);\n }),\n setUser: monitor(function (newUser) {\n if (checkUser(newUser)) {\n userContextManager.setContext(sanitizeUser(newUser));\n }\n addTelemetryUsage({ feature: 'set-user' });\n }),\n getUser: monitor(function () { return userContextManager.getContext(); }),\n setUserProperty: monitor(function (key, property) {\n var _a;\n var sanitizedProperty = sanitizeUser((_a = {}, _a[key] = property, _a))[key];\n userContextManager.setContextProperty(key, sanitizedProperty);\n addTelemetryUsage({ feature: 'set-user' });\n }),\n removeUserProperty: monitor(function (key) { return userContextManager.removeContextProperty(key); }),\n clearUser: monitor(function () { return userContextManager.clearContext(); }),\n startView: startView,\n stopSession: monitor(function () {\n strategy.stopSession();\n addTelemetryUsage({ feature: 'stop-session' });\n }),\n addFeatureFlagEvaluation: monitor(function (key, value) {\n strategy.addFeatureFlagEvaluation(sanitize(key), sanitize(value));\n addTelemetryUsage({ feature: 'add-feature-flag-evaluation' });\n }),\n getSessionReplayLink: monitor(function () { return recorderApi.getSessionReplayLink(); }),\n startSessionReplayRecording: monitor(function () {\n recorderApi.start();\n addTelemetryUsage({ feature: 'start-session-replay-recording' });\n }),\n stopSessionReplayRecording: monitor(function () { return recorderApi.stop(); }),\n });\n return rumPublicApi;\n}\nfunction createPostStartStrategy(initConfiguration, startRumResult) {\n return assign({\n init: function (initConfiguration) {\n displayAlreadyInitializedError('DD_RUM', initConfiguration);\n },\n initConfiguration: initConfiguration,\n }, startRumResult);\n}\n//# sourceMappingURL=rumPublicApi.js.map","import { monitor, noop, Observable, getZoneJsOriginalValue } from '@datadog/browser-core';\nexport function createDOMMutationObservable() {\n var MutationObserver = getMutationObserverConstructor();\n return new Observable(function (observable) {\n if (!MutationObserver) {\n return;\n }\n var observer = new MutationObserver(monitor(function () { return observable.notify(); }));\n observer.observe(document, {\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n });\n return function () { return observer.disconnect(); };\n });\n}\nexport function getMutationObserverConstructor() {\n var constructor;\n var browserWindow = window;\n // Angular uses Zone.js to provide a context persisting across async tasks. Zone.js replaces the\n // global MutationObserver constructor with a patched version to support the context propagation.\n // There is an ongoing issue[1][2] with this setup when using a MutationObserver within a Angular\n // component: on some occasions, the callback is being called in an infinite loop, causing the\n // page to freeze (even if the callback is completely empty).\n //\n // To work around this issue, we try to get the original MutationObserver constructor stored by\n // Zone.js.\n //\n // [1] https://github.com/angular/angular/issues/26948\n // [2] https://github.com/angular/angular/issues/31712\n if (browserWindow.Zone) {\n // Zone.js 0.8.6+ is storing original class constructors into the browser 'window' object[3].\n //\n // [3] https://github.com/angular/angular/blob/6375fa79875c0fe7b815efc45940a6e6f5c9c9eb/packages/zone.js/lib/common/utils.ts#L288\n constructor = getZoneJsOriginalValue(browserWindow, 'MutationObserver');\n if (browserWindow.MutationObserver && constructor === browserWindow.MutationObserver) {\n // Anterior Zone.js versions (used in Angular 2) does not expose the original MutationObserver\n // in the 'window' object. Luckily, the patched MutationObserver class is storing an original\n // instance in its properties[4]. Let's get the original MutationObserver constructor from\n // there.\n //\n // [4] https://github.com/angular/zone.js/blob/v0.8.5/lib/common/utils.ts#L412\n var patchedInstance = new browserWindow.MutationObserver(noop);\n var originalInstance = getZoneJsOriginalValue(patchedInstance, 'originalInstance');\n constructor = originalInstance && originalInstance.constructor;\n }\n }\n if (!constructor) {\n constructor = browserWindow.MutationObserver;\n }\n return constructor;\n}\n//# sourceMappingURL=domMutationObservable.js.map","import { addTelemetryDebug, elapsed, ExperimentalFeature, getPathName, includes, isExperimentalFeatureEnabled, isValidUrl, toServerDuration, } from '@datadog/browser-core';\nexport var FAKE_INITIAL_DOCUMENT = 'initial_document';\nvar RESOURCE_TYPES = [\n [\"document\" /* ResourceType.DOCUMENT */, function (initiatorType) { return FAKE_INITIAL_DOCUMENT === initiatorType; }],\n [\"xhr\" /* ResourceType.XHR */, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],\n [\"fetch\" /* ResourceType.FETCH */, function (initiatorType) { return 'fetch' === initiatorType; }],\n [\"beacon\" /* ResourceType.BEACON */, function (initiatorType) { return 'beacon' === initiatorType; }],\n [\"css\" /* ResourceType.CSS */, function (_, path) { return /\\.css$/i.test(path); }],\n [\"js\" /* ResourceType.JS */, function (_, path) { return /\\.js$/i.test(path); }],\n [\n \"image\" /* ResourceType.IMAGE */,\n function (initiatorType, path) {\n return includes(['image', 'img', 'icon'], initiatorType) || /\\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i.exec(path) !== null;\n },\n ],\n [\"font\" /* ResourceType.FONT */, function (_, path) { return /\\.(woff|eot|woff2|ttf)$/i.exec(path) !== null; }],\n [\n \"media\" /* ResourceType.MEDIA */,\n function (initiatorType, path) {\n return includes(['audio', 'video'], initiatorType) || /\\.(mp3|mp4)$/i.exec(path) !== null;\n },\n ],\n];\nexport function computeResourceKind(timing) {\n var url = timing.name;\n if (!isValidUrl(url)) {\n addTelemetryDebug(\"Failed to construct URL for \\\"\".concat(timing.name, \"\\\"\"));\n return \"other\" /* ResourceType.OTHER */;\n }\n var path = getPathName(url);\n for (var _i = 0, RESOURCE_TYPES_1 = RESOURCE_TYPES; _i < RESOURCE_TYPES_1.length; _i++) {\n var _a = RESOURCE_TYPES_1[_i], type = _a[0], isType = _a[1];\n if (isType(timing.initiatorType, path)) {\n return type;\n }\n }\n return \"other\" /* ResourceType.OTHER */;\n}\nfunction areInOrder() {\n var numbers = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n numbers[_i] = arguments[_i];\n }\n for (var i = 1; i < numbers.length; i += 1) {\n if (numbers[i - 1] > numbers[i]) {\n return false;\n }\n }\n return true;\n}\nexport function isRequestKind(timing) {\n return timing.initiatorType === 'xmlhttprequest' || timing.initiatorType === 'fetch';\n}\nexport function computePerformanceResourceDuration(entry) {\n var duration = entry.duration, startTime = entry.startTime, responseEnd = entry.responseEnd;\n // Safari duration is always 0 on timings blocked by cross origin policies.\n if (duration === 0 && startTime < responseEnd) {\n return toServerDuration(elapsed(startTime, responseEnd));\n }\n return toServerDuration(duration);\n}\nexport function computePerformanceResourceDetails(entry) {\n if (!isValidEntry(entry)) {\n return undefined;\n }\n var startTime = entry.startTime, fetchStart = entry.fetchStart, redirectStart = entry.redirectStart, redirectEnd = entry.redirectEnd, domainLookupStart = entry.domainLookupStart, domainLookupEnd = entry.domainLookupEnd, connectStart = entry.connectStart, secureConnectionStart = entry.secureConnectionStart, connectEnd = entry.connectEnd, requestStart = entry.requestStart, responseStart = entry.responseStart, responseEnd = entry.responseEnd;\n var details = {\n download: formatTiming(startTime, responseStart, responseEnd),\n first_byte: formatTiming(startTime, requestStart, responseStart),\n };\n // Make sure a connection occurred\n if (fetchStart < connectEnd) {\n details.connect = formatTiming(startTime, connectStart, connectEnd);\n // Make sure a secure connection occurred\n if (connectStart <= secureConnectionStart && secureConnectionStart <= connectEnd) {\n details.ssl = formatTiming(startTime, secureConnectionStart, connectEnd);\n }\n }\n // Make sure a domain lookup occurred\n if (fetchStart < domainLookupEnd) {\n details.dns = formatTiming(startTime, domainLookupStart, domainLookupEnd);\n }\n // Make sure a redirection occurred\n if (startTime < redirectEnd) {\n details.redirect = formatTiming(startTime, redirectStart, redirectEnd);\n }\n return details;\n}\nexport function isValidEntry(entry) {\n if (isExperimentalFeatureEnabled(ExperimentalFeature.TOLERANT_RESOURCE_TIMINGS)) {\n return true;\n }\n // Ensure timings are in the right order. On top of filtering out potential invalid\n // RumPerformanceResourceTiming, it will ignore entries from requests where timings cannot be\n // collected, for example cross origin requests without a \"Timing-Allow-Origin\" header allowing\n // it.\n var areCommonTimingsInOrder = areInOrder(entry.startTime, entry.fetchStart, entry.domainLookupStart, entry.domainLookupEnd, entry.connectStart, entry.connectEnd, entry.requestStart, entry.responseStart, entry.responseEnd);\n var areRedirectionTimingsInOrder = hasRedirection(entry)\n ? areInOrder(entry.startTime, entry.redirectStart, entry.redirectEnd, entry.fetchStart)\n : true;\n return areCommonTimingsInOrder && areRedirectionTimingsInOrder;\n}\nfunction hasRedirection(entry) {\n return entry.redirectEnd > entry.startTime;\n}\nfunction formatTiming(origin, start, end) {\n if (origin <= start && start <= end) {\n return {\n duration: toServerDuration(elapsed(start, end)),\n start: toServerDuration(elapsed(origin, start)),\n };\n }\n}\nexport function computeSize(entry) {\n // Make sure a request actually occurred\n if (entry.startTime < entry.responseStart) {\n var encodedBodySize = entry.encodedBodySize, decodedBodySize = entry.decodedBodySize, transferSize = entry.transferSize;\n return {\n size: decodedBodySize,\n encoded_body_size: encodedBodySize,\n decoded_body_size: decodedBodySize,\n transfer_size: transferSize,\n };\n }\n return {\n size: undefined,\n encoded_body_size: undefined,\n decoded_body_size: undefined,\n transfer_size: undefined,\n };\n}\nexport function isAllowedRequestUrl(configuration, url) {\n return url && !configuration.isIntakeUrl(url);\n}\nvar DATA_URL_REGEX = /data:(.+)?(;base64)?,/g;\nexport var MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 24000;\nexport function isLongDataUrl(url) {\n if (url.length <= MAX_ATTRIBUTE_VALUE_CHAR_LENGTH) {\n return false;\n }\n else if (url.substring(0, 5) === 'data:') {\n // Avoid String.match RangeError: Maximum call stack size exceeded\n url = url.substring(0, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH);\n return true;\n }\n return false;\n}\nexport function sanitizeDataUrl(url) {\n return \"\".concat(url.match(DATA_URL_REGEX)[0], \"[...]\");\n}\n//# sourceMappingURL=resourceUtils.js.map","export function isTextNode(node) {\n return node.nodeType === Node.TEXT_NODE;\n}\nexport function isCommentNode(node) {\n return node.nodeType === Node.COMMENT_NODE;\n}\nexport function isElementNode(node) {\n return node.nodeType === Node.ELEMENT_NODE;\n}\nexport function isNodeShadowHost(node) {\n return isElementNode(node) && Boolean(node.shadowRoot);\n}\nexport function isNodeShadowRoot(node) {\n var shadowRoot = node;\n return !!shadowRoot.host && shadowRoot.nodeType === Node.DOCUMENT_FRAGMENT_NODE && isElementNode(shadowRoot.host);\n}\nexport function hasChildNodes(node) {\n return node.childNodes.length > 0 || isNodeShadowHost(node);\n}\nexport function forEachChildNodes(node, callback) {\n var child = node.firstChild;\n while (child) {\n callback(child);\n child = child.nextSibling;\n }\n if (isNodeShadowHost(node)) {\n callback(node.shadowRoot);\n }\n}\n/**\n * Return `host` in case if the current node is a shadow root otherwise will return the `parentNode`\n */\nexport function getParentNode(node) {\n return isNodeShadowRoot(node) ? node.host : node.parentNode;\n}\n//# sourceMappingURL=htmlDomUtils.js.map","import { dateNow, findCommaSeparatedValue, ONE_MINUTE } from '@datadog/browser-core';\nimport { isCommentNode, isTextNode } from '../../browser/htmlDomUtils';\nexport var INITIAL_DOCUMENT_OUTDATED_TRACE_ID_THRESHOLD = 2 * ONE_MINUTE;\nexport function getDocumentTraceId(document) {\n var data = getDocumentTraceDataFromMeta(document) || getDocumentTraceDataFromComment(document);\n if (!data || data.traceTime <= dateNow() - INITIAL_DOCUMENT_OUTDATED_TRACE_ID_THRESHOLD) {\n return undefined;\n }\n return data.traceId;\n}\nexport function getDocumentTraceDataFromMeta(document) {\n var traceIdMeta = document.querySelector('meta[name=dd-trace-id]');\n var traceTimeMeta = document.querySelector('meta[name=dd-trace-time]');\n return createDocumentTraceData(traceIdMeta && traceIdMeta.content, traceTimeMeta && traceTimeMeta.content);\n}\nexport function getDocumentTraceDataFromComment(document) {\n var comment = findTraceComment(document);\n if (!comment) {\n return undefined;\n }\n return createDocumentTraceData(findCommaSeparatedValue(comment, 'trace-id'), findCommaSeparatedValue(comment, 'trace-time'));\n}\nexport function createDocumentTraceData(traceId, rawTraceTime) {\n var traceTime = rawTraceTime && Number(rawTraceTime);\n if (!traceId || !traceTime) {\n return undefined;\n }\n return {\n traceId: traceId,\n traceTime: traceTime,\n };\n}\nexport function findTraceComment(document) {\n // 1. Try to find the comment as a direct child of the document\n // Note: TSLint advises to use a 'for of', but TS doesn't allow to use 'for of' if the iterated\n // value is not an array or string (here, a NodeList).\n for (var i = 0; i < document.childNodes.length; i += 1) {\n var comment = getTraceCommentFromNode(document.childNodes[i]);\n if (comment) {\n return comment;\n }\n }\n // 2. If the comment is placed after the tag, but have some space or new lines before or\n // after, the DOM parser will lift it (and the surrounding text) at the end of the tag.\n // Try to look for the comment at the end of the by by iterating over its child nodes in\n // reverse order, stopping if we come across a non-text node.\n if (document.body) {\n for (var i = document.body.childNodes.length - 1; i >= 0; i -= 1) {\n var node = document.body.childNodes[i];\n var comment = getTraceCommentFromNode(node);\n if (comment) {\n return comment;\n }\n if (!isTextNode(node)) {\n break;\n }\n }\n }\n}\nfunction getTraceCommentFromNode(node) {\n if (node && isCommentNode(node)) {\n var match = /^\\s*DATADOG;(.*?)\\s*$/.exec(node.data);\n if (match) {\n return match[1];\n }\n }\n}\n//# sourceMappingURL=getDocumentTraceId.js.map","import { dateNow, assign, addEventListeners, DOM_EVENT, getRelativeTime, isNumber, monitor, setTimeout, relativeNow, runOnReadyState, addEventListener, objectHasValue, } from '@datadog/browser-core';\nimport { FAKE_INITIAL_DOCUMENT, isAllowedRequestUrl } from '../domain/resource/resourceUtils';\nimport { getDocumentTraceId } from '../domain/tracing/getDocumentTraceId';\n// We want to use a real enum (i.e. not a const enum) here, to be able to check whether an arbitrary\n// string is an expected performance entry\n// eslint-disable-next-line no-restricted-syntax\nexport var RumPerformanceEntryType;\n(function (RumPerformanceEntryType) {\n RumPerformanceEntryType[\"EVENT\"] = \"event\";\n RumPerformanceEntryType[\"FIRST_INPUT\"] = \"first-input\";\n RumPerformanceEntryType[\"LARGEST_CONTENTFUL_PAINT\"] = \"largest-contentful-paint\";\n RumPerformanceEntryType[\"LAYOUT_SHIFT\"] = \"layout-shift\";\n RumPerformanceEntryType[\"LONG_TASK\"] = \"longtask\";\n RumPerformanceEntryType[\"NAVIGATION\"] = \"navigation\";\n RumPerformanceEntryType[\"PAINT\"] = \"paint\";\n RumPerformanceEntryType[\"RESOURCE\"] = \"resource\";\n})(RumPerformanceEntryType || (RumPerformanceEntryType = {}));\nfunction supportPerformanceObject() {\n return window.performance !== undefined && 'getEntries' in performance;\n}\nexport function supportPerformanceTimingEvent(entryType) {\n return (window.PerformanceObserver &&\n PerformanceObserver.supportedEntryTypes !== undefined &&\n PerformanceObserver.supportedEntryTypes.includes(entryType));\n}\nexport function startPerformanceCollection(lifeCycle, configuration) {\n var cleanupTasks = [];\n retrieveInitialDocumentResourceTiming(configuration, function (timing) {\n handleRumPerformanceEntries(lifeCycle, configuration, [timing]);\n });\n if (supportPerformanceObject()) {\n var performanceEntries_1 = performance.getEntries();\n // Because the performance entry list can be quite large\n // delay the computation to prevent the SDK from blocking the main thread on init\n setTimeout(function () { return handleRumPerformanceEntries(lifeCycle, configuration, performanceEntries_1); });\n }\n if (window.PerformanceObserver) {\n var handlePerformanceEntryList_1 = monitor(function (entries) {\n return handleRumPerformanceEntries(lifeCycle, configuration, entries.getEntries());\n });\n var mainEntries = [\n RumPerformanceEntryType.RESOURCE,\n RumPerformanceEntryType.NAVIGATION,\n RumPerformanceEntryType.LONG_TASK,\n RumPerformanceEntryType.PAINT,\n ];\n var experimentalEntries = [\n RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT,\n RumPerformanceEntryType.FIRST_INPUT,\n RumPerformanceEntryType.LAYOUT_SHIFT,\n RumPerformanceEntryType.EVENT,\n ];\n try {\n // Experimental entries are not retrieved by performance.getEntries()\n // use a single PerformanceObserver with buffered flag by type\n // to get values that could happen before SDK init\n experimentalEntries.forEach(function (type) {\n var observer = new window.PerformanceObserver(handlePerformanceEntryList_1);\n observer.observe({\n type: type,\n buffered: true,\n // durationThreshold only impact PerformanceEventTiming entries used for INP computation which requires a threshold at 40 (default is 104ms)\n // cf: https://github.com/GoogleChrome/web-vitals/blob/3806160ffbc93c3c4abf210a167b81228172b31c/src/onINP.ts#L209\n durationThreshold: 40,\n });\n cleanupTasks.push(function () { return observer.disconnect(); });\n });\n }\n catch (e) {\n // Some old browser versions (ex: chrome 67) don't support the PerformanceObserver type and buffered options\n // In these cases, fallback to PerformanceObserver with entryTypes\n mainEntries.push.apply(mainEntries, experimentalEntries);\n }\n var mainObserver_1 = new PerformanceObserver(handlePerformanceEntryList_1);\n mainObserver_1.observe({ entryTypes: mainEntries });\n cleanupTasks.push(function () { return mainObserver_1.disconnect(); });\n if (supportPerformanceObject() && 'addEventListener' in performance) {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1559377\n var removePerformanceListener = addEventListener(configuration, performance, 'resourcetimingbufferfull', function () {\n performance.clearResourceTimings();\n }).stop;\n cleanupTasks.push(removePerformanceListener);\n }\n }\n if (!supportPerformanceTimingEvent(RumPerformanceEntryType.NAVIGATION)) {\n retrieveNavigationTiming(configuration, function (timing) {\n handleRumPerformanceEntries(lifeCycle, configuration, [timing]);\n });\n }\n if (!supportPerformanceTimingEvent(RumPerformanceEntryType.FIRST_INPUT)) {\n var stopFirstInputTiming = retrieveFirstInputTiming(configuration, function (timing) {\n handleRumPerformanceEntries(lifeCycle, configuration, [timing]);\n }).stop;\n cleanupTasks.push(stopFirstInputTiming);\n }\n return {\n stop: function () {\n cleanupTasks.forEach(function (task) { return task(); });\n },\n };\n}\nexport function retrieveInitialDocumentResourceTiming(configuration, callback) {\n runOnReadyState(configuration, 'interactive', function () {\n var timing;\n var forcedAttributes = {\n entryType: RumPerformanceEntryType.RESOURCE,\n initiatorType: FAKE_INITIAL_DOCUMENT,\n traceId: getDocumentTraceId(document),\n toJSON: function () { return assign({}, timing, { toJSON: undefined }); },\n };\n if (supportPerformanceTimingEvent(RumPerformanceEntryType.NAVIGATION) &&\n performance.getEntriesByType(RumPerformanceEntryType.NAVIGATION).length > 0) {\n var navigationEntry = performance.getEntriesByType(RumPerformanceEntryType.NAVIGATION)[0];\n timing = assign(navigationEntry.toJSON(), forcedAttributes);\n }\n else {\n var relativePerformanceTiming = computeRelativePerformanceTiming();\n timing = assign(relativePerformanceTiming, {\n decodedBodySize: 0,\n encodedBodySize: 0,\n transferSize: 0,\n renderBlockingStatus: 'non-blocking',\n duration: relativePerformanceTiming.responseEnd,\n name: window.location.href,\n startTime: 0,\n }, forcedAttributes);\n }\n callback(timing);\n });\n}\nfunction retrieveNavigationTiming(configuration, callback) {\n function sendFakeTiming() {\n callback(assign(computeRelativePerformanceTiming(), {\n entryType: RumPerformanceEntryType.NAVIGATION,\n }));\n }\n runOnReadyState(configuration, 'complete', function () {\n // Send it a bit after the actual load event, so the \"loadEventEnd\" timing is accurate\n setTimeout(sendFakeTiming);\n });\n}\n/**\n * first-input timing entry polyfill based on\n * https://github.com/GoogleChrome/web-vitals/blob/master/src/lib/polyfills/firstInputPolyfill.ts\n */\nfunction retrieveFirstInputTiming(configuration, callback) {\n var startTimeStamp = dateNow();\n var timingSent = false;\n var removeEventListeners = addEventListeners(configuration, window, [DOM_EVENT.CLICK, DOM_EVENT.MOUSE_DOWN, DOM_EVENT.KEY_DOWN, DOM_EVENT.TOUCH_START, DOM_EVENT.POINTER_DOWN], function (evt) {\n // Only count cancelable events, which should trigger behavior important to the user.\n if (!evt.cancelable) {\n return;\n }\n // This timing will be used to compute the \"first Input delay\", which is the delta between\n // when the system received the event (e.g. evt.timeStamp) and when it could run the callback\n // (e.g. performance.now()).\n var timing = {\n entryType: RumPerformanceEntryType.FIRST_INPUT,\n processingStart: relativeNow(),\n processingEnd: relativeNow(),\n startTime: evt.timeStamp,\n duration: 0, // arbitrary value to avoid nullable duration and simplify INP logic\n name: '',\n };\n if (evt.type === DOM_EVENT.POINTER_DOWN) {\n sendTimingIfPointerIsNotCancelled(configuration, timing);\n }\n else {\n sendTiming(timing);\n }\n }, { passive: true, capture: true }).stop;\n return { stop: removeEventListeners };\n /**\n * Pointer events are a special case, because they can trigger main or compositor thread behavior.\n * We differentiate these cases based on whether or not we see a pointercancel event, which are\n * fired when we scroll. If we're scrolling we don't need to report input delay since FID excludes\n * scrolling and pinch/zooming.\n */\n function sendTimingIfPointerIsNotCancelled(configuration, timing) {\n addEventListeners(configuration, window, [DOM_EVENT.POINTER_UP, DOM_EVENT.POINTER_CANCEL], function (event) {\n if (event.type === DOM_EVENT.POINTER_UP) {\n sendTiming(timing);\n }\n }, { once: true });\n }\n function sendTiming(timing) {\n if (!timingSent) {\n timingSent = true;\n removeEventListeners();\n // In some cases the recorded delay is clearly wrong, e.g. it's negative or it's larger than\n // the time between now and when the page was loaded.\n // - https://github.com/GoogleChromeLabs/first-input-delay/issues/4\n // - https://github.com/GoogleChromeLabs/first-input-delay/issues/6\n // - https://github.com/GoogleChromeLabs/first-input-delay/issues/7\n var delay = timing.processingStart - timing.startTime;\n if (delay >= 0 && delay < dateNow() - startTimeStamp) {\n callback(timing);\n }\n }\n }\n}\nfunction computeRelativePerformanceTiming() {\n var result = {};\n var timing = performance.timing;\n for (var key in timing) {\n if (isNumber(timing[key])) {\n var numberKey = key;\n var timingElement = timing[numberKey];\n result[numberKey] = timingElement === 0 ? 0 : getRelativeTime(timingElement);\n }\n }\n return result;\n}\nfunction handleRumPerformanceEntries(lifeCycle, configuration, entries) {\n var rumPerformanceEntries = entries.filter(function (entry) {\n return objectHasValue(RumPerformanceEntryType, entry.entryType);\n });\n var rumAllowedPerformanceEntries = rumPerformanceEntries.filter(function (entry) { return !isIncompleteNavigation(entry) && !isForbiddenResource(configuration, entry); });\n if (rumAllowedPerformanceEntries.length) {\n lifeCycle.notify(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, rumAllowedPerformanceEntries);\n }\n}\nfunction isIncompleteNavigation(entry) {\n return entry.entryType === RumPerformanceEntryType.NAVIGATION && entry.loadEventEnd <= 0;\n}\nfunction isForbiddenResource(configuration, entry) {\n return entry.entryType === RumPerformanceEntryType.RESOURCE && !isAllowedRequestUrl(configuration, entry.name);\n}\n//# sourceMappingURL=performanceCollection.js.map","import { getSyntheticsResultId, getSyntheticsTestId, willSyntheticsInjectRum } from '@datadog/browser-core';\nexport function getSyntheticsContext() {\n var testId = getSyntheticsTestId();\n var resultId = getSyntheticsResultId();\n if (testId && resultId) {\n return {\n test_id: testId,\n result_id: resultId,\n injected: willSyntheticsInjectRum(),\n };\n }\n}\n//# sourceMappingURL=syntheticsContext.js.map","import { sanitize, deepClone, getType, objectEntries } from '@datadog/browser-core';\n/**\n * Current limitation:\n * - field path do not support array, 'a.b.c' only\n */\nexport function limitModification(object, modifiableFieldPaths, modifier) {\n var clone = deepClone(object);\n var result = modifier(clone);\n objectEntries(modifiableFieldPaths).forEach(function (_a) {\n var fieldPath = _a[0], fieldType = _a[1];\n var newValue = get(clone, fieldPath);\n var newType = getType(newValue);\n if (newType === fieldType) {\n set(object, fieldPath, sanitize(newValue));\n }\n else if (fieldType === 'object' && (newType === 'undefined' || newType === 'null')) {\n set(object, fieldPath, {});\n }\n });\n return result;\n}\nfunction get(object, path) {\n var current = object;\n for (var _i = 0, _a = path.split('.'); _i < _a.length; _i++) {\n var field = _a[_i];\n if (!isValidObjectContaining(current, field)) {\n return;\n }\n current = current[field];\n }\n return current;\n}\nfunction set(object, path, value) {\n var current = object;\n var fields = path.split('.');\n for (var i = 0; i < fields.length; i += 1) {\n var field = fields[i];\n if (!isValidObject(current)) {\n return;\n }\n if (i !== fields.length - 1) {\n current = current[field];\n }\n else {\n current[field] = value;\n }\n }\n}\nfunction isValidObject(object) {\n return getType(object) === 'object';\n}\nfunction isValidObjectContaining(object, field) {\n return isValidObject(object) && Object.prototype.hasOwnProperty.call(object, field);\n}\n//# sourceMappingURL=limitModification.js.map","import { combine, isEmptyObject, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, assign, round, isExperimentalFeatureEnabled, ExperimentalFeature, getConnectivity, } from '@datadog/browser-core';\nimport { getSyntheticsContext } from './contexts/syntheticsContext';\nimport { limitModification } from './limitModification';\nvar VIEW_MODIFIABLE_FIELD_PATHS = {\n 'view.name': 'string',\n 'view.url': 'string',\n 'view.referrer': 'string',\n};\nvar USER_CUSTOMIZABLE_FIELD_PATHS = {\n context: 'object',\n};\nvar modifiableFieldPathsByEvent;\nexport function startRumAssembly(configuration, lifeCycle, sessionManager, viewContexts, urlContexts, actionContexts, displayContext, ciVisibilityContext, getCommonContext, reportError) {\n var _a, _b;\n modifiableFieldPathsByEvent = (_a = {},\n _a[\"view\" /* RumEventType.VIEW */] = VIEW_MODIFIABLE_FIELD_PATHS,\n _a[\"error\" /* RumEventType.ERROR */] = assign({\n 'error.message': 'string',\n 'error.stack': 'string',\n 'error.resource.url': 'string',\n 'error.fingerprint': 'string',\n }, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS),\n _a[\"resource\" /* RumEventType.RESOURCE */] = assign({\n 'resource.url': 'string',\n }, isExperimentalFeatureEnabled(ExperimentalFeature.WRITABLE_RESOURCE_GRAPHQL) && {\n 'resource.graphql': 'object',\n }, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS),\n _a[\"action\" /* RumEventType.ACTION */] = assign({\n 'action.target.name': 'string',\n }, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS),\n _a[\"long_task\" /* RumEventType.LONG_TASK */] = assign({}, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS),\n _a[\"vital\" /* RumEventType.VITAL */] = assign({}, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS),\n _a);\n var eventRateLimiters = (_b = {},\n _b[\"error\" /* RumEventType.ERROR */] = createEventRateLimiter(\"error\" /* RumEventType.ERROR */, configuration.eventRateLimiterThreshold, reportError),\n _b[\"action\" /* RumEventType.ACTION */] = createEventRateLimiter(\"action\" /* RumEventType.ACTION */, configuration.eventRateLimiterThreshold, reportError),\n _b[\"vital\" /* RumEventType.VITAL */] = createEventRateLimiter(\"vital\" /* RumEventType.VITAL */, configuration.eventRateLimiterThreshold, reportError),\n _b);\n var syntheticsContext = getSyntheticsContext();\n lifeCycle.subscribe(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, function (_a) {\n var startTime = _a.startTime, rawRumEvent = _a.rawRumEvent, domainContext = _a.domainContext, savedCommonContext = _a.savedCommonContext, customerContext = _a.customerContext;\n var viewContext = viewContexts.findView(startTime);\n var urlContext = urlContexts.findUrl(startTime);\n var session = sessionManager.findTrackedSession(startTime);\n if (session && viewContext && urlContext) {\n var commonContext = savedCommonContext || getCommonContext();\n var actionId = actionContexts.findActionId(startTime);\n var rumContext = {\n _dd: {\n format_version: 2,\n drift: currentDrift(),\n configuration: {\n session_sample_rate: round(configuration.sessionSampleRate, 3),\n session_replay_sample_rate: round(configuration.sessionReplaySampleRate, 3),\n },\n browser_sdk_version: canUseEventBridge() ? \"5.20.0\" : undefined,\n },\n application: {\n id: configuration.applicationId,\n },\n date: timeStampNow(),\n service: viewContext.service || configuration.service,\n version: viewContext.version || configuration.version,\n source: 'browser',\n session: {\n id: session.id,\n type: syntheticsContext\n ? \"synthetics\" /* SessionType.SYNTHETICS */\n : ciVisibilityContext.get()\n ? \"ci_test\" /* SessionType.CI_TEST */\n : \"user\" /* SessionType.USER */,\n },\n view: {\n id: viewContext.id,\n name: viewContext.name,\n url: urlContext.url,\n referrer: urlContext.referrer,\n },\n action: needToAssembleWithAction(rawRumEvent) && actionId ? { id: actionId } : undefined,\n synthetics: syntheticsContext,\n ci_test: ciVisibilityContext.get(),\n display: displayContext.get(),\n connectivity: getConnectivity(),\n };\n var serverRumEvent = combine(rumContext, rawRumEvent);\n serverRumEvent.context = combine(commonContext.context, customerContext);\n if (!('has_replay' in serverRumEvent.session)) {\n ;\n serverRumEvent.session.has_replay = commonContext.hasReplay;\n }\n if (serverRumEvent.type === 'view') {\n ;\n serverRumEvent.session.sampled_for_replay = session.sessionReplayAllowed;\n }\n if (!isEmptyObject(commonContext.user)) {\n ;\n serverRumEvent.usr = commonContext.user;\n }\n if (shouldSend(serverRumEvent, configuration.beforeSend, domainContext, eventRateLimiters)) {\n if (isEmptyObject(serverRumEvent.context)) {\n delete serverRumEvent.context;\n }\n lifeCycle.notify(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, serverRumEvent);\n }\n }\n });\n}\nfunction shouldSend(event, beforeSend, domainContext, eventRateLimiters) {\n var _a;\n if (beforeSend) {\n var result = limitModification(event, modifiableFieldPathsByEvent[event.type], function (event) {\n return beforeSend(event, domainContext);\n });\n if (result === false && event.type !== \"view\" /* RumEventType.VIEW */) {\n return false;\n }\n if (result === false) {\n display.warn(\"Can't dismiss view events using beforeSend!\");\n }\n }\n var rateLimitReached = (_a = eventRateLimiters[event.type]) === null || _a === void 0 ? void 0 : _a.isLimitReached();\n return !rateLimitReached;\n}\nfunction needToAssembleWithAction(event) {\n return [\"error\" /* RumEventType.ERROR */, \"resource\" /* RumEventType.RESOURCE */, \"long_task\" /* RumEventType.LONG_TASK */].indexOf(event.type) !== -1;\n}\n//# sourceMappingURL=assembly.js.map","/**\n * Internal context keep returning v1 format\n * to not break compatibility with logs data format\n */\nexport function startInternalContext(applicationId, sessionManager, viewContexts, actionContexts, urlContexts) {\n return {\n get: function (startTime) {\n var viewContext = viewContexts.findView(startTime);\n var urlContext = urlContexts.findUrl(startTime);\n var session = sessionManager.findTrackedSession(startTime);\n if (session && viewContext && urlContext) {\n var actionId = actionContexts.findActionId(startTime);\n return {\n application_id: applicationId,\n session_id: session.id,\n user_action: actionId ? { id: actionId } : undefined,\n view: { id: viewContext.id, name: viewContext.name, referrer: urlContext.referrer, url: urlContext.url },\n };\n }\n },\n };\n}\n//# sourceMappingURL=internalContext.js.map","import { AbstractLifeCycle } from '@datadog/browser-core';\nexport var LifeCycle = (AbstractLifeCycle);\n//# sourceMappingURL=lifeCycle.js.map","import { SESSION_TIME_OUT_DELAY, ValueHistory } from '@datadog/browser-core';\nexport var VIEW_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;\nexport function startViewContexts(lifeCycle) {\n var viewContextHistory = new ValueHistory(VIEW_CONTEXT_TIME_OUT_DELAY);\n lifeCycle.subscribe(2 /* LifeCycleEventType.BEFORE_VIEW_CREATED */, function (view) {\n viewContextHistory.add(buildViewContext(view), view.startClocks.relative);\n });\n lifeCycle.subscribe(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, function (_a) {\n var endClocks = _a.endClocks;\n viewContextHistory.closeActive(endClocks.relative);\n });\n lifeCycle.subscribe(10 /* LifeCycleEventType.SESSION_RENEWED */, function () {\n viewContextHistory.reset();\n });\n function buildViewContext(view) {\n return {\n service: view.service,\n version: view.version,\n id: view.id,\n name: view.name,\n startClocks: view.startClocks,\n };\n }\n return {\n findView: function (startTime) { return viewContextHistory.find(startTime); },\n stop: function () {\n viewContextHistory.stop();\n },\n };\n}\n//# sourceMappingURL=viewContexts.js.map","import { initFetchObservable, initXhrObservable, readBytesFromStream, elapsed, timeStampNow, tryToClone, } from '@datadog/browser-core';\nimport { isAllowedRequestUrl } from './resource/resourceUtils';\nimport { startTracer } from './tracing/tracer';\nvar nextRequestIndex = 1;\nexport function startRequestCollection(lifeCycle, configuration, sessionManager) {\n var tracer = startTracer(configuration, sessionManager);\n trackXhr(lifeCycle, configuration, tracer);\n trackFetch(lifeCycle, configuration, tracer);\n}\nexport function trackXhr(lifeCycle, configuration, tracer) {\n var subscription = initXhrObservable(configuration).subscribe(function (rawContext) {\n var context = rawContext;\n if (!isAllowedRequestUrl(configuration, context.url)) {\n return;\n }\n switch (context.state) {\n case 'start':\n tracer.traceXhr(context, context.xhr);\n context.requestIndex = getNextRequestIndex();\n lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_STARTED */, {\n requestIndex: context.requestIndex,\n url: context.url,\n });\n break;\n case 'complete':\n tracer.clearTracingIfNeeded(context);\n lifeCycle.notify(8 /* LifeCycleEventType.REQUEST_COMPLETED */, {\n duration: context.duration,\n method: context.method,\n requestIndex: context.requestIndex,\n spanId: context.spanId,\n startClocks: context.startClocks,\n status: context.status,\n traceId: context.traceId,\n traceSampled: context.traceSampled,\n type: \"xhr\" /* RequestType.XHR */,\n url: context.url,\n xhr: context.xhr,\n isAborted: context.isAborted,\n handlingStack: context.handlingStack,\n });\n break;\n }\n });\n return { stop: function () { return subscription.unsubscribe(); } };\n}\nexport function trackFetch(lifeCycle, configuration, tracer) {\n var subscription = initFetchObservable().subscribe(function (rawContext) {\n var context = rawContext;\n if (!isAllowedRequestUrl(configuration, context.url)) {\n return;\n }\n switch (context.state) {\n case 'start':\n tracer.traceFetch(context);\n context.requestIndex = getNextRequestIndex();\n lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_STARTED */, {\n requestIndex: context.requestIndex,\n url: context.url,\n });\n break;\n case 'resolve':\n waitForResponseToComplete(context, function (duration) {\n tracer.clearTracingIfNeeded(context);\n lifeCycle.notify(8 /* LifeCycleEventType.REQUEST_COMPLETED */, {\n duration: duration,\n method: context.method,\n requestIndex: context.requestIndex,\n responseType: context.responseType,\n spanId: context.spanId,\n startClocks: context.startClocks,\n status: context.status,\n traceId: context.traceId,\n traceSampled: context.traceSampled,\n type: \"fetch\" /* RequestType.FETCH */,\n url: context.url,\n response: context.response,\n init: context.init,\n input: context.input,\n isAborted: context.isAborted,\n handlingStack: context.handlingStack,\n });\n });\n break;\n }\n });\n return { stop: function () { return subscription.unsubscribe(); } };\n}\nfunction getNextRequestIndex() {\n var result = nextRequestIndex;\n nextRequestIndex += 1;\n return result;\n}\nfunction waitForResponseToComplete(context, callback) {\n var clonedResponse = context.response && tryToClone(context.response);\n if (!clonedResponse || !clonedResponse.body) {\n // do not try to wait for the response if the clone failed, fetch error or null body\n callback(elapsed(context.startClocks.timeStamp, timeStampNow()));\n }\n else {\n readBytesFromStream(clonedResponse.body, function () {\n callback(elapsed(context.startClocks.timeStamp, timeStampNow()));\n }, {\n bytesLimit: Number.POSITIVE_INFINITY,\n collectStreamBody: false,\n });\n }\n}\n//# sourceMappingURL=requestCollection.js.map","import { isNumber } from '@datadog/browser-core';\nexport function discardNegativeDuration(duration) {\n return isNumber(duration) && duration < 0 ? undefined : duration;\n}\n//# sourceMappingURL=discardNegativeDuration.js.map","import { noop } from '@datadog/browser-core';\nexport function trackEventCounts(_a) {\n var lifeCycle = _a.lifeCycle, isChildEvent = _a.isChildEvent, _b = _a.onChange, callback = _b === void 0 ? noop : _b;\n var eventCounts = {\n errorCount: 0,\n longTaskCount: 0,\n resourceCount: 0,\n actionCount: 0,\n frustrationCount: 0,\n };\n var subscription = lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (event) {\n var _a;\n if (event.type === 'view' || event.type === 'vital' || !isChildEvent(event)) {\n return;\n }\n switch (event.type) {\n case \"error\" /* RumEventType.ERROR */:\n eventCounts.errorCount += 1;\n callback();\n break;\n case \"action\" /* RumEventType.ACTION */:\n eventCounts.actionCount += 1;\n if (event.action.frustration) {\n eventCounts.frustrationCount += event.action.frustration.type.length;\n }\n callback();\n break;\n case \"long_task\" /* RumEventType.LONG_TASK */:\n eventCounts.longTaskCount += 1;\n callback();\n break;\n case \"resource\" /* RumEventType.RESOURCE */:\n if (!((_a = event._dd) === null || _a === void 0 ? void 0 : _a.discarded)) {\n eventCounts.resourceCount += 1;\n callback();\n }\n break;\n }\n });\n return {\n stop: function () {\n subscription.unsubscribe();\n },\n eventCounts: eventCounts,\n };\n}\n//# sourceMappingURL=trackEventCounts.js.map","import { instrumentMethod, matchList, monitor, Observable, timeStampNow, setTimeout, clearTimeout, } from '@datadog/browser-core';\nimport { RumPerformanceEntryType } from '../browser/performanceCollection';\n// Delay to wait for a page activity to validate the tracking process\nexport var PAGE_ACTIVITY_VALIDATION_DELAY = 100;\n// Delay to wait after a page activity to end the tracking process\nexport var PAGE_ACTIVITY_END_DELAY = 100;\n/**\n * Wait for the page activity end\n *\n * Detection lifecycle:\n * ```\n * Wait page activity end\n * .-------------------'--------------------.\n * v v\n * [Wait for a page activity ] [Wait for a maximum duration]\n * [timeout: VALIDATION_DELAY] [ timeout: maxDuration ]\n * / \\ |\n * v v |\n * [No page activity] [Page activity] |\n * | |,----------------------. |\n * v v | |\n * (Discard) [Wait for a page activity] | |\n * [ timeout: END_DELAY ] | |\n * / \\ | |\n * v v | |\n * [No page activity] [Page activity] | |\n * | | | |\n * | '------------' |\n * '-----------. ,--------------------'\n * v\n * (End)\n * ```\n *\n * Note: by assuming that maxDuration is greater than VALIDATION_DELAY, we are sure that if the\n * process is still alive after maxDuration, it has been validated.\n */\nexport function waitPageActivityEnd(lifeCycle, domMutationObservable, configuration, pageActivityEndCallback, maxDuration) {\n var pageActivityObservable = createPageActivityObservable(lifeCycle, domMutationObservable, configuration);\n return doWaitPageActivityEnd(pageActivityObservable, pageActivityEndCallback, maxDuration);\n}\nexport function doWaitPageActivityEnd(pageActivityObservable, pageActivityEndCallback, maxDuration) {\n var pageActivityEndTimeoutId;\n var hasCompleted = false;\n var validationTimeoutId = setTimeout(monitor(function () { return complete({ hadActivity: false }); }), PAGE_ACTIVITY_VALIDATION_DELAY);\n var maxDurationTimeoutId = maxDuration !== undefined\n ? setTimeout(monitor(function () { return complete({ hadActivity: true, end: timeStampNow() }); }), maxDuration)\n : undefined;\n var pageActivitySubscription = pageActivityObservable.subscribe(function (_a) {\n var isBusy = _a.isBusy;\n clearTimeout(validationTimeoutId);\n clearTimeout(pageActivityEndTimeoutId);\n var lastChangeTime = timeStampNow();\n if (!isBusy) {\n pageActivityEndTimeoutId = setTimeout(monitor(function () { return complete({ hadActivity: true, end: lastChangeTime }); }), PAGE_ACTIVITY_END_DELAY);\n }\n });\n var stop = function () {\n hasCompleted = true;\n clearTimeout(validationTimeoutId);\n clearTimeout(pageActivityEndTimeoutId);\n clearTimeout(maxDurationTimeoutId);\n pageActivitySubscription.unsubscribe();\n };\n function complete(event) {\n if (hasCompleted) {\n return;\n }\n stop();\n pageActivityEndCallback(event);\n }\n return { stop: stop };\n}\nexport function createPageActivityObservable(lifeCycle, domMutationObservable, configuration) {\n return new Observable(function (observable) {\n var subscriptions = [];\n var firstRequestIndex;\n var pendingRequestsCount = 0;\n subscriptions.push(domMutationObservable.subscribe(notifyPageActivity), lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n if (entries.some(function (entry) { return entry.entryType === RumPerformanceEntryType.RESOURCE && !isExcludedUrl(configuration, entry.name); })) {\n notifyPageActivity();\n }\n }), lifeCycle.subscribe(7 /* LifeCycleEventType.REQUEST_STARTED */, function (startEvent) {\n if (isExcludedUrl(configuration, startEvent.url)) {\n return;\n }\n if (firstRequestIndex === undefined) {\n firstRequestIndex = startEvent.requestIndex;\n }\n pendingRequestsCount += 1;\n notifyPageActivity();\n }), lifeCycle.subscribe(8 /* LifeCycleEventType.REQUEST_COMPLETED */, function (request) {\n if (isExcludedUrl(configuration, request.url) ||\n firstRequestIndex === undefined ||\n // If the request started before the tracking start, ignore it\n request.requestIndex < firstRequestIndex) {\n return;\n }\n pendingRequestsCount -= 1;\n notifyPageActivity();\n }));\n var stopTrackingWindowOpen = trackWindowOpen(notifyPageActivity).stop;\n return function () {\n stopTrackingWindowOpen();\n subscriptions.forEach(function (s) { return s.unsubscribe(); });\n };\n function notifyPageActivity() {\n observable.notify({ isBusy: pendingRequestsCount > 0 });\n }\n });\n}\nfunction isExcludedUrl(configuration, requestUrl) {\n return matchList(configuration.excludedActivityUrls, requestUrl);\n}\nfunction trackWindowOpen(callback) {\n return instrumentMethod(window, 'open', callback);\n}\n//# sourceMappingURL=waitPageActivityEnd.js.map","// https://github.com/jquery/jquery/blob/a684e6ba836f7c553968d7d026ed7941e1a612d8/src/selector/escapeSelector.js\nexport function cssEscape(str) {\n if (window.CSS && window.CSS.escape) {\n return window.CSS.escape(str);\n }\n // eslint-disable-next-line no-control-regex\n return str.replace(/([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\x80-\\uFFFF\\w-]/g, function (ch, asCodePoint) {\n if (asCodePoint) {\n // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\n if (ch === '\\0') {\n return '\\uFFFD';\n }\n // Control characters and (dependent upon position) numbers get escaped as code points\n return \"\".concat(ch.slice(0, -1), \"\\\\\").concat(ch.charCodeAt(ch.length - 1).toString(16), \" \");\n }\n // Other potentially-special ASCII characters get backslash-escaped\n return \"\\\\\".concat(ch);\n });\n}\nexport function elementMatches(element, selector) {\n if (element.matches) {\n return element.matches(selector);\n }\n // IE11 support\n if (element.msMatchesSelector) {\n return element.msMatchesSelector(selector);\n }\n return false;\n}\n/**\n * Return the parentElement of an node\n *\n * In cases where parentElement is not supported, such as in IE11 for SVG nodes, we fallback to parentNode\n */\nexport function getParentElement(node) {\n if (node.parentElement) {\n return node.parentElement;\n }\n while (node.parentNode) {\n if (node.parentNode.nodeType === Node.ELEMENT_NODE) {\n return node.parentNode;\n }\n node = node.parentNode;\n }\n return null;\n}\n/**\n * Return the classList of an element or an array of classes if classList is not supported\n *\n * In cases where classList is not supported, such as in IE11 for SVG and MathML elements,\n * we fallback to using element.getAttribute('class').\n * We opt for element.getAttribute('class') over element.className because className returns an SVGAnimatedString for SVG elements.\n */\nexport function getClassList(element) {\n var _a;\n if (element.classList) {\n return element.classList;\n }\n var classes = (_a = element.getAttribute('class')) === null || _a === void 0 ? void 0 : _a.trim();\n return classes ? classes.split(/\\s+/) : [];\n}\n// ie11 supports WeakMap but not WeakSet\nvar PLACEHOLDER = 1;\nvar WeakSet = /** @class */ (function () {\n function WeakSet(initialValues) {\n var _this = this;\n this.map = new WeakMap();\n if (initialValues) {\n initialValues.forEach(function (value) { return _this.map.set(value, PLACEHOLDER); });\n }\n }\n WeakSet.prototype.add = function (value) {\n this.map.set(value, PLACEHOLDER);\n return this;\n };\n WeakSet.prototype.delete = function (value) {\n return this.map.delete(value);\n };\n WeakSet.prototype.has = function (value) {\n return this.map.has(value);\n };\n return WeakSet;\n}());\nexport { WeakSet };\n//# sourceMappingURL=polyfills.js.map","import { safeTruncate, isIE, find } from '@datadog/browser-core';\nimport { getParentElement } from '../../browser/polyfills';\n/**\n * Get the action name from the attribute 'data-dd-action-name' on the element or any of its parent.\n * It can also be retrieved from a user defined attribute.\n */\nexport var DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = 'data-dd-action-name';\nexport function getActionNameFromElement(element, userProgrammaticAttribute) {\n // Proceed to get the action name in two steps:\n // * first, get the name programmatically, explicitly defined by the user.\n // * then, use strategies that are known to return good results. Those strategies will be used on\n // the element and a few parents, but it's likely that they won't succeed at all.\n // * if no name is found this way, use strategies returning less accurate names as a fallback.\n // Those are much likely to succeed.\n return (getActionNameFromElementProgrammatically(element, DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||\n (userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute)) ||\n getActionNameFromElementForStrategies(element, userProgrammaticAttribute, priorityStrategies) ||\n getActionNameFromElementForStrategies(element, userProgrammaticAttribute, fallbackStrategies) ||\n '');\n}\nfunction getActionNameFromElementProgrammatically(targetElement, programmaticAttribute) {\n var elementWithAttribute;\n // We don't use getActionNameFromElementForStrategies here, because we want to consider all parents,\n // without limit. It is up to the user to declare a relevant naming strategy.\n // If available, use element.closest() to match get the attribute from the element or any of its\n // parent. Else fallback to a more traditional implementation.\n if (supportsElementClosest()) {\n elementWithAttribute = targetElement.closest(\"[\".concat(programmaticAttribute, \"]\"));\n }\n else {\n var element = targetElement;\n while (element) {\n if (element.hasAttribute(programmaticAttribute)) {\n elementWithAttribute = element;\n break;\n }\n element = getParentElement(element);\n }\n }\n if (!elementWithAttribute) {\n return;\n }\n var name = elementWithAttribute.getAttribute(programmaticAttribute);\n return truncate(normalizeWhitespace(name.trim()));\n}\nvar priorityStrategies = [\n // associated LABEL text\n function (element, userProgrammaticAttribute) {\n // IE does not support element.labels, so we fallback to a CSS selector based on the element id\n // instead\n if (supportsLabelProperty()) {\n if ('labels' in element && element.labels && element.labels.length > 0) {\n return getTextualContent(element.labels[0], userProgrammaticAttribute);\n }\n }\n else if (element.id) {\n var label = element.ownerDocument &&\n find(element.ownerDocument.querySelectorAll('label'), function (label) { return label.htmlFor === element.id; });\n return label && getTextualContent(label, userProgrammaticAttribute);\n }\n },\n // INPUT button (and associated) value\n function (element) {\n if (element.nodeName === 'INPUT') {\n var input = element;\n var type = input.getAttribute('type');\n if (type === 'button' || type === 'submit' || type === 'reset') {\n return input.value;\n }\n }\n },\n // BUTTON, LABEL or button-like element text\n function (element, userProgrammaticAttribute) {\n if (element.nodeName === 'BUTTON' || element.nodeName === 'LABEL' || element.getAttribute('role') === 'button') {\n return getTextualContent(element, userProgrammaticAttribute);\n }\n },\n function (element) { return element.getAttribute('aria-label'); },\n // associated element text designated by the aria-labelledby attribute\n function (element, userProgrammaticAttribute) {\n var labelledByAttribute = element.getAttribute('aria-labelledby');\n if (labelledByAttribute) {\n return labelledByAttribute\n .split(/\\s+/)\n .map(function (id) { return getElementById(element, id); })\n .filter(function (label) { return Boolean(label); })\n .map(function (element) { return getTextualContent(element, userProgrammaticAttribute); })\n .join(' ');\n }\n },\n function (element) { return element.getAttribute('alt'); },\n function (element) { return element.getAttribute('name'); },\n function (element) { return element.getAttribute('title'); },\n function (element) { return element.getAttribute('placeholder'); },\n // SELECT first OPTION text\n function (element, userProgrammaticAttribute) {\n if ('options' in element && element.options.length > 0) {\n return getTextualContent(element.options[0], userProgrammaticAttribute);\n }\n },\n];\nvar fallbackStrategies = [\n function (element, userProgrammaticAttribute) { return getTextualContent(element, userProgrammaticAttribute); },\n];\n/**\n * Iterates over the target element and its parent, using the strategies list to get an action name.\n * Each strategies are applied on each element, stopping as soon as a non-empty value is returned.\n */\nvar MAX_PARENTS_TO_CONSIDER = 10;\nfunction getActionNameFromElementForStrategies(targetElement, userProgrammaticAttribute, strategies) {\n var element = targetElement;\n var recursionCounter = 0;\n while (recursionCounter <= MAX_PARENTS_TO_CONSIDER &&\n element &&\n element.nodeName !== 'BODY' &&\n element.nodeName !== 'HTML' &&\n element.nodeName !== 'HEAD') {\n for (var _i = 0, strategies_1 = strategies; _i < strategies_1.length; _i++) {\n var strategy = strategies_1[_i];\n var name_1 = strategy(element, userProgrammaticAttribute);\n if (typeof name_1 === 'string') {\n var trimmedName = name_1.trim();\n if (trimmedName) {\n return truncate(normalizeWhitespace(trimmedName));\n }\n }\n }\n // Consider a FORM as a contextual limit to get the action name. This is experimental and may\n // be reconsidered in the future.\n if (element.nodeName === 'FORM') {\n break;\n }\n element = getParentElement(element);\n recursionCounter += 1;\n }\n}\nfunction normalizeWhitespace(s) {\n return s.replace(/\\s+/g, ' ');\n}\nfunction truncate(s) {\n return s.length > 100 ? \"\".concat(safeTruncate(s, 100), \" [...]\") : s;\n}\nfunction getElementById(refElement, id) {\n // Use the element ownerDocument here, because tests are executed in an iframe, so\n // document.getElementById won't work.\n return refElement.ownerDocument ? refElement.ownerDocument.getElementById(id) : null;\n}\nfunction getTextualContent(element, userProgrammaticAttribute) {\n if (element.isContentEditable) {\n return;\n }\n if ('innerText' in element) {\n var text_1 = element.innerText;\n var removeTextFromElements = function (query) {\n var list = element.querySelectorAll(query);\n for (var index = 0; index < list.length; index += 1) {\n var element_1 = list[index];\n if ('innerText' in element_1) {\n var textToReplace = element_1.innerText;\n if (textToReplace && textToReplace.trim().length > 0) {\n text_1 = text_1.replace(textToReplace, '');\n }\n }\n }\n };\n if (!supportsInnerTextScriptAndStyleRemoval()) {\n // remove the inner text of SCRIPT and STYLES from the result. This is a bit dirty, but should\n // be relatively fast and work in most cases.\n removeTextFromElements('script, style');\n }\n // remove the text of elements with programmatic attribute value\n removeTextFromElements(\"[\".concat(DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE, \"]\"));\n if (userProgrammaticAttribute) {\n removeTextFromElements(\"[\".concat(userProgrammaticAttribute, \"]\"));\n }\n return text_1;\n }\n return element.textContent;\n}\n/**\n * Returns true if element.innerText excludes the text from inline SCRIPT and STYLE element. This\n * should be the case everywhere except on Internet Explorer 10 and 11 (see [1])\n *\n * The innerText property relies on what is actually rendered to compute its output, so to check if\n * it actually excludes SCRIPT and STYLE content, a solution would be to create a style element, set\n * its content to '*', inject it in the document body, and check if the style element innerText\n * property returns '*'. Using a new `document` instance won't work as it is not rendered.\n *\n * This solution requires specific CSP rules (see [2]) to be set by the customer. We want to avoid\n * this, so instead we rely on browser detection. In case of false negative, the impact should be\n * low, since we rely on this result to remove the SCRIPT and STYLE innerText (which will be empty)\n * from a parent element innerText.\n *\n * [1]: https://web.archive.org/web/20210602165716/http://perfectionkills.com/the-poor-misunderstood-innerText/#diff-with-textContent\n * [2]: https://github.com/DataDog/browser-sdk/issues/1084\n */\nfunction supportsInnerTextScriptAndStyleRemoval() {\n return !isIE();\n}\n/**\n * Returns true if the browser supports the element.labels property. This should be the case\n * everywhere except on Internet Explorer.\n * Note: The result is computed lazily, because we don't want any DOM access when the SDK is\n * evaluated.\n */\nvar supportsLabelPropertyResult;\nfunction supportsLabelProperty() {\n if (supportsLabelPropertyResult === undefined) {\n supportsLabelPropertyResult = 'labels' in HTMLInputElement.prototype;\n }\n return supportsLabelPropertyResult;\n}\n/**\n * Returns true if the browser supports the element.closest method. This should be the case\n * everywhere except on Internet Explorer.\n * Note: The result is computed lazily, because we don't want any DOM access when the SDK is\n * evaluated.\n */\nvar supportsElementClosestResult;\nfunction supportsElementClosest() {\n if (supportsElementClosestResult === undefined) {\n supportsElementClosestResult = 'closest' in HTMLElement.prototype;\n }\n return supportsElementClosestResult;\n}\n//# sourceMappingURL=getActionNameFromElement.js.map","import { cssEscape, elementMatches, getClassList, getParentElement } from '../browser/polyfills';\nimport { DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE } from './action/getActionNameFromElement';\n/**\n * Stable attributes are attributes that are commonly used to identify parts of a UI (ex:\n * component). Those attribute values should not be generated randomly (hardcoded most of the time)\n * and stay the same across deploys. They are not necessarily unique across the document.\n */\nexport var STABLE_ATTRIBUTES = [\n DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE,\n // Common test attributes (list provided by google recorder)\n 'data-testid',\n 'data-test',\n 'data-qa',\n 'data-cy',\n 'data-test-id',\n 'data-qa-id',\n 'data-testing',\n // FullStory decorator attributes:\n 'data-component',\n 'data-element',\n 'data-source-file',\n];\n// Selectors to use if they target a single element on the whole document. Those selectors are\n// considered as \"stable\" and uniquely identify an element regardless of the page state. If we find\n// one, we should consider the selector \"complete\" and stop iterating over ancestors.\nvar GLOBALLY_UNIQUE_SELECTOR_GETTERS = [getStableAttributeSelector, getIDSelector];\n// Selectors to use if they target a single element among an element descendants. Those selectors\n// are more brittle than \"globally unique\" selectors and should be combined with ancestor selectors\n// to improve specificity.\nvar UNIQUE_AMONG_CHILDREN_SELECTOR_GETTERS = [\n getStableAttributeSelector,\n getClassSelector,\n getTagNameSelector,\n];\nexport function getSelectorFromElement(targetElement, actionNameAttribute) {\n if (!isConnected(targetElement)) {\n // We cannot compute a selector for a detached element, as we don't have access to all of its\n // parents, and we cannot determine if it's unique in the document.\n return;\n }\n var targetElementSelector;\n var currentElement = targetElement;\n while (currentElement && currentElement.nodeName !== 'HTML') {\n var globallyUniqueSelector = findSelector(currentElement, GLOBALLY_UNIQUE_SELECTOR_GETTERS, isSelectorUniqueGlobally, actionNameAttribute, targetElementSelector);\n if (globallyUniqueSelector) {\n return globallyUniqueSelector;\n }\n var uniqueSelectorAmongChildren = findSelector(currentElement, UNIQUE_AMONG_CHILDREN_SELECTOR_GETTERS, isSelectorUniqueAmongSiblings, actionNameAttribute, targetElementSelector);\n targetElementSelector =\n uniqueSelectorAmongChildren || combineSelector(getPositionSelector(currentElement), targetElementSelector);\n currentElement = getParentElement(currentElement);\n }\n return targetElementSelector;\n}\nfunction isGeneratedValue(value) {\n // To compute the \"URL path group\", the backend replaces every URL path parts as a question mark\n // if it thinks the part is an identifier. The condition it uses is to checks whether a digit is\n // present.\n //\n // Here, we use the same strategy: if the value contains a digit, we consider it generated. This\n // strategy might be a bit naive and fail in some cases, but there are many fallbacks to generate\n // CSS selectors so it should be fine most of the time.\n return /[0-9]/.test(value);\n}\nfunction getIDSelector(element) {\n if (element.id && !isGeneratedValue(element.id)) {\n return \"#\".concat(cssEscape(element.id));\n }\n}\nfunction getClassSelector(element) {\n if (element.tagName === 'BODY') {\n return;\n }\n var classList = getClassList(element);\n for (var i = 0; i < classList.length; i += 1) {\n var className = classList[i];\n if (isGeneratedValue(className)) {\n continue;\n }\n return \"\".concat(cssEscape(element.tagName), \".\").concat(cssEscape(className));\n }\n}\nfunction getTagNameSelector(element) {\n return cssEscape(element.tagName);\n}\nfunction getStableAttributeSelector(element, actionNameAttribute) {\n if (actionNameAttribute) {\n var selector = getAttributeSelector(actionNameAttribute);\n if (selector) {\n return selector;\n }\n }\n for (var _i = 0, STABLE_ATTRIBUTES_1 = STABLE_ATTRIBUTES; _i < STABLE_ATTRIBUTES_1.length; _i++) {\n var attributeName = STABLE_ATTRIBUTES_1[_i];\n var selector = getAttributeSelector(attributeName);\n if (selector) {\n return selector;\n }\n }\n function getAttributeSelector(attributeName) {\n if (element.hasAttribute(attributeName)) {\n return \"\".concat(cssEscape(element.tagName), \"[\").concat(attributeName, \"=\\\"\").concat(cssEscape(element.getAttribute(attributeName)), \"\\\"]\");\n }\n }\n}\nfunction getPositionSelector(element) {\n var sibling = getParentElement(element).firstElementChild;\n var elementIndex = 1;\n while (sibling && sibling !== element) {\n if (sibling.tagName === element.tagName) {\n elementIndex += 1;\n }\n sibling = sibling.nextElementSibling;\n }\n return \"\".concat(cssEscape(element.tagName), \":nth-of-type(\").concat(elementIndex, \")\");\n}\nfunction findSelector(element, selectorGetters, predicate, actionNameAttribute, childSelector) {\n for (var _i = 0, selectorGetters_1 = selectorGetters; _i < selectorGetters_1.length; _i++) {\n var selectorGetter = selectorGetters_1[_i];\n var elementSelector = selectorGetter(element, actionNameAttribute);\n if (!elementSelector) {\n continue;\n }\n if (predicate(element, elementSelector, childSelector)) {\n return combineSelector(elementSelector, childSelector);\n }\n }\n}\n/**\n * Check whether the selector is unique among the whole document.\n */\nfunction isSelectorUniqueGlobally(element, elementSelector, childSelector) {\n return element.ownerDocument.querySelectorAll(combineSelector(elementSelector, childSelector)).length === 1;\n}\n/**\n * Check whether the selector is unique among the element siblings. In other words, it returns true\n * if \"ELEMENT_PARENT > CHILD_SELECTOR\" returns a single element.\n *\n * @param {Element} currentElement - the element being considered while iterating over the target\n * element ancestors.\n *\n * @param {string} currentElementSelector - a selector that matches the current element. That\n * selector is not a composed selector (i.e. it might be a single tag name, class name...).\n *\n * @param {string|undefined} childSelector - child selector is a selector that targets a descendant\n * of the current element. When undefined, the current element is the target element.\n *\n * # Scope selector usage\n *\n * When composed together, the final selector will be joined with `>` operators to make sure we\n * target direct descendants at each level. In this function, we'll use `querySelector` to check if\n * a selector matches descendants of the current element. But by default, the query selector match\n * elements at any level. Example:\n *\n * ```html\n *
\n *
\n * \n *
\n * \n *
\n * \n *
\n *
\n *
\n * ```\n *\n * `sibling.querySelector('DIV > SPAN')` will match both span elements, so we would consider the\n * selector to be not unique, even if it is unique when we'll compose it with the parent with a `>`\n * operator (`MAIN > DIV > SPAN`).\n *\n * To avoid this, we can use the `:scope` selector to make sure the selector starts from the current\n * sibling (i.e. `sibling.querySelector('DIV:scope > SPAN')` will only match the first span).\n *\n * The result will be less accurate on browsers that don't support :scope (i. e. IE): it will check\n * for any element matching the selector contained in the parent (in other words,\n * \"ELEMENT_PARENT CHILD_SELECTOR\" returns a single element), regardless of whether the selector is\n * a direct descendant of the element parent. This should not impact results too much: if it\n * inaccurately returns false, we'll just fall back to another strategy.\n *\n * [1]: https://developer.mozilla.org/fr/docs/Web/CSS/:scope\n *\n * # Performance considerations\n *\n * We compute selectors in performance-critical operations (ex: during a click), so we need to make\n * sure the function is as fast as possible. We observed that naively using `querySelectorAll` to\n * check if the selector matches more than 1 element is quite expensive, so we want to avoid it.\n *\n * Because we are iterating the DOM upward and we use that function at every level, we know the\n * child selector is already unique among the current element children, so we don't need to check\n * for the current element subtree.\n *\n * Instead, we can focus on the current element siblings. If we find a single element matching the\n * selector within a sibling, we know that it's not unique. This allows us to use `querySelector`\n * (or `matches`, when the current element is the target element) instead of `querySelectorAll`.\n */\nexport function isSelectorUniqueAmongSiblings(currentElement, currentElementSelector, childSelector) {\n var isSiblingMatching;\n if (childSelector === undefined) {\n // If the child selector is undefined (meaning `currentElement` is the target element, not one\n // of its ancestor), we need to use `matches` to check if the sibling is matching the selector,\n // as `querySelector` only returns a descendant of the element.\n isSiblingMatching = function (sibling) { return elementMatches(sibling, currentElementSelector); };\n }\n else {\n var scopedSelector_1 = supportScopeSelector()\n ? combineSelector(\"\".concat(currentElementSelector, \":scope\"), childSelector)\n : combineSelector(currentElementSelector, childSelector);\n isSiblingMatching = function (sibling) { return sibling.querySelector(scopedSelector_1) !== null; };\n }\n var parent = getParentElement(currentElement);\n var sibling = parent.firstElementChild;\n while (sibling) {\n if (sibling !== currentElement && isSiblingMatching(sibling)) {\n return false;\n }\n sibling = sibling.nextElementSibling;\n }\n return true;\n}\nfunction combineSelector(parent, child) {\n return child ? \"\".concat(parent, \">\").concat(child) : parent;\n}\nvar supportScopeSelectorCache;\nexport function supportScopeSelector() {\n if (supportScopeSelectorCache === undefined) {\n try {\n document.querySelector(':scope');\n supportScopeSelectorCache = true;\n }\n catch (_a) {\n supportScopeSelectorCache = false;\n }\n }\n return supportScopeSelectorCache;\n}\n/**\n * Polyfill-utility for the `isConnected` property not supported in IE11\n */\nfunction isConnected(element) {\n if ('isConnected' in\n // cast is to make sure `element` is not inferred as `never` after the check\n element) {\n return element.isConnected;\n }\n return element.ownerDocument.documentElement.contains(element);\n}\n//# sourceMappingURL=getSelectorFromElement.js.map","import { ONE_SECOND, clearTimeout, setTimeout } from '@datadog/browser-core';\nexport var MAX_DURATION_BETWEEN_CLICKS = ONE_SECOND;\nexport var MAX_DISTANCE_BETWEEN_CLICKS = 100;\nexport function createClickChain(firstClick, onFinalize) {\n var bufferedClicks = [];\n var status = 0 /* ClickChainStatus.WaitingForMoreClicks */;\n var maxDurationBetweenClicksTimeoutId;\n appendClick(firstClick);\n function appendClick(click) {\n click.stopObservable.subscribe(tryFinalize);\n bufferedClicks.push(click);\n clearTimeout(maxDurationBetweenClicksTimeoutId);\n maxDurationBetweenClicksTimeoutId = setTimeout(dontAcceptMoreClick, MAX_DURATION_BETWEEN_CLICKS);\n }\n function tryFinalize() {\n if (status === 1 /* ClickChainStatus.WaitingForClicksToStop */ && bufferedClicks.every(function (click) { return click.isStopped(); })) {\n status = 2 /* ClickChainStatus.Finalized */;\n onFinalize(bufferedClicks);\n }\n }\n function dontAcceptMoreClick() {\n clearTimeout(maxDurationBetweenClicksTimeoutId);\n if (status === 0 /* ClickChainStatus.WaitingForMoreClicks */) {\n status = 1 /* ClickChainStatus.WaitingForClicksToStop */;\n tryFinalize();\n }\n }\n return {\n tryAppend: function (click) {\n if (status !== 0 /* ClickChainStatus.WaitingForMoreClicks */) {\n return false;\n }\n if (bufferedClicks.length > 0 &&\n !areEventsSimilar(bufferedClicks[bufferedClicks.length - 1].event, click.event)) {\n dontAcceptMoreClick();\n return false;\n }\n appendClick(click);\n return true;\n },\n stop: function () {\n dontAcceptMoreClick();\n },\n };\n}\n/**\n * Checks whether two events are similar by comparing their target, position and timestamp\n */\nfunction areEventsSimilar(first, second) {\n return (first.target === second.target &&\n mouseEventDistance(first, second) <= MAX_DISTANCE_BETWEEN_CLICKS &&\n first.timeStamp - second.timeStamp <= MAX_DURATION_BETWEEN_CLICKS);\n}\nfunction mouseEventDistance(origin, other) {\n return Math.sqrt(Math.pow(origin.clientX - other.clientX, 2) + Math.pow(origin.clientY - other.clientY, 2));\n}\n//# sourceMappingURL=clickChain.js.map","import { addEventListener, DOM_EVENT } from '@datadog/browser-core';\nexport function listenActionEvents(configuration, _a) {\n var onPointerDown = _a.onPointerDown, onPointerUp = _a.onPointerUp;\n var selectionEmptyAtPointerDown;\n var userActivity = {\n selection: false,\n input: false,\n scroll: false,\n };\n var clickContext;\n var listeners = [\n addEventListener(configuration, window, DOM_EVENT.POINTER_DOWN, function (event) {\n if (isValidPointerEvent(event)) {\n selectionEmptyAtPointerDown = isSelectionEmpty();\n userActivity = {\n selection: false,\n input: false,\n scroll: false,\n };\n clickContext = onPointerDown(event);\n }\n }, { capture: true }),\n addEventListener(configuration, window, DOM_EVENT.SELECTION_CHANGE, function () {\n if (!selectionEmptyAtPointerDown || !isSelectionEmpty()) {\n userActivity.selection = true;\n }\n }, { capture: true }),\n addEventListener(configuration, window, DOM_EVENT.SCROLL, function () {\n userActivity.scroll = true;\n }, { capture: true, passive: true }),\n addEventListener(configuration, window, DOM_EVENT.POINTER_UP, function (event) {\n if (isValidPointerEvent(event) && clickContext) {\n // Use a scoped variable to make sure the value is not changed by other clicks\n var localUserActivity_1 = userActivity;\n onPointerUp(clickContext, event, function () { return localUserActivity_1; });\n clickContext = undefined;\n }\n }, { capture: true }),\n addEventListener(configuration, window, DOM_EVENT.INPUT, function () {\n userActivity.input = true;\n }, { capture: true }),\n ];\n return {\n stop: function () {\n listeners.forEach(function (listener) { return listener.stop(); });\n },\n };\n}\nfunction isSelectionEmpty() {\n var selection = window.getSelection();\n return !selection || selection.isCollapsed;\n}\nfunction isValidPointerEvent(event) {\n return (event.target instanceof Element &&\n // Only consider 'primary' pointer events for now. Multi-touch support could be implemented in\n // the future.\n event.isPrimary !== false);\n}\n//# sourceMappingURL=listenActionEvents.js.map","import { ONE_SECOND } from '@datadog/browser-core';\nimport { elementMatches } from '../../browser/polyfills';\nvar MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE = 3;\nexport function computeFrustration(clicks, rageClick) {\n if (isRage(clicks)) {\n rageClick.addFrustration(\"rage_click\" /* FrustrationType.RAGE_CLICK */);\n if (clicks.some(isDead)) {\n rageClick.addFrustration(\"dead_click\" /* FrustrationType.DEAD_CLICK */);\n }\n if (rageClick.hasError) {\n rageClick.addFrustration(\"error_click\" /* FrustrationType.ERROR_CLICK */);\n }\n return { isRage: true };\n }\n var hasSelectionChanged = clicks.some(function (click) { return click.getUserActivity().selection; });\n clicks.forEach(function (click) {\n if (click.hasError) {\n click.addFrustration(\"error_click\" /* FrustrationType.ERROR_CLICK */);\n }\n if (isDead(click) &&\n // Avoid considering clicks part of a double-click or triple-click selections as dead clicks\n !hasSelectionChanged) {\n click.addFrustration(\"dead_click\" /* FrustrationType.DEAD_CLICK */);\n }\n });\n return { isRage: false };\n}\nexport function isRage(clicks) {\n if (clicks.some(function (click) { return click.getUserActivity().selection || click.getUserActivity().scroll; })) {\n return false;\n }\n for (var i = 0; i < clicks.length - (MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE - 1); i += 1) {\n if (clicks[i + MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE - 1].event.timeStamp - clicks[i].event.timeStamp <=\n ONE_SECOND) {\n return true;\n }\n }\n return false;\n}\nvar DEAD_CLICK_EXCLUDE_SELECTOR = \n// inputs that don't trigger a meaningful event like \"input\" when clicked, including textual\n// inputs (using a negative selector is shorter here)\n'input:not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]):not([type=\"range\"]),' +\n 'textarea,' +\n 'select,' +\n // contenteditable and their descendants don't always trigger meaningful changes when manipulated\n '[contenteditable],' +\n '[contenteditable] *,' +\n // canvas, as there is no good way to detect activity occurring on them\n 'canvas,' +\n // links that are interactive (have an href attribute) or any of their descendants, as they can\n // open a new tab or navigate to a hash without triggering a meaningful event\n 'a[href],' +\n 'a[href] *';\nexport function isDead(click) {\n if (click.hasPageActivity || click.getUserActivity().input || click.getUserActivity().scroll) {\n return false;\n }\n return !elementMatches(click.event.target, DEAD_CLICK_EXCLUDE_SELECTOR);\n}\n//# sourceMappingURL=computeFrustration.js.map","import { includes, timeStampNow, Observable, assign, getRelativeTime, ONE_MINUTE, ValueHistory, generateUUID, clocksNow, ONE_SECOND, elapsed, } from '@datadog/browser-core';\nimport { trackEventCounts } from '../trackEventCounts';\nimport { PAGE_ACTIVITY_VALIDATION_DELAY, waitPageActivityEnd } from '../waitPageActivityEnd';\nimport { getSelectorFromElement } from '../getSelectorFromElement';\nimport { createClickChain } from './clickChain';\nimport { getActionNameFromElement } from './getActionNameFromElement';\nimport { listenActionEvents } from './listenActionEvents';\nimport { computeFrustration } from './computeFrustration';\n// Maximum duration for click actions\nexport var CLICK_ACTION_MAX_DURATION = 10 * ONE_SECOND;\nexport var ACTION_CONTEXT_TIME_OUT_DELAY = 5 * ONE_MINUTE; // arbitrary\nexport function trackClickActions(lifeCycle, domMutationObservable, configuration) {\n var history = new ValueHistory(ACTION_CONTEXT_TIME_OUT_DELAY);\n var stopObservable = new Observable();\n var currentClickChain;\n lifeCycle.subscribe(10 /* LifeCycleEventType.SESSION_RENEWED */, function () {\n history.reset();\n });\n lifeCycle.subscribe(5 /* LifeCycleEventType.VIEW_ENDED */, stopClickChain);\n var stopActionEventsListener = listenActionEvents(configuration, {\n onPointerDown: function (pointerDownEvent) {\n return processPointerDown(configuration, lifeCycle, domMutationObservable, pointerDownEvent);\n },\n onPointerUp: function (_a, startEvent, getUserActivity) {\n var clickActionBase = _a.clickActionBase, hadActivityOnPointerDown = _a.hadActivityOnPointerDown;\n return startClickAction(configuration, lifeCycle, domMutationObservable, history, stopObservable, appendClickToClickChain, clickActionBase, startEvent, getUserActivity, hadActivityOnPointerDown);\n },\n }).stop;\n var actionContexts = {\n findActionId: function (startTime) { return history.findAll(startTime); },\n };\n return {\n stop: function () {\n stopClickChain();\n stopObservable.notify();\n stopActionEventsListener();\n },\n actionContexts: actionContexts,\n };\n function appendClickToClickChain(click) {\n if (!currentClickChain || !currentClickChain.tryAppend(click)) {\n var rageClick_1 = click.clone();\n currentClickChain = createClickChain(click, function (clicks) {\n finalizeClicks(clicks, rageClick_1);\n });\n }\n }\n function stopClickChain() {\n if (currentClickChain) {\n currentClickChain.stop();\n }\n }\n}\nfunction processPointerDown(configuration, lifeCycle, domMutationObservable, pointerDownEvent) {\n var clickActionBase = computeClickActionBase(pointerDownEvent, configuration.actionNameAttribute);\n var hadActivityOnPointerDown = false;\n waitPageActivityEnd(lifeCycle, domMutationObservable, configuration, function (pageActivityEndEvent) {\n hadActivityOnPointerDown = pageActivityEndEvent.hadActivity;\n }, \n // We don't care about the activity duration, we just want to know whether an activity did happen\n // within the \"validation delay\" or not. Limit the duration so the callback is called sooner.\n PAGE_ACTIVITY_VALIDATION_DELAY);\n return { clickActionBase: clickActionBase, hadActivityOnPointerDown: function () { return hadActivityOnPointerDown; } };\n}\nfunction startClickAction(configuration, lifeCycle, domMutationObservable, history, stopObservable, appendClickToClickChain, clickActionBase, startEvent, getUserActivity, hadActivityOnPointerDown) {\n var click = newClick(lifeCycle, history, getUserActivity, clickActionBase, startEvent);\n appendClickToClickChain(click);\n var stopWaitPageActivityEnd = waitPageActivityEnd(lifeCycle, domMutationObservable, configuration, function (pageActivityEndEvent) {\n if (pageActivityEndEvent.hadActivity && pageActivityEndEvent.end < click.startClocks.timeStamp) {\n // If the clock is looking weird, just discard the click\n click.discard();\n }\n else {\n if (pageActivityEndEvent.hadActivity) {\n click.stop(pageActivityEndEvent.end);\n }\n else if (hadActivityOnPointerDown()) {\n click.stop(\n // using the click start as activity end, so the click will have some activity but its\n // duration will be 0 (as the activity started before the click start)\n click.startClocks.timeStamp);\n }\n else {\n click.stop();\n }\n }\n }, CLICK_ACTION_MAX_DURATION).stop;\n var viewEndedSubscription = lifeCycle.subscribe(5 /* LifeCycleEventType.VIEW_ENDED */, function (_a) {\n var endClocks = _a.endClocks;\n click.stop(endClocks.timeStamp);\n });\n var stopSubscription = stopObservable.subscribe(function () {\n click.stop();\n });\n click.stopObservable.subscribe(function () {\n viewEndedSubscription.unsubscribe();\n stopWaitPageActivityEnd();\n stopSubscription.unsubscribe();\n });\n}\nfunction computeClickActionBase(event, actionNameAttribute) {\n var rect = event.target.getBoundingClientRect();\n return {\n type: \"click\" /* ActionType.CLICK */,\n target: {\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n selector: getSelectorFromElement(event.target, actionNameAttribute),\n },\n position: {\n // Use clientX and Y because for SVG element offsetX and Y are relatives to the element\n x: Math.round(event.clientX - rect.left),\n y: Math.round(event.clientY - rect.top),\n },\n name: getActionNameFromElement(event.target, actionNameAttribute),\n };\n}\nfunction newClick(lifeCycle, history, getUserActivity, clickActionBase, startEvent) {\n var id = generateUUID();\n var startClocks = clocksNow();\n var historyEntry = history.add(id, startClocks.relative);\n var eventCountsSubscription = trackEventCounts({\n lifeCycle: lifeCycle,\n isChildEvent: function (event) {\n return event.action !== undefined &&\n (Array.isArray(event.action.id) ? includes(event.action.id, id) : event.action.id === id);\n },\n });\n var status = 0 /* ClickStatus.ONGOING */;\n var activityEndTime;\n var frustrationTypes = [];\n var stopObservable = new Observable();\n function stop(newActivityEndTime) {\n if (status !== 0 /* ClickStatus.ONGOING */) {\n return;\n }\n activityEndTime = newActivityEndTime;\n status = 1 /* ClickStatus.STOPPED */;\n if (activityEndTime) {\n historyEntry.close(getRelativeTime(activityEndTime));\n }\n else {\n historyEntry.remove();\n }\n eventCountsSubscription.stop();\n stopObservable.notify();\n }\n return {\n event: startEvent,\n stop: stop,\n stopObservable: stopObservable,\n get hasError() {\n return eventCountsSubscription.eventCounts.errorCount > 0;\n },\n get hasPageActivity() {\n return activityEndTime !== undefined;\n },\n getUserActivity: getUserActivity,\n addFrustration: function (frustrationType) {\n frustrationTypes.push(frustrationType);\n },\n startClocks: startClocks,\n isStopped: function () { return status === 1 /* ClickStatus.STOPPED */ || status === 2 /* ClickStatus.FINALIZED */; },\n clone: function () { return newClick(lifeCycle, history, getUserActivity, clickActionBase, startEvent); },\n validate: function (domEvents) {\n stop();\n if (status !== 1 /* ClickStatus.STOPPED */) {\n return;\n }\n var _a = eventCountsSubscription.eventCounts, resourceCount = _a.resourceCount, errorCount = _a.errorCount, longTaskCount = _a.longTaskCount;\n var clickAction = assign({\n type: \"click\" /* ActionType.CLICK */,\n duration: activityEndTime && elapsed(startClocks.timeStamp, activityEndTime),\n startClocks: startClocks,\n id: id,\n frustrationTypes: frustrationTypes,\n counts: {\n resourceCount: resourceCount,\n errorCount: errorCount,\n longTaskCount: longTaskCount,\n },\n events: domEvents !== null && domEvents !== void 0 ? domEvents : [startEvent],\n event: startEvent,\n }, clickActionBase);\n lifeCycle.notify(1 /* LifeCycleEventType.AUTO_ACTION_COMPLETED */, clickAction);\n status = 2 /* ClickStatus.FINALIZED */;\n },\n discard: function () {\n stop();\n status = 2 /* ClickStatus.FINALIZED */;\n },\n };\n}\nexport function finalizeClicks(clicks, rageClick) {\n var isRage = computeFrustration(clicks, rageClick).isRage;\n if (isRage) {\n clicks.forEach(function (click) { return click.discard(); });\n rageClick.stop(timeStampNow());\n rageClick.validate(clicks.map(function (click) { return click.event; }));\n }\n else {\n rageClick.discard();\n clicks.forEach(function (click) { return click.validate(); });\n }\n}\n//# sourceMappingURL=trackClickActions.js.map","import { noop, assign, combine, toServerDuration, generateUUID, isExperimentalFeatureEnabled, ExperimentalFeature, } from '@datadog/browser-core';\nimport { discardNegativeDuration } from '../discardNegativeDuration';\nimport { trackClickActions } from './trackClickActions';\nexport function startActionCollection(lifeCycle, domMutationObservable, configuration, pageStateHistory) {\n lifeCycle.subscribe(1 /* LifeCycleEventType.AUTO_ACTION_COMPLETED */, function (action) {\n return lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processAction(action, pageStateHistory));\n });\n var actionContexts = { findActionId: noop };\n if (configuration.trackUserInteractions) {\n actionContexts = trackClickActions(lifeCycle, domMutationObservable, configuration).actionContexts;\n }\n return {\n addAction: function (action, savedCommonContext) {\n lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, assign({\n savedCommonContext: savedCommonContext,\n }, processAction(action, pageStateHistory)));\n },\n actionContexts: actionContexts,\n };\n}\nfunction processAction(action, pageStateHistory) {\n var autoActionProperties = isAutoAction(action)\n ? {\n action: {\n id: action.id,\n loading_time: discardNegativeDuration(toServerDuration(action.duration)),\n frustration: {\n type: action.frustrationTypes,\n },\n error: {\n count: action.counts.errorCount,\n },\n long_task: {\n count: action.counts.longTaskCount,\n },\n resource: {\n count: action.counts.resourceCount,\n },\n },\n _dd: {\n action: {\n target: action.target,\n position: action.position,\n },\n },\n }\n : undefined;\n var customerContext = !isAutoAction(action) ? action.context : undefined;\n var actionEvent = combine({\n action: {\n id: generateUUID(),\n target: {\n name: action.name,\n },\n type: action.type,\n },\n date: action.startClocks.timeStamp,\n type: \"action\" /* RumEventType.ACTION */,\n view: { in_foreground: pageStateHistory.wasInPageStateAt(\"active\" /* PageState.ACTIVE */, action.startClocks.relative) },\n }, autoActionProperties);\n var domainContext = isAutoAction(action) ? { events: action.events } : {};\n if (!isAutoAction(action) &&\n action.handlingStack &&\n isExperimentalFeatureEnabled(ExperimentalFeature.MICRO_FRONTEND)) {\n domainContext.handlingStack = action.handlingStack;\n }\n return {\n customerContext: customerContext,\n rawRumEvent: actionEvent,\n startTime: action.startClocks.relative,\n domainContext: domainContext,\n };\n}\nfunction isAutoAction(action) {\n return action.type !== \"custom\" /* ActionType.CUSTOM */;\n}\n//# sourceMappingURL=actionCollection.js.map","import { clocksNow, initConsoleObservable, ErrorSource, ConsoleApiName } from '@datadog/browser-core';\nexport function trackConsoleError(errorObservable) {\n var subscription = initConsoleObservable([ConsoleApiName.error]).subscribe(function (consoleError) {\n return errorObservable.notify({\n startClocks: clocksNow(),\n message: consoleError.message,\n stack: consoleError.stack,\n fingerprint: consoleError.fingerprint,\n source: ErrorSource.CONSOLE,\n handling: \"handled\" /* ErrorHandling.HANDLED */,\n handlingStack: consoleError.handlingStack,\n });\n });\n return {\n stop: function () {\n subscription.unsubscribe();\n },\n };\n}\n//# sourceMappingURL=trackConsoleError.js.map","import { clocksNow, ErrorSource, initReportObservable, RawReportType } from '@datadog/browser-core';\nexport function trackReportError(configuration, errorObservable) {\n var subscription = initReportObservable(configuration, [\n RawReportType.cspViolation,\n RawReportType.intervention,\n ]).subscribe(function (reportError) {\n var rawError = {\n startClocks: clocksNow(),\n message: reportError.message,\n stack: reportError.stack,\n type: reportError.subtype,\n source: ErrorSource.REPORT,\n handling: \"unhandled\" /* ErrorHandling.UNHANDLED */,\n originalError: reportError.originalReport,\n };\n if (reportError.originalReport.type === 'securitypolicyviolation') {\n rawError.csp = {\n disposition: reportError.originalReport.disposition,\n };\n }\n return errorObservable.notify(rawError);\n });\n return {\n stop: function () {\n subscription.unsubscribe();\n },\n };\n}\n//# sourceMappingURL=trackReportError.js.map","import { isEmptyObject, assign, ErrorSource, generateUUID, computeRawError, computeStackTrace, Observable, trackRuntimeError, isExperimentalFeatureEnabled, ExperimentalFeature, } from '@datadog/browser-core';\nimport { trackConsoleError } from './trackConsoleError';\nimport { trackReportError } from './trackReportError';\nexport function startErrorCollection(lifeCycle, configuration, pageStateHistory, featureFlagContexts) {\n var errorObservable = new Observable();\n trackConsoleError(errorObservable);\n trackRuntimeError(errorObservable);\n trackReportError(configuration, errorObservable);\n errorObservable.subscribe(function (error) { return lifeCycle.notify(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error: error }); });\n return doStartErrorCollection(lifeCycle, pageStateHistory, featureFlagContexts);\n}\nexport function doStartErrorCollection(lifeCycle, pageStateHistory, featureFlagContexts) {\n lifeCycle.subscribe(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, function (_a) {\n var error = _a.error, customerContext = _a.customerContext, savedCommonContext = _a.savedCommonContext;\n lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, assign({\n customerContext: customerContext,\n savedCommonContext: savedCommonContext,\n }, processError(error, pageStateHistory, featureFlagContexts)));\n });\n return {\n addError: function (_a, savedCommonContext) {\n var error = _a.error, handlingStack = _a.handlingStack, startClocks = _a.startClocks, customerContext = _a.context;\n var stackTrace = error instanceof Error ? computeStackTrace(error) : undefined;\n var rawError = computeRawError({\n stackTrace: stackTrace,\n originalError: error,\n handlingStack: handlingStack,\n startClocks: startClocks,\n nonErrorPrefix: \"Provided\" /* NonErrorPrefix.PROVIDED */,\n source: ErrorSource.CUSTOM,\n handling: \"handled\" /* ErrorHandling.HANDLED */,\n });\n lifeCycle.notify(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, {\n customerContext: customerContext,\n savedCommonContext: savedCommonContext,\n error: rawError,\n });\n },\n };\n}\nfunction processError(error, pageStateHistory, featureFlagContexts) {\n var rawRumEvent = {\n date: error.startClocks.timeStamp,\n error: {\n id: generateUUID(),\n message: error.message,\n source: error.source,\n stack: error.stack,\n handling_stack: error.handlingStack,\n type: error.type,\n handling: error.handling,\n causes: error.causes,\n source_type: 'browser',\n fingerprint: error.fingerprint,\n csp: error.csp,\n },\n type: \"error\" /* RumEventType.ERROR */,\n view: { in_foreground: pageStateHistory.wasInPageStateAt(\"active\" /* PageState.ACTIVE */, error.startClocks.relative) },\n };\n var featureFlagContext = featureFlagContexts.findFeatureFlagEvaluations(error.startClocks.relative);\n if (featureFlagContext && !isEmptyObject(featureFlagContext)) {\n rawRumEvent.feature_flags = featureFlagContext;\n }\n var domainContext = {\n error: error.originalError,\n };\n if (isExperimentalFeatureEnabled(ExperimentalFeature.MICRO_FRONTEND)) {\n domainContext.handlingStack = error.handlingStack;\n }\n return {\n rawRumEvent: rawRumEvent,\n startTime: error.startClocks.relative,\n domainContext: domainContext,\n };\n}\n//# sourceMappingURL=errorCollection.js.map","import { toServerDuration, relativeToClocks, generateUUID } from '@datadog/browser-core';\nimport { RumPerformanceEntryType } from '../../browser/performanceCollection';\nexport function startLongTaskCollection(lifeCycle, configuration) {\n lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if (entry.entryType !== RumPerformanceEntryType.LONG_TASK) {\n break;\n }\n if (!configuration.trackLongTasks) {\n break;\n }\n var startClocks = relativeToClocks(entry.startTime);\n var rawRumEvent = {\n date: startClocks.timeStamp,\n long_task: {\n id: generateUUID(),\n duration: toServerDuration(entry.duration),\n },\n type: \"long_task\" /* RumEventType.LONG_TASK */,\n _dd: {\n discarded: false,\n },\n };\n lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, {\n rawRumEvent: rawRumEvent,\n startTime: startClocks.relative,\n domainContext: { performanceEntry: entry },\n });\n }\n });\n}\n//# sourceMappingURL=longTaskCollection.js.map","import { addDuration } from '@datadog/browser-core';\nimport { WeakSet } from '../../browser/polyfills';\nimport { isValidEntry } from './resourceUtils';\nvar alreadyMatchedEntries = new WeakSet();\n/**\n * Look for corresponding timing in resource timing buffer\n *\n * Observations:\n * - Timing (start, end) are nested inside the request (start, end)\n * - Some timing can be not exactly nested, being off by < 1 ms\n *\n * Strategy:\n * - from valid nested entries (with 1 ms error margin)\n * - filter out timing that were already matched to a request\n * - then, if a single timing match, return the timing\n * - otherwise we can't decide, return undefined\n */\nexport function matchRequestTiming(request) {\n if (!performance || !('getEntriesByName' in performance)) {\n return;\n }\n var sameNameEntries = performance.getEntriesByName(request.url, 'resource');\n if (!sameNameEntries.length || !('toJSON' in sameNameEntries[0])) {\n return;\n }\n var candidates = sameNameEntries\n .filter(function (entry) { return !alreadyMatchedEntries.has(entry); })\n .filter(function (entry) { return isValidEntry(entry); })\n .filter(function (entry) {\n return isBetween(entry, request.startClocks.relative, endTime({ startTime: request.startClocks.relative, duration: request.duration }));\n });\n if (candidates.length === 1) {\n alreadyMatchedEntries.add(candidates[0]);\n return candidates[0].toJSON();\n }\n return;\n}\nfunction endTime(timing) {\n return addDuration(timing.startTime, timing.duration);\n}\nfunction isBetween(timing, start, end) {\n var errorMargin = 1;\n return timing.startTime >= start - errorMargin && endTime(timing) <= addDuration(end, errorMargin);\n}\n//# sourceMappingURL=matchRequestTiming.js.map","import { combine, generateUUID, toServerDuration, relativeToClocks, assign, isNumber, ExperimentalFeature, isExperimentalFeatureEnabled, } from '@datadog/browser-core';\nimport { RumPerformanceEntryType } from '../../browser/performanceCollection';\nimport { matchRequestTiming } from './matchRequestTiming';\nimport { computePerformanceResourceDetails, computePerformanceResourceDuration, computeResourceKind, computeSize, isRequestKind, isLongDataUrl, sanitizeDataUrl, } from './resourceUtils';\nexport function startResourceCollection(lifeCycle, configuration, pageStateHistory) {\n lifeCycle.subscribe(8 /* LifeCycleEventType.REQUEST_COMPLETED */, function (request) {\n var rawEvent = processRequest(request, configuration, pageStateHistory);\n if (rawEvent) {\n lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, rawEvent);\n }\n });\n lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if (entry.entryType === RumPerformanceEntryType.RESOURCE && !isRequestKind(entry)) {\n var rawEvent = processResourceEntry(entry, configuration);\n if (rawEvent) {\n lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, rawEvent);\n }\n }\n }\n });\n}\nfunction processRequest(request, configuration, pageStateHistory) {\n var matchingTiming = matchRequestTiming(request);\n var startClocks = matchingTiming ? relativeToClocks(matchingTiming.startTime) : request.startClocks;\n var tracingInfo = computeRequestTracingInfo(request, configuration);\n if (!configuration.trackResources && !tracingInfo) {\n return;\n }\n var type = request.type === \"xhr\" /* RequestType.XHR */ ? \"xhr\" /* ResourceType.XHR */ : \"fetch\" /* ResourceType.FETCH */;\n var correspondingTimingOverrides = matchingTiming ? computePerformanceEntryMetrics(matchingTiming) : undefined;\n var duration = computeRequestDuration(pageStateHistory, startClocks, request.duration);\n var resourceEvent = combine({\n date: startClocks.timeStamp,\n resource: {\n id: generateUUID(),\n type: type,\n duration: duration,\n method: request.method,\n status_code: request.status,\n url: isLongDataUrl(request.url) ? sanitizeDataUrl(request.url) : request.url,\n },\n type: \"resource\" /* RumEventType.RESOURCE */,\n _dd: {\n discarded: !configuration.trackResources,\n },\n }, tracingInfo, correspondingTimingOverrides);\n var collectedData = {\n startTime: startClocks.relative,\n rawRumEvent: resourceEvent,\n domainContext: {\n performanceEntry: matchingTiming,\n xhr: request.xhr,\n response: request.response,\n requestInput: request.input,\n requestInit: request.init,\n error: request.error,\n isAborted: request.isAborted,\n },\n };\n if (isExperimentalFeatureEnabled(ExperimentalFeature.MICRO_FRONTEND)) {\n collectedData.domainContext.handlingStack = request.handlingStack;\n }\n return collectedData;\n}\nfunction processResourceEntry(entry, configuration) {\n var startClocks = relativeToClocks(entry.startTime);\n var tracingInfo = computeEntryTracingInfo(entry, configuration);\n if (!configuration.trackResources && !tracingInfo) {\n return;\n }\n var type = computeResourceKind(entry);\n var entryMetrics = computePerformanceEntryMetrics(entry);\n var resourceEvent = combine({\n date: startClocks.timeStamp,\n resource: {\n id: generateUUID(),\n type: type,\n url: entry.name,\n status_code: discardZeroStatus(entry.responseStatus),\n },\n type: \"resource\" /* RumEventType.RESOURCE */,\n _dd: {\n discarded: !configuration.trackResources,\n },\n }, tracingInfo, entryMetrics);\n return {\n startTime: startClocks.relative,\n rawRumEvent: resourceEvent,\n domainContext: {\n performanceEntry: entry,\n },\n };\n}\nfunction computePerformanceEntryMetrics(timing) {\n var renderBlockingStatus = timing.renderBlockingStatus;\n return {\n resource: assign({\n duration: computePerformanceResourceDuration(timing),\n render_blocking_status: renderBlockingStatus,\n }, computeSize(timing), computePerformanceResourceDetails(timing)),\n };\n}\nfunction computeRequestTracingInfo(request, configuration) {\n var hasBeenTraced = request.traceSampled && request.traceId && request.spanId;\n if (!hasBeenTraced) {\n return undefined;\n }\n return {\n _dd: {\n span_id: request.spanId.toDecimalString(),\n trace_id: request.traceId.toDecimalString(),\n rule_psr: getRulePsr(configuration),\n },\n };\n}\nfunction computeEntryTracingInfo(entry, configuration) {\n var hasBeenTraced = entry.traceId;\n if (!hasBeenTraced) {\n return undefined;\n }\n return {\n _dd: {\n trace_id: entry.traceId,\n rule_psr: getRulePsr(configuration),\n },\n };\n}\n/**\n * @returns number between 0 and 1 which represents trace sample rate\n */\nfunction getRulePsr(configuration) {\n return isNumber(configuration.traceSampleRate) ? configuration.traceSampleRate / 100 : undefined;\n}\nfunction computeRequestDuration(pageStateHistory, startClocks, duration) {\n return !pageStateHistory.wasInPageStateDuringPeriod(\"frozen\" /* PageState.FROZEN */, startClocks.relative, duration)\n ? toServerDuration(duration)\n : undefined;\n}\n/**\n * The status is 0 for cross-origin resources without CORS headers, so the status is meaningless, and we shouldn't report it\n * https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/responseStatus#cross-origin_response_status_codes\n */\nfunction discardZeroStatus(statusCode) {\n return statusCode === 0 ? undefined : statusCode;\n}\n//# sourceMappingURL=resourceCollection.js.map","import { trackEventCounts } from '../trackEventCounts';\nexport function trackViewEventCounts(lifeCycle, viewId, onChange) {\n var _a = trackEventCounts({\n lifeCycle: lifeCycle,\n isChildEvent: function (event) { return event.view.id === viewId; },\n onChange: onChange,\n }), stop = _a.stop, eventCounts = _a.eventCounts;\n return {\n stop: stop,\n eventCounts: eventCounts,\n };\n}\n//# sourceMappingURL=trackViewEventCounts.js.map","import { ONE_MINUTE, find } from '@datadog/browser-core';\nimport { RumPerformanceEntryType } from '../../../browser/performanceCollection';\n// Discard FCP timings above a certain delay to avoid incorrect data\n// It happens in some cases like sleep mode or some browser implementations\nexport var FCP_MAXIMUM_DELAY = 10 * ONE_MINUTE;\nexport function trackFirstContentfulPaint(lifeCycle, firstHidden, callback) {\n var unsubscribeLifeCycle = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n var fcpEntry = find(entries, function (entry) {\n return entry.entryType === RumPerformanceEntryType.PAINT &&\n entry.name === 'first-contentful-paint' &&\n entry.startTime < firstHidden.timeStamp &&\n entry.startTime < FCP_MAXIMUM_DELAY;\n });\n if (fcpEntry) {\n callback(fcpEntry.startTime);\n }\n }).unsubscribe;\n return {\n stop: unsubscribeLifeCycle,\n };\n}\n//# sourceMappingURL=trackFirstContentfulPaint.js.map","import { elapsed, find } from '@datadog/browser-core';\nimport { isElementNode } from '../../../browser/htmlDomUtils';\nimport { RumPerformanceEntryType } from '../../../browser/performanceCollection';\nimport { getSelectorFromElement } from '../../getSelectorFromElement';\n/**\n * Track the first input occurring during the initial View to return:\n * - First Input Delay\n * - First Input Time\n * Callback is called at most one time.\n * Documentation: https://web.dev/fid/\n * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getFID.ts\n */\nexport function trackFirstInput(lifeCycle, configuration, firstHidden, callback) {\n var unsubscribeLifeCycle = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n var firstInputEntry = find(entries, function (entry) {\n return entry.entryType === RumPerformanceEntryType.FIRST_INPUT && entry.startTime < firstHidden.timeStamp;\n });\n if (firstInputEntry) {\n var firstInputDelay = elapsed(firstInputEntry.startTime, firstInputEntry.processingStart);\n var firstInputTargetSelector = void 0;\n if (firstInputEntry.target && isElementNode(firstInputEntry.target)) {\n firstInputTargetSelector = getSelectorFromElement(firstInputEntry.target, configuration.actionNameAttribute);\n }\n callback({\n // Ensure firstInputDelay to be positive, see\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1185815\n delay: firstInputDelay >= 0 ? firstInputDelay : 0,\n time: firstInputEntry.startTime,\n targetSelector: firstInputTargetSelector,\n });\n }\n }).unsubscribe;\n return {\n stop: unsubscribeLifeCycle,\n };\n}\n//# sourceMappingURL=trackFirstInput.js.map","import { relativeNow } from '@datadog/browser-core';\nimport { RumPerformanceEntryType } from '../../../browser/performanceCollection';\nexport function trackNavigationTimings(lifeCycle, callback) {\n var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if (entry.entryType === RumPerformanceEntryType.NAVIGATION) {\n callback({\n domComplete: entry.domComplete,\n domContentLoaded: entry.domContentLoadedEventEnd,\n domInteractive: entry.domInteractive,\n loadEvent: entry.loadEventEnd,\n // In some cases the value reported is negative or is larger\n // than the current page time. Ignore these cases:\n // https://github.com/GoogleChrome/web-vitals/issues/137\n // https://github.com/GoogleChrome/web-vitals/issues/162\n firstByte: entry.responseStart >= 0 && entry.responseStart <= relativeNow() ? entry.responseStart : undefined,\n });\n }\n }\n }).unsubscribe;\n return { stop: stop };\n}\n//# sourceMappingURL=trackNavigationTimings.js.map","import { DOM_EVENT, ONE_MINUTE, addEventListeners, findLast } from '@datadog/browser-core';\nimport { RumPerformanceEntryType } from '../../../browser/performanceCollection';\nimport { getSelectorFromElement } from '../../getSelectorFromElement';\n// Discard LCP timings above a certain delay to avoid incorrect data\n// It happens in some cases like sleep mode or some browser implementations\nexport var LCP_MAXIMUM_DELAY = 10 * ONE_MINUTE;\n/**\n * Track the largest contentful paint (LCP) occurring during the initial View. This can yield\n * multiple values, only the most recent one should be used.\n * Documentation: https://web.dev/lcp/\n * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/onLCP.ts\n */\nexport function trackLargestContentfulPaint(lifeCycle, configuration, firstHidden, eventTarget, callback) {\n // Ignore entries that come after the first user interaction. According to the documentation, the\n // browser should not send largest-contentful-paint entries after a user interact with the page,\n // but the web-vitals reference implementation uses this as a safeguard.\n var firstInteractionTimestamp = Infinity;\n var stopEventListener = addEventListeners(configuration, eventTarget, [DOM_EVENT.POINTER_DOWN, DOM_EVENT.KEY_DOWN], function (event) {\n firstInteractionTimestamp = event.timeStamp;\n }, { capture: true, once: true }).stop;\n var biggestLcpSize = 0;\n var unsubscribeLifeCycle = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n var lcpEntry = findLast(entries, function (entry) {\n return entry.entryType === RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT &&\n entry.startTime < firstInteractionTimestamp &&\n entry.startTime < firstHidden.timeStamp &&\n entry.startTime < LCP_MAXIMUM_DELAY &&\n // Ensure to get the LCP entry with the biggest size, see\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1516655\n entry.size > biggestLcpSize;\n });\n if (lcpEntry) {\n var lcpTargetSelector = void 0;\n if (lcpEntry.element) {\n lcpTargetSelector = getSelectorFromElement(lcpEntry.element, configuration.actionNameAttribute);\n }\n callback({\n value: lcpEntry.startTime,\n targetSelector: lcpTargetSelector,\n });\n biggestLcpSize = lcpEntry.size;\n }\n }).unsubscribe;\n return {\n stop: function () {\n stopEventListener();\n unsubscribeLifeCycle();\n },\n };\n}\n//# sourceMappingURL=trackLargestContentfulPaint.js.map","import { addEventListeners, DOM_EVENT } from '@datadog/browser-core';\nexport function trackFirstHidden(configuration, eventTarget) {\n if (eventTarget === void 0) { eventTarget = window; }\n var timeStamp;\n var stopListeners;\n if (document.visibilityState === 'hidden') {\n timeStamp = 0;\n }\n else {\n timeStamp = Infinity;\n (stopListeners = addEventListeners(configuration, eventTarget, [DOM_EVENT.PAGE_HIDE, DOM_EVENT.VISIBILITY_CHANGE], function (event) {\n if (event.type === DOM_EVENT.PAGE_HIDE || document.visibilityState === 'hidden') {\n timeStamp = event.timeStamp;\n stopListeners();\n }\n }, { capture: true }).stop);\n }\n return {\n get timeStamp() {\n return timeStamp;\n },\n stop: function () {\n stopListeners === null || stopListeners === void 0 ? void 0 : stopListeners();\n },\n };\n}\n//# sourceMappingURL=trackFirstHidden.js.map","import { trackFirstContentfulPaint } from './trackFirstContentfulPaint';\nimport { trackFirstInput } from './trackFirstInput';\nimport { trackNavigationTimings } from './trackNavigationTimings';\nimport { trackLargestContentfulPaint } from './trackLargestContentfulPaint';\nimport { trackFirstHidden } from './trackFirstHidden';\nexport function trackInitialViewMetrics(lifeCycle, configuration, setLoadEvent, scheduleViewUpdate) {\n var initialViewMetrics = {};\n var stopNavigationTracking = trackNavigationTimings(lifeCycle, function (navigationTimings) {\n setLoadEvent(navigationTimings.loadEvent);\n initialViewMetrics.navigationTimings = navigationTimings;\n scheduleViewUpdate();\n }).stop;\n var firstHidden = trackFirstHidden(configuration);\n var stopFCPTracking = trackFirstContentfulPaint(lifeCycle, firstHidden, function (firstContentfulPaint) {\n initialViewMetrics.firstContentfulPaint = firstContentfulPaint;\n scheduleViewUpdate();\n }).stop;\n var stopLCPTracking = trackLargestContentfulPaint(lifeCycle, configuration, firstHidden, window, function (largestContentfulPaint) {\n initialViewMetrics.largestContentfulPaint = largestContentfulPaint;\n scheduleViewUpdate();\n }).stop;\n var stopFIDTracking = trackFirstInput(lifeCycle, configuration, firstHidden, function (firstInput) {\n initialViewMetrics.firstInput = firstInput;\n scheduleViewUpdate();\n }).stop;\n function stop() {\n stopNavigationTracking();\n stopFCPTracking();\n stopLCPTracking();\n stopFIDTracking();\n firstHidden.stop();\n }\n return {\n stop: stop,\n initialViewMetrics: initialViewMetrics,\n };\n}\n//# sourceMappingURL=trackInitialViewMetrics.js.map","import { round, find, ONE_SECOND, noop } from '@datadog/browser-core';\nimport { isElementNode } from '../../../browser/htmlDomUtils';\nimport { supportPerformanceTimingEvent, RumPerformanceEntryType } from '../../../browser/performanceCollection';\nimport { getSelectorFromElement } from '../../getSelectorFromElement';\n/**\n * Track the cumulative layout shifts (CLS).\n * Layout shifts are grouped into session windows.\n * The minimum gap between session windows is 1 second.\n * The maximum duration of a session window is 5 second.\n * The session window layout shift value is the sum of layout shifts inside it.\n * The CLS value is the max of session windows values.\n *\n * This yields a new value whenever the CLS value is updated (a higher session window value is computed).\n *\n * See isLayoutShiftSupported to check for browser support.\n *\n * Documentation:\n * https://web.dev/cls/\n * https://web.dev/evolving-cls/\n * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getCLS.ts\n */\nexport function trackCumulativeLayoutShift(configuration, lifeCycle, callback) {\n if (!isLayoutShiftSupported()) {\n return {\n stop: noop,\n };\n }\n var maxClsValue = 0;\n // WeakRef is not supported in IE11 and Safari mobile, but so is the layout shift API, so this code won't be executed in these browsers\n var maxClsTarget;\n // if no layout shift happen the value should be reported as 0\n callback({\n value: 0,\n });\n var window = slidingSessionWindow();\n var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if (entry.entryType === RumPerformanceEntryType.LAYOUT_SHIFT && !entry.hadRecentInput) {\n var _a = window.update(entry), cumulatedValue = _a.cumulatedValue, isMaxValue = _a.isMaxValue;\n if (isMaxValue) {\n var target = getTargetFromSource(entry.sources);\n maxClsTarget = target ? new WeakRef(target) : undefined;\n }\n if (cumulatedValue > maxClsValue) {\n maxClsValue = cumulatedValue;\n var target = maxClsTarget === null || maxClsTarget === void 0 ? void 0 : maxClsTarget.deref();\n callback({\n value: round(maxClsValue, 4),\n targetSelector: target && getSelectorFromElement(target, configuration.actionNameAttribute),\n });\n }\n }\n }\n }).unsubscribe;\n return {\n stop: stop,\n };\n}\nfunction getTargetFromSource(sources) {\n var _a;\n if (!sources) {\n return;\n }\n return (_a = find(sources, function (source) { return !!source.node && isElementNode(source.node); })) === null || _a === void 0 ? void 0 : _a.node;\n}\nexport var MAX_WINDOW_DURATION = 5 * ONE_SECOND;\nvar MAX_UPDATE_GAP = ONE_SECOND;\nfunction slidingSessionWindow() {\n var cumulatedValue = 0;\n var startTime;\n var endTime;\n var maxValue = 0;\n return {\n update: function (entry) {\n var shouldCreateNewWindow = startTime === undefined ||\n entry.startTime - endTime >= MAX_UPDATE_GAP ||\n entry.startTime - startTime >= MAX_WINDOW_DURATION;\n var isMaxValue;\n if (shouldCreateNewWindow) {\n startTime = endTime = entry.startTime;\n maxValue = cumulatedValue = entry.value;\n isMaxValue = true;\n }\n else {\n cumulatedValue += entry.value;\n endTime = entry.startTime;\n isMaxValue = entry.value > maxValue;\n if (isMaxValue) {\n maxValue = entry.value;\n }\n }\n return {\n cumulatedValue: cumulatedValue,\n isMaxValue: isMaxValue,\n };\n },\n };\n}\n/**\n * Check whether `layout-shift` is supported by the browser.\n */\nexport function isLayoutShiftSupported() {\n return supportPerformanceTimingEvent(RumPerformanceEntryType.LAYOUT_SHIFT);\n}\n//# sourceMappingURL=trackCumulativeLayoutShift.js.map","/**\n * performance.interactionCount polyfill\n *\n * The interactionCount is an integer which counts the total number of distinct user interactions,\n * for which there was a unique interactionId.\n *\n * The interactionCount polyfill is an estimate based on a convention specific to Chrome. Cf: https://github.com/GoogleChrome/web-vitals/pull/213\n * This is currently not an issue as the polyfill is only used for INP which is currently only supported on Chrome.\n * Hopefully when/if other browsers will support INP, they will also implement performance.interactionCount at the same time, so we won't need that polyfill.\n *\n * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/main/src/lib/polyfills/interactionCountPolyfill.ts\n */\nimport { monitor } from '@datadog/browser-core';\nvar observer;\nvar interactionCountEstimate = 0;\nvar minKnownInteractionId = Infinity;\nvar maxKnownInteractionId = 0;\nexport function initInteractionCountPolyfill() {\n if ('interactionCount' in performance || observer) {\n return;\n }\n observer = new window.PerformanceObserver(monitor(function (entries) {\n entries.getEntries().forEach(function (e) {\n var entry = e;\n if (entry.interactionId) {\n minKnownInteractionId = Math.min(minKnownInteractionId, entry.interactionId);\n maxKnownInteractionId = Math.max(maxKnownInteractionId, entry.interactionId);\n interactionCountEstimate = (maxKnownInteractionId - minKnownInteractionId) / 7 + 1;\n }\n });\n }));\n observer.observe({ type: 'event', buffered: true, durationThreshold: 0 });\n}\n/**\n * Returns the `interactionCount` value using the native API (if available)\n * or the polyfill estimate in this module.\n */\nexport var getInteractionCount = function () {\n return observer ? interactionCountEstimate : window.performance.interactionCount || 0;\n};\n//# sourceMappingURL=interactionCountPolyfill.js.map","import { noop, ONE_MINUTE } from '@datadog/browser-core';\nimport { RumPerformanceEntryType, supportPerformanceTimingEvent } from '../../../browser/performanceCollection';\nimport { getSelectorFromElement } from '../../getSelectorFromElement';\nimport { isElementNode } from '../../../browser/htmlDomUtils';\nimport { getInteractionCount, initInteractionCountPolyfill } from './interactionCountPolyfill';\n// Arbitrary value to prevent unnecessary memory usage on views with lots of interactions.\nvar MAX_INTERACTION_ENTRIES = 10;\n// Arbitrary value to cap INP outliers\nexport var MAX_INP_VALUE = (1 * ONE_MINUTE);\n/**\n * Track the interaction to next paint (INP).\n * To avoid outliers, return the p98 worst interaction of the view.\n * Documentation: https://web.dev/inp/\n * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/main/src/onINP.ts\n */\nexport function trackInteractionToNextPaint(configuration, viewStart, viewLoadingType, lifeCycle) {\n if (!isInteractionToNextPaintSupported()) {\n return {\n getInteractionToNextPaint: function () { return undefined; },\n setViewEnd: noop,\n stop: noop,\n };\n }\n var _a = trackViewInteractionCount(viewLoadingType), getViewInteractionCount = _a.getViewInteractionCount, stopViewInteractionCount = _a.stopViewInteractionCount;\n var viewEnd = Infinity;\n var longestInteractions = trackLongestInteractions(getViewInteractionCount);\n var interactionToNextPaint = -1;\n var interactionToNextPaintTargetSelector;\n var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if ((entry.entryType === RumPerformanceEntryType.EVENT ||\n entry.entryType === RumPerformanceEntryType.FIRST_INPUT) &&\n entry.interactionId &&\n // Check the entry start time is inside the view bounds because some view interactions can be reported after the view end (if long duration).\n entry.startTime >= viewStart &&\n entry.startTime <= viewEnd) {\n longestInteractions.process(entry);\n }\n }\n var newInteraction = longestInteractions.estimateP98Interaction();\n if (newInteraction && newInteraction.duration !== interactionToNextPaint) {\n interactionToNextPaint = newInteraction.duration;\n if (newInteraction.target && isElementNode(newInteraction.target)) {\n interactionToNextPaintTargetSelector = getSelectorFromElement(newInteraction.target, configuration.actionNameAttribute);\n }\n else {\n interactionToNextPaintTargetSelector = undefined;\n }\n }\n }).unsubscribe;\n return {\n getInteractionToNextPaint: function () {\n // If no INP duration where captured because of the performanceObserver 40ms threshold\n // but the view interaction count > 0 then report 0\n if (interactionToNextPaint >= 0) {\n return {\n value: Math.min(interactionToNextPaint, MAX_INP_VALUE),\n targetSelector: interactionToNextPaintTargetSelector,\n };\n }\n else if (getViewInteractionCount()) {\n return {\n value: 0,\n };\n }\n },\n setViewEnd: function (viewEndTime) {\n viewEnd = viewEndTime;\n stopViewInteractionCount();\n },\n stop: stop,\n };\n}\nfunction trackLongestInteractions(getViewInteractionCount) {\n var longestInteractions = [];\n function sortAndTrimLongestInteractions() {\n longestInteractions.sort(function (a, b) { return b.duration - a.duration; }).splice(MAX_INTERACTION_ENTRIES);\n }\n return {\n /**\n * Process the performance entry:\n * - if its duration is long enough, add the performance entry to the list of worst interactions\n * - if an entry with the same interaction id exists and its duration is lower than the new one, then replace it in the list of worst interactions\n */\n process: function (entry) {\n var interactionIndex = longestInteractions.findIndex(function (interaction) { return entry.interactionId === interaction.interactionId; });\n var minLongestInteraction = longestInteractions[longestInteractions.length - 1];\n if (interactionIndex !== -1) {\n if (entry.duration > longestInteractions[interactionIndex].duration) {\n longestInteractions[interactionIndex] = entry;\n sortAndTrimLongestInteractions();\n }\n }\n else if (longestInteractions.length < MAX_INTERACTION_ENTRIES ||\n entry.duration > minLongestInteraction.duration) {\n longestInteractions.push(entry);\n sortAndTrimLongestInteractions();\n }\n },\n /**\n * Compute the p98 longest interaction.\n * For better performance the computation is based on 10 longest interactions and the interaction count of the current view.\n */\n estimateP98Interaction: function () {\n var interactionIndex = Math.min(longestInteractions.length - 1, Math.floor(getViewInteractionCount() / 50));\n return longestInteractions[interactionIndex];\n },\n };\n}\nexport function trackViewInteractionCount(viewLoadingType) {\n initInteractionCountPolyfill();\n var previousInteractionCount = viewLoadingType === \"initial_load\" /* ViewLoadingType.INITIAL_LOAD */ ? 0 : getInteractionCount();\n var state = { stopped: false };\n function computeViewInteractionCount() {\n return getInteractionCount() - previousInteractionCount;\n }\n return {\n getViewInteractionCount: function () {\n if (state.stopped) {\n return state.interactionCount;\n }\n return computeViewInteractionCount();\n },\n stopViewInteractionCount: function () {\n state = { stopped: true, interactionCount: computeViewInteractionCount() };\n },\n };\n}\nexport function isInteractionToNextPaintSupported() {\n return (supportPerformanceTimingEvent(RumPerformanceEntryType.EVENT) &&\n window.PerformanceEventTiming &&\n 'interactionId' in PerformanceEventTiming.prototype);\n}\n//# sourceMappingURL=trackInteractionToNextPaint.js.map","import { elapsed } from '@datadog/browser-core';\nimport { waitPageActivityEnd } from '../../waitPageActivityEnd';\nexport function trackLoadingTime(lifeCycle, domMutationObservable, configuration, loadType, viewStart, callback) {\n var isWaitingForLoadEvent = loadType === \"initial_load\" /* ViewLoadingType.INITIAL_LOAD */;\n var isWaitingForActivityLoadingTime = true;\n var loadingTimeCandidates = [];\n function invokeCallbackIfAllCandidatesAreReceived() {\n if (!isWaitingForActivityLoadingTime && !isWaitingForLoadEvent && loadingTimeCandidates.length > 0) {\n callback(Math.max.apply(Math, loadingTimeCandidates));\n }\n }\n var stop = waitPageActivityEnd(lifeCycle, domMutationObservable, configuration, function (event) {\n if (isWaitingForActivityLoadingTime) {\n isWaitingForActivityLoadingTime = false;\n if (event.hadActivity) {\n loadingTimeCandidates.push(elapsed(viewStart.timeStamp, event.end));\n }\n invokeCallbackIfAllCandidatesAreReceived();\n }\n }).stop;\n return {\n stop: stop,\n setLoadEvent: function (loadEvent) {\n if (isWaitingForLoadEvent) {\n isWaitingForLoadEvent = false;\n loadingTimeCandidates.push(loadEvent);\n invokeCallbackIfAllCandidatesAreReceived();\n }\n },\n };\n}\n//# sourceMappingURL=trackLoadingTime.js.map","export function getScrollX() {\n var scrollX;\n var visual = window.visualViewport;\n if (visual) {\n scrollX = visual.pageLeft - visual.offsetLeft;\n }\n else if (window.scrollX !== undefined) {\n scrollX = window.scrollX;\n }\n else {\n scrollX = window.pageXOffset || 0;\n }\n return Math.round(scrollX);\n}\nexport function getScrollY() {\n var scrollY;\n var visual = window.visualViewport;\n if (visual) {\n scrollY = visual.pageTop - visual.offsetTop;\n }\n else if (window.scrollY !== undefined) {\n scrollY = window.scrollY;\n }\n else {\n scrollY = window.pageYOffset || 0;\n }\n return Math.round(scrollY);\n}\n//# sourceMappingURL=scroll.js.map","import { Observable, throttle, addEventListener, DOM_EVENT } from '@datadog/browser-core';\nvar viewportObservable;\nexport function initViewportObservable(configuration) {\n if (!viewportObservable) {\n viewportObservable = createViewportObservable(configuration);\n }\n return viewportObservable;\n}\nexport function createViewportObservable(configuration) {\n return new Observable(function (observable) {\n var updateDimension = throttle(function () {\n observable.notify(getViewportDimension());\n }, 200).throttled;\n return addEventListener(configuration, window, DOM_EVENT.RESIZE, updateDimension, { capture: true, passive: true })\n .stop;\n });\n}\n// excludes the width and height of any rendered classic scrollbar that is fixed to the visual viewport\nexport function getViewportDimension() {\n var visual = window.visualViewport;\n if (visual) {\n return {\n width: Number(visual.width * visual.scale),\n height: Number(visual.height * visual.scale),\n };\n }\n return {\n width: Number(window.innerWidth || 0),\n height: Number(window.innerHeight || 0),\n };\n}\n//# sourceMappingURL=viewportObservable.js.map","import { Observable, ONE_SECOND, elapsed, relativeNow, throttle, addEventListener, DOM_EVENT, monitor, } from '@datadog/browser-core';\nimport { getScrollY } from '../../../browser/scroll';\nimport { getViewportDimension } from '../../../browser/viewportObservable';\n/** Arbitrary scroll throttle duration */\nexport var THROTTLE_SCROLL_DURATION = ONE_SECOND;\nexport function trackScrollMetrics(configuration, viewStart, callback, scrollValues) {\n if (scrollValues === void 0) { scrollValues = createScrollValuesObservable(configuration); }\n var maxScrollDepth = 0;\n var maxScrollHeight = 0;\n var maxScrollHeightTime = 0;\n var subscription = scrollValues.subscribe(function (_a) {\n var scrollDepth = _a.scrollDepth, scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight;\n var shouldUpdate = false;\n if (scrollDepth > maxScrollDepth) {\n maxScrollDepth = scrollDepth;\n shouldUpdate = true;\n }\n if (scrollHeight > maxScrollHeight) {\n maxScrollHeight = scrollHeight;\n var now = relativeNow();\n maxScrollHeightTime = elapsed(viewStart.relative, now);\n shouldUpdate = true;\n }\n if (shouldUpdate) {\n callback({\n maxDepth: Math.min(maxScrollDepth, maxScrollHeight),\n maxDepthScrollTop: scrollTop,\n maxScrollHeight: maxScrollHeight,\n maxScrollHeightTime: maxScrollHeightTime,\n });\n }\n });\n return {\n stop: function () { return subscription.unsubscribe(); },\n };\n}\nexport function computeScrollValues() {\n var scrollTop = getScrollY();\n var height = getViewportDimension().height;\n var scrollHeight = Math.round((document.scrollingElement || document.documentElement).scrollHeight);\n var scrollDepth = Math.round(height + scrollTop);\n return {\n scrollHeight: scrollHeight,\n scrollDepth: scrollDepth,\n scrollTop: scrollTop,\n };\n}\nexport function createScrollValuesObservable(configuration, throttleDuration) {\n if (throttleDuration === void 0) { throttleDuration = THROTTLE_SCROLL_DURATION; }\n return new Observable(function (observable) {\n function notify() {\n observable.notify(computeScrollValues());\n }\n if (window.ResizeObserver) {\n var throttledNotify_1 = throttle(notify, throttleDuration, {\n leading: false,\n trailing: true,\n });\n var observerTarget_1 = document.scrollingElement || document.documentElement;\n var resizeObserver_1 = new ResizeObserver(monitor(throttledNotify_1.throttled));\n resizeObserver_1.observe(observerTarget_1);\n var eventListener_1 = addEventListener(configuration, window, DOM_EVENT.SCROLL, throttledNotify_1.throttled, {\n passive: true,\n });\n return function () {\n throttledNotify_1.cancel();\n resizeObserver_1.unobserve(observerTarget_1);\n eventListener_1.stop();\n };\n }\n });\n}\n//# sourceMappingURL=trackScrollMetrics.js.map","import { trackCumulativeLayoutShift } from './trackCumulativeLayoutShift';\nimport { trackInteractionToNextPaint } from './trackInteractionToNextPaint';\nimport { trackLoadingTime } from './trackLoadingTime';\nimport { trackScrollMetrics } from './trackScrollMetrics';\nexport function trackCommonViewMetrics(lifeCycle, domMutationObservable, configuration, scheduleViewUpdate, loadingType, viewStart) {\n var commonViewMetrics = {};\n var _a = trackLoadingTime(lifeCycle, domMutationObservable, configuration, loadingType, viewStart, function (newLoadingTime) {\n commonViewMetrics.loadingTime = newLoadingTime;\n scheduleViewUpdate();\n }), stopLoadingTimeTracking = _a.stop, setLoadEvent = _a.setLoadEvent;\n var stopScrollMetricsTracking = trackScrollMetrics(configuration, viewStart, function (newScrollMetrics) {\n commonViewMetrics.scroll = newScrollMetrics;\n }).stop;\n var stopCLSTracking = trackCumulativeLayoutShift(configuration, lifeCycle, function (cumulativeLayoutShift) {\n commonViewMetrics.cumulativeLayoutShift = cumulativeLayoutShift;\n scheduleViewUpdate();\n }).stop;\n var _b = trackInteractionToNextPaint(configuration, viewStart.relative, loadingType, lifeCycle), stopINPTracking = _b.stop, getInteractionToNextPaint = _b.getInteractionToNextPaint, setViewEnd = _b.setViewEnd;\n return {\n stop: function () {\n stopLoadingTimeTracking();\n stopCLSTracking();\n stopScrollMetricsTracking();\n },\n stopINPTracking: stopINPTracking,\n setLoadEvent: setLoadEvent,\n setViewEnd: setViewEnd,\n getCommonViewMetrics: function () {\n commonViewMetrics.interactionToNextPaint = getInteractionToNextPaint();\n return commonViewMetrics;\n },\n };\n}\n//# sourceMappingURL=trackCommonViewMetrics.js.map","import { noop, PageExitReason, shallowClone, elapsed, generateUUID, ONE_MINUTE, throttle, clocksNow, clocksOrigin, timeStampNow, display, looksLikeRelativeTime, setInterval, clearInterval, setTimeout, Observable, } from '@datadog/browser-core';\nimport { trackViewEventCounts } from './trackViewEventCounts';\nimport { trackInitialViewMetrics } from './viewMetrics/trackInitialViewMetrics';\nimport { trackCommonViewMetrics } from './viewMetrics/trackCommonViewMetrics';\nexport var THROTTLE_VIEW_UPDATE_PERIOD = 3000;\nexport var SESSION_KEEP_ALIVE_INTERVAL = 5 * ONE_MINUTE;\n// Some events or metrics can be captured after the end of the view. To avoid missing those;\n// an arbitrary delay is added for stopping their tracking after the view ends.\n//\n// Ideally, we would not stop and keep tracking events or metrics until the end of the session.\n// But this might have a small performance impact if there are many many views.\n// So let's have a fairly short delay improving the situation in most cases and avoid impacting performances too much.\nexport var KEEP_TRACKING_AFTER_VIEW_DELAY = 5 * ONE_MINUTE;\nexport function trackViews(location, lifeCycle, domMutationObservable, configuration, locationChangeObservable, areViewsTrackedAutomatically, initialViewOptions) {\n var activeViews = new Set();\n var currentView = startNewView(\"initial_load\" /* ViewLoadingType.INITIAL_LOAD */, clocksOrigin(), initialViewOptions);\n startViewLifeCycle();\n var locationChangeSubscription;\n if (areViewsTrackedAutomatically) {\n locationChangeSubscription = renewViewOnLocationChange(locationChangeObservable);\n }\n function startNewView(loadingType, startClocks, viewOptions) {\n var newlyCreatedView = newView(lifeCycle, domMutationObservable, configuration, location, loadingType, startClocks, viewOptions);\n activeViews.add(newlyCreatedView);\n newlyCreatedView.stopObservable.subscribe(function () {\n activeViews.delete(newlyCreatedView);\n });\n return newlyCreatedView;\n }\n function startViewLifeCycle() {\n lifeCycle.subscribe(10 /* LifeCycleEventType.SESSION_RENEWED */, function () {\n // Renew view on session renewal\n currentView = startNewView(\"route_change\" /* ViewLoadingType.ROUTE_CHANGE */, undefined, {\n name: currentView.name,\n service: currentView.service,\n version: currentView.version,\n });\n });\n lifeCycle.subscribe(9 /* LifeCycleEventType.SESSION_EXPIRED */, function () {\n currentView.end({ sessionIsActive: false });\n });\n // End the current view on page unload\n lifeCycle.subscribe(11 /* LifeCycleEventType.PAGE_EXITED */, function (pageExitEvent) {\n if (pageExitEvent.reason === PageExitReason.UNLOADING) {\n currentView.end();\n }\n });\n }\n function renewViewOnLocationChange(locationChangeObservable) {\n return locationChangeObservable.subscribe(function (_a) {\n var oldLocation = _a.oldLocation, newLocation = _a.newLocation;\n if (areDifferentLocation(oldLocation, newLocation)) {\n currentView.end();\n currentView = startNewView(\"route_change\" /* ViewLoadingType.ROUTE_CHANGE */);\n }\n });\n }\n return {\n addTiming: function (name, time) {\n if (time === void 0) { time = timeStampNow(); }\n currentView.addTiming(name, time);\n },\n startView: function (options, startClocks) {\n currentView.end({ endClocks: startClocks });\n currentView = startNewView(\"route_change\" /* ViewLoadingType.ROUTE_CHANGE */, startClocks, options);\n },\n stop: function () {\n locationChangeSubscription === null || locationChangeSubscription === void 0 ? void 0 : locationChangeSubscription.unsubscribe();\n currentView.end();\n activeViews.forEach(function (view) { return view.stop(); });\n },\n };\n}\nfunction newView(lifeCycle, domMutationObservable, configuration, initialLocation, loadingType, startClocks, viewOptions) {\n if (startClocks === void 0) { startClocks = clocksNow(); }\n // Setup initial values\n var id = generateUUID();\n var stopObservable = new Observable();\n var customTimings = {};\n var documentVersion = 0;\n var endClocks;\n var location = shallowClone(initialLocation);\n var sessionIsActive = true;\n var name;\n var service;\n var version;\n if (viewOptions) {\n name = viewOptions.name;\n service = viewOptions.service;\n version = viewOptions.version;\n }\n var viewCreatedEvent = {\n id: id,\n name: name,\n startClocks: startClocks,\n service: service,\n version: version,\n };\n lifeCycle.notify(2 /* LifeCycleEventType.BEFORE_VIEW_CREATED */, viewCreatedEvent);\n lifeCycle.notify(3 /* LifeCycleEventType.VIEW_CREATED */, viewCreatedEvent);\n // Update the view every time the measures are changing\n var _a = throttle(triggerViewUpdate, THROTTLE_VIEW_UPDATE_PERIOD, {\n leading: false,\n }), scheduleViewUpdate = _a.throttled, cancelScheduleViewUpdate = _a.cancel;\n var _b = trackCommonViewMetrics(lifeCycle, domMutationObservable, configuration, scheduleViewUpdate, loadingType, startClocks), setLoadEvent = _b.setLoadEvent, setViewEnd = _b.setViewEnd, stopCommonViewMetricsTracking = _b.stop, stopINPTracking = _b.stopINPTracking, getCommonViewMetrics = _b.getCommonViewMetrics;\n var _c = loadingType === \"initial_load\" /* ViewLoadingType.INITIAL_LOAD */\n ? trackInitialViewMetrics(lifeCycle, configuration, setLoadEvent, scheduleViewUpdate)\n : { stop: noop, initialViewMetrics: {} }, stopInitialViewMetricsTracking = _c.stop, initialViewMetrics = _c.initialViewMetrics;\n var _d = trackViewEventCounts(lifeCycle, id, scheduleViewUpdate), stopEventCountsTracking = _d.stop, eventCounts = _d.eventCounts;\n // Session keep alive\n var keepAliveIntervalId = setInterval(triggerViewUpdate, SESSION_KEEP_ALIVE_INTERVAL);\n // Initial view update\n triggerViewUpdate();\n function triggerViewUpdate() {\n cancelScheduleViewUpdate();\n documentVersion += 1;\n var currentEnd = endClocks === undefined ? timeStampNow() : endClocks.timeStamp;\n lifeCycle.notify(4 /* LifeCycleEventType.VIEW_UPDATED */, {\n customTimings: customTimings,\n documentVersion: documentVersion,\n id: id,\n name: name,\n service: service,\n version: version,\n loadingType: loadingType,\n location: location,\n startClocks: startClocks,\n commonViewMetrics: getCommonViewMetrics(),\n initialViewMetrics: initialViewMetrics,\n duration: elapsed(startClocks.timeStamp, currentEnd),\n isActive: endClocks === undefined,\n sessionIsActive: sessionIsActive,\n eventCounts: eventCounts,\n });\n }\n return {\n name: name,\n service: service,\n version: version,\n stopObservable: stopObservable,\n end: function (options) {\n var _this = this;\n var _a, _b;\n if (options === void 0) { options = {}; }\n if (endClocks) {\n // view already ended\n return;\n }\n endClocks = (_a = options.endClocks) !== null && _a !== void 0 ? _a : clocksNow();\n sessionIsActive = (_b = options.sessionIsActive) !== null && _b !== void 0 ? _b : true;\n lifeCycle.notify(5 /* LifeCycleEventType.VIEW_ENDED */, { endClocks: endClocks });\n lifeCycle.notify(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, { endClocks: endClocks });\n clearInterval(keepAliveIntervalId);\n setViewEnd(endClocks.relative);\n stopCommonViewMetricsTracking();\n triggerViewUpdate();\n setTimeout(function () {\n _this.stop();\n }, KEEP_TRACKING_AFTER_VIEW_DELAY);\n },\n stop: function () {\n stopInitialViewMetricsTracking();\n stopEventCountsTracking();\n stopINPTracking();\n stopObservable.notify();\n },\n addTiming: function (name, time) {\n if (endClocks) {\n return;\n }\n var relativeTime = looksLikeRelativeTime(time) ? time : elapsed(startClocks.timeStamp, time);\n customTimings[sanitizeTiming(name)] = relativeTime;\n scheduleViewUpdate();\n },\n };\n}\n/**\n * Timing name is used as facet path that must contain only letters, digits, or the characters - _ . @ $\n */\nfunction sanitizeTiming(name) {\n var sanitized = name.replace(/[^a-zA-Z0-9-_.@$]/g, '_');\n if (sanitized !== name) {\n display.warn(\"Invalid timing name: \".concat(name, \", sanitized to: \").concat(sanitized));\n }\n return sanitized;\n}\nfunction areDifferentLocation(currentLocation, otherLocation) {\n return (currentLocation.pathname !== otherLocation.pathname ||\n (!isHashAnAnchor(otherLocation.hash) &&\n getPathFromHash(otherLocation.hash) !== getPathFromHash(currentLocation.hash)));\n}\nfunction isHashAnAnchor(hash) {\n var correspondingId = hash.substring(1);\n // check if the correspondingId is empty because on Firefox an empty string passed to getElementById() prints a consol warning\n return correspondingId !== '' && !!document.getElementById(correspondingId);\n}\nfunction getPathFromHash(hash) {\n var index = hash.indexOf('?');\n return index < 0 ? hash : hash.slice(0, index);\n}\n//# sourceMappingURL=trackViews.js.map","import { isEmptyObject, mapValues, toServerDuration } from '@datadog/browser-core';\nimport { discardNegativeDuration } from '../discardNegativeDuration';\nimport { trackViews } from './trackViews';\nexport function startViewCollection(lifeCycle, configuration, location, domMutationObservable, locationChangeObservable, featureFlagContexts, pageStateHistory, recorderApi, initialViewOptions) {\n lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_UPDATED */, function (view) {\n return lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processViewUpdate(view, configuration, featureFlagContexts, recorderApi, pageStateHistory));\n });\n return trackViews(location, lifeCycle, domMutationObservable, configuration, locationChangeObservable, !configuration.trackViewsManually, initialViewOptions);\n}\nfunction processViewUpdate(view, configuration, featureFlagContexts, recorderApi, pageStateHistory) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;\n var replayStats = recorderApi.getReplayStats(view.id);\n var featureFlagContext = featureFlagContexts.findFeatureFlagEvaluations(view.startClocks.relative);\n var pageStates = pageStateHistory.findAll(view.startClocks.relative, view.duration);\n var viewEvent = {\n _dd: {\n document_version: view.documentVersion,\n replay_stats: replayStats,\n page_states: pageStates,\n configuration: {\n start_session_replay_recording_manually: configuration.startSessionReplayRecordingManually,\n },\n },\n date: view.startClocks.timeStamp,\n type: \"view\" /* RumEventType.VIEW */,\n view: {\n action: {\n count: view.eventCounts.actionCount,\n },\n frustration: {\n count: view.eventCounts.frustrationCount,\n },\n cumulative_layout_shift: (_a = view.commonViewMetrics.cumulativeLayoutShift) === null || _a === void 0 ? void 0 : _a.value,\n cumulative_layout_shift_target_selector: (_b = view.commonViewMetrics.cumulativeLayoutShift) === null || _b === void 0 ? void 0 : _b.targetSelector,\n first_byte: toServerDuration((_c = view.initialViewMetrics.navigationTimings) === null || _c === void 0 ? void 0 : _c.firstByte),\n dom_complete: toServerDuration((_d = view.initialViewMetrics.navigationTimings) === null || _d === void 0 ? void 0 : _d.domComplete),\n dom_content_loaded: toServerDuration((_e = view.initialViewMetrics.navigationTimings) === null || _e === void 0 ? void 0 : _e.domContentLoaded),\n dom_interactive: toServerDuration((_f = view.initialViewMetrics.navigationTimings) === null || _f === void 0 ? void 0 : _f.domInteractive),\n error: {\n count: view.eventCounts.errorCount,\n },\n first_contentful_paint: toServerDuration(view.initialViewMetrics.firstContentfulPaint),\n first_input_delay: toServerDuration((_g = view.initialViewMetrics.firstInput) === null || _g === void 0 ? void 0 : _g.delay),\n first_input_time: toServerDuration((_h = view.initialViewMetrics.firstInput) === null || _h === void 0 ? void 0 : _h.time),\n first_input_target_selector: (_j = view.initialViewMetrics.firstInput) === null || _j === void 0 ? void 0 : _j.targetSelector,\n interaction_to_next_paint: toServerDuration((_k = view.commonViewMetrics.interactionToNextPaint) === null || _k === void 0 ? void 0 : _k.value),\n interaction_to_next_paint_target_selector: (_l = view.commonViewMetrics.interactionToNextPaint) === null || _l === void 0 ? void 0 : _l.targetSelector,\n is_active: view.isActive,\n name: view.name,\n largest_contentful_paint: toServerDuration((_m = view.initialViewMetrics.largestContentfulPaint) === null || _m === void 0 ? void 0 : _m.value),\n largest_contentful_paint_target_selector: (_o = view.initialViewMetrics.largestContentfulPaint) === null || _o === void 0 ? void 0 : _o.targetSelector,\n load_event: toServerDuration((_p = view.initialViewMetrics.navigationTimings) === null || _p === void 0 ? void 0 : _p.loadEvent),\n loading_time: discardNegativeDuration(toServerDuration(view.commonViewMetrics.loadingTime)),\n loading_type: view.loadingType,\n long_task: {\n count: view.eventCounts.longTaskCount,\n },\n resource: {\n count: view.eventCounts.resourceCount,\n },\n time_spent: toServerDuration(view.duration),\n },\n feature_flags: featureFlagContext && !isEmptyObject(featureFlagContext) ? featureFlagContext : undefined,\n display: view.commonViewMetrics.scroll\n ? {\n scroll: {\n max_depth: view.commonViewMetrics.scroll.maxDepth,\n max_depth_scroll_top: view.commonViewMetrics.scroll.maxDepthScrollTop,\n max_scroll_height: view.commonViewMetrics.scroll.maxScrollHeight,\n max_scroll_height_time: toServerDuration(view.commonViewMetrics.scroll.maxScrollHeightTime),\n },\n }\n : undefined,\n session: {\n has_replay: replayStats ? true : undefined,\n is_active: view.sessionIsActive ? undefined : false,\n },\n privacy: {\n replay_level: configuration.defaultPrivacyLevel,\n },\n };\n if (!isEmptyObject(view.customTimings)) {\n viewEvent.view.custom_timings = mapValues(view.customTimings, toServerDuration);\n }\n return {\n rawRumEvent: viewEvent,\n startTime: view.startClocks.relative,\n domainContext: {\n location: view.location,\n },\n };\n}\n//# sourceMappingURL=viewCollection.js.map","import { Observable, bridgeSupports, noop, performDraw, startSessionManager, } from '@datadog/browser-core';\nexport var RUM_SESSION_KEY = 'rum';\nexport function startRumSessionManager(configuration, lifeCycle, trackingConsentState) {\n var sessionManager = startSessionManager(configuration, RUM_SESSION_KEY, function (rawTrackingType) { return computeSessionState(configuration, rawTrackingType); }, trackingConsentState);\n sessionManager.expireObservable.subscribe(function () {\n lifeCycle.notify(9 /* LifeCycleEventType.SESSION_EXPIRED */);\n });\n sessionManager.renewObservable.subscribe(function () {\n lifeCycle.notify(10 /* LifeCycleEventType.SESSION_RENEWED */);\n });\n return {\n findTrackedSession: function (startTime) {\n var session = sessionManager.findSession(startTime);\n if (!session || !isTypeTracked(session.trackingType)) {\n return;\n }\n return {\n id: session.id,\n sessionReplayAllowed: session.trackingType === \"1\" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */,\n };\n },\n expire: sessionManager.expire,\n expireObservable: sessionManager.expireObservable,\n };\n}\n/**\n * Start a tracked replay session stub\n */\nexport function startRumSessionManagerStub() {\n var session = {\n id: '00000000-aaaa-0000-aaaa-000000000000',\n sessionReplayAllowed: bridgeSupports(\"records\" /* BridgeCapability.RECORDS */),\n };\n return {\n findTrackedSession: function () { return session; },\n expire: noop,\n expireObservable: new Observable(),\n };\n}\nfunction computeSessionState(configuration, rawTrackingType) {\n var trackingType;\n if (hasValidRumSession(rawTrackingType)) {\n trackingType = rawTrackingType;\n }\n else if (!performDraw(configuration.sessionSampleRate)) {\n trackingType = \"0\" /* RumTrackingType.NOT_TRACKED */;\n }\n else if (!performDraw(configuration.sessionReplaySampleRate)) {\n trackingType = \"2\" /* RumTrackingType.TRACKED_WITHOUT_SESSION_REPLAY */;\n }\n else {\n trackingType = \"1\" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */;\n }\n return {\n trackingType: trackingType,\n isTracked: isTypeTracked(trackingType),\n };\n}\nfunction hasValidRumSession(trackingType) {\n return (trackingType === \"0\" /* RumTrackingType.NOT_TRACKED */ ||\n trackingType === \"1\" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */ ||\n trackingType === \"2\" /* RumTrackingType.TRACKED_WITHOUT_SESSION_REPLAY */);\n}\nfunction isTypeTracked(rumSessionType) {\n return (rumSessionType === \"2\" /* RumTrackingType.TRACKED_WITHOUT_SESSION_REPLAY */ ||\n rumSessionType === \"1\" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */);\n}\n//# sourceMappingURL=rumSessionManager.js.map","import { combine, isTelemetryReplicationAllowed, startBatchWithReplica, } from '@datadog/browser-core';\nexport function startRumBatch(configuration, lifeCycle, telemetryEventObservable, reportError, pageExitObservable, sessionExpireObservable, createEncoder) {\n var replica = configuration.replica;\n var batch = startBatchWithReplica(configuration, {\n endpoint: configuration.rumEndpointBuilder,\n encoder: createEncoder(2 /* DeflateEncoderStreamId.RUM */),\n }, replica && {\n endpoint: replica.rumEndpointBuilder,\n transformMessage: function (message) { return combine(message, { application: { id: replica.applicationId } }); },\n encoder: createEncoder(3 /* DeflateEncoderStreamId.RUM_REPLICA */),\n }, reportError, pageExitObservable, sessionExpireObservable);\n lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (serverRumEvent) {\n if (serverRumEvent.type === \"view\" /* RumEventType.VIEW */) {\n batch.upsert(serverRumEvent, serverRumEvent.view.id);\n }\n else {\n batch.add(serverRumEvent);\n }\n });\n telemetryEventObservable.subscribe(function (event) { return batch.add(event, isTelemetryReplicationAllowed(configuration)); });\n return batch;\n}\n//# sourceMappingURL=startRumBatch.js.map","import { getEventBridge } from '@datadog/browser-core';\nexport function startRumEventBridge(lifeCycle) {\n var bridge = getEventBridge();\n lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (serverRumEvent) {\n bridge.send('rum', serverRumEvent);\n });\n}\n//# sourceMappingURL=startRumEventBridge.js.map","import { SESSION_TIME_OUT_DELAY, relativeNow, ValueHistory } from '@datadog/browser-core';\n/**\n * We want to attach to an event:\n * - the url corresponding to its start\n * - the referrer corresponding to the previous view url (or document referrer for initial view)\n */\nexport var URL_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;\nexport function startUrlContexts(lifeCycle, locationChangeObservable, location) {\n var urlContextHistory = new ValueHistory(URL_CONTEXT_TIME_OUT_DELAY);\n var previousViewUrl;\n lifeCycle.subscribe(2 /* LifeCycleEventType.BEFORE_VIEW_CREATED */, function (_a) {\n var startClocks = _a.startClocks;\n var viewUrl = location.href;\n urlContextHistory.add(buildUrlContext({\n url: viewUrl,\n referrer: !previousViewUrl ? document.referrer : previousViewUrl,\n }), startClocks.relative);\n previousViewUrl = viewUrl;\n });\n lifeCycle.subscribe(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, function (_a) {\n var endClocks = _a.endClocks;\n urlContextHistory.closeActive(endClocks.relative);\n });\n var locationChangeSubscription = locationChangeObservable.subscribe(function (_a) {\n var newLocation = _a.newLocation;\n var current = urlContextHistory.find();\n if (current) {\n var changeTime = relativeNow();\n urlContextHistory.closeActive(changeTime);\n urlContextHistory.add(buildUrlContext({\n url: newLocation.href,\n referrer: current.referrer,\n }), changeTime);\n }\n });\n function buildUrlContext(_a) {\n var url = _a.url, referrer = _a.referrer;\n return {\n url: url,\n referrer: referrer,\n };\n }\n return {\n findUrl: function (startTime) { return urlContextHistory.find(startTime); },\n stop: function () {\n locationChangeSubscription.unsubscribe();\n urlContextHistory.stop();\n },\n };\n}\n//# sourceMappingURL=urlContexts.js.map","import { addEventListener, DOM_EVENT, instrumentMethod, Observable, shallowClone } from '@datadog/browser-core';\nexport function createLocationChangeObservable(configuration, location) {\n var currentLocation = shallowClone(location);\n return new Observable(function (observable) {\n var stopHistoryTracking = trackHistory(configuration, onLocationChange).stop;\n var stopHashTracking = trackHash(configuration, onLocationChange).stop;\n function onLocationChange() {\n if (currentLocation.href === location.href) {\n return;\n }\n var newLocation = shallowClone(location);\n observable.notify({\n newLocation: newLocation,\n oldLocation: currentLocation,\n });\n currentLocation = newLocation;\n }\n return function () {\n stopHistoryTracking();\n stopHashTracking();\n };\n });\n}\nfunction trackHistory(configuration, onHistoryChange) {\n var stopInstrumentingPushState = instrumentMethod(history, 'pushState', function (_a) {\n var onPostCall = _a.onPostCall;\n onPostCall(onHistoryChange);\n }).stop;\n var stopInstrumentingReplaceState = instrumentMethod(history, 'replaceState', function (_a) {\n var onPostCall = _a.onPostCall;\n onPostCall(onHistoryChange);\n }).stop;\n var removeListener = addEventListener(configuration, window, DOM_EVENT.POP_STATE, onHistoryChange).stop;\n return {\n stop: function () {\n stopInstrumentingPushState();\n stopInstrumentingReplaceState();\n removeListener();\n },\n };\n}\nfunction trackHash(configuration, onHashChange) {\n return addEventListener(configuration, window, DOM_EVENT.HASH_CHANGE, onHashChange);\n}\n//# sourceMappingURL=locationChangeObservable.js.map","import { SESSION_TIME_OUT_DELAY, ValueHistory } from '@datadog/browser-core';\nexport var FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;\nexport var BYTES_COMPUTATION_THROTTLING_DELAY = 200;\n/**\n * Start feature flag contexts\n *\n * Feature flag contexts follow the life of views.\n * A new context is added when a view is created and ended when the view is ended\n *\n * Note: we choose not to add a new context at each evaluation to save memory\n */\nexport function startFeatureFlagContexts(lifeCycle, customerDataTracker) {\n var featureFlagContexts = new ValueHistory(FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY);\n lifeCycle.subscribe(2 /* LifeCycleEventType.BEFORE_VIEW_CREATED */, function (_a) {\n var startClocks = _a.startClocks;\n featureFlagContexts.add({}, startClocks.relative);\n customerDataTracker.resetCustomerData();\n });\n lifeCycle.subscribe(6 /* LifeCycleEventType.AFTER_VIEW_ENDED */, function (_a) {\n var endClocks = _a.endClocks;\n featureFlagContexts.closeActive(endClocks.relative);\n });\n return {\n findFeatureFlagEvaluations: function (startTime) { return featureFlagContexts.find(startTime); },\n addFeatureFlagEvaluation: function (key, value) {\n var currentContext = featureFlagContexts.find();\n if (currentContext) {\n currentContext[key] = value;\n customerDataTracker.updateCustomerData(currentContext);\n }\n },\n stop: function () { return customerDataTracker.stop(); },\n };\n}\n//# sourceMappingURL=featureFlagContext.js.map","import { includes, performDraw, ONE_SECOND, addTelemetryDebug, setInterval, } from '@datadog/browser-core';\nexport var MEASURES_PERIOD_DURATION = 10 * ONE_SECOND;\nvar currentPeriodMeasures;\nvar currentBatchMeasures;\nvar batchHasRumEvent;\nexport function startCustomerDataTelemetry(configuration, telemetry, lifeCycle, customerDataTrackerManager, batchFlushObservable) {\n var customerDataTelemetryEnabled = telemetry.enabled && performDraw(configuration.customerDataTelemetrySampleRate);\n if (!customerDataTelemetryEnabled) {\n return;\n }\n initCurrentPeriodMeasures();\n initCurrentBatchMeasures();\n // We measure the data of every view updates even if there could only be one per batch due to the upsert\n // It means that contexts bytes count sums can be higher than it really is\n lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (event) {\n batchHasRumEvent = true;\n updateMeasure(currentBatchMeasures.globalContextBytes, customerDataTrackerManager.getOrCreateTracker(2 /* CustomerDataType.GlobalContext */).getBytesCount());\n updateMeasure(currentBatchMeasures.userContextBytes, customerDataTrackerManager.getOrCreateTracker(1 /* CustomerDataType.User */).getBytesCount());\n updateMeasure(currentBatchMeasures.featureFlagBytes, includes([\"view\" /* RumEventType.VIEW */, \"error\" /* RumEventType.ERROR */], event.type)\n ? customerDataTrackerManager.getOrCreateTracker(0 /* CustomerDataType.FeatureFlag */).getBytesCount()\n : 0);\n });\n batchFlushObservable.subscribe(function (_a) {\n var bytesCount = _a.bytesCount, messagesCount = _a.messagesCount;\n // Don't measure batch that only contains telemetry events to avoid batch sending loop\n // It could happen because after each batch we are adding a customer data measures telemetry event to the next one\n if (!batchHasRumEvent) {\n return;\n }\n currentPeriodMeasures.batchCount += 1;\n updateMeasure(currentPeriodMeasures.batchBytesCount, bytesCount);\n updateMeasure(currentPeriodMeasures.batchMessagesCount, messagesCount);\n mergeMeasure(currentPeriodMeasures.globalContextBytes, currentBatchMeasures.globalContextBytes);\n mergeMeasure(currentPeriodMeasures.userContextBytes, currentBatchMeasures.userContextBytes);\n mergeMeasure(currentPeriodMeasures.featureFlagBytes, currentBatchMeasures.featureFlagBytes);\n initCurrentBatchMeasures();\n });\n setInterval(sendCurrentPeriodMeasures, MEASURES_PERIOD_DURATION);\n}\nfunction sendCurrentPeriodMeasures() {\n if (currentPeriodMeasures.batchCount === 0) {\n return;\n }\n addTelemetryDebug('Customer data measures', currentPeriodMeasures);\n initCurrentPeriodMeasures();\n}\nfunction createMeasure() {\n return { min: Infinity, max: 0, sum: 0 };\n}\nfunction updateMeasure(measure, value) {\n measure.sum += value;\n measure.min = Math.min(measure.min, value);\n measure.max = Math.max(measure.max, value);\n}\nfunction mergeMeasure(target, source) {\n target.sum += source.sum;\n target.min = Math.min(target.min, source.min);\n target.max = Math.max(target.max, source.max);\n}\nfunction initCurrentPeriodMeasures() {\n currentPeriodMeasures = {\n batchCount: 0,\n batchBytesCount: createMeasure(),\n batchMessagesCount: createMeasure(),\n globalContextBytes: createMeasure(),\n userContextBytes: createMeasure(),\n featureFlagBytes: createMeasure(),\n };\n}\nfunction initCurrentBatchMeasures() {\n batchHasRumEvent = false;\n currentBatchMeasures = {\n globalContextBytes: createMeasure(),\n userContextBytes: createMeasure(),\n featureFlagBytes: createMeasure(),\n };\n}\n//# sourceMappingURL=startCustomerDataTelemetry.js.map","import { elapsed, ValueHistory, SESSION_TIME_OUT_DELAY, toServerDuration, addEventListeners, relativeNow, DOM_EVENT, } from '@datadog/browser-core';\n// Arbitrary value to cap number of element for memory consumption in the browser\nexport var MAX_PAGE_STATE_ENTRIES = 4000;\n// Arbitrary value to cap number of element for backend & to save bandwidth\nexport var MAX_PAGE_STATE_ENTRIES_SELECTABLE = 500;\nexport var PAGE_STATE_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;\nexport function startPageStateHistory(configuration, maxPageStateEntriesSelectable) {\n if (maxPageStateEntriesSelectable === void 0) { maxPageStateEntriesSelectable = MAX_PAGE_STATE_ENTRIES_SELECTABLE; }\n var pageStateEntryHistory = new ValueHistory(PAGE_STATE_CONTEXT_TIME_OUT_DELAY, MAX_PAGE_STATE_ENTRIES);\n var currentPageState;\n addPageState(getPageState(), relativeNow());\n var stopEventListeners = addEventListeners(configuration, window, [\n DOM_EVENT.PAGE_SHOW,\n DOM_EVENT.FOCUS,\n DOM_EVENT.BLUR,\n DOM_EVENT.VISIBILITY_CHANGE,\n DOM_EVENT.RESUME,\n DOM_EVENT.FREEZE,\n DOM_EVENT.PAGE_HIDE,\n ], function (event) {\n addPageState(computePageState(event), event.timeStamp);\n }, { capture: true }).stop;\n function addPageState(nextPageState, startTime) {\n if (startTime === void 0) { startTime = relativeNow(); }\n if (nextPageState === currentPageState) {\n return;\n }\n currentPageState = nextPageState;\n pageStateEntryHistory.closeActive(startTime);\n pageStateEntryHistory.add({ state: currentPageState, startTime: startTime }, startTime);\n }\n var pageStateHistory = {\n findAll: function (eventStartTime, duration) {\n var pageStateEntries = pageStateEntryHistory.findAll(eventStartTime, duration);\n if (pageStateEntries.length === 0) {\n return;\n }\n var pageStateServerEntries = [];\n // limit the number of entries to return\n var limit = Math.max(0, pageStateEntries.length - maxPageStateEntriesSelectable);\n // loop page state entries backward to return the selected ones in desc order\n for (var index = pageStateEntries.length - 1; index >= limit; index--) {\n var pageState = pageStateEntries[index];\n // compute the start time relative to the event start time (ex: to be relative to the view start time)\n var relativeStartTime = elapsed(eventStartTime, pageState.startTime);\n pageStateServerEntries.push({\n state: pageState.state,\n start: toServerDuration(relativeStartTime),\n });\n }\n return pageStateServerEntries;\n },\n wasInPageStateAt: function (state, startTime) {\n return pageStateHistory.wasInPageStateDuringPeriod(state, startTime, 0);\n },\n wasInPageStateDuringPeriod: function (state, startTime, duration) {\n return pageStateEntryHistory.findAll(startTime, duration).some(function (pageState) { return pageState.state === state; });\n },\n addPageState: addPageState,\n stop: function () {\n stopEventListeners();\n pageStateEntryHistory.stop();\n },\n };\n return pageStateHistory;\n}\nfunction computePageState(event) {\n if (event.type === DOM_EVENT.FREEZE) {\n return \"frozen\" /* PageState.FROZEN */;\n }\n else if (event.type === DOM_EVENT.PAGE_HIDE) {\n return event.persisted ? \"frozen\" /* PageState.FROZEN */ : \"terminated\" /* PageState.TERMINATED */;\n }\n return getPageState();\n}\nfunction getPageState() {\n if (document.visibilityState === 'hidden') {\n return \"hidden\" /* PageState.HIDDEN */;\n }\n if (document.hasFocus()) {\n return \"active\" /* PageState.ACTIVE */;\n }\n return \"passive\" /* PageState.PASSIVE */;\n}\n//# sourceMappingURL=pageStateHistory.js.map","import { getViewportDimension, initViewportObservable } from '../../browser/viewportObservable';\nexport function startDisplayContext(configuration) {\n var viewport = getViewportDimension();\n var unsubscribeViewport = initViewportObservable(configuration).subscribe(function (viewportDimension) {\n viewport = viewportDimension;\n }).unsubscribe;\n return {\n get: function () { return ({ viewport: viewport }); },\n stop: unsubscribeViewport,\n };\n}\n//# sourceMappingURL=displayContext.js.map","import { combine, elapsed, generateUUID } from '@datadog/browser-core';\nexport function startVitalCollection(lifeCycle, pageStateHistory) {\n var vitalStartsByName = new Map();\n lifeCycle.subscribe(10 /* LifeCycleEventType.SESSION_RENEWED */, function () {\n // Discard all the vitals that have not been stopped to avoid memory leaks\n vitalStartsByName.clear();\n });\n function isValid(vital) {\n return !pageStateHistory.wasInPageStateDuringPeriod(\"frozen\" /* PageState.FROZEN */, vital.startClocks.relative, vital.value);\n }\n return {\n startDurationVital: function (vitalStart) {\n vitalStartsByName.set(vitalStart.name, vitalStart);\n },\n stopDurationVital: function (vitalStop) {\n var vitalStart = vitalStartsByName.get(vitalStop.name);\n if (!vitalStart) {\n return;\n }\n var vital = buildDurationVital(vitalStart, vitalStop);\n vitalStartsByName.delete(vital.name);\n if (isValid(vital)) {\n lifeCycle.notify(12 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processVital(vital, true));\n }\n },\n };\n}\nfunction buildDurationVital(vitalStart, vitalStop) {\n return {\n name: vitalStart.name,\n type: \"duration\" /* VitalType.DURATION */,\n startClocks: vitalStart.startClocks,\n value: elapsed(vitalStart.startClocks.timeStamp, vitalStop.stopClocks.timeStamp),\n context: combine(vitalStart.context, vitalStop.context),\n };\n}\nfunction processVital(vital, valueComputedBySdk) {\n var _a;\n var rawRumEvent = {\n date: vital.startClocks.timeStamp,\n vital: {\n id: generateUUID(),\n type: vital.type,\n name: vital.name,\n custom: (_a = {},\n _a[vital.name] = vital.value,\n _a),\n },\n type: \"vital\" /* RumEventType.VITAL */,\n };\n if (valueComputedBySdk) {\n rawRumEvent._dd = {\n vital: {\n computed_value: true,\n },\n };\n }\n return {\n rawRumEvent: rawRumEvent,\n startTime: vital.startClocks.relative,\n customerContext: vital.context,\n domainContext: {},\n };\n}\n//# sourceMappingURL=vitalCollection.js.map","import { setInterval, clearInterval, Observable, addEventListener, ONE_SECOND, findCommaSeparatedValue, DOM_EVENT, find, } from '@datadog/browser-core';\nexport function createCookieObservable(configuration, cookieName) {\n var detectCookieChangeStrategy = window.cookieStore\n ? listenToCookieStoreChange(configuration)\n : watchCookieFallback;\n return new Observable(function (observable) {\n return detectCookieChangeStrategy(cookieName, function (event) { return observable.notify(event); });\n });\n}\nfunction listenToCookieStoreChange(configuration) {\n return function (cookieName, callback) {\n var listener = addEventListener(configuration, window.cookieStore, DOM_EVENT.CHANGE, function (event) {\n // Based on our experimentation, we're assuming that entries for the same cookie cannot be in both the 'changed' and 'deleted' arrays.\n // However, due to ambiguity in the specification, we asked for clarification: https://github.com/WICG/cookie-store/issues/226\n var changeEvent = find(event.changed, function (event) { return event.name === cookieName; }) ||\n find(event.deleted, function (event) { return event.name === cookieName; });\n if (changeEvent) {\n callback(changeEvent.value);\n }\n });\n return listener.stop;\n };\n}\nexport var WATCH_COOKIE_INTERVAL_DELAY = ONE_SECOND;\nfunction watchCookieFallback(cookieName, callback) {\n var previousCookieValue = findCommaSeparatedValue(document.cookie, cookieName);\n var watchCookieIntervalId = setInterval(function () {\n var cookieValue = findCommaSeparatedValue(document.cookie, cookieName);\n if (cookieValue !== previousCookieValue) {\n callback(cookieValue);\n }\n }, WATCH_COOKIE_INTERVAL_DELAY);\n return function () {\n clearInterval(watchCookieIntervalId);\n };\n}\n//# sourceMappingURL=cookieObservable.js.map","import { getInitCookie } from '@datadog/browser-core';\nimport { createCookieObservable } from '../../browser/cookieObservable';\nexport var CI_VISIBILITY_TEST_ID_COOKIE_NAME = 'datadog-ci-visibility-test-execution-id';\nexport function startCiVisibilityContext(configuration, cookieObservable) {\n var _a;\n if (cookieObservable === void 0) { cookieObservable = createCookieObservable(configuration, CI_VISIBILITY_TEST_ID_COOKIE_NAME); }\n var testExecutionId = getInitCookie(CI_VISIBILITY_TEST_ID_COOKIE_NAME) || ((_a = window.Cypress) === null || _a === void 0 ? void 0 : _a.env('traceId'));\n var cookieObservableSubscription = cookieObservable.subscribe(function (value) {\n testExecutionId = value;\n });\n return {\n get: function () {\n if (typeof testExecutionId === 'string') {\n return {\n test_execution_id: testExecutionId,\n };\n }\n },\n stop: function () { return cookieObservableSubscription.unsubscribe(); },\n };\n}\n//# sourceMappingURL=ciVisibilityContext.js.map","import { sendToExtension, createPageExitObservable, addTelemetryConfiguration, startTelemetry, canUseEventBridge, getEventBridge, addTelemetryDebug, drainPreStartTelemetry, } from '@datadog/browser-core';\nimport { createDOMMutationObservable } from '../browser/domMutationObservable';\nimport { startPerformanceCollection } from '../browser/performanceCollection';\nimport { startRumAssembly } from '../domain/assembly';\nimport { startInternalContext } from '../domain/contexts/internalContext';\nimport { LifeCycle } from '../domain/lifeCycle';\nimport { startViewContexts } from '../domain/contexts/viewContexts';\nimport { startRequestCollection } from '../domain/requestCollection';\nimport { startActionCollection } from '../domain/action/actionCollection';\nimport { startErrorCollection } from '../domain/error/errorCollection';\nimport { startLongTaskCollection } from '../domain/longTask/longTaskCollection';\nimport { startResourceCollection } from '../domain/resource/resourceCollection';\nimport { startViewCollection } from '../domain/view/viewCollection';\nimport { startRumSessionManager, startRumSessionManagerStub } from '../domain/rumSessionManager';\nimport { startRumBatch } from '../transport/startRumBatch';\nimport { startRumEventBridge } from '../transport/startRumEventBridge';\nimport { startUrlContexts } from '../domain/contexts/urlContexts';\nimport { createLocationChangeObservable } from '../browser/locationChangeObservable';\nimport { serializeRumConfiguration } from '../domain/configuration';\nimport { startFeatureFlagContexts } from '../domain/contexts/featureFlagContext';\nimport { startCustomerDataTelemetry } from '../domain/startCustomerDataTelemetry';\nimport { startPageStateHistory } from '../domain/contexts/pageStateHistory';\nimport { startDisplayContext } from '../domain/contexts/displayContext';\nimport { startVitalCollection } from '../domain/vital/vitalCollection';\nimport { startCiVisibilityContext } from '../domain/contexts/ciVisibilityContext';\nexport function startRum(initConfiguration, configuration, recorderApi, customerDataTrackerManager, getCommonContext, initialViewOptions, createEncoder, \n// `startRum` and its subcomponents assume tracking consent is granted initially and starts\n// collecting logs unconditionally. As such, `startRum` should be called with a\n// `trackingConsentState` set to \"granted\".\ntrackingConsentState) {\n var cleanupTasks = [];\n var lifeCycle = new LifeCycle();\n lifeCycle.subscribe(13 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (event) { return sendToExtension('rum', event); });\n var telemetry = startRumTelemetry(configuration);\n telemetry.setContextProvider(function () {\n var _a, _b;\n return ({\n application: {\n id: configuration.applicationId,\n },\n session: {\n id: (_a = session.findTrackedSession()) === null || _a === void 0 ? void 0 : _a.id,\n },\n view: {\n id: (_b = viewContexts.findView()) === null || _b === void 0 ? void 0 : _b.id,\n },\n action: {\n id: actionContexts.findActionId(),\n },\n });\n });\n var reportError = function (error) {\n lifeCycle.notify(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error: error });\n addTelemetryDebug('Error reported to customer', { 'error.message': error.message });\n };\n var featureFlagContexts = startFeatureFlagContexts(lifeCycle, customerDataTrackerManager.getOrCreateTracker(0 /* CustomerDataType.FeatureFlag */));\n var pageExitObservable = createPageExitObservable(configuration);\n var pageExitSubscription = pageExitObservable.subscribe(function (event) {\n lifeCycle.notify(11 /* LifeCycleEventType.PAGE_EXITED */, event);\n });\n cleanupTasks.push(function () { return pageExitSubscription.unsubscribe(); });\n var session = !canUseEventBridge()\n ? startRumSessionManager(configuration, lifeCycle, trackingConsentState)\n : startRumSessionManagerStub();\n if (!canUseEventBridge()) {\n var batch_1 = startRumBatch(configuration, lifeCycle, telemetry.observable, reportError, pageExitObservable, session.expireObservable, createEncoder);\n cleanupTasks.push(function () { return batch_1.stop(); });\n startCustomerDataTelemetry(configuration, telemetry, lifeCycle, customerDataTrackerManager, batch_1.flushObservable);\n }\n else {\n startRumEventBridge(lifeCycle);\n }\n var domMutationObservable = createDOMMutationObservable();\n var locationChangeObservable = createLocationChangeObservable(configuration, location);\n var _a = startRumEventCollection(lifeCycle, configuration, location, session, locationChangeObservable, domMutationObservable, getCommonContext, reportError), viewContexts = _a.viewContexts, pageStateHistory = _a.pageStateHistory, urlContexts = _a.urlContexts, actionContexts = _a.actionContexts, addAction = _a.addAction, stopRumEventCollection = _a.stop;\n cleanupTasks.push(stopRumEventCollection);\n drainPreStartTelemetry();\n addTelemetryConfiguration(serializeRumConfiguration(initConfiguration));\n startLongTaskCollection(lifeCycle, configuration);\n startResourceCollection(lifeCycle, configuration, pageStateHistory);\n var _b = startViewCollection(lifeCycle, configuration, location, domMutationObservable, locationChangeObservable, featureFlagContexts, pageStateHistory, recorderApi, initialViewOptions), addTiming = _b.addTiming, startView = _b.startView, stopViewCollection = _b.stop;\n cleanupTasks.push(stopViewCollection);\n var addError = startErrorCollection(lifeCycle, configuration, pageStateHistory, featureFlagContexts).addError;\n startRequestCollection(lifeCycle, configuration, session);\n var stopPerformanceCollection = startPerformanceCollection(lifeCycle, configuration).stop;\n cleanupTasks.push(stopPerformanceCollection);\n var vitalCollection = startVitalCollection(lifeCycle, pageStateHistory);\n var internalContext = startInternalContext(configuration.applicationId, session, viewContexts, actionContexts, urlContexts);\n return {\n addAction: addAction,\n addError: addError,\n addTiming: addTiming,\n addFeatureFlagEvaluation: featureFlagContexts.addFeatureFlagEvaluation,\n startView: startView,\n lifeCycle: lifeCycle,\n viewContexts: viewContexts,\n session: session,\n stopSession: function () { return session.expire(); },\n getInternalContext: internalContext.get,\n startDurationVital: vitalCollection.startDurationVital,\n stopDurationVital: vitalCollection.stopDurationVital,\n stop: function () {\n cleanupTasks.forEach(function (task) { return task(); });\n },\n };\n}\nfunction startRumTelemetry(configuration) {\n var telemetry = startTelemetry(\"browser-rum-sdk\" /* TelemetryService.RUM */, configuration);\n if (canUseEventBridge()) {\n var bridge_1 = getEventBridge();\n telemetry.observable.subscribe(function (event) { return bridge_1.send('internal_telemetry', event); });\n }\n return telemetry;\n}\nexport function startRumEventCollection(lifeCycle, configuration, location, sessionManager, locationChangeObservable, domMutationObservable, getCommonContext, reportError) {\n var viewContexts = startViewContexts(lifeCycle);\n var urlContexts = startUrlContexts(lifeCycle, locationChangeObservable, location);\n var pageStateHistory = startPageStateHistory(configuration);\n var _a = startActionCollection(lifeCycle, domMutationObservable, configuration, pageStateHistory), addAction = _a.addAction, actionContexts = _a.actionContexts;\n var displayContext = startDisplayContext(configuration);\n var ciVisibilityContext = startCiVisibilityContext(configuration);\n startRumAssembly(configuration, lifeCycle, sessionManager, viewContexts, urlContexts, actionContexts, displayContext, ciVisibilityContext, getCommonContext, reportError);\n return {\n viewContexts: viewContexts,\n pageStateHistory: pageStateHistory,\n urlContexts: urlContexts,\n addAction: addAction,\n actionContexts: actionContexts,\n stop: function () {\n ciVisibilityContext.stop();\n displayContext.stop();\n pageStateHistory.stop();\n urlContexts.stop();\n viewContexts.stop();\n pageStateHistory.stop();\n },\n };\n}\n//# sourceMappingURL=startRum.js.map","import { INTAKE_SITE_STAGING, INTAKE_SITE_US1, INTAKE_SITE_EU1 } from '@datadog/browser-core';\nexport function getSessionReplayUrl(configuration, _a) {\n var session = _a.session, viewContext = _a.viewContext, errorType = _a.errorType;\n var sessionId = session ? session.id : 'no-session-id';\n var parameters = [];\n if (errorType !== undefined) {\n parameters.push(\"error-type=\".concat(errorType));\n }\n if (viewContext) {\n parameters.push(\"seed=\".concat(viewContext.id));\n parameters.push(\"from=\".concat(viewContext.startClocks.timeStamp));\n }\n var origin = getDatadogSiteUrl(configuration);\n var path = \"/rum/replay/sessions/\".concat(sessionId);\n return \"\".concat(origin).concat(path, \"?\").concat(parameters.join('&'));\n}\nexport function getDatadogSiteUrl(rumConfiguration) {\n var site = rumConfiguration.site;\n var subdomain = rumConfiguration.subdomain || getSiteDefaultSubdomain(rumConfiguration);\n return \"https://\".concat(subdomain ? \"\".concat(subdomain, \".\") : '').concat(site);\n}\nfunction getSiteDefaultSubdomain(configuration) {\n switch (configuration.site) {\n case INTAKE_SITE_US1:\n case INTAKE_SITE_EU1:\n return 'app';\n case INTAKE_SITE_STAGING:\n return 'dd';\n default:\n return undefined;\n }\n}\n//# sourceMappingURL=getSessionReplayUrl.js.map","export var MAX_STATS_HISTORY = 10;\nvar statsPerView;\nexport function getSegmentsCount(viewId) {\n return getOrCreateReplayStats(viewId).segments_count;\n}\nexport function addSegment(viewId) {\n getOrCreateReplayStats(viewId).segments_count += 1;\n}\nexport function addRecord(viewId) {\n getOrCreateReplayStats(viewId).records_count += 1;\n}\nexport function addWroteData(viewId, additionalBytesCount) {\n getOrCreateReplayStats(viewId).segments_total_raw_size += additionalBytesCount;\n}\nexport function getReplayStats(viewId) {\n return statsPerView === null || statsPerView === void 0 ? void 0 : statsPerView.get(viewId);\n}\nexport function resetReplayStats() {\n statsPerView = undefined;\n}\nfunction getOrCreateReplayStats(viewId) {\n if (!statsPerView) {\n statsPerView = new Map();\n }\n var replayStats;\n if (statsPerView.has(viewId)) {\n replayStats = statsPerView.get(viewId);\n }\n else {\n replayStats = {\n records_count: 0,\n segments_count: 0,\n segments_total_raw_size: 0,\n };\n statsPerView.set(viewId, replayStats);\n if (statsPerView.size > MAX_STATS_HISTORY) {\n deleteOldestStats();\n }\n }\n return replayStats;\n}\nfunction deleteOldestStats() {\n if (!statsPerView) {\n return;\n }\n if (statsPerView.keys) {\n statsPerView.delete(statsPerView.keys().next().value);\n }\n else {\n // IE11 doesn't support map.keys\n var isFirst_1 = true;\n statsPerView.forEach(function (_value, key) {\n if (isFirst_1) {\n statsPerView.delete(key);\n isFirst_1 = false;\n }\n });\n }\n}\n//# sourceMappingURL=replayStats.js.map","import { DefaultPrivacyLevel } from '@datadog/browser-core';\nexport var NodePrivacyLevel = {\n IGNORE: 'ignore',\n HIDDEN: 'hidden',\n ALLOW: DefaultPrivacyLevel.ALLOW,\n MASK: DefaultPrivacyLevel.MASK,\n MASK_USER_INPUT: DefaultPrivacyLevel.MASK_USER_INPUT,\n};\nexport var PRIVACY_ATTR_NAME = 'data-dd-privacy';\n// Privacy Attrs\nexport var PRIVACY_ATTR_VALUE_ALLOW = 'allow';\nexport var PRIVACY_ATTR_VALUE_MASK = 'mask';\nexport var PRIVACY_ATTR_VALUE_MASK_USER_INPUT = 'mask-user-input';\nexport var PRIVACY_ATTR_VALUE_HIDDEN = 'hidden';\n// Privacy Classes - not all customers can set plain HTML attributes, so support classes too\nexport var PRIVACY_CLASS_ALLOW = 'dd-privacy-allow';\nexport var PRIVACY_CLASS_MASK = 'dd-privacy-mask';\nexport var PRIVACY_CLASS_MASK_USER_INPUT = 'dd-privacy-mask-user-input';\nexport var PRIVACY_CLASS_HIDDEN = 'dd-privacy-hidden';\n// Private Replacement Templates\nexport var CENSORED_STRING_MARK = '***';\nexport var CENSORED_IMG_MARK = 'data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';\nexport var FORM_PRIVATE_TAG_NAMES = {\n INPUT: true,\n OUTPUT: true,\n TEXTAREA: true,\n SELECT: true,\n OPTION: true,\n DATALIST: true,\n OPTGROUP: true,\n};\n//# sourceMappingURL=constants.js.map","import { isElementNode, getParentNode, isTextNode } from '@datadog/browser-rum-core';\nimport { NodePrivacyLevel, PRIVACY_ATTR_NAME, PRIVACY_ATTR_VALUE_ALLOW, PRIVACY_ATTR_VALUE_MASK, PRIVACY_ATTR_VALUE_MASK_USER_INPUT, PRIVACY_ATTR_VALUE_HIDDEN, PRIVACY_CLASS_ALLOW, PRIVACY_CLASS_MASK, PRIVACY_CLASS_MASK_USER_INPUT, PRIVACY_CLASS_HIDDEN, FORM_PRIVATE_TAG_NAMES, CENSORED_STRING_MARK, } from '../../constants';\nvar TEXT_MASKING_CHAR = 'x';\n/**\n * Get node privacy level by iterating over its ancestors. When the direct parent privacy level is\n * know, it is best to use something like:\n *\n * derivePrivacyLevelGivenParent(getNodeSelfPrivacyLevel(node), parentNodePrivacyLevel)\n */\nexport function getNodePrivacyLevel(node, defaultPrivacyLevel, cache) {\n if (cache && cache.has(node)) {\n return cache.get(node);\n }\n var parentNode = getParentNode(node);\n var parentNodePrivacyLevel = parentNode\n ? getNodePrivacyLevel(parentNode, defaultPrivacyLevel, cache)\n : defaultPrivacyLevel;\n var selfNodePrivacyLevel = getNodeSelfPrivacyLevel(node);\n var nodePrivacyLevel = reducePrivacyLevel(selfNodePrivacyLevel, parentNodePrivacyLevel);\n if (cache) {\n cache.set(node, nodePrivacyLevel);\n }\n return nodePrivacyLevel;\n}\n/**\n * Reduces the next privacy level based on self + parent privacy levels\n */\nexport function reducePrivacyLevel(childPrivacyLevel, parentNodePrivacyLevel) {\n switch (parentNodePrivacyLevel) {\n // These values cannot be overridden\n case NodePrivacyLevel.HIDDEN:\n case NodePrivacyLevel.IGNORE:\n return parentNodePrivacyLevel;\n }\n switch (childPrivacyLevel) {\n case NodePrivacyLevel.ALLOW:\n case NodePrivacyLevel.MASK:\n case NodePrivacyLevel.MASK_USER_INPUT:\n case NodePrivacyLevel.HIDDEN:\n case NodePrivacyLevel.IGNORE:\n return childPrivacyLevel;\n default:\n return parentNodePrivacyLevel;\n }\n}\n/**\n * Determines the node's own privacy level without checking for ancestors.\n */\nexport function getNodeSelfPrivacyLevel(node) {\n // Only Element types can have a privacy level set\n if (!isElementNode(node)) {\n return;\n }\n var privAttr = node.getAttribute(PRIVACY_ATTR_NAME);\n // Overrules for replay purpose\n if (node.tagName === 'BASE') {\n return NodePrivacyLevel.ALLOW;\n }\n // Overrules to enforce end-user protection\n if (node.tagName === 'INPUT') {\n var inputElement = node;\n if (inputElement.type === 'password' || inputElement.type === 'email' || inputElement.type === 'tel') {\n return NodePrivacyLevel.MASK;\n }\n if (inputElement.type === 'hidden') {\n return NodePrivacyLevel.MASK;\n }\n var autocomplete = inputElement.getAttribute('autocomplete');\n // Handle input[autocomplete=cc-number/cc-csc/cc-exp/cc-exp-month/cc-exp-year]\n if (autocomplete && autocomplete.indexOf('cc-') === 0) {\n return NodePrivacyLevel.MASK;\n }\n }\n // Check HTML privacy attributes and classes\n if (privAttr === PRIVACY_ATTR_VALUE_HIDDEN || node.classList.contains(PRIVACY_CLASS_HIDDEN)) {\n return NodePrivacyLevel.HIDDEN;\n }\n if (privAttr === PRIVACY_ATTR_VALUE_MASK || node.classList.contains(PRIVACY_CLASS_MASK)) {\n return NodePrivacyLevel.MASK;\n }\n if (privAttr === PRIVACY_ATTR_VALUE_MASK_USER_INPUT || node.classList.contains(PRIVACY_CLASS_MASK_USER_INPUT)) {\n return NodePrivacyLevel.MASK_USER_INPUT;\n }\n if (privAttr === PRIVACY_ATTR_VALUE_ALLOW || node.classList.contains(PRIVACY_CLASS_ALLOW)) {\n return NodePrivacyLevel.ALLOW;\n }\n if (shouldIgnoreElement(node)) {\n return NodePrivacyLevel.IGNORE;\n }\n}\n/**\n * Helper aiming to unify `mask` and `mask-user-input` privacy levels:\n *\n * In the `mask` case, it is trivial: we should mask the element.\n *\n * In the `mask-user-input` case, we should mask the element only if it is a \"form\" element or the\n * direct parent is a form element for text nodes).\n *\n * Other `shouldMaskNode` cases are edge cases that should not matter too much (ex: should we mask a\n * node if it is ignored or hidden? it doesn't matter since it won't be serialized).\n */\nexport function shouldMaskNode(node, privacyLevel) {\n switch (privacyLevel) {\n case NodePrivacyLevel.MASK:\n case NodePrivacyLevel.HIDDEN:\n case NodePrivacyLevel.IGNORE:\n return true;\n case NodePrivacyLevel.MASK_USER_INPUT:\n return isTextNode(node) ? isFormElement(node.parentNode) : isFormElement(node);\n default:\n return false;\n }\n}\nfunction isFormElement(node) {\n if (!node || node.nodeType !== node.ELEMENT_NODE) {\n return false;\n }\n var element = node;\n if (element.tagName === 'INPUT') {\n switch (element.type) {\n case 'button':\n case 'color':\n case 'reset':\n case 'submit':\n return false;\n }\n }\n return !!FORM_PRIVATE_TAG_NAMES[element.tagName];\n}\n/**\n * Text censoring non-destructively maintains whitespace characters in order to preserve text shape\n * during replay.\n */\nexport var censorText = function (text) { return text.replace(/\\S/g, TEXT_MASKING_CHAR); };\nexport function getTextContent(textNode, ignoreWhiteSpace, parentNodePrivacyLevel) {\n var _a;\n // The parent node may not be a html element which has a tagName attribute.\n // So just let it be undefined which is ok in this use case.\n var parentTagName = (_a = textNode.parentElement) === null || _a === void 0 ? void 0 : _a.tagName;\n var textContent = textNode.textContent || '';\n if (ignoreWhiteSpace && !textContent.trim()) {\n return;\n }\n var nodePrivacyLevel = parentNodePrivacyLevel;\n var isScript = parentTagName === 'SCRIPT';\n if (isScript) {\n // For perf reasons, we don't record script (heuristic)\n textContent = CENSORED_STRING_MARK;\n }\n else if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {\n // Should never occur, but just in case, we set to CENSORED_MARK.\n textContent = CENSORED_STRING_MARK;\n }\n else if (shouldMaskNode(textNode, nodePrivacyLevel)) {\n if (\n // Scrambling the child list breaks text nodes for DATALIST/SELECT/OPTGROUP\n parentTagName === 'DATALIST' ||\n parentTagName === 'SELECT' ||\n parentTagName === 'OPTGROUP') {\n if (!textContent.trim()) {\n return;\n }\n }\n else if (parentTagName === 'OPTION') {\n // \n );\n};\n\nexport default XIcon;\n","import React from 'react';\nimport Typography from '../typography/Typography';\nimport { ILoaderProps } from '../../types/loader';\nimport './loader.scss';\n\nconst Loader: React.FC = ({\n size,\n height,\n dotsColor,\n className,\n fullScreen,\n fullComponent,\n text = 'Please wait!',\n spinner = false,\n}) => {\n const classBase = 'custom-loader';\n\n const classes: string[] = [\n classBase,\n `${fullComponent ? `${classBase}-full-component` : ''}`,\n `${className || ''}`,\n ];\n\n const dotsClasses: string[] = [\n 'loading-dots--dot',\n `${dotsColor ? `dots-color-${dotsColor}` : ''}`,\n ];\n\n const loader = (\n \n
\n \n \n
\n
\n
\n );\n\n if (fullScreen) {\n return (\n <>\n
\n {loader}\n {text}\n
\n
\n \n );\n }\n\n if (spinner) {\n return
;\n }\n return loader;\n};\n\nexport default Loader;\n","import React, { forwardRef } from 'react';\nimport { ButtonProps } from '../../types/button';\nimport Typography from '../typography/Typography';\nimport XIcon from '../icons/XIcon';\nimport './button.scss';\nimport Loader from '../loader/Loader';\n\nexport const Button = forwardRef(({\n label,\n icon,\n onClick,\n type = 'button',\n textColor,\n className,\n formId,\n priority = 'secondary',\n variant = 'info',\n iconPosition = 'left',\n circle = false,\n disabled = false,\n fullWidth = false,\n progress = false,\n infoText = '',\n moreText = '',\n loading = false,\n ...props\n}, ref) => {\n const classBase = 'custom-button';\n\n const classes: string[] = [\n classBase,\n `${classBase}-priority-${priority}`,\n `${classBase}-variant-${variant}`,\n `${className || ''}`,\n `${disabled ? 'disabled' : ''}`,\n `${fullWidth ? 'width-12' : ''}`,\n `${progress ? 'progress' : ''}`,\n `${infoText ? 'info-text' : ''}`,\n ];\n\n if (circle && icon) classes.push(`${classBase}-circle`);\n\n return (\n (onClick ? onClick() : null)}\n disabled={disabled}\n ref={ref}\n form={formId}\n {...props}\n >\n {!!icon && iconPosition === 'left' && (\n \n {icon}\n \n )}\n\n {(!circle || !icon) && (\n
\n \n {label}\n \n {infoText && (\n \n {infoText}\n \n )}\n {moreText && (\n \n  \n {moreText}\n \n )}\n
\n\n )}\n\n {!!icon && iconPosition === 'right' && (\n \n {icon}\n \n )}\n {progress &&
}\n {loading &&
}\n {progress && (\n
\n \n
\n )}\n \n );\n});\n\nButton.displayName = 'Button';\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst ChevronIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n direction = 'right',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''} ${direction || ''}`;\n\n return (\n \n \n \n );\n};\n\nexport default ChevronIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst CircleXIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default CircleXIcon;\n","import React, { FunctionComponent } from 'react';\nimport { Button } from '../button/Button';\nimport ChevronIcon from '../icons/ChevronIcon';\nimport CircleXIcon from '../icons/CircleXIcon';\nimport Typography from '../typography/Typography';\nimport './errorScreen.scss';\n\ntype ErrorScreenProps = {\n onClick: () => void;\n title?: string;\n text?: string;\n buttonLabel?: string;\n}\n\nconst ErrorScreen: FunctionComponent = ({\n onClick,\n title = 'Oops!',\n text = 'This page could not be loaded.',\n buttonLabel = 'Go Back',\n}) => (\n
\n \n \n { title }\n \n \n { text }\n \n }\n onClick={onClick}\n />\n
\n);\n\nexport default ErrorScreen;\n","!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?t(exports,require(\"react\")):\"function\"==typeof define&&define.amd?define([\"exports\",\"react\"],t):t((e=e||self)[\"localize-react\"]={},e.React)}(this,function(e,s){\"use strict\";var p=\"default\"in s?s.default:s;function v(e){return(v=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e})(e)}var y={},d=\"[LOCALIZE-REACT]: There are no translations for specified locale\",a=\"[LOCALIZE-REACT] Looks like template is being used, but no value passed for \",u=/{{([^{]+[^}])}}/g;function b(e,t){if(!t)return e;if(0===Object.keys(t).length)return e;var r,n,o,i=e.match(u);return i&&0!==i.length?(r=i,n=t,o=Object.keys(n),r.map(function(e){var t=Array.prototype.slice.call(e,2,-2).join(\"\"),r=o.find(function(e){return e===t});return r?[e,n[r]]:(console.warn(a,e),[e,e])})).reduce(function(e,t){var r=new RegExp(t[0],\"gi\");return e.replace(r,t[1])},e):e}var g=p.createContext();var t=g.Consumer;function o(){return s.useContext(g)}e.LocalizationConsumer=t,e.LocalizationContext=g,e.LocalizationProvider=function(e){var t=e.children,r=e.disableCache,n=e.locale,o=e.translations,i=void 0===o?{}:o,a=function(e,t){if(!e)return null;if(\"object\"===v(t[e]))return e;var r=e.toLowerCase().replace(/-/g,\"_\");if(\"object\"===v(t[r]))return r;var n=r.split(\"_\")[0];return\"object\"===v(t[n])?n:(console.warn(d,e),e)}(n,i),l=a?i[a]:i;function u(e,t,r){if(!l||!e)return r||e;var n=\"string\"==typeof r?r:e,o=l[e];if(\"string\"==typeof o)return t?b(o,t):o;var i=e.split(\".\");if(1===i.length)return b(n,t);for(var a=l[i[0]],u=1;u = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} `;\n\n return (\n \n \n \n );\n};\n\nexport default ListIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst LogoIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default LogoIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst MenuIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''}`;\n\n return (\n \n \n \n );\n};\n\nexport default MenuIcon;\n","import React, { FunctionComponent } from 'react';\nimport './divider.scss';\n\ntype DividerProps = {\n fullWidth?: boolean,\n style?: React.CSSProperties,\n className?: string,\n}\n\nconst Divider: FunctionComponent = ({ fullWidth = true, className = '', style }) => (\n
\n);\n\nexport default Divider;\n","/*\n\nBased off glamor's StyleSheet, thanks Sunil ❤️\n\nhigh performance StyleSheet for css-in-js systems\n\n- uses multiple style tags behind the scenes for millions of rules\n- uses `insertRule` for appending in production for *much* faster performance\n\n// usage\n\nimport { StyleSheet } from '@emotion/sheet'\n\nlet styleSheet = new StyleSheet({ key: '', container: document.head })\n\nstyleSheet.insert('#box { border: 1px solid red; }')\n- appends a css rule into the stylesheet\n\nstyleSheet.flush()\n- empties the stylesheet of all its contents\n\n*/\n// $FlowFixMe\nfunction sheetForTag(tag) {\n if (tag.sheet) {\n // $FlowFixMe\n return tag.sheet;\n } // this weirdness brought to you by firefox\n\n /* istanbul ignore next */\n\n\n for (var i = 0; i < document.styleSheets.length; i++) {\n if (document.styleSheets[i].ownerNode === tag) {\n // $FlowFixMe\n return document.styleSheets[i];\n }\n }\n}\n\nfunction createStyleElement(options) {\n var tag = document.createElement('style');\n tag.setAttribute('data-emotion', options.key);\n\n if (options.nonce !== undefined) {\n tag.setAttribute('nonce', options.nonce);\n }\n\n tag.appendChild(document.createTextNode(''));\n tag.setAttribute('data-s', '');\n return tag;\n}\n\nvar StyleSheet = /*#__PURE__*/function () {\n function StyleSheet(options) {\n var _this = this;\n\n this._insertTag = function (tag) {\n var before;\n\n if (_this.tags.length === 0) {\n if (_this.insertionPoint) {\n before = _this.insertionPoint.nextSibling;\n } else if (_this.prepend) {\n before = _this.container.firstChild;\n } else {\n before = _this.before;\n }\n } else {\n before = _this.tags[_this.tags.length - 1].nextSibling;\n }\n\n _this.container.insertBefore(tag, before);\n\n _this.tags.push(tag);\n };\n\n this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy;\n this.tags = [];\n this.ctr = 0;\n this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets\n\n this.key = options.key;\n this.container = options.container;\n this.prepend = options.prepend;\n this.insertionPoint = options.insertionPoint;\n this.before = null;\n }\n\n var _proto = StyleSheet.prototype;\n\n _proto.hydrate = function hydrate(nodes) {\n nodes.forEach(this._insertTag);\n };\n\n _proto.insert = function insert(rule) {\n // the max length is how many rules we have per style tag, it's 65000 in speedy mode\n // it's 1 in dev because we insert source maps that map a single rule to a location\n // and you can only have one source map per style tag\n if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {\n this._insertTag(createStyleElement(this));\n }\n\n var tag = this.tags[this.tags.length - 1];\n\n if (process.env.NODE_ENV !== 'production') {\n var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;\n\n if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {\n // this would only cause problem in speedy mode\n // but we don't want enabling speedy to affect the observable behavior\n // so we report this error at all times\n console.error(\"You're attempting to insert the following rule:\\n\" + rule + '\\n\\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.');\n }\n this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;\n }\n\n if (this.isSpeedy) {\n var sheet = sheetForTag(tag);\n\n try {\n // this is the ultrafast version, works across browsers\n // the big drawback is that the css won't be editable in devtools\n sheet.insertRule(rule, sheet.cssRules.length);\n } catch (e) {\n if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear){/.test(rule)) {\n console.error(\"There was a problem inserting the following rule: \\\"\" + rule + \"\\\"\", e);\n }\n }\n } else {\n tag.appendChild(document.createTextNode(rule));\n }\n\n this.ctr++;\n };\n\n _proto.flush = function flush() {\n // $FlowFixMe\n this.tags.forEach(function (tag) {\n return tag.parentNode && tag.parentNode.removeChild(tag);\n });\n this.tags = [];\n this.ctr = 0;\n\n if (process.env.NODE_ENV !== 'production') {\n this._alreadyInsertedOrderInsensitiveRule = false;\n }\n };\n\n return StyleSheet;\n}();\n\nexport { StyleSheet };\n","export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\n","/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3)\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @return {number}\n */\nexport function indexof (value, search) {\n\treturn value.indexOf(search)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n","import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n","import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && characters.charCodeAt(length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f') != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset:\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule) {\n\t\t\t\t\t\t\t\t\t// d m s\n\t\t\t\t\t\t\t\t\tcase 100: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @return {object}\n */\nexport function comment (value, root, parent) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @return {object}\n */\nexport function declaration (value, root, parent, length) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)\n}\n","import {MS, MOZ, WEBKIT} from './Enum.js'\nimport {hash, charat, strlen, indexof, replace} from './Utility.js'\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {string}\n */\nexport function prefix (value, length) {\n\tswitch (hash(value, length)) {\n\t\t// color-adjust\n\t\tcase 5103:\n\t\t\treturn WEBKIT + 'print-' + value + value\n\t\t// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)\n\t\tcase 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:\n\t\t// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break\n\t\tcase 5572: case 6356: case 5844: case 3191: case 6645: case 3005:\n\t\t// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,\n\t\tcase 6391: case 5879: case 5623: case 6135: case 4599: case 4855:\n\t\t// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)\n\t\tcase 4215: case 6389: case 5109: case 5365: case 5621: case 3829:\n\t\t\treturn WEBKIT + value + value\n\t\t// appearance, user-select, transform, hyphens, text-size-adjust\n\t\tcase 5349: case 4246: case 4810: case 6968: case 2756:\n\t\t\treturn WEBKIT + value + MOZ + value + MS + value + value\n\t\t// flex, flex-direction\n\t\tcase 6828: case 4268:\n\t\t\treturn WEBKIT + value + MS + value + value\n\t\t// order\n\t\tcase 6165:\n\t\t\treturn WEBKIT + value + MS + 'flex-' + value + value\n\t\t// align-items\n\t\tcase 5187:\n\t\t\treturn WEBKIT + value + replace(value, /(\\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value\n\t\t// align-self\n\t\tcase 5443:\n\t\t\treturn WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value\n\t\t// align-content\n\t\tcase 4675:\n\t\t\treturn WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value\n\t\t// flex-shrink\n\t\tcase 5548:\n\t\t\treturn WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value\n\t\t// flex-basis\n\t\tcase 5292:\n\t\t\treturn WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value\n\t\t// flex-grow\n\t\tcase 6060:\n\t\t\treturn WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value\n\t\t// transition\n\t\tcase 4554:\n\t\t\treturn WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value\n\t\t// cursor\n\t\tcase 6187:\n\t\t\treturn replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value\n\t\t// background, background-image\n\t\tcase 5495: case 3959:\n\t\t\treturn replace(value, /(image-set\\([^]*)/, WEBKIT + '$1' + '$`$1')\n\t\t// justify-content\n\t\tcase 4968:\n\t\t\treturn replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value\n\t\t// (margin|padding)-inline-(start|end)\n\t\tcase 4095: case 3583: case 4068: case 2532:\n\t\t\treturn replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value\n\t\t// (min|max)?(width|height|inline-size|block-size)\n\t\tcase 8116: case 7059: case 5753: case 5535:\n\t\tcase 5445: case 5701: case 4933: case 4677:\n\t\tcase 5533: case 5789: case 5021: case 4765:\n\t\t\t// stretch, max-content, min-content, fill-available\n\t\t\tif (strlen(value) - 1 - length > 6)\n\t\t\t\tswitch (charat(value, length + 1)) {\n\t\t\t\t\t// (m)ax-content, (m)in-content\n\t\t\t\t\tcase 109:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (charat(value, length + 4) !== 45)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t// (f)ill-available, (f)it-content\n\t\t\t\t\tcase 102:\n\t\t\t\t\t\treturn replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value\n\t\t\t\t\t// (s)tretch\n\t\t\t\t\tcase 115:\n\t\t\t\t\t\treturn ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value\n\t\t\t\t}\n\t\t\tbreak\n\t\t// position: sticky\n\t\tcase 4949:\n\t\t\t// (s)ticky?\n\t\t\tif (charat(value, length + 1) !== 115)\n\t\t\t\tbreak\n\t\t// display: (flex|inline-flex)\n\t\tcase 6444:\n\t\t\tswitch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {\n\t\t\t\t// stic(k)y\n\t\t\t\tcase 107:\n\t\t\t\t\treturn replace(value, ':', ':' + WEBKIT) + value\n\t\t\t\t// (inline-)?fl(e)x\n\t\t\t\tcase 101:\n\t\t\t\t\treturn replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value\n\t\t\t}\n\t\t\tbreak\n\t\t// writing-mode\n\t\tcase 5936:\n\t\t\tswitch (charat(value, length + 11)) {\n\t\t\t\t// vertical-l(r)\n\t\t\t\tcase 114:\n\t\t\t\t\treturn WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb') + value\n\t\t\t\t// vertical-r(l)\n\t\t\t\tcase 108:\n\t\t\t\t\treturn WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb-rl') + value\n\t\t\t\t// horizontal(-)tb\n\t\t\t\tcase 45:\n\t\t\t\t\treturn WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'lr') + value\n\t\t\t}\n\n\t\t\treturn WEBKIT + value + MS + value + value\n\t}\n\n\treturn value\n}\n","import {IMPORT, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen, sizeof} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\tvar length = sizeof(children)\n\n\tfor (var i = 0; i < length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: element.value = element.props.join(',')\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n","import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'\nimport {match, charat, substr, strlen, sizeof, replace, combine} from './Utility.js'\nimport {copy, tokenize} from './Tokenizer.js'\nimport {serialize} from './Serializer.js'\nimport {prefix} from './Prefixer.js'\n\n/**\n * @param {function[]} collection\n * @return {function}\n */\nexport function middleware (collection) {\n\tvar length = sizeof(collection)\n\n\treturn function (element, index, children, callback) {\n\t\tvar output = ''\n\n\t\tfor (var i = 0; i < length; i++)\n\t\t\toutput += collection[i](element, index, children, callback) || ''\n\n\t\treturn output\n\t}\n}\n\n/**\n * @param {function} callback\n * @return {function}\n */\nexport function rulesheet (callback) {\n\treturn function (element) {\n\t\tif (!element.root)\n\t\t\tif (element = element.return)\n\t\t\t\tcallback(element)\n\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n */\nexport function prefixer (element, index, children, callback) {\n\tif (element.length > -1)\n\t\tif (!element.return)\n\t\t\tswitch (element.type) {\n\t\t\t\tcase DECLARATION: element.return = prefix(element.value, element.length)\n\t\t\t\t\tbreak\n\t\t\t\tcase KEYFRAMES:\n\t\t\t\t\treturn serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)\n\t\t\t\tcase RULESET:\n\t\t\t\t\tif (element.length)\n\t\t\t\t\t\treturn combine(element.props, function (value) {\n\t\t\t\t\t\t\tswitch (match(value, /(::plac\\w+|:read-\\w+)/)) {\n\t\t\t\t\t\t\t\t// :read-(only|write)\n\t\t\t\t\t\t\t\tcase ':read-only': case ':read-write':\n\t\t\t\t\t\t\t\t\treturn serialize([copy(element, {props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]})], callback)\n\t\t\t\t\t\t\t\t// :placeholder\n\t\t\t\t\t\t\t\tcase '::placeholder':\n\t\t\t\t\t\t\t\t\treturn serialize([\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]}),\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]}),\n\t\t\t\t\t\t\t\t\t\tcopy(element, {props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]})\n\t\t\t\t\t\t\t\t\t], callback)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t})\n\t\t\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n */\nexport function namespace (element) {\n\tswitch (element.type) {\n\t\tcase RULESET:\n\t\t\telement.props = element.props.map(function (value) {\n\t\t\t\treturn combine(tokenize(value), function (value, index, children) {\n\t\t\t\t\tswitch (charat(value, 0)) {\n\t\t\t\t\t\t// \\f\n\t\t\t\t\t\tcase 12:\n\t\t\t\t\t\t\treturn substr(value, 1, strlen(value))\n\t\t\t\t\t\t// \\0 ( + > ~\n\t\t\t\t\t\tcase 0: case 40: case 43: case 62: case 126:\n\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase 58:\n\t\t\t\t\t\t\tif (children[++index] === 'global')\n\t\t\t\t\t\t\t\tchildren[index] = '', children[++index] = '\\f' + substr(children[index], index = 1, -1)\n\t\t\t\t\t\t// \\s\n\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\treturn index === 1 ? '' : value\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tswitch (index) {\n\t\t\t\t\t\t\t\tcase 0: element = value\n\t\t\t\t\t\t\t\t\treturn sizeof(children) > 1 ? '' : value\n\t\t\t\t\t\t\t\tcase index = sizeof(children) - 1: case 2:\n\t\t\t\t\t\t\t\t\treturn index === 2 ? value + element + element : value + element\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n","function memoize(fn) {\n var cache = Object.create(null);\n return function (arg) {\n if (cache[arg] === undefined) cache[arg] = fn(arg);\n return cache[arg];\n };\n}\n\nexport default memoize;\n","import { StyleSheet } from '@emotion/sheet';\nimport { dealloc, alloc, next, token, from, peek, delimit, slice, position, stringify, COMMENT, rulesheet, middleware, prefixer, serialize, compile } from 'stylis';\nimport '@emotion/weak-memoize';\nimport '@emotion/memoize';\n\nvar last = function last(arr) {\n return arr.length ? arr[arr.length - 1] : null;\n}; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244\n\n\nvar identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {\n var previous = 0;\n var character = 0;\n\n while (true) {\n previous = character;\n character = peek(); // &\\f\n\n if (previous === 38 && character === 12) {\n points[index] = 1;\n }\n\n if (token(character)) {\n break;\n }\n\n next();\n }\n\n return slice(begin, position);\n};\n\nvar toRules = function toRules(parsed, points) {\n // pretend we've started with a comma\n var index = -1;\n var character = 44;\n\n do {\n switch (token(character)) {\n case 0:\n // &\\f\n if (character === 38 && peek() === 12) {\n // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings\n // stylis inserts \\f after & to know when & where it should replace this sequence with the context selector\n // and when it should just concatenate the outer and inner selectors\n // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here\n points[index] = 1;\n }\n\n parsed[index] += identifierWithPointTracking(position - 1, points, index);\n break;\n\n case 2:\n parsed[index] += delimit(character);\n break;\n\n case 4:\n // comma\n if (character === 44) {\n // colon\n parsed[++index] = peek() === 58 ? '&\\f' : '';\n points[index] = parsed[index].length;\n break;\n }\n\n // fallthrough\n\n default:\n parsed[index] += from(character);\n }\n } while (character = next());\n\n return parsed;\n};\n\nvar getRules = function getRules(value, points) {\n return dealloc(toRules(alloc(value), points));\n}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11\n\n\nvar fixedElements = /* #__PURE__ */new WeakMap();\nvar compat = function compat(element) {\n if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo\n // negative .length indicates that this rule has been already prefixed\n element.length < 1) {\n return;\n }\n\n var value = element.value,\n parent = element.parent;\n var isImplicitRule = element.column === parent.column && element.line === parent.line;\n\n while (parent.type !== 'rule') {\n parent = parent.parent;\n if (!parent) return;\n } // short-circuit for the simplest case\n\n\n if (element.props.length === 1 && value.charCodeAt(0) !== 58\n /* colon */\n && !fixedElements.get(parent)) {\n return;\n } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)\n // then the props has already been manipulated beforehand as they that array is shared between it and its \"rule parent\"\n\n\n if (isImplicitRule) {\n return;\n }\n\n fixedElements.set(element, true);\n var points = [];\n var rules = getRules(value, points);\n var parentRules = parent.props;\n\n for (var i = 0, k = 0; i < rules.length; i++) {\n for (var j = 0; j < parentRules.length; j++, k++) {\n element.props[k] = points[i] ? rules[i].replace(/&\\f/g, parentRules[j]) : parentRules[j] + \" \" + rules[i];\n }\n }\n};\nvar removeLabel = function removeLabel(element) {\n if (element.type === 'decl') {\n var value = element.value;\n\n if ( // charcode for l\n value.charCodeAt(0) === 108 && // charcode for b\n value.charCodeAt(2) === 98) {\n // this ignores label\n element[\"return\"] = '';\n element.value = '';\n }\n }\n};\nvar ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';\n\nvar isIgnoringComment = function isIgnoringComment(element) {\n return !!element && element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;\n};\n\nvar createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {\n return function (element, index, children) {\n if (element.type !== 'rule') return;\n var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);\n\n if (unsafePseudoClasses && cache.compat !== true) {\n var prevElement = index > 0 ? children[index - 1] : null;\n\n if (prevElement && isIgnoringComment(last(prevElement.children))) {\n return;\n }\n\n unsafePseudoClasses.forEach(function (unsafePseudoClass) {\n console.error(\"The pseudo class \\\"\" + unsafePseudoClass + \"\\\" is potentially unsafe when doing server-side rendering. Try changing it to \\\"\" + unsafePseudoClass.split('-child')[0] + \"-of-type\\\".\");\n });\n }\n };\n};\n\nvar isImportRule = function isImportRule(element) {\n return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;\n};\n\nvar isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {\n for (var i = index - 1; i >= 0; i--) {\n if (!isImportRule(children[i])) {\n return true;\n }\n }\n\n return false;\n}; // use this to remove incorrect elements from further processing\n// so they don't get handed to the `sheet` (or anything else)\n// as that could potentially lead to additional logs which in turn could be overhelming to the user\n\n\nvar nullifyElement = function nullifyElement(element) {\n element.type = '';\n element.value = '';\n element[\"return\"] = '';\n element.children = '';\n element.props = '';\n};\n\nvar incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {\n if (!isImportRule(element)) {\n return;\n }\n\n if (element.parent) {\n console.error(\"`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.\");\n nullifyElement(element);\n } else if (isPrependedWithRegularRules(index, children)) {\n console.error(\"`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.\");\n nullifyElement(element);\n }\n};\n\nvar defaultStylisPlugins = [prefixer];\n\nvar createCache = function createCache(options) {\n var key = options.key;\n\n if (process.env.NODE_ENV !== 'production' && !key) {\n throw new Error(\"You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\\n\" + \"If multiple caches share the same key they might \\\"fight\\\" for each other's style elements.\");\n }\n\n if ( key === 'css') {\n var ssrStyles = document.querySelectorAll(\"style[data-emotion]:not([data-s])\"); // get SSRed styles out of the way of React's hydration\n // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)\n // note this very very intentionally targets all style elements regardless of the key to ensure\n // that creating a cache works inside of render of a React component\n\n Array.prototype.forEach.call(ssrStyles, function (node) {\n // we want to only move elements which have a space in the data-emotion attribute value\n // because that indicates that it is an Emotion 11 server-side rendered style elements\n // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector\n // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)\n // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles\n // will not result in the Emotion 10 styles being destroyed\n var dataEmotionAttribute = node.getAttribute('data-emotion');\n\n if (dataEmotionAttribute.indexOf(' ') === -1) {\n return;\n }\n document.head.appendChild(node);\n node.setAttribute('data-s', '');\n });\n }\n\n var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;\n\n if (process.env.NODE_ENV !== 'production') {\n // $FlowFixMe\n if (/[^a-z-]/.test(key)) {\n throw new Error(\"Emotion key must only contain lower case alphabetical characters and - but \\\"\" + key + \"\\\" was passed\");\n }\n }\n\n var inserted = {}; // $FlowFixMe\n\n var container;\n var nodesToHydrate = [];\n\n {\n container = options.container || document.head;\n Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which\n // means that the style elements we're looking at are only Emotion 11 server-rendered style elements\n document.querySelectorAll(\"style[data-emotion^=\\\"\" + key + \" \\\"]\"), function (node) {\n var attrib = node.getAttribute(\"data-emotion\").split(' '); // $FlowFixMe\n\n for (var i = 1; i < attrib.length; i++) {\n inserted[attrib[i]] = true;\n }\n\n nodesToHydrate.push(node);\n });\n }\n\n var _insert;\n\n var omnipresentPlugins = [compat, removeLabel];\n\n if (process.env.NODE_ENV !== 'production') {\n omnipresentPlugins.push(createUnsafeSelectorsAlarm({\n get compat() {\n return cache.compat;\n }\n\n }), incorrectImportAlarm);\n }\n\n {\n var currentSheet;\n var finalizingPlugins = [stringify, process.env.NODE_ENV !== 'production' ? function (element) {\n if (!element.root) {\n if (element[\"return\"]) {\n currentSheet.insert(element[\"return\"]);\n } else if (element.value && element.type !== COMMENT) {\n // insert empty rule in non-production environments\n // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet\n currentSheet.insert(element.value + \"{}\");\n }\n }\n } : rulesheet(function (rule) {\n currentSheet.insert(rule);\n })];\n var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));\n\n var stylis = function stylis(styles) {\n return serialize(compile(styles), serializer);\n };\n\n _insert = function insert(selector, serialized, sheet, shouldCache) {\n currentSheet = sheet;\n\n if (process.env.NODE_ENV !== 'production' && serialized.map !== undefined) {\n currentSheet = {\n insert: function insert(rule) {\n sheet.insert(rule + serialized.map);\n }\n };\n }\n\n stylis(selector ? selector + \"{\" + serialized.styles + \"}\" : serialized.styles);\n\n if (shouldCache) {\n cache.inserted[serialized.name] = true;\n }\n };\n }\n\n var cache = {\n key: key,\n sheet: new StyleSheet({\n key: key,\n container: container,\n nonce: options.nonce,\n speedy: options.speedy,\n prepend: options.prepend,\n insertionPoint: options.insertionPoint\n }),\n nonce: options.nonce,\n inserted: inserted,\n registered: {},\n insert: _insert\n };\n cache.sheet.hydrate(nodesToHydrate);\n return cache;\n};\n\nexport default createCache;\n","var isBrowser = \"object\" !== 'undefined';\nfunction getRegisteredStyles(registered, registeredStyles, classNames) {\n var rawClassName = '';\n classNames.split(' ').forEach(function (className) {\n if (registered[className] !== undefined) {\n registeredStyles.push(registered[className] + \";\");\n } else {\n rawClassName += className + \" \";\n }\n });\n return rawClassName;\n}\nvar insertStyles = function insertStyles(cache, serialized, isStringTag) {\n var className = cache.key + \"-\" + serialized.name;\n\n if ( // we only need to add the styles to the registered cache if the\n // class name could be used further down\n // the tree but if it's a string tag, we know it won't\n // so we don't have to add it to registered cache.\n // this improves memory usage since we can avoid storing the whole style string\n (isStringTag === false || // we need to always store it if we're in compat mode and\n // in node since emotion-server relies on whether a style is in\n // the registered cache to know whether a style is global or not\n // also, note that this check will be dead code eliminated in the browser\n isBrowser === false ) && cache.registered[className] === undefined) {\n cache.registered[className] = serialized.styles;\n }\n\n if (cache.inserted[serialized.name] === undefined) {\n var current = serialized;\n\n do {\n var maybeStyles = cache.insert(serialized === current ? \".\" + className : '', current, cache.sheet, true);\n\n current = current.next;\n } while (current !== undefined);\n }\n};\n\nexport { getRegisteredStyles, insertStyles };\n","/* eslint-disable */\n// Inspired by https://github.com/garycourt/murmurhash-js\n// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86\nfunction murmur2(str) {\n // 'm' and 'r' are mixing constants generated offline.\n // They're not really 'magic', they just happen to work well.\n // const m = 0x5bd1e995;\n // const r = 24;\n // Initialize the hash\n var h = 0; // Mix 4 bytes at a time into the hash\n\n var k,\n i = 0,\n len = str.length;\n\n for (; len >= 4; ++i, len -= 4) {\n k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;\n k =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);\n k ^=\n /* k >>> r: */\n k >>> 24;\n h =\n /* Math.imul(k, m): */\n (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Handle the last few bytes of the input array\n\n\n switch (len) {\n case 3:\n h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n\n case 2:\n h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n\n case 1:\n h ^= str.charCodeAt(i) & 0xff;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n } // Do a few final mixes of the hash to ensure the last few\n // bytes are well-incorporated.\n\n\n h ^= h >>> 13;\n h =\n /* Math.imul(h, m): */\n (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);\n return ((h ^ h >>> 15) >>> 0).toString(36);\n}\n\nexport default murmur2;\n","var unitlessKeys = {\n animationIterationCount: 1,\n borderImageOutset: 1,\n borderImageSlice: 1,\n borderImageWidth: 1,\n boxFlex: 1,\n boxFlexGroup: 1,\n boxOrdinalGroup: 1,\n columnCount: 1,\n columns: 1,\n flex: 1,\n flexGrow: 1,\n flexPositive: 1,\n flexShrink: 1,\n flexNegative: 1,\n flexOrder: 1,\n gridRow: 1,\n gridRowEnd: 1,\n gridRowSpan: 1,\n gridRowStart: 1,\n gridColumn: 1,\n gridColumnEnd: 1,\n gridColumnSpan: 1,\n gridColumnStart: 1,\n msGridRow: 1,\n msGridRowSpan: 1,\n msGridColumn: 1,\n msGridColumnSpan: 1,\n fontWeight: 1,\n lineHeight: 1,\n opacity: 1,\n order: 1,\n orphans: 1,\n tabSize: 1,\n widows: 1,\n zIndex: 1,\n zoom: 1,\n WebkitLineClamp: 1,\n // SVG-related properties\n fillOpacity: 1,\n floodOpacity: 1,\n stopOpacity: 1,\n strokeDasharray: 1,\n strokeDashoffset: 1,\n strokeMiterlimit: 1,\n strokeOpacity: 1,\n strokeWidth: 1\n};\n\nexport default unitlessKeys;\n","import hashString from '@emotion/hash';\nimport unitless from '@emotion/unitless';\nimport memoize from '@emotion/memoize';\n\nvar ILLEGAL_ESCAPE_SEQUENCE_ERROR = \"You have illegal escape sequence in your template literal, most likely inside content's property value.\\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \\\"content: '\\\\00d7';\\\" should become \\\"content: '\\\\\\\\00d7';\\\".\\nYou can read more about this here:\\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences\";\nvar UNDEFINED_AS_OBJECT_KEY_ERROR = \"You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).\";\nvar hyphenateRegex = /[A-Z]|^ms/g;\nvar animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;\n\nvar isCustomProperty = function isCustomProperty(property) {\n return property.charCodeAt(1) === 45;\n};\n\nvar isProcessableValue = function isProcessableValue(value) {\n return value != null && typeof value !== 'boolean';\n};\n\nvar processStyleName = /* #__PURE__ */memoize(function (styleName) {\n return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();\n});\n\nvar processStyleValue = function processStyleValue(key, value) {\n switch (key) {\n case 'animation':\n case 'animationName':\n {\n if (typeof value === 'string') {\n return value.replace(animationRegex, function (match, p1, p2) {\n cursor = {\n name: p1,\n styles: p2,\n next: cursor\n };\n return p1;\n });\n }\n }\n }\n\n if (unitless[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {\n return value + 'px';\n }\n\n return value;\n};\n\nif (process.env.NODE_ENV !== 'production') {\n var contentValuePattern = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\\(|(no-)?(open|close)-quote/;\n var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset'];\n var oldProcessStyleValue = processStyleValue;\n var msPattern = /^-ms-/;\n var hyphenPattern = /-(.)/g;\n var hyphenatedCache = {};\n\n processStyleValue = function processStyleValue(key, value) {\n if (key === 'content') {\n if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '\"' && value.charAt(0) !== \"'\")) {\n throw new Error(\"You seem to be using a value for 'content' without quotes, try replacing it with `content: '\\\"\" + value + \"\\\"'`\");\n }\n }\n\n var processed = oldProcessStyleValue(key, value);\n\n if (processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined) {\n hyphenatedCache[key] = true;\n console.error(\"Using kebab-case for css properties in objects is not supported. Did you mean \" + key.replace(msPattern, 'ms-').replace(hyphenPattern, function (str, _char) {\n return _char.toUpperCase();\n }) + \"?\");\n }\n\n return processed;\n };\n}\n\nfunction handleInterpolation(mergedProps, registered, interpolation) {\n if (interpolation == null) {\n return '';\n }\n\n if (interpolation.__emotion_styles !== undefined) {\n if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') {\n throw new Error('Component selectors can only be used in conjunction with @emotion/babel-plugin.');\n }\n\n return interpolation;\n }\n\n switch (typeof interpolation) {\n case 'boolean':\n {\n return '';\n }\n\n case 'object':\n {\n if (interpolation.anim === 1) {\n cursor = {\n name: interpolation.name,\n styles: interpolation.styles,\n next: cursor\n };\n return interpolation.name;\n }\n\n if (interpolation.styles !== undefined) {\n var next = interpolation.next;\n\n if (next !== undefined) {\n // not the most efficient thing ever but this is a pretty rare case\n // and there will be very few iterations of this generally\n while (next !== undefined) {\n cursor = {\n name: next.name,\n styles: next.styles,\n next: cursor\n };\n next = next.next;\n }\n }\n\n var styles = interpolation.styles + \";\";\n\n if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) {\n styles += interpolation.map;\n }\n\n return styles;\n }\n\n return createStringFromObject(mergedProps, registered, interpolation);\n }\n\n case 'function':\n {\n if (mergedProps !== undefined) {\n var previousCursor = cursor;\n var result = interpolation(mergedProps);\n cursor = previousCursor;\n return handleInterpolation(mergedProps, registered, result);\n } else if (process.env.NODE_ENV !== 'production') {\n console.error('Functions that are interpolated in css calls will be stringified.\\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\\n' + 'It can be called directly with props or interpolated in a styled call like this\\n' + \"let SomeComponent = styled('div')`${dynamicStyle}`\");\n }\n\n break;\n }\n\n case 'string':\n if (process.env.NODE_ENV !== 'production') {\n var matched = [];\n var replaced = interpolation.replace(animationRegex, function (match, p1, p2) {\n var fakeVarName = \"animation\" + matched.length;\n matched.push(\"const \" + fakeVarName + \" = keyframes`\" + p2.replace(/^@keyframes animation-\\w+/, '') + \"`\");\n return \"${\" + fakeVarName + \"}\";\n });\n\n if (matched.length) {\n console.error('`keyframes` output got interpolated into plain string, please wrap it with `css`.\\n\\n' + 'Instead of doing this:\\n\\n' + [].concat(matched, [\"`\" + replaced + \"`\"]).join('\\n') + '\\n\\nYou should wrap it with `css` like this:\\n\\n' + (\"css`\" + replaced + \"`\"));\n }\n }\n\n break;\n } // finalize string values (regular strings and functions interpolated into css calls)\n\n\n if (registered == null) {\n return interpolation;\n }\n\n var cached = registered[interpolation];\n return cached !== undefined ? cached : interpolation;\n}\n\nfunction createStringFromObject(mergedProps, registered, obj) {\n var string = '';\n\n if (Array.isArray(obj)) {\n for (var i = 0; i < obj.length; i++) {\n string += handleInterpolation(mergedProps, registered, obj[i]) + \";\";\n }\n } else {\n for (var _key in obj) {\n var value = obj[_key];\n\n if (typeof value !== 'object') {\n if (registered != null && registered[value] !== undefined) {\n string += _key + \"{\" + registered[value] + \"}\";\n } else if (isProcessableValue(value)) {\n string += processStyleName(_key) + \":\" + processStyleValue(_key, value) + \";\";\n }\n } else {\n if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {\n throw new Error('Component selectors can only be used in conjunction with @emotion/babel-plugin.');\n }\n\n if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {\n for (var _i = 0; _i < value.length; _i++) {\n if (isProcessableValue(value[_i])) {\n string += processStyleName(_key) + \":\" + processStyleValue(_key, value[_i]) + \";\";\n }\n }\n } else {\n var interpolated = handleInterpolation(mergedProps, registered, value);\n\n switch (_key) {\n case 'animation':\n case 'animationName':\n {\n string += processStyleName(_key) + \":\" + interpolated + \";\";\n break;\n }\n\n default:\n {\n if (process.env.NODE_ENV !== 'production' && _key === 'undefined') {\n console.error(UNDEFINED_AS_OBJECT_KEY_ERROR);\n }\n\n string += _key + \"{\" + interpolated + \"}\";\n }\n }\n }\n }\n }\n }\n\n return string;\n}\n\nvar labelPattern = /label:\\s*([^\\s;\\n{]+)\\s*(;|$)/g;\nvar sourceMapPattern;\n\nif (process.env.NODE_ENV !== 'production') {\n sourceMapPattern = /\\/\\*#\\ssourceMappingURL=data:application\\/json;\\S+\\s+\\*\\//g;\n} // this is the cursor for keyframes\n// keyframes are stored on the SerializedStyles object as a linked list\n\n\nvar cursor;\nvar serializeStyles = function serializeStyles(args, registered, mergedProps) {\n if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {\n return args[0];\n }\n\n var stringMode = true;\n var styles = '';\n cursor = undefined;\n var strings = args[0];\n\n if (strings == null || strings.raw === undefined) {\n stringMode = false;\n styles += handleInterpolation(mergedProps, registered, strings);\n } else {\n if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) {\n console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);\n }\n\n styles += strings[0];\n } // we start at 1 since we've already handled the first arg\n\n\n for (var i = 1; i < args.length; i++) {\n styles += handleInterpolation(mergedProps, registered, args[i]);\n\n if (stringMode) {\n if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) {\n console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);\n }\n\n styles += strings[i];\n }\n }\n\n var sourceMap;\n\n if (process.env.NODE_ENV !== 'production') {\n styles = styles.replace(sourceMapPattern, function (match) {\n sourceMap = match;\n return '';\n });\n } // using a global regex with .exec is stateful so lastIndex has to be reset each time\n\n\n labelPattern.lastIndex = 0;\n var identifierName = '';\n var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5\n\n while ((match = labelPattern.exec(styles)) !== null) {\n identifierName += '-' + // $FlowFixMe we know it's not null\n match[1];\n }\n\n var name = hashString(styles) + identifierName;\n\n if (process.env.NODE_ENV !== 'production') {\n // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it)\n return {\n name: name,\n styles: styles,\n map: sourceMap,\n next: cursor,\n toString: function toString() {\n return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\";\n }\n };\n }\n\n return {\n name: name,\n styles: styles,\n next: cursor\n };\n};\n\nexport { serializeStyles };\n","import { createContext, useContext, forwardRef, createElement, Fragment } from 'react';\nimport createCache from '@emotion/cache';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport weakMemoize from '@emotion/weak-memoize';\nimport hoistNonReactStatics from '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js';\nimport { getRegisteredStyles, insertStyles } from '@emotion/utils';\nimport { serializeStyles } from '@emotion/serialize';\n\nvar hasOwnProperty = {}.hasOwnProperty;\n\nvar EmotionCacheContext = /* #__PURE__ */createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case\n// because this module is primarily intended for the browser and node\n// but it's also required in react native and similar environments sometimes\n// and we could have a special build just for that\n// but this is much easier and the native packages\n// might use a different theme context in the future anyway\ntypeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({\n key: 'css'\n}) : null);\n\nif (process.env.NODE_ENV !== 'production') {\n EmotionCacheContext.displayName = 'EmotionCacheContext';\n}\n\nvar CacheProvider = EmotionCacheContext.Provider;\nvar __unsafe_useEmotionCache = function useEmotionCache() {\n return useContext(EmotionCacheContext);\n};\n\nvar withEmotionCache = function withEmotionCache(func) {\n // $FlowFixMe\n return /*#__PURE__*/forwardRef(function (props, ref) {\n // the cache will never be null in the browser\n var cache = useContext(EmotionCacheContext);\n return func(props, cache, ref);\n });\n};\n\nvar ThemeContext = /* #__PURE__ */createContext({});\n\nif (process.env.NODE_ENV !== 'production') {\n ThemeContext.displayName = 'EmotionThemeContext';\n}\n\nvar useTheme = function useTheme() {\n return useContext(ThemeContext);\n};\n\nvar getTheme = function getTheme(outerTheme, theme) {\n if (typeof theme === 'function') {\n var mergedTheme = theme(outerTheme);\n\n if (process.env.NODE_ENV !== 'production' && (mergedTheme == null || typeof mergedTheme !== 'object' || Array.isArray(mergedTheme))) {\n throw new Error('[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!');\n }\n\n return mergedTheme;\n }\n\n if (process.env.NODE_ENV !== 'production' && (theme == null || typeof theme !== 'object' || Array.isArray(theme))) {\n throw new Error('[ThemeProvider] Please make your theme prop a plain object');\n }\n\n return _extends({}, outerTheme, theme);\n};\n\nvar createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {\n return weakMemoize(function (theme) {\n return getTheme(outerTheme, theme);\n });\n});\nvar ThemeProvider = function ThemeProvider(props) {\n var theme = useContext(ThemeContext);\n\n if (props.theme !== theme) {\n theme = createCacheWithTheme(theme)(props.theme);\n }\n\n return /*#__PURE__*/createElement(ThemeContext.Provider, {\n value: theme\n }, props.children);\n};\nfunction withTheme(Component) {\n var componentName = Component.displayName || Component.name || 'Component';\n\n var render = function render(props, ref) {\n var theme = useContext(ThemeContext);\n return /*#__PURE__*/createElement(Component, _extends({\n theme: theme,\n ref: ref\n }, props));\n }; // $FlowFixMe\n\n\n var WithTheme = /*#__PURE__*/forwardRef(render);\n WithTheme.displayName = \"WithTheme(\" + componentName + \")\";\n return hoistNonReactStatics(WithTheme, Component);\n}\n\nvar getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {\n // V8\n var match = /^\\s+at\\s+([A-Za-z0-9$.]+)\\s/.exec(line);\n\n if (match) {\n // The match may be something like 'Object.createEmotionProps'\n var parts = match[1].split('.');\n return parts[parts.length - 1];\n } // Safari / Firefox\n\n\n match = /^([A-Za-z0-9$.]+)@/.exec(line);\n if (match) return match[1];\n return undefined;\n};\n\nvar internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS\n// identifiers, thus we only need to replace what is a valid character for JS,\n// but not for CSS.\n\nvar sanitizeIdentifier = function sanitizeIdentifier(identifier) {\n return identifier.replace(/\\$/g, '-');\n};\n\nvar getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {\n if (!stackTrace) return undefined;\n var lines = stackTrace.split('\\n');\n\n for (var i = 0; i < lines.length; i++) {\n var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just \"Error\"\n\n if (!functionName) continue; // If we reach one of these, we have gone too far and should quit\n\n if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an\n // uppercase letter\n\n if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);\n }\n\n return undefined;\n};\n\nvar typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';\nvar labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';\nvar createEmotionProps = function createEmotionProps(type, props) {\n if (process.env.NODE_ENV !== 'production' && typeof props.css === 'string' && // check if there is a css declaration\n props.css.indexOf(':') !== -1) {\n throw new Error(\"Strings are not allowed as css prop values, please wrap it in a css template literal from '@emotion/react' like this: css`\" + props.css + \"`\");\n }\n\n var newProps = {};\n\n for (var key in props) {\n if (hasOwnProperty.call(props, key)) {\n newProps[key] = props[key];\n }\n }\n\n newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when\n // the label hasn't already been computed\n\n if (process.env.NODE_ENV !== 'production' && !!props.css && (typeof props.css !== 'object' || typeof props.css.name !== 'string' || props.css.name.indexOf('-') === -1)) {\n var label = getLabelFromStackTrace(new Error().stack);\n if (label) newProps[labelPropName] = label;\n }\n\n return newProps;\n};\n\nvar Noop = function Noop() {\n return null;\n};\n\nvar Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {\n var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works\n // not passing the registered cache to serializeStyles because it would\n // make certain babel optimisations not possible\n\n if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {\n cssProp = cache.registered[cssProp];\n }\n\n var type = props[typePropName];\n var registeredStyles = [cssProp];\n var className = '';\n\n if (typeof props.className === 'string') {\n className = getRegisteredStyles(cache.registered, registeredStyles, props.className);\n } else if (props.className != null) {\n className = props.className + \" \";\n }\n\n var serialized = serializeStyles(registeredStyles, undefined, useContext(ThemeContext));\n\n if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {\n var labelFromStack = props[labelPropName];\n\n if (labelFromStack) {\n serialized = serializeStyles([serialized, 'label:' + labelFromStack + ';']);\n }\n }\n\n var rules = insertStyles(cache, serialized, typeof type === 'string');\n className += cache.key + \"-\" + serialized.name;\n var newProps = {};\n\n for (var key in props) {\n if (hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {\n newProps[key] = props[key];\n }\n }\n\n newProps.ref = ref;\n newProps.className = className;\n var ele = /*#__PURE__*/createElement(type, newProps);\n var possiblyStyleElement = /*#__PURE__*/createElement(Noop, null);\n\n\n return /*#__PURE__*/createElement(Fragment, null, possiblyStyleElement, ele);\n});\n\nif (process.env.NODE_ENV !== 'production') {\n Emotion.displayName = 'EmotionCssPropInternal';\n}\n\nexport { CacheProvider as C, Emotion as E, ThemeContext as T, __unsafe_useEmotionCache as _, ThemeProvider as a, withTheme as b, createEmotionProps as c, hasOwnProperty as h, useTheme as u, withEmotionCache as w };\n","import { createElement, useContext, useRef, useLayoutEffect, Fragment } from 'react';\nimport '@emotion/cache';\nimport { h as hasOwnProperty, E as Emotion, c as createEmotionProps, w as withEmotionCache, T as ThemeContext } from './emotion-element-699e6908.browser.esm.js';\nexport { C as CacheProvider, T as ThemeContext, a as ThemeProvider, _ as __unsafe_useEmotionCache, u as useTheme, w as withEmotionCache, b as withTheme } from './emotion-element-699e6908.browser.esm.js';\nimport '@babel/runtime/helpers/extends';\nimport '@emotion/weak-memoize';\nimport 'hoist-non-react-statics';\nimport '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js';\nimport { insertStyles, getRegisteredStyles } from '@emotion/utils';\nimport { serializeStyles } from '@emotion/serialize';\nimport { StyleSheet } from '@emotion/sheet';\n\nvar pkg = {\n\tname: \"@emotion/react\",\n\tversion: \"11.7.1\",\n\tmain: \"dist/emotion-react.cjs.js\",\n\tmodule: \"dist/emotion-react.esm.js\",\n\tbrowser: {\n\t\t\"./dist/emotion-react.cjs.js\": \"./dist/emotion-react.browser.cjs.js\",\n\t\t\"./dist/emotion-react.esm.js\": \"./dist/emotion-react.browser.esm.js\"\n\t},\n\ttypes: \"types/index.d.ts\",\n\tfiles: [\n\t\t\"src\",\n\t\t\"dist\",\n\t\t\"jsx-runtime\",\n\t\t\"jsx-dev-runtime\",\n\t\t\"_isolated-hnrs\",\n\t\t\"types/*.d.ts\",\n\t\t\"macro.js\",\n\t\t\"macro.d.ts\",\n\t\t\"macro.js.flow\"\n\t],\n\tsideEffects: false,\n\tauthor: \"mitchellhamilton \",\n\tlicense: \"MIT\",\n\tscripts: {\n\t\t\"test:typescript\": \"dtslint types\"\n\t},\n\tdependencies: {\n\t\t\"@babel/runtime\": \"^7.13.10\",\n\t\t\"@emotion/cache\": \"^11.7.1\",\n\t\t\"@emotion/serialize\": \"^1.0.2\",\n\t\t\"@emotion/sheet\": \"^1.1.0\",\n\t\t\"@emotion/utils\": \"^1.0.0\",\n\t\t\"@emotion/weak-memoize\": \"^0.2.5\",\n\t\t\"hoist-non-react-statics\": \"^3.3.1\"\n\t},\n\tpeerDependencies: {\n\t\t\"@babel/core\": \"^7.0.0\",\n\t\treact: \">=16.8.0\"\n\t},\n\tpeerDependenciesMeta: {\n\t\t\"@babel/core\": {\n\t\t\toptional: true\n\t\t},\n\t\t\"@types/react\": {\n\t\t\toptional: true\n\t\t}\n\t},\n\tdevDependencies: {\n\t\t\"@babel/core\": \"^7.13.10\",\n\t\t\"@emotion/css\": \"11.7.1\",\n\t\t\"@emotion/css-prettifier\": \"1.0.1\",\n\t\t\"@emotion/server\": \"11.4.0\",\n\t\t\"@emotion/styled\": \"11.6.0\",\n\t\t\"@types/react\": \"^16.9.11\",\n\t\tdtslint: \"^0.3.0\",\n\t\t\"html-tag-names\": \"^1.1.2\",\n\t\treact: \"16.14.0\",\n\t\t\"svg-tag-names\": \"^1.1.1\"\n\t},\n\trepository: \"https://github.com/emotion-js/emotion/tree/main/packages/react\",\n\tpublishConfig: {\n\t\taccess: \"public\"\n\t},\n\t\"umd:main\": \"dist/emotion-react.umd.min.js\",\n\tpreconstruct: {\n\t\tentrypoints: [\n\t\t\t\"./index.js\",\n\t\t\t\"./jsx-runtime.js\",\n\t\t\t\"./jsx-dev-runtime.js\",\n\t\t\t\"./_isolated-hnrs.js\"\n\t\t],\n\t\tumdName: \"emotionReact\"\n\t}\n};\n\nvar jsx = function jsx(type, props) {\n var args = arguments;\n\n if (props == null || !hasOwnProperty.call(props, 'css')) {\n // $FlowFixMe\n return createElement.apply(undefined, args);\n }\n\n var argsLength = args.length;\n var createElementArgArray = new Array(argsLength);\n createElementArgArray[0] = Emotion;\n createElementArgArray[1] = createEmotionProps(type, props);\n\n for (var i = 2; i < argsLength; i++) {\n createElementArgArray[i] = args[i];\n } // $FlowFixMe\n\n\n return createElement.apply(null, createElementArgArray);\n};\n\nvar warnedAboutCssPropForGlobal = false; // maintain place over rerenders.\n// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild\n// initial client-side render from SSR, use place of hydrating tag\n\nvar Global = /* #__PURE__ */withEmotionCache(function (props, cache) {\n if (process.env.NODE_ENV !== 'production' && !warnedAboutCssPropForGlobal && ( // check for className as well since the user is\n // probably using the custom createElement which\n // means it will be turned into a className prop\n // $FlowFixMe I don't really want to add it to the type since it shouldn't be used\n props.className || props.css)) {\n console.error(\"It looks like you're using the css prop on Global, did you mean to use the styles prop instead?\");\n warnedAboutCssPropForGlobal = true;\n }\n\n var styles = props.styles;\n var serialized = serializeStyles([styles], undefined, useContext(ThemeContext));\n // but it is based on a constant that will never change at runtime\n // it's effectively like having two implementations and switching them out\n // so it's not actually breaking anything\n\n\n var sheetRef = useRef();\n useLayoutEffect(function () {\n var key = cache.key + \"-global\";\n var sheet = new StyleSheet({\n key: key,\n nonce: cache.sheet.nonce,\n container: cache.sheet.container,\n speedy: cache.sheet.isSpeedy\n });\n var rehydrating = false; // $FlowFixMe\n\n var node = document.querySelector(\"style[data-emotion=\\\"\" + key + \" \" + serialized.name + \"\\\"]\");\n\n if (cache.sheet.tags.length) {\n sheet.before = cache.sheet.tags[0];\n }\n\n if (node !== null) {\n rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other s\n\n node.setAttribute('data-emotion', key);\n sheet.hydrate([node]);\n }\n\n sheetRef.current = [sheet, rehydrating];\n return function () {\n sheet.flush();\n };\n }, [cache]);\n useLayoutEffect(function () {\n var sheetRefCurrent = sheetRef.current;\n var sheet = sheetRefCurrent[0],\n rehydrating = sheetRefCurrent[1];\n\n if (rehydrating) {\n sheetRefCurrent[1] = false;\n return;\n }\n\n if (serialized.next !== undefined) {\n // insert keyframes\n insertStyles(cache, serialized.next, true);\n }\n\n if (sheet.tags.length) {\n // if this doesn't exist then it will be null so the style element will be appended\n var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;\n sheet.before = element;\n sheet.flush();\n }\n\n cache.insert(\"\", serialized, sheet, false);\n }, [cache, serialized.name]);\n return null;\n});\n\nif (process.env.NODE_ENV !== 'production') {\n Global.displayName = 'EmotionGlobal';\n}\n\nfunction css() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return serializeStyles(args);\n}\n\nvar keyframes = function keyframes() {\n var insertable = css.apply(void 0, arguments);\n var name = \"animation-\" + insertable.name; // $FlowFixMe\n\n return {\n name: name,\n styles: \"@keyframes \" + name + \"{\" + insertable.styles + \"}\",\n anim: 1,\n toString: function toString() {\n return \"_EMO_\" + this.name + \"_\" + this.styles + \"_EMO_\";\n }\n };\n};\n\nvar classnames = function classnames(args) {\n var len = args.length;\n var i = 0;\n var cls = '';\n\n for (; i < len; i++) {\n var arg = args[i];\n if (arg == null) continue;\n var toAdd = void 0;\n\n switch (typeof arg) {\n case 'boolean':\n break;\n\n case 'object':\n {\n if (Array.isArray(arg)) {\n toAdd = classnames(arg);\n } else {\n if (process.env.NODE_ENV !== 'production' && arg.styles !== undefined && arg.name !== undefined) {\n console.error('You have passed styles created with `css` from `@emotion/react` package to the `cx`.\\n' + '`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from component.');\n }\n\n toAdd = '';\n\n for (var k in arg) {\n if (arg[k] && k) {\n toAdd && (toAdd += ' ');\n toAdd += k;\n }\n }\n }\n\n break;\n }\n\n default:\n {\n toAdd = arg;\n }\n }\n\n if (toAdd) {\n cls && (cls += ' ');\n cls += toAdd;\n }\n }\n\n return cls;\n};\n\nfunction merge(registered, css, className) {\n var registeredStyles = [];\n var rawClassName = getRegisteredStyles(registered, registeredStyles, className);\n\n if (registeredStyles.length < 2) {\n return className;\n }\n\n return rawClassName + css(registeredStyles);\n}\n\nvar Noop = function Noop() {\n return null;\n};\n\nvar ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {\n var hasRendered = false;\n\n var css = function css() {\n if (hasRendered && process.env.NODE_ENV !== 'production') {\n throw new Error('css can only be used during render');\n }\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var serialized = serializeStyles(args, cache.registered);\n\n {\n insertStyles(cache, serialized, false);\n }\n\n return cache.key + \"-\" + serialized.name;\n };\n\n var cx = function cx() {\n if (hasRendered && process.env.NODE_ENV !== 'production') {\n throw new Error('cx can only be used during render');\n }\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return merge(cache.registered, css, classnames(args));\n };\n\n var content = {\n css: css,\n cx: cx,\n theme: useContext(ThemeContext)\n };\n var ele = props.children(content);\n hasRendered = true;\n var possiblyStyleElement = /*#__PURE__*/createElement(Noop, null);\n\n\n return /*#__PURE__*/createElement(Fragment, null, possiblyStyleElement, ele);\n});\n\nif (process.env.NODE_ENV !== 'production') {\n ClassNames.displayName = 'EmotionClassNames';\n}\n\nif (process.env.NODE_ENV !== 'production') {\n var isBrowser = \"object\" !== 'undefined'; // #1727 for some reason Jest evaluates modules twice if some consuming module gets mocked with jest.mock\n\n var isJest = typeof jest !== 'undefined';\n\n if (isBrowser && !isJest) {\n // globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later\n var globalContext = // $FlowIgnore\n typeof globalThis !== 'undefined' ? globalThis // eslint-disable-line no-undef\n : isBrowser ? window : global;\n var globalKey = \"__EMOTION_REACT_\" + pkg.version.split('.')[0] + \"__\";\n\n if (globalContext[globalKey]) {\n console.warn('You are loading @emotion/react when it is already loaded. Running ' + 'multiple instances may cause problems. This can happen if multiple ' + 'versions are used, or if multiple builds of the same version are ' + 'used.');\n }\n\n globalContext[globalKey] = true;\n }\n}\n\nexport { ClassNames, Global, jsx as createElement, css, jsx, keyframes };\n","export default function _taggedTemplateLiteral(strings, raw) {\n if (!raw) {\n raw = strings.slice(0);\n }\n\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import _extends from '@babel/runtime/helpers/esm/extends';\nimport { jsx, keyframes, css as css$2, ClassNames } from '@emotion/react';\nimport _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';\nimport _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';\nimport _typeof from '@babel/runtime/helpers/esm/typeof';\nimport _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';\nimport _createClass from '@babel/runtime/helpers/esm/createClass';\nimport _inherits from '@babel/runtime/helpers/esm/inherits';\nimport _defineProperty$1 from '@babel/runtime/helpers/esm/defineProperty';\nimport { Component, createContext } from 'react';\nimport { createPortal } from 'react-dom';\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nvar _excluded$3 = [\"className\", \"clearValue\", \"cx\", \"getStyles\", \"getValue\", \"hasValue\", \"isMulti\", \"isRtl\", \"options\", \"selectOption\", \"selectProps\", \"setValue\", \"theme\"];\n// ==============================\n// NO OP\n// ==============================\nvar noop = function noop() {};\n// Class Name Prefixer\n// ==============================\n\n/**\n String representation of component state for styling with class names.\n\n Expects an array of strings OR a string/object pair:\n - className(['comp', 'comp-arg', 'comp-arg-2'])\n @returns 'react-select__comp react-select__comp-arg react-select__comp-arg-2'\n - className('comp', { some: true, state: false })\n @returns 'react-select__comp react-select__comp--some'\n*/\n\nfunction applyPrefixToName(prefix, name) {\n if (!name) {\n return prefix;\n } else if (name[0] === '-') {\n return prefix + name;\n } else {\n return prefix + '__' + name;\n }\n}\n\nfunction classNames(prefix, state, className) {\n var arr = [className];\n\n if (state && prefix) {\n for (var key in state) {\n if (state.hasOwnProperty(key) && state[key]) {\n arr.push(\"\".concat(applyPrefixToName(prefix, key)));\n }\n }\n }\n\n return arr.filter(function (i) {\n return i;\n }).map(function (i) {\n return String(i).trim();\n }).join(' ');\n} // ==============================\n// Clean Value\n// ==============================\n\nvar cleanValue = function cleanValue(value) {\n if (isArray(value)) return value.filter(Boolean);\n if (_typeof(value) === 'object' && value !== null) return [value];\n return [];\n}; // ==============================\n// Clean Common Props\n// ==============================\n\nvar cleanCommonProps = function cleanCommonProps(props) {\n //className\n props.className;\n props.clearValue;\n props.cx;\n props.getStyles;\n props.getValue;\n props.hasValue;\n props.isMulti;\n props.isRtl;\n props.options;\n props.selectOption;\n props.selectProps;\n props.setValue;\n props.theme;\n var innerProps = _objectWithoutProperties(props, _excluded$3);\n\n return _objectSpread2({}, innerProps);\n}; // ==============================\n// Handle Input Change\n// ==============================\n\nfunction handleInputChange(inputValue, actionMeta, onInputChange) {\n if (onInputChange) {\n var _newValue = onInputChange(inputValue, actionMeta);\n\n if (typeof _newValue === 'string') return _newValue;\n }\n\n return inputValue;\n} // ==============================\n// Scroll Helpers\n// ==============================\n\nfunction isDocumentElement(el) {\n return [document.documentElement, document.body, window].indexOf(el) > -1;\n} // Normalized Scroll Top\n// ------------------------------\n\nfunction getScrollTop(el) {\n if (isDocumentElement(el)) {\n return window.pageYOffset;\n }\n\n return el.scrollTop;\n}\nfunction scrollTo(el, top) {\n // with a scroll distance, we perform scroll on the element\n if (isDocumentElement(el)) {\n window.scrollTo(0, top);\n return;\n }\n\n el.scrollTop = top;\n} // Get Scroll Parent\n// ------------------------------\n\nfunction getScrollParent(element) {\n var style = getComputedStyle(element);\n var excludeStaticParent = style.position === 'absolute';\n var overflowRx = /(auto|scroll)/;\n if (style.position === 'fixed') return document.documentElement;\n\n for (var parent = element; parent = parent.parentElement;) {\n style = getComputedStyle(parent);\n\n if (excludeStaticParent && style.position === 'static') {\n continue;\n }\n\n if (overflowRx.test(style.overflow + style.overflowY + style.overflowX)) {\n return parent;\n }\n }\n\n return document.documentElement;\n} // Animated Scroll To\n// ------------------------------\n\n/**\n @param t: time (elapsed)\n @param b: initial value\n @param c: amount of change\n @param d: duration\n*/\n\nfunction easeOutCubic(t, b, c, d) {\n return c * ((t = t / d - 1) * t * t + 1) + b;\n}\n\nfunction animatedScrollTo(element, to) {\n var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;\n var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;\n var start = getScrollTop(element);\n var change = to - start;\n var increment = 10;\n var currentTime = 0;\n\n function animateScroll() {\n currentTime += increment;\n var val = easeOutCubic(currentTime, start, change, duration);\n scrollTo(element, val);\n\n if (currentTime < duration) {\n window.requestAnimationFrame(animateScroll);\n } else {\n callback(element);\n }\n }\n\n animateScroll();\n} // Scroll Into View\n// ------------------------------\n\nfunction scrollIntoView(menuEl, focusedEl) {\n var menuRect = menuEl.getBoundingClientRect();\n var focusedRect = focusedEl.getBoundingClientRect();\n var overScroll = focusedEl.offsetHeight / 3;\n\n if (focusedRect.bottom + overScroll > menuRect.bottom) {\n scrollTo(menuEl, Math.min(focusedEl.offsetTop + focusedEl.clientHeight - menuEl.offsetHeight + overScroll, menuEl.scrollHeight));\n } else if (focusedRect.top - overScroll < menuRect.top) {\n scrollTo(menuEl, Math.max(focusedEl.offsetTop - overScroll, 0));\n }\n} // ==============================\n// Get bounding client object\n// ==============================\n// cannot get keys using array notation with DOMRect\n\nfunction getBoundingClientObj(element) {\n var rect = element.getBoundingClientRect();\n return {\n bottom: rect.bottom,\n height: rect.height,\n left: rect.left,\n right: rect.right,\n top: rect.top,\n width: rect.width\n };\n}\n// Touch Capability Detector\n// ==============================\n\nfunction isTouchCapable() {\n try {\n document.createEvent('TouchEvent');\n return true;\n } catch (e) {\n return false;\n }\n} // ==============================\n// Mobile Device Detector\n// ==============================\n\nfunction isMobileDevice() {\n try {\n return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n } catch (e) {\n return false;\n }\n} // ==============================\n// Passive Event Detector\n// ==============================\n// https://github.com/rafgraph/detect-it/blob/main/src/index.ts#L19-L36\n\nvar passiveOptionAccessed = false;\nvar options = {\n get passive() {\n return passiveOptionAccessed = true;\n }\n\n}; // check for SSR\n\nvar w = typeof window !== 'undefined' ? window : {};\n\nif (w.addEventListener && w.removeEventListener) {\n w.addEventListener('p', noop, options);\n w.removeEventListener('p', noop, false);\n}\n\nvar supportsPassiveEvents = passiveOptionAccessed;\nfunction notNullish(item) {\n return item != null;\n}\nfunction isArray(arg) {\n return Array.isArray(arg);\n}\nfunction valueTernary(isMulti, multiValue, singleValue) {\n return isMulti ? multiValue : singleValue;\n}\nfunction singleValueAsValue(singleValue) {\n return singleValue;\n}\nfunction multiValueAsValue(multiValue) {\n return multiValue;\n}\n\nfunction getMenuPlacement(_ref) {\n var maxHeight = _ref.maxHeight,\n menuEl = _ref.menuEl,\n minHeight = _ref.minHeight,\n placement = _ref.placement,\n shouldScroll = _ref.shouldScroll,\n isFixedPosition = _ref.isFixedPosition,\n theme = _ref.theme;\n var spacing = theme.spacing;\n var scrollParent = getScrollParent(menuEl);\n var defaultState = {\n placement: 'bottom',\n maxHeight: maxHeight\n }; // something went wrong, return default state\n\n if (!menuEl || !menuEl.offsetParent) return defaultState; // we can't trust `scrollParent.scrollHeight` --> it may increase when\n // the menu is rendered\n\n var _scrollParent$getBoun = scrollParent.getBoundingClientRect(),\n scrollHeight = _scrollParent$getBoun.height;\n\n var _menuEl$getBoundingCl = menuEl.getBoundingClientRect(),\n menuBottom = _menuEl$getBoundingCl.bottom,\n menuHeight = _menuEl$getBoundingCl.height,\n menuTop = _menuEl$getBoundingCl.top;\n\n var _menuEl$offsetParent$ = menuEl.offsetParent.getBoundingClientRect(),\n containerTop = _menuEl$offsetParent$.top;\n\n var viewHeight = window.innerHeight;\n var scrollTop = getScrollTop(scrollParent);\n var marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10);\n var marginTop = parseInt(getComputedStyle(menuEl).marginTop, 10);\n var viewSpaceAbove = containerTop - marginTop;\n var viewSpaceBelow = viewHeight - menuTop;\n var scrollSpaceAbove = viewSpaceAbove + scrollTop;\n var scrollSpaceBelow = scrollHeight - scrollTop - menuTop;\n var scrollDown = menuBottom - viewHeight + scrollTop + marginBottom;\n var scrollUp = scrollTop + menuTop - marginTop;\n var scrollDuration = 160;\n\n switch (placement) {\n case 'auto':\n case 'bottom':\n // 1: the menu will fit, do nothing\n if (viewSpaceBelow >= menuHeight) {\n return {\n placement: 'bottom',\n maxHeight: maxHeight\n };\n } // 2: the menu will fit, if scrolled\n\n\n if (scrollSpaceBelow >= menuHeight && !isFixedPosition) {\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollDown, scrollDuration);\n }\n\n return {\n placement: 'bottom',\n maxHeight: maxHeight\n };\n } // 3: the menu will fit, if constrained\n\n\n if (!isFixedPosition && scrollSpaceBelow >= minHeight || isFixedPosition && viewSpaceBelow >= minHeight) {\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollDown, scrollDuration);\n } // we want to provide as much of the menu as possible to the user,\n // so give them whatever is available below rather than the minHeight.\n\n\n var constrainedHeight = isFixedPosition ? viewSpaceBelow - marginBottom : scrollSpaceBelow - marginBottom;\n return {\n placement: 'bottom',\n maxHeight: constrainedHeight\n };\n } // 4. Forked beviour when there isn't enough space below\n // AUTO: flip the menu, render above\n\n\n if (placement === 'auto' || isFixedPosition) {\n // may need to be constrained after flipping\n var _constrainedHeight = maxHeight;\n var spaceAbove = isFixedPosition ? viewSpaceAbove : scrollSpaceAbove;\n\n if (spaceAbove >= minHeight) {\n _constrainedHeight = Math.min(spaceAbove - marginBottom - spacing.controlHeight, maxHeight);\n }\n\n return {\n placement: 'top',\n maxHeight: _constrainedHeight\n };\n } // BOTTOM: allow browser to increase scrollable area and immediately set scroll\n\n\n if (placement === 'bottom') {\n if (shouldScroll) {\n scrollTo(scrollParent, scrollDown);\n }\n\n return {\n placement: 'bottom',\n maxHeight: maxHeight\n };\n }\n\n break;\n\n case 'top':\n // 1: the menu will fit, do nothing\n if (viewSpaceAbove >= menuHeight) {\n return {\n placement: 'top',\n maxHeight: maxHeight\n };\n } // 2: the menu will fit, if scrolled\n\n\n if (scrollSpaceAbove >= menuHeight && !isFixedPosition) {\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollUp, scrollDuration);\n }\n\n return {\n placement: 'top',\n maxHeight: maxHeight\n };\n } // 3: the menu will fit, if constrained\n\n\n if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {\n var _constrainedHeight2 = maxHeight; // we want to provide as much of the menu as possible to the user,\n // so give them whatever is available below rather than the minHeight.\n\n if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {\n _constrainedHeight2 = isFixedPosition ? viewSpaceAbove - marginTop : scrollSpaceAbove - marginTop;\n }\n\n if (shouldScroll) {\n animatedScrollTo(scrollParent, scrollUp, scrollDuration);\n }\n\n return {\n placement: 'top',\n maxHeight: _constrainedHeight2\n };\n } // 4. not enough space, the browser WILL NOT increase scrollable area when\n // absolutely positioned element rendered above the viewport (only below).\n // Flip the menu, render below\n\n\n return {\n placement: 'bottom',\n maxHeight: maxHeight\n };\n\n default:\n throw new Error(\"Invalid placement provided \\\"\".concat(placement, \"\\\".\"));\n }\n\n return defaultState;\n} // Menu Component\n// ------------------------------\n\nfunction alignToControl(placement) {\n var placementToCSSProp = {\n bottom: 'top',\n top: 'bottom'\n };\n return placement ? placementToCSSProp[placement] : 'bottom';\n}\n\nvar coercePlacement = function coercePlacement(p) {\n return p === 'auto' ? 'bottom' : p;\n};\n\nvar menuCSS = function menuCSS(_ref2) {\n var _ref3;\n\n var placement = _ref2.placement,\n _ref2$theme = _ref2.theme,\n borderRadius = _ref2$theme.borderRadius,\n spacing = _ref2$theme.spacing,\n colors = _ref2$theme.colors;\n return _ref3 = {\n label: 'menu'\n }, _defineProperty$1(_ref3, alignToControl(placement), '100%'), _defineProperty$1(_ref3, \"backgroundColor\", colors.neutral0), _defineProperty$1(_ref3, \"borderRadius\", borderRadius), _defineProperty$1(_ref3, \"boxShadow\", '0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)'), _defineProperty$1(_ref3, \"marginBottom\", spacing.menuGutter), _defineProperty$1(_ref3, \"marginTop\", spacing.menuGutter), _defineProperty$1(_ref3, \"position\", 'absolute'), _defineProperty$1(_ref3, \"width\", '100%'), _defineProperty$1(_ref3, \"zIndex\", 1), _ref3;\n};\nvar PortalPlacementContext = /*#__PURE__*/createContext({\n getPortalPlacement: null\n}); // NOTE: internal only\n\nvar MenuPlacer = /*#__PURE__*/function (_Component) {\n _inherits(MenuPlacer, _Component);\n\n var _super = _createSuper(MenuPlacer);\n\n function MenuPlacer() {\n var _this;\n\n _classCallCheck(this, MenuPlacer);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n _this.state = {\n maxHeight: _this.props.maxMenuHeight,\n placement: null\n };\n _this.context = void 0;\n\n _this.getPlacement = function (ref) {\n var _this$props = _this.props,\n minMenuHeight = _this$props.minMenuHeight,\n maxMenuHeight = _this$props.maxMenuHeight,\n menuPlacement = _this$props.menuPlacement,\n menuPosition = _this$props.menuPosition,\n menuShouldScrollIntoView = _this$props.menuShouldScrollIntoView,\n theme = _this$props.theme;\n if (!ref) return; // DO NOT scroll if position is fixed\n\n var isFixedPosition = menuPosition === 'fixed';\n var shouldScroll = menuShouldScrollIntoView && !isFixedPosition;\n var state = getMenuPlacement({\n maxHeight: maxMenuHeight,\n menuEl: ref,\n minHeight: minMenuHeight,\n placement: menuPlacement,\n shouldScroll: shouldScroll,\n isFixedPosition: isFixedPosition,\n theme: theme\n });\n var getPortalPlacement = _this.context.getPortalPlacement;\n if (getPortalPlacement) getPortalPlacement(state);\n\n _this.setState(state);\n };\n\n _this.getUpdatedProps = function () {\n var menuPlacement = _this.props.menuPlacement;\n var placement = _this.state.placement || coercePlacement(menuPlacement);\n return _objectSpread2(_objectSpread2({}, _this.props), {}, {\n placement: placement,\n maxHeight: _this.state.maxHeight\n });\n };\n\n return _this;\n }\n\n _createClass(MenuPlacer, [{\n key: \"render\",\n value: function render() {\n var children = this.props.children;\n return children({\n ref: this.getPlacement,\n placerProps: this.getUpdatedProps()\n });\n }\n }]);\n\n return MenuPlacer;\n}(Component);\nMenuPlacer.contextType = PortalPlacementContext;\n\nvar Menu = function Menu(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerRef = props.innerRef,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('menu', props),\n className: cx({\n menu: true\n }, className),\n ref: innerRef\n }, innerProps), children);\n};\n// Menu List\n// ==============================\n\nvar menuListCSS = function menuListCSS(_ref4) {\n var maxHeight = _ref4.maxHeight,\n baseUnit = _ref4.theme.spacing.baseUnit;\n return {\n maxHeight: maxHeight,\n overflowY: 'auto',\n paddingBottom: baseUnit,\n paddingTop: baseUnit,\n position: 'relative',\n // required for offset[Height, Top] > keyboard scroll\n WebkitOverflowScrolling: 'touch'\n };\n};\nvar MenuList = function MenuList(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps,\n innerRef = props.innerRef,\n isMulti = props.isMulti;\n return jsx(\"div\", _extends({\n css: getStyles('menuList', props),\n className: cx({\n 'menu-list': true,\n 'menu-list--is-multi': isMulti\n }, className),\n ref: innerRef\n }, innerProps), children);\n}; // ==============================\n// Menu Notices\n// ==============================\n\nvar noticeCSS = function noticeCSS(_ref5) {\n var _ref5$theme = _ref5.theme,\n baseUnit = _ref5$theme.spacing.baseUnit,\n colors = _ref5$theme.colors;\n return {\n color: colors.neutral40,\n padding: \"\".concat(baseUnit * 2, \"px \").concat(baseUnit * 3, \"px\"),\n textAlign: 'center'\n };\n};\n\nvar noOptionsMessageCSS = noticeCSS;\nvar loadingMessageCSS = noticeCSS;\nvar NoOptionsMessage = function NoOptionsMessage(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('noOptionsMessage', props),\n className: cx({\n 'menu-notice': true,\n 'menu-notice--no-options': true\n }, className)\n }, innerProps), children);\n};\nNoOptionsMessage.defaultProps = {\n children: 'No options'\n};\nvar LoadingMessage = function LoadingMessage(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('loadingMessage', props),\n className: cx({\n 'menu-notice': true,\n 'menu-notice--loading': true\n }, className)\n }, innerProps), children);\n};\nLoadingMessage.defaultProps = {\n children: 'Loading...'\n}; // ==============================\n// Menu Portal\n// ==============================\n\nvar menuPortalCSS = function menuPortalCSS(_ref6) {\n var rect = _ref6.rect,\n offset = _ref6.offset,\n position = _ref6.position;\n return {\n left: rect.left,\n position: position,\n top: offset,\n width: rect.width,\n zIndex: 1\n };\n};\nvar MenuPortal = /*#__PURE__*/function (_Component2) {\n _inherits(MenuPortal, _Component2);\n\n var _super2 = _createSuper(MenuPortal);\n\n function MenuPortal() {\n var _this2;\n\n _classCallCheck(this, MenuPortal);\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n _this2 = _super2.call.apply(_super2, [this].concat(args));\n _this2.state = {\n placement: null\n };\n\n _this2.getPortalPlacement = function (_ref7) {\n var placement = _ref7.placement;\n var initialPlacement = coercePlacement(_this2.props.menuPlacement); // avoid re-renders if the placement has not changed\n\n if (placement !== initialPlacement) {\n _this2.setState({\n placement: placement\n });\n }\n };\n\n return _this2;\n }\n\n _createClass(MenuPortal, [{\n key: \"render\",\n value: function render() {\n var _this$props2 = this.props,\n appendTo = _this$props2.appendTo,\n children = _this$props2.children,\n className = _this$props2.className,\n controlElement = _this$props2.controlElement,\n cx = _this$props2.cx,\n innerProps = _this$props2.innerProps,\n menuPlacement = _this$props2.menuPlacement,\n position = _this$props2.menuPosition,\n getStyles = _this$props2.getStyles;\n var isFixed = position === 'fixed'; // bail early if required elements aren't present\n\n if (!appendTo && !isFixed || !controlElement) {\n return null;\n }\n\n var placement = this.state.placement || coercePlacement(menuPlacement);\n var rect = getBoundingClientObj(controlElement);\n var scrollDistance = isFixed ? 0 : window.pageYOffset;\n var offset = rect[placement] + scrollDistance;\n var state = {\n offset: offset,\n position: position,\n rect: rect\n }; // same wrapper element whether fixed or portalled\n\n var menuWrapper = jsx(\"div\", _extends({\n css: getStyles('menuPortal', state),\n className: cx({\n 'menu-portal': true\n }, className)\n }, innerProps), children);\n return jsx(PortalPlacementContext.Provider, {\n value: {\n getPortalPlacement: this.getPortalPlacement\n }\n }, appendTo ? /*#__PURE__*/createPortal(menuWrapper, appendTo) : menuWrapper);\n }\n }]);\n\n return MenuPortal;\n}(Component);\n\nvar containerCSS = function containerCSS(_ref) {\n var isDisabled = _ref.isDisabled,\n isRtl = _ref.isRtl;\n return {\n label: 'container',\n direction: isRtl ? 'rtl' : undefined,\n pointerEvents: isDisabled ? 'none' : undefined,\n // cancel mouse events when disabled\n position: 'relative'\n };\n};\nvar SelectContainer = function SelectContainer(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps,\n isDisabled = props.isDisabled,\n isRtl = props.isRtl;\n return jsx(\"div\", _extends({\n css: getStyles('container', props),\n className: cx({\n '--is-disabled': isDisabled,\n '--is-rtl': isRtl\n }, className)\n }, innerProps), children);\n}; // ==============================\n// Value Container\n// ==============================\n\nvar valueContainerCSS = function valueContainerCSS(_ref2) {\n var spacing = _ref2.theme.spacing,\n isMulti = _ref2.isMulti,\n hasValue = _ref2.hasValue,\n controlShouldRenderValue = _ref2.selectProps.controlShouldRenderValue;\n return {\n alignItems: 'center',\n display: isMulti && hasValue && controlShouldRenderValue ? 'flex' : 'grid',\n flex: 1,\n flexWrap: 'wrap',\n padding: \"\".concat(spacing.baseUnit / 2, \"px \").concat(spacing.baseUnit * 2, \"px\"),\n WebkitOverflowScrolling: 'touch',\n position: 'relative',\n overflow: 'hidden'\n };\n};\nvar ValueContainer = function ValueContainer(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n innerProps = props.innerProps,\n isMulti = props.isMulti,\n getStyles = props.getStyles,\n hasValue = props.hasValue;\n return jsx(\"div\", _extends({\n css: getStyles('valueContainer', props),\n className: cx({\n 'value-container': true,\n 'value-container--is-multi': isMulti,\n 'value-container--has-value': hasValue\n }, className)\n }, innerProps), children);\n}; // ==============================\n// Indicator Container\n// ==============================\n\nvar indicatorsContainerCSS = function indicatorsContainerCSS() {\n return {\n alignItems: 'center',\n alignSelf: 'stretch',\n display: 'flex',\n flexShrink: 0\n };\n};\nvar IndicatorsContainer = function IndicatorsContainer(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n innerProps = props.innerProps,\n getStyles = props.getStyles;\n return jsx(\"div\", _extends({\n css: getStyles('indicatorsContainer', props),\n className: cx({\n indicators: true\n }, className)\n }, innerProps), children);\n};\n\nvar _templateObject;\n\nvar _excluded$2 = [\"size\"];\n\nfunction _EMOTION_STRINGIFIED_CSS_ERROR__() { return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\"; }\n\nvar _ref2 = process.env.NODE_ENV === \"production\" ? {\n name: \"8mmkcg\",\n styles: \"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0\"\n} : {\n name: \"tj5bde-Svg\",\n styles: \"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0;label:Svg;\",\n map: \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGljYXRvcnMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXdCSSIsImZpbGUiOiJpbmRpY2F0b3JzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgUmVhY3ROb2RlIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsganN4LCBrZXlmcmFtZXMgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmltcG9ydCB7XG4gIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lLFxuICBDU1NPYmplY3RXaXRoTGFiZWwsXG4gIEdyb3VwQmFzZSxcbn0gZnJvbSAnLi4vdHlwZXMnO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgSWNvbnNcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5jb25zdCBTdmcgPSAoe1xuICBzaXplLFxuICAuLi5wcm9wc1xufTogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzdmcnXSAmIHsgc2l6ZTogbnVtYmVyIH0pID0+IChcbiAgPHN2Z1xuICAgIGhlaWdodD17c2l6ZX1cbiAgICB3aWR0aD17c2l6ZX1cbiAgICB2aWV3Qm94PVwiMCAwIDIwIDIwXCJcbiAgICBhcmlhLWhpZGRlbj1cInRydWVcIlxuICAgIGZvY3VzYWJsZT1cImZhbHNlXCJcbiAgICBjc3M9e3tcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgZmlsbDogJ2N1cnJlbnRDb2xvcicsXG4gICAgICBsaW5lSGVpZ2h0OiAxLFxuICAgICAgc3Ryb2tlOiAnY3VycmVudENvbG9yJyxcbiAgICAgIHN0cm9rZVdpZHRoOiAwLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IHR5cGUgQ3Jvc3NJY29uUHJvcHMgPSBKU1guSW50cmluc2ljRWxlbWVudHNbJ3N2ZyddICYgeyBzaXplPzogbnVtYmVyIH07XG5leHBvcnQgY29uc3QgQ3Jvc3NJY29uID0gKHByb3BzOiBDcm9zc0ljb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNMTQuMzQ4IDE0Ljg0OWMtMC40NjkgMC40NjktMS4yMjkgMC40NjktMS42OTcgMGwtMi42NTEtMy4wMzAtMi42NTEgMy4wMjljLTAuNDY5IDAuNDY5LTEuMjI5IDAuNDY5LTEuNjk3IDAtMC40NjktMC40NjktMC40NjktMS4yMjkgMC0xLjY5N2wyLjc1OC0zLjE1LTIuNzU5LTMuMTUyYy0wLjQ2OS0wLjQ2OS0wLjQ2OS0xLjIyOCAwLTEuNjk3czEuMjI4LTAuNDY5IDEuNjk3IDBsMi42NTIgMy4wMzEgMi42NTEtMy4wMzFjMC40NjktMC40NjkgMS4yMjgtMC40NjkgMS42OTcgMHMwLjQ2OSAxLjIyOSAwIDEuNjk3bC0yLjc1OCAzLjE1MiAyLjc1OCAzLjE1YzAuNDY5IDAuNDY5IDAuNDY5IDEuMjI5IDAgMS42OTh6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuZXhwb3J0IHR5cGUgRG93bkNoZXZyb25Qcm9wcyA9IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snc3ZnJ10gJiB7IHNpemU/OiBudW1iZXIgfTtcbmV4cG9ydCBjb25zdCBEb3duQ2hldnJvbiA9IChwcm9wczogRG93bkNoZXZyb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNNC41MTYgNy41NDhjMC40MzYtMC40NDYgMS4wNDMtMC40ODEgMS41NzYgMGwzLjkwOCAzLjc0NyAzLjkwOC0zLjc0N2MwLjUzMy0wLjQ4MSAxLjE0MS0wLjQ0NiAxLjU3NCAwIDAuNDM2IDAuNDQ1IDAuNDA4IDEuMTk3IDAgMS42MTUtMC40MDYgMC40MTgtNC42OTUgNC41MDItNC42OTUgNC41MDItMC4yMTcgMC4yMjMtMC41MDIgMC4zMzUtMC43ODcgMC4zMzVzLTAuNTctMC4xMTItMC43ODktMC4zMzVjMCAwLTQuMjg3LTQuMDg0LTQuNjk1LTQuNTAycy0wLjQzNi0xLjE3IDAtMS42MTV6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgQnV0dG9uc1xuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG5cbmV4cG9ydCBpbnRlcmZhY2UgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxcbiAgT3B0aW9uID0gdW5rbm93bixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4gPSBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+ID0gR3JvdXBCYXNlPE9wdGlvbj5cbj4gZXh0ZW5kcyBDb21tb25Qcm9wc0FuZENsYXNzTmFtZTxPcHRpb24sIElzTXVsdGksIEdyb3VwPiB7XG4gIC8qKiBUaGUgY2hpbGRyZW4gdG8gYmUgcmVuZGVyZWQgaW5zaWRlIHRoZSBpbmRpY2F0b3IuICovXG4gIGNoaWxkcmVuPzogUmVhY3ROb2RlO1xuICAvKiogUHJvcHMgdGhhdCB3aWxsIGJlIHBhc3NlZCBvbiB0byB0aGUgY2hpbGRyZW4uICovXG4gIGlubmVyUHJvcHM6IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snZGl2J107XG4gIC8qKiBUaGUgZm9jdXNlZCBzdGF0ZSBvZiB0aGUgc2VsZWN0LiAqL1xuICBpc0ZvY3VzZWQ6IGJvb2xlYW47XG4gIGlzRGlzYWJsZWQ6IGJvb2xlYW47XG59XG5cbmNvbnN0IGJhc2VDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oe1xuICBpc0ZvY3VzZWQsXG4gIHRoZW1lOiB7XG4gICAgc3BhY2luZzogeyBiYXNlVW5pdCB9LFxuICAgIGNvbG9ycyxcbiAgfSxcbn06XG4gIHwgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuICB8IENsZWFySW5kaWNhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD4pOiBDU1NPYmplY3RXaXRoTGFiZWwgPT4gKHtcbiAgbGFiZWw6ICdpbmRpY2F0b3JDb250YWluZXInLFxuICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw2MCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gIGRpc3BsYXk6ICdmbGV4JyxcbiAgcGFkZGluZzogYmFzZVVuaXQgKiAyLFxuICB0cmFuc2l0aW9uOiAnY29sb3IgMTUwbXMnLFxuXG4gICc6aG92ZXInOiB7XG4gICAgY29sb3I6IGlzRm9jdXNlZCA/IGNvbG9ycy5uZXV0cmFsODAgOiBjb2xvcnMubmV1dHJhbDQwLFxuICB9LFxufSk7XG5cbmV4cG9ydCBjb25zdCBkcm9wZG93bkluZGljYXRvckNTUyA9IGJhc2VDU1M7XG5leHBvcnQgY29uc3QgRHJvcGRvd25JbmRpY2F0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHByb3BzOiBEcm9wZG93bkluZGljYXRvclByb3BzPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+XG4pID0+IHtcbiAgY29uc3QgeyBjaGlsZHJlbiwgY2xhc3NOYW1lLCBjeCwgZ2V0U3R5bGVzLCBpbm5lclByb3BzIH0gPSBwcm9wcztcbiAgcmV0dXJuIChcbiAgICA8ZGl2XG4gICAgICBjc3M9e2dldFN0eWxlcygnZHJvcGRvd25JbmRpY2F0b3InLCBwcm9wcyl9XG4gICAgICBjbGFzc05hbWU9e2N4KFxuICAgICAgICB7XG4gICAgICAgICAgaW5kaWNhdG9yOiB0cnVlLFxuICAgICAgICAgICdkcm9wZG93bi1pbmRpY2F0b3InOiB0cnVlLFxuICAgICAgICB9LFxuICAgICAgICBjbGFzc05hbWVcbiAgICAgICl9XG4gICAgICB7Li4uaW5uZXJQcm9wc31cbiAgICA+XG4gICAgICB7Y2hpbGRyZW4gfHwgPERvd25DaGV2cm9uIC8+fVxuICAgIDwvZGl2PlxuICApO1xufTtcblxuZXhwb3J0IGludGVyZmFjZSBDbGVhckluZGljYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgLyoqIFRoZSBjaGlsZHJlbiB0byBiZSByZW5kZXJlZCBpbnNpZGUgdGhlIGluZGljYXRvci4gKi9cbiAgY2hpbGRyZW4/OiBSZWFjdE5vZGU7XG4gIC8qKiBQcm9wcyB0aGF0IHdpbGwgYmUgcGFzc2VkIG9uIHRvIHRoZSBjaGlsZHJlbi4gKi9cbiAgaW5uZXJQcm9wczogSlNYLkludHJpbnNpY0VsZW1lbnRzWydkaXYnXTtcbiAgLyoqIFRoZSBmb2N1c2VkIHN0YXRlIG9mIHRoZSBzZWxlY3QuICovXG4gIGlzRm9jdXNlZDogYm9vbGVhbjtcbn1cblxuZXhwb3J0IGNvbnN0IGNsZWFySW5kaWNhdG9yQ1NTID0gYmFzZUNTUztcbmV4cG9ydCBjb25zdCBDbGVhckluZGljYXRvciA9IDxcbiAgT3B0aW9uLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbixcbiAgR3JvdXAgZXh0ZW5kcyBHcm91cEJhc2U8T3B0aW9uPlxuPihcbiAgcHJvcHM6IENsZWFySW5kaWNhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD5cbikgPT4ge1xuICBjb25zdCB7IGNoaWxkcmVuLCBjbGFzc05hbWUsIGN4LCBnZXRTdHlsZXMsIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIGNzcz17Z2V0U3R5bGVzKCdjbGVhckluZGljYXRvcicsIHByb3BzKX1cbiAgICAgIGNsYXNzTmFtZT17Y3goXG4gICAgICAgIHtcbiAgICAgICAgICBpbmRpY2F0b3I6IHRydWUsXG4gICAgICAgICAgJ2NsZWFyLWluZGljYXRvcic6IHRydWUsXG4gICAgICAgIH0sXG4gICAgICAgIGNsYXNzTmFtZVxuICAgICAgKX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8Q3Jvc3NJY29uIC8+fVxuICAgIDwvZGl2PlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBTZXBhcmF0b3Jcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5leHBvcnQgaW50ZXJmYWNlIEluZGljYXRvclNlcGFyYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgaXNEaXNhYmxlZDogYm9vbGVhbjtcbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpbm5lclByb3BzPzogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ107XG59XG5cbmV4cG9ydCBjb25zdCBpbmRpY2F0b3JTZXBhcmF0b3JDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oe1xuICBpc0Rpc2FibGVkLFxuICB0aGVtZToge1xuICAgIHNwYWNpbmc6IHsgYmFzZVVuaXQgfSxcbiAgICBjb2xvcnMsXG4gIH0sXG59OiBJbmRpY2F0b3JTZXBhcmF0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPik6IENTU09iamVjdFdpdGhMYWJlbCA9PiAoe1xuICBsYWJlbDogJ2luZGljYXRvclNlcGFyYXRvcicsXG4gIGFsaWduU2VsZjogJ3N0cmV0Y2gnLFxuICBiYWNrZ3JvdW5kQ29sb3I6IGlzRGlzYWJsZWQgPyBjb2xvcnMubmV1dHJhbDEwIDogY29sb3JzLm5ldXRyYWwyMCxcbiAgbWFyZ2luQm90dG9tOiBiYXNlVW5pdCAqIDIsXG4gIG1hcmdpblRvcDogYmFzZVVuaXQgKiAyLFxuICB3aWR0aDogMSxcbn0pO1xuXG5leHBvcnQgY29uc3QgSW5kaWNhdG9yU2VwYXJhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KFxuICBwcm9wczogSW5kaWNhdG9yU2VwYXJhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD5cbikgPT4ge1xuICBjb25zdCB7IGNsYXNzTmFtZSwgY3gsIGdldFN0eWxlcywgaW5uZXJQcm9wcyB9ID0gcHJvcHM7XG4gIHJldHVybiAoXG4gICAgPHNwYW5cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgY3NzPXtnZXRTdHlsZXMoJ2luZGljYXRvclNlcGFyYXRvcicsIHByb3BzKX1cbiAgICAgIGNsYXNzTmFtZT17Y3goeyAnaW5kaWNhdG9yLXNlcGFyYXRvcic6IHRydWUgfSwgY2xhc3NOYW1lKX1cbiAgICAvPlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBMb2FkaW5nXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuY29uc3QgbG9hZGluZ0RvdEFuaW1hdGlvbnMgPSBrZXlmcmFtZXNgXG4gIDAlLCA4MCUsIDEwMCUgeyBvcGFjaXR5OiAwOyB9XG4gIDQwJSB7IG9wYWNpdHk6IDE7IH1cbmA7XG5cbmV4cG9ydCBjb25zdCBsb2FkaW5nSW5kaWNhdG9yQ1NTID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KHtcbiAgaXNGb2N1c2VkLFxuICBzaXplLFxuICB0aGVtZToge1xuICAgIGNvbG9ycyxcbiAgICBzcGFjaW5nOiB7IGJhc2VVbml0IH0sXG4gIH0sXG59OiBMb2FkaW5nSW5kaWNhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD4pOiBDU1NPYmplY3RXaXRoTGFiZWwgPT4gKHtcbiAgbGFiZWw6ICdsb2FkaW5nSW5kaWNhdG9yJyxcbiAgY29sb3I6IGlzRm9jdXNlZCA/IGNvbG9ycy5uZXV0cmFsNjAgOiBjb2xvcnMubmV1dHJhbDIwLFxuICBkaXNwbGF5OiAnZmxleCcsXG4gIHBhZGRpbmc6IGJhc2VVbml0ICogMixcbiAgdHJhbnNpdGlvbjogJ2NvbG9yIDE1MG1zJyxcbiAgYWxpZ25TZWxmOiAnY2VudGVyJyxcbiAgZm9udFNpemU6IHNpemUsXG4gIGxpbmVIZWlnaHQ6IDEsXG4gIG1hcmdpblJpZ2h0OiBzaXplLFxuICB0ZXh0QWxpZ246ICdjZW50ZXInLFxuICB2ZXJ0aWNhbEFsaWduOiAnbWlkZGxlJyxcbn0pO1xuXG5pbnRlcmZhY2UgTG9hZGluZ0RvdFByb3BzIHtcbiAgZGVsYXk6IG51bWJlcjtcbiAgb2Zmc2V0OiBib29sZWFuO1xufVxuY29uc3QgTG9hZGluZ0RvdCA9ICh7IGRlbGF5LCBvZmZzZXQgfTogTG9hZGluZ0RvdFByb3BzKSA9PiAoXG4gIDxzcGFuXG4gICAgY3NzPXt7XG4gICAgICBhbmltYXRpb246IGAke2xvYWRpbmdEb3RBbmltYXRpb25zfSAxcyBlYXNlLWluLW91dCAke2RlbGF5fW1zIGluZmluaXRlO2AsXG4gICAgICBiYWNrZ3JvdW5kQ29sb3I6ICdjdXJyZW50Q29sb3InLFxuICAgICAgYm9yZGVyUmFkaXVzOiAnMWVtJyxcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgbWFyZ2luTGVmdDogb2Zmc2V0ID8gJzFlbScgOiB1bmRlZmluZWQsXG4gICAgICBoZWlnaHQ6ICcxZW0nLFxuICAgICAgdmVydGljYWxBbGlnbjogJ3RvcCcsXG4gICAgICB3aWR0aDogJzFlbScsXG4gICAgfX1cbiAgLz5cbik7XG5cbmV4cG9ydCBpbnRlcmZhY2UgTG9hZGluZ0luZGljYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgLyoqIFByb3BzIHRoYXQgd2lsbCBiZSBwYXNzZWQgb24gdG8gdGhlIGNoaWxkcmVuLiAqL1xuICBpbm5lclByb3BzOiBKU1guSW50cmluc2ljRWxlbWVudHNbJ2RpdiddO1xuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpc0Rpc2FibGVkOiBib29sZWFuO1xuICAvKiogU2V0IHNpemUgb2YgdGhlIGNvbnRhaW5lci4gKi9cbiAgc2l6ZTogbnVtYmVyO1xufVxuZXhwb3J0IGNvbnN0IExvYWRpbmdJbmRpY2F0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHByb3BzOiBMb2FkaW5nSW5kaWNhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD5cbikgPT4ge1xuICBjb25zdCB7IGNsYXNzTmFtZSwgY3gsIGdldFN0eWxlcywgaW5uZXJQcm9wcywgaXNSdGwgfSA9IHByb3BzO1xuXG4gIHJldHVybiAoXG4gICAgPGRpdlxuICAgICAgY3NzPXtnZXRTdHlsZXMoJ2xvYWRpbmdJbmRpY2F0b3InLCBwcm9wcyl9XG4gICAgICBjbGFzc05hbWU9e2N4KFxuICAgICAgICB7XG4gICAgICAgICAgaW5kaWNhdG9yOiB0cnVlLFxuICAgICAgICAgICdsb2FkaW5nLWluZGljYXRvcic6IHRydWUsXG4gICAgICAgIH0sXG4gICAgICAgIGNsYXNzTmFtZVxuICAgICAgKX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIDxMb2FkaW5nRG90IGRlbGF5PXswfSBvZmZzZXQ9e2lzUnRsfSAvPlxuICAgICAgPExvYWRpbmdEb3QgZGVsYXk9ezE2MH0gb2Zmc2V0IC8+XG4gICAgICA8TG9hZGluZ0RvdCBkZWxheT17MzIwfSBvZmZzZXQ9eyFpc1J0bH0gLz5cbiAgICA8L2Rpdj5cbiAgKTtcbn07XG5Mb2FkaW5nSW5kaWNhdG9yLmRlZmF1bHRQcm9wcyA9IHsgc2l6ZTogNCB9O1xuIl19 */\",\n toString: _EMOTION_STRINGIFIED_CSS_ERROR__\n};\n\n// ==============================\n// Dropdown & Clear Icons\n// ==============================\nvar Svg = function Svg(_ref) {\n var size = _ref.size,\n props = _objectWithoutProperties(_ref, _excluded$2);\n\n return jsx(\"svg\", _extends({\n height: size,\n width: size,\n viewBox: \"0 0 20 20\",\n \"aria-hidden\": \"true\",\n focusable: \"false\",\n css: _ref2\n }, props));\n};\n\nvar CrossIcon = function CrossIcon(props) {\n return jsx(Svg, _extends({\n size: 20\n }, props), jsx(\"path\", {\n d: \"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z\"\n }));\n};\nvar DownChevron = function DownChevron(props) {\n return jsx(Svg, _extends({\n size: 20\n }, props), jsx(\"path\", {\n d: \"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z\"\n }));\n}; // ==============================\n// Dropdown & Clear Buttons\n// ==============================\n\nvar baseCSS = function baseCSS(_ref3) {\n var isFocused = _ref3.isFocused,\n _ref3$theme = _ref3.theme,\n baseUnit = _ref3$theme.spacing.baseUnit,\n colors = _ref3$theme.colors;\n return {\n label: 'indicatorContainer',\n color: isFocused ? colors.neutral60 : colors.neutral20,\n display: 'flex',\n padding: baseUnit * 2,\n transition: 'color 150ms',\n ':hover': {\n color: isFocused ? colors.neutral80 : colors.neutral40\n }\n };\n};\n\nvar dropdownIndicatorCSS = baseCSS;\nvar DropdownIndicator = function DropdownIndicator(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('dropdownIndicator', props),\n className: cx({\n indicator: true,\n 'dropdown-indicator': true\n }, className)\n }, innerProps), children || jsx(DownChevron, null));\n};\nvar clearIndicatorCSS = baseCSS;\nvar ClearIndicator = function ClearIndicator(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('clearIndicator', props),\n className: cx({\n indicator: true,\n 'clear-indicator': true\n }, className)\n }, innerProps), children || jsx(CrossIcon, null));\n}; // ==============================\n// Separator\n// ==============================\n\nvar indicatorSeparatorCSS = function indicatorSeparatorCSS(_ref4) {\n var isDisabled = _ref4.isDisabled,\n _ref4$theme = _ref4.theme,\n baseUnit = _ref4$theme.spacing.baseUnit,\n colors = _ref4$theme.colors;\n return {\n label: 'indicatorSeparator',\n alignSelf: 'stretch',\n backgroundColor: isDisabled ? colors.neutral10 : colors.neutral20,\n marginBottom: baseUnit * 2,\n marginTop: baseUnit * 2,\n width: 1\n };\n};\nvar IndicatorSeparator = function IndicatorSeparator(props) {\n var className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"span\", _extends({}, innerProps, {\n css: getStyles('indicatorSeparator', props),\n className: cx({\n 'indicator-separator': true\n }, className)\n }));\n}; // ==============================\n// Loading\n// ==============================\n\nvar loadingDotAnimations = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral([\"\\n 0%, 80%, 100% { opacity: 0; }\\n 40% { opacity: 1; }\\n\"])));\nvar loadingIndicatorCSS = function loadingIndicatorCSS(_ref5) {\n var isFocused = _ref5.isFocused,\n size = _ref5.size,\n _ref5$theme = _ref5.theme,\n colors = _ref5$theme.colors,\n baseUnit = _ref5$theme.spacing.baseUnit;\n return {\n label: 'loadingIndicator',\n color: isFocused ? colors.neutral60 : colors.neutral20,\n display: 'flex',\n padding: baseUnit * 2,\n transition: 'color 150ms',\n alignSelf: 'center',\n fontSize: size,\n lineHeight: 1,\n marginRight: size,\n textAlign: 'center',\n verticalAlign: 'middle'\n };\n};\n\nvar LoadingDot = function LoadingDot(_ref6) {\n var delay = _ref6.delay,\n offset = _ref6.offset;\n return jsx(\"span\", {\n css: /*#__PURE__*/css$2({\n animation: \"\".concat(loadingDotAnimations, \" 1s ease-in-out \").concat(delay, \"ms infinite;\"),\n backgroundColor: 'currentColor',\n borderRadius: '1em',\n display: 'inline-block',\n marginLeft: offset ? '1em' : undefined,\n height: '1em',\n verticalAlign: 'top',\n width: '1em'\n }, process.env.NODE_ENV === \"production\" ? \"\" : \";label:LoadingDot;\", process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGljYXRvcnMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXFQSSIsImZpbGUiOiJpbmRpY2F0b3JzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgUmVhY3ROb2RlIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsganN4LCBrZXlmcmFtZXMgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmltcG9ydCB7XG4gIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lLFxuICBDU1NPYmplY3RXaXRoTGFiZWwsXG4gIEdyb3VwQmFzZSxcbn0gZnJvbSAnLi4vdHlwZXMnO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgSWNvbnNcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5jb25zdCBTdmcgPSAoe1xuICBzaXplLFxuICAuLi5wcm9wc1xufTogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzdmcnXSAmIHsgc2l6ZTogbnVtYmVyIH0pID0+IChcbiAgPHN2Z1xuICAgIGhlaWdodD17c2l6ZX1cbiAgICB3aWR0aD17c2l6ZX1cbiAgICB2aWV3Qm94PVwiMCAwIDIwIDIwXCJcbiAgICBhcmlhLWhpZGRlbj1cInRydWVcIlxuICAgIGZvY3VzYWJsZT1cImZhbHNlXCJcbiAgICBjc3M9e3tcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgZmlsbDogJ2N1cnJlbnRDb2xvcicsXG4gICAgICBsaW5lSGVpZ2h0OiAxLFxuICAgICAgc3Ryb2tlOiAnY3VycmVudENvbG9yJyxcbiAgICAgIHN0cm9rZVdpZHRoOiAwLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IHR5cGUgQ3Jvc3NJY29uUHJvcHMgPSBKU1guSW50cmluc2ljRWxlbWVudHNbJ3N2ZyddICYgeyBzaXplPzogbnVtYmVyIH07XG5leHBvcnQgY29uc3QgQ3Jvc3NJY29uID0gKHByb3BzOiBDcm9zc0ljb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNMTQuMzQ4IDE0Ljg0OWMtMC40NjkgMC40NjktMS4yMjkgMC40NjktMS42OTcgMGwtMi42NTEtMy4wMzAtMi42NTEgMy4wMjljLTAuNDY5IDAuNDY5LTEuMjI5IDAuNDY5LTEuNjk3IDAtMC40NjktMC40NjktMC40NjktMS4yMjkgMC0xLjY5N2wyLjc1OC0zLjE1LTIuNzU5LTMuMTUyYy0wLjQ2OS0wLjQ2OS0wLjQ2OS0xLjIyOCAwLTEuNjk3czEuMjI4LTAuNDY5IDEuNjk3IDBsMi42NTIgMy4wMzEgMi42NTEtMy4wMzFjMC40NjktMC40NjkgMS4yMjgtMC40NjkgMS42OTcgMHMwLjQ2OSAxLjIyOSAwIDEuNjk3bC0yLjc1OCAzLjE1MiAyLjc1OCAzLjE1YzAuNDY5IDAuNDY5IDAuNDY5IDEuMjI5IDAgMS42OTh6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuZXhwb3J0IHR5cGUgRG93bkNoZXZyb25Qcm9wcyA9IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snc3ZnJ10gJiB7IHNpemU/OiBudW1iZXIgfTtcbmV4cG9ydCBjb25zdCBEb3duQ2hldnJvbiA9IChwcm9wczogRG93bkNoZXZyb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNNC41MTYgNy41NDhjMC40MzYtMC40NDYgMS4wNDMtMC40ODEgMS41NzYgMGwzLjkwOCAzLjc0NyAzLjkwOC0zLjc0N2MwLjUzMy0wLjQ4MSAxLjE0MS0wLjQ0NiAxLjU3NCAwIDAuNDM2IDAuNDQ1IDAuNDA4IDEuMTk3IDAgMS42MTUtMC40MDYgMC40MTgtNC42OTUgNC41MDItNC42OTUgNC41MDItMC4yMTcgMC4yMjMtMC41MDIgMC4zMzUtMC43ODcgMC4zMzVzLTAuNTctMC4xMTItMC43ODktMC4zMzVjMCAwLTQuMjg3LTQuMDg0LTQuNjk1LTQuNTAycy0wLjQzNi0xLjE3IDAtMS42MTV6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgQnV0dG9uc1xuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG5cbmV4cG9ydCBpbnRlcmZhY2UgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxcbiAgT3B0aW9uID0gdW5rbm93bixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4gPSBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+ID0gR3JvdXBCYXNlPE9wdGlvbj5cbj4gZXh0ZW5kcyBDb21tb25Qcm9wc0FuZENsYXNzTmFtZTxPcHRpb24sIElzTXVsdGksIEdyb3VwPiB7XG4gIC8qKiBUaGUgY2hpbGRyZW4gdG8gYmUgcmVuZGVyZWQgaW5zaWRlIHRoZSBpbmRpY2F0b3IuICovXG4gIGNoaWxkcmVuPzogUmVhY3ROb2RlO1xuICAvKiogUHJvcHMgdGhhdCB3aWxsIGJlIHBhc3NlZCBvbiB0byB0aGUgY2hpbGRyZW4uICovXG4gIGlubmVyUHJvcHM6IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snZGl2J107XG4gIC8qKiBUaGUgZm9jdXNlZCBzdGF0ZSBvZiB0aGUgc2VsZWN0LiAqL1xuICBpc0ZvY3VzZWQ6IGJvb2xlYW47XG4gIGlzRGlzYWJsZWQ6IGJvb2xlYW47XG59XG5cbmNvbnN0IGJhc2VDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oe1xuICBpc0ZvY3VzZWQsXG4gIHRoZW1lOiB7XG4gICAgc3BhY2luZzogeyBiYXNlVW5pdCB9LFxuICAgIGNvbG9ycyxcbiAgfSxcbn06XG4gIHwgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuICB8IENsZWFySW5kaWNhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD4pOiBDU1NPYmplY3RXaXRoTGFiZWwgPT4gKHtcbiAgbGFiZWw6ICdpbmRpY2F0b3JDb250YWluZXInLFxuICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw2MCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gIGRpc3BsYXk6ICdmbGV4JyxcbiAgcGFkZGluZzogYmFzZVVuaXQgKiAyLFxuICB0cmFuc2l0aW9uOiAnY29sb3IgMTUwbXMnLFxuXG4gICc6aG92ZXInOiB7XG4gICAgY29sb3I6IGlzRm9jdXNlZCA/IGNvbG9ycy5uZXV0cmFsODAgOiBjb2xvcnMubmV1dHJhbDQwLFxuICB9LFxufSk7XG5cbmV4cG9ydCBjb25zdCBkcm9wZG93bkluZGljYXRvckNTUyA9IGJhc2VDU1M7XG5leHBvcnQgY29uc3QgRHJvcGRvd25JbmRpY2F0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHByb3BzOiBEcm9wZG93bkluZGljYXRvclByb3BzPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+XG4pID0+IHtcbiAgY29uc3QgeyBjaGlsZHJlbiwgY2xhc3NOYW1lLCBjeCwgZ2V0U3R5bGVzLCBpbm5lclByb3BzIH0gPSBwcm9wcztcbiAgcmV0dXJuIChcbiAgICA8ZGl2XG4gICAgICBjc3M9e2dldFN0eWxlcygnZHJvcGRvd25JbmRpY2F0b3InLCBwcm9wcyl9XG4gICAgICBjbGFzc05hbWU9e2N4KFxuICAgICAgICB7XG4gICAgICAgICAgaW5kaWNhdG9yOiB0cnVlLFxuICAgICAgICAgICdkcm9wZG93bi1pbmRpY2F0b3InOiB0cnVlLFxuICAgICAgICB9LFxuICAgICAgICBjbGFzc05hbWVcbiAgICAgICl9XG4gICAgICB7Li4uaW5uZXJQcm9wc31cbiAgICA+XG4gICAgICB7Y2hpbGRyZW4gfHwgPERvd25DaGV2cm9uIC8+fVxuICAgIDwvZGl2PlxuICApO1xufTtcblxuZXhwb3J0IGludGVyZmFjZSBDbGVhckluZGljYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgLyoqIFRoZSBjaGlsZHJlbiB0byBiZSByZW5kZXJlZCBpbnNpZGUgdGhlIGluZGljYXRvci4gKi9cbiAgY2hpbGRyZW4/OiBSZWFjdE5vZGU7XG4gIC8qKiBQcm9wcyB0aGF0IHdpbGwgYmUgcGFzc2VkIG9uIHRvIHRoZSBjaGlsZHJlbi4gKi9cbiAgaW5uZXJQcm9wczogSlNYLkludHJpbnNpY0VsZW1lbnRzWydkaXYnXTtcbiAgLyoqIFRoZSBmb2N1c2VkIHN0YXRlIG9mIHRoZSBzZWxlY3QuICovXG4gIGlzRm9jdXNlZDogYm9vbGVhbjtcbn1cblxuZXhwb3J0IGNvbnN0IGNsZWFySW5kaWNhdG9yQ1NTID0gYmFzZUNTUztcbmV4cG9ydCBjb25zdCBDbGVhckluZGljYXRvciA9IDxcbiAgT3B0aW9uLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbixcbiAgR3JvdXAgZXh0ZW5kcyBHcm91cEJhc2U8T3B0aW9uPlxuPihcbiAgcHJvcHM6IENsZWFySW5kaWNhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD5cbikgPT4ge1xuICBjb25zdCB7IGNoaWxkcmVuLCBjbGFzc05hbWUsIGN4LCBnZXRTdHlsZXMsIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIGNzcz17Z2V0U3R5bGVzKCdjbGVhckluZGljYXRvcicsIHByb3BzKX1cbiAgICAgIGNsYXNzTmFtZT17Y3goXG4gICAgICAgIHtcbiAgICAgICAgICBpbmRpY2F0b3I6IHRydWUsXG4gICAgICAgICAgJ2NsZWFyLWluZGljYXRvcic6IHRydWUsXG4gICAgICAgIH0sXG4gICAgICAgIGNsYXNzTmFtZVxuICAgICAgKX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8Q3Jvc3NJY29uIC8+fVxuICAgIDwvZGl2PlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBTZXBhcmF0b3Jcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5leHBvcnQgaW50ZXJmYWNlIEluZGljYXRvclNlcGFyYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgaXNEaXNhYmxlZDogYm9vbGVhbjtcbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpbm5lclByb3BzPzogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ107XG59XG5cbmV4cG9ydCBjb25zdCBpbmRpY2F0b3JTZXBhcmF0b3JDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oe1xuICBpc0Rpc2FibGVkLFxuICB0aGVtZToge1xuICAgIHNwYWNpbmc6IHsgYmFzZVVuaXQgfSxcbiAgICBjb2xvcnMsXG4gIH0sXG59OiBJbmRpY2F0b3JTZXBhcmF0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPik6IENTU09iamVjdFdpdGhMYWJlbCA9PiAoe1xuICBsYWJlbDogJ2luZGljYXRvclNlcGFyYXRvcicsXG4gIGFsaWduU2VsZjogJ3N0cmV0Y2gnLFxuICBiYWNrZ3JvdW5kQ29sb3I6IGlzRGlzYWJsZWQgPyBjb2xvcnMubmV1dHJhbDEwIDogY29sb3JzLm5ldXRyYWwyMCxcbiAgbWFyZ2luQm90dG9tOiBiYXNlVW5pdCAqIDIsXG4gIG1hcmdpblRvcDogYmFzZVVuaXQgKiAyLFxuICB3aWR0aDogMSxcbn0pO1xuXG5leHBvcnQgY29uc3QgSW5kaWNhdG9yU2VwYXJhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KFxuICBwcm9wczogSW5kaWNhdG9yU2VwYXJhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD5cbikgPT4ge1xuICBjb25zdCB7IGNsYXNzTmFtZSwgY3gsIGdldFN0eWxlcywgaW5uZXJQcm9wcyB9ID0gcHJvcHM7XG4gIHJldHVybiAoXG4gICAgPHNwYW5cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgY3NzPXtnZXRTdHlsZXMoJ2luZGljYXRvclNlcGFyYXRvcicsIHByb3BzKX1cbiAgICAgIGNsYXNzTmFtZT17Y3goeyAnaW5kaWNhdG9yLXNlcGFyYXRvcic6IHRydWUgfSwgY2xhc3NOYW1lKX1cbiAgICAvPlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBMb2FkaW5nXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuY29uc3QgbG9hZGluZ0RvdEFuaW1hdGlvbnMgPSBrZXlmcmFtZXNgXG4gIDAlLCA4MCUsIDEwMCUgeyBvcGFjaXR5OiAwOyB9XG4gIDQwJSB7IG9wYWNpdHk6IDE7IH1cbmA7XG5cbmV4cG9ydCBjb25zdCBsb2FkaW5nSW5kaWNhdG9yQ1NTID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KHtcbiAgaXNGb2N1c2VkLFxuICBzaXplLFxuICB0aGVtZToge1xuICAgIGNvbG9ycyxcbiAgICBzcGFjaW5nOiB7IGJhc2VVbml0IH0sXG4gIH0sXG59OiBMb2FkaW5nSW5kaWNhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD4pOiBDU1NPYmplY3RXaXRoTGFiZWwgPT4gKHtcbiAgbGFiZWw6ICdsb2FkaW5nSW5kaWNhdG9yJyxcbiAgY29sb3I6IGlzRm9jdXNlZCA/IGNvbG9ycy5uZXV0cmFsNjAgOiBjb2xvcnMubmV1dHJhbDIwLFxuICBkaXNwbGF5OiAnZmxleCcsXG4gIHBhZGRpbmc6IGJhc2VVbml0ICogMixcbiAgdHJhbnNpdGlvbjogJ2NvbG9yIDE1MG1zJyxcbiAgYWxpZ25TZWxmOiAnY2VudGVyJyxcbiAgZm9udFNpemU6IHNpemUsXG4gIGxpbmVIZWlnaHQ6IDEsXG4gIG1hcmdpblJpZ2h0OiBzaXplLFxuICB0ZXh0QWxpZ246ICdjZW50ZXInLFxuICB2ZXJ0aWNhbEFsaWduOiAnbWlkZGxlJyxcbn0pO1xuXG5pbnRlcmZhY2UgTG9hZGluZ0RvdFByb3BzIHtcbiAgZGVsYXk6IG51bWJlcjtcbiAgb2Zmc2V0OiBib29sZWFuO1xufVxuY29uc3QgTG9hZGluZ0RvdCA9ICh7IGRlbGF5LCBvZmZzZXQgfTogTG9hZGluZ0RvdFByb3BzKSA9PiAoXG4gIDxzcGFuXG4gICAgY3NzPXt7XG4gICAgICBhbmltYXRpb246IGAke2xvYWRpbmdEb3RBbmltYXRpb25zfSAxcyBlYXNlLWluLW91dCAke2RlbGF5fW1zIGluZmluaXRlO2AsXG4gICAgICBiYWNrZ3JvdW5kQ29sb3I6ICdjdXJyZW50Q29sb3InLFxuICAgICAgYm9yZGVyUmFkaXVzOiAnMWVtJyxcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgbWFyZ2luTGVmdDogb2Zmc2V0ID8gJzFlbScgOiB1bmRlZmluZWQsXG4gICAgICBoZWlnaHQ6ICcxZW0nLFxuICAgICAgdmVydGljYWxBbGlnbjogJ3RvcCcsXG4gICAgICB3aWR0aDogJzFlbScsXG4gICAgfX1cbiAgLz5cbik7XG5cbmV4cG9ydCBpbnRlcmZhY2UgTG9hZGluZ0luZGljYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgLyoqIFByb3BzIHRoYXQgd2lsbCBiZSBwYXNzZWQgb24gdG8gdGhlIGNoaWxkcmVuLiAqL1xuICBpbm5lclByb3BzOiBKU1guSW50cmluc2ljRWxlbWVudHNbJ2RpdiddO1xuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpc0Rpc2FibGVkOiBib29sZWFuO1xuICAvKiogU2V0IHNpemUgb2YgdGhlIGNvbnRhaW5lci4gKi9cbiAgc2l6ZTogbnVtYmVyO1xufVxuZXhwb3J0IGNvbnN0IExvYWRpbmdJbmRpY2F0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHByb3BzOiBMb2FkaW5nSW5kaWNhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD5cbikgPT4ge1xuICBjb25zdCB7IGNsYXNzTmFtZSwgY3gsIGdldFN0eWxlcywgaW5uZXJQcm9wcywgaXNSdGwgfSA9IHByb3BzO1xuXG4gIHJldHVybiAoXG4gICAgPGRpdlxuICAgICAgY3NzPXtnZXRTdHlsZXMoJ2xvYWRpbmdJbmRpY2F0b3InLCBwcm9wcyl9XG4gICAgICBjbGFzc05hbWU9e2N4KFxuICAgICAgICB7XG4gICAgICAgICAgaW5kaWNhdG9yOiB0cnVlLFxuICAgICAgICAgICdsb2FkaW5nLWluZGljYXRvcic6IHRydWUsXG4gICAgICAgIH0sXG4gICAgICAgIGNsYXNzTmFtZVxuICAgICAgKX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIDxMb2FkaW5nRG90IGRlbGF5PXswfSBvZmZzZXQ9e2lzUnRsfSAvPlxuICAgICAgPExvYWRpbmdEb3QgZGVsYXk9ezE2MH0gb2Zmc2V0IC8+XG4gICAgICA8TG9hZGluZ0RvdCBkZWxheT17MzIwfSBvZmZzZXQ9eyFpc1J0bH0gLz5cbiAgICA8L2Rpdj5cbiAgKTtcbn07XG5Mb2FkaW5nSW5kaWNhdG9yLmRlZmF1bHRQcm9wcyA9IHsgc2l6ZTogNCB9O1xuIl19 */\")\n });\n};\n\nvar LoadingIndicator = function LoadingIndicator(props) {\n var className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps,\n isRtl = props.isRtl;\n return jsx(\"div\", _extends({\n css: getStyles('loadingIndicator', props),\n className: cx({\n indicator: true,\n 'loading-indicator': true\n }, className)\n }, innerProps), jsx(LoadingDot, {\n delay: 0,\n offset: isRtl\n }), jsx(LoadingDot, {\n delay: 160,\n offset: true\n }), jsx(LoadingDot, {\n delay: 320,\n offset: !isRtl\n }));\n};\nLoadingIndicator.defaultProps = {\n size: 4\n};\n\nvar css$1 = function css(_ref) {\n var isDisabled = _ref.isDisabled,\n isFocused = _ref.isFocused,\n _ref$theme = _ref.theme,\n colors = _ref$theme.colors,\n borderRadius = _ref$theme.borderRadius,\n spacing = _ref$theme.spacing;\n return {\n label: 'control',\n alignItems: 'center',\n backgroundColor: isDisabled ? colors.neutral5 : colors.neutral0,\n borderColor: isDisabled ? colors.neutral10 : isFocused ? colors.primary : colors.neutral20,\n borderRadius: borderRadius,\n borderStyle: 'solid',\n borderWidth: 1,\n boxShadow: isFocused ? \"0 0 0 1px \".concat(colors.primary) : undefined,\n cursor: 'default',\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'space-between',\n minHeight: spacing.controlHeight,\n outline: '0 !important',\n position: 'relative',\n transition: 'all 100ms',\n '&:hover': {\n borderColor: isFocused ? colors.primary : colors.neutral30\n }\n };\n};\n\nvar Control = function Control(props) {\n var children = props.children,\n cx = props.cx,\n getStyles = props.getStyles,\n className = props.className,\n isDisabled = props.isDisabled,\n isFocused = props.isFocused,\n innerRef = props.innerRef,\n innerProps = props.innerProps,\n menuIsOpen = props.menuIsOpen;\n return jsx(\"div\", _extends({\n ref: innerRef,\n css: getStyles('control', props),\n className: cx({\n control: true,\n 'control--is-disabled': isDisabled,\n 'control--is-focused': isFocused,\n 'control--menu-is-open': menuIsOpen\n }, className)\n }, innerProps), children);\n};\n\nvar _excluded$1 = [\"data\"];\nvar groupCSS = function groupCSS(_ref) {\n var spacing = _ref.theme.spacing;\n return {\n paddingBottom: spacing.baseUnit * 2,\n paddingTop: spacing.baseUnit * 2\n };\n};\n\nvar Group = function Group(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n Heading = props.Heading,\n headingProps = props.headingProps,\n innerProps = props.innerProps,\n label = props.label,\n theme = props.theme,\n selectProps = props.selectProps;\n return jsx(\"div\", _extends({\n css: getStyles('group', props),\n className: cx({\n group: true\n }, className)\n }, innerProps), jsx(Heading, _extends({}, headingProps, {\n selectProps: selectProps,\n theme: theme,\n getStyles: getStyles,\n cx: cx\n }), label), jsx(\"div\", null, children));\n};\n\nvar groupHeadingCSS = function groupHeadingCSS(_ref2) {\n var spacing = _ref2.theme.spacing;\n return {\n label: 'group',\n color: '#999',\n cursor: 'default',\n display: 'block',\n fontSize: '75%',\n fontWeight: 500,\n marginBottom: '0.25em',\n paddingLeft: spacing.baseUnit * 3,\n paddingRight: spacing.baseUnit * 3,\n textTransform: 'uppercase'\n };\n};\nvar GroupHeading = function GroupHeading(props) {\n var getStyles = props.getStyles,\n cx = props.cx,\n className = props.className;\n\n var _cleanCommonProps = cleanCommonProps(props);\n _cleanCommonProps.data;\n var innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded$1);\n\n return jsx(\"div\", _extends({\n css: getStyles('groupHeading', props),\n className: cx({\n 'group-heading': true\n }, className)\n }, innerProps));\n};\n\nvar _excluded = [\"innerRef\", \"isDisabled\", \"isHidden\", \"inputClassName\"];\nvar inputCSS = function inputCSS(_ref) {\n var isDisabled = _ref.isDisabled,\n value = _ref.value,\n _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return _objectSpread2({\n margin: spacing.baseUnit / 2,\n paddingBottom: spacing.baseUnit / 2,\n paddingTop: spacing.baseUnit / 2,\n visibility: isDisabled ? 'hidden' : 'visible',\n color: colors.neutral80,\n // force css to recompute when value change due to @emotion bug.\n // We can remove it whenever the bug is fixed.\n transform: value ? 'translateZ(0)' : ''\n }, containerStyle);\n};\nvar spacingStyle = {\n gridArea: '1 / 2',\n font: 'inherit',\n minWidth: '2px',\n border: 0,\n margin: 0,\n outline: 0,\n padding: 0\n};\nvar containerStyle = {\n flex: '1 1 auto',\n display: 'inline-grid',\n gridArea: '1 / 1 / 2 / 3',\n gridTemplateColumns: '0 min-content',\n '&:after': _objectSpread2({\n content: 'attr(data-value) \" \"',\n visibility: 'hidden',\n whiteSpace: 'pre'\n }, spacingStyle)\n};\n\nvar inputStyle = function inputStyle(isHidden) {\n return _objectSpread2({\n label: 'input',\n color: 'inherit',\n background: 0,\n opacity: isHidden ? 0 : 1,\n width: '100%'\n }, spacingStyle);\n};\n\nvar Input = function Input(props) {\n var className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n value = props.value;\n\n var _cleanCommonProps = cleanCommonProps(props),\n innerRef = _cleanCommonProps.innerRef,\n isDisabled = _cleanCommonProps.isDisabled,\n isHidden = _cleanCommonProps.isHidden,\n inputClassName = _cleanCommonProps.inputClassName,\n innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded);\n\n return jsx(\"div\", {\n className: cx({\n 'input-container': true\n }, className),\n css: getStyles('input', props),\n \"data-value\": value || ''\n }, jsx(\"input\", _extends({\n className: cx({\n input: true\n }, inputClassName),\n ref: innerRef,\n style: inputStyle(isHidden),\n disabled: isDisabled\n }, innerProps)));\n};\n\nvar multiValueCSS = function multiValueCSS(_ref) {\n var _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n borderRadius = _ref$theme.borderRadius,\n colors = _ref$theme.colors;\n return {\n label: 'multiValue',\n backgroundColor: colors.neutral10,\n borderRadius: borderRadius / 2,\n display: 'flex',\n margin: spacing.baseUnit / 2,\n minWidth: 0 // resolves flex/text-overflow bug\n\n };\n};\nvar multiValueLabelCSS = function multiValueLabelCSS(_ref2) {\n var _ref2$theme = _ref2.theme,\n borderRadius = _ref2$theme.borderRadius,\n colors = _ref2$theme.colors,\n cropWithEllipsis = _ref2.cropWithEllipsis;\n return {\n borderRadius: borderRadius / 2,\n color: colors.neutral80,\n fontSize: '85%',\n overflow: 'hidden',\n padding: 3,\n paddingLeft: 6,\n textOverflow: cropWithEllipsis || cropWithEllipsis === undefined ? 'ellipsis' : undefined,\n whiteSpace: 'nowrap'\n };\n};\nvar multiValueRemoveCSS = function multiValueRemoveCSS(_ref3) {\n var _ref3$theme = _ref3.theme,\n spacing = _ref3$theme.spacing,\n borderRadius = _ref3$theme.borderRadius,\n colors = _ref3$theme.colors,\n isFocused = _ref3.isFocused;\n return {\n alignItems: 'center',\n borderRadius: borderRadius / 2,\n backgroundColor: isFocused ? colors.dangerLight : undefined,\n display: 'flex',\n paddingLeft: spacing.baseUnit,\n paddingRight: spacing.baseUnit,\n ':hover': {\n backgroundColor: colors.dangerLight,\n color: colors.danger\n }\n };\n};\nvar MultiValueGeneric = function MultiValueGeneric(_ref4) {\n var children = _ref4.children,\n innerProps = _ref4.innerProps;\n return jsx(\"div\", innerProps, children);\n};\nvar MultiValueContainer = MultiValueGeneric;\nvar MultiValueLabel = MultiValueGeneric;\nfunction MultiValueRemove(_ref5) {\n var children = _ref5.children,\n innerProps = _ref5.innerProps;\n return jsx(\"div\", _extends({\n role: \"button\"\n }, innerProps), children || jsx(CrossIcon, {\n size: 14\n }));\n}\n\nvar MultiValue = function MultiValue(props) {\n var children = props.children,\n className = props.className,\n components = props.components,\n cx = props.cx,\n data = props.data,\n getStyles = props.getStyles,\n innerProps = props.innerProps,\n isDisabled = props.isDisabled,\n removeProps = props.removeProps,\n selectProps = props.selectProps;\n var Container = components.Container,\n Label = components.Label,\n Remove = components.Remove;\n return jsx(ClassNames, null, function (_ref6) {\n var css = _ref6.css,\n emotionCx = _ref6.cx;\n return jsx(Container, {\n data: data,\n innerProps: _objectSpread2({\n className: emotionCx(css(getStyles('multiValue', props)), cx({\n 'multi-value': true,\n 'multi-value--is-disabled': isDisabled\n }, className))\n }, innerProps),\n selectProps: selectProps\n }, jsx(Label, {\n data: data,\n innerProps: {\n className: emotionCx(css(getStyles('multiValueLabel', props)), cx({\n 'multi-value__label': true\n }, className))\n },\n selectProps: selectProps\n }, children), jsx(Remove, {\n data: data,\n innerProps: _objectSpread2({\n className: emotionCx(css(getStyles('multiValueRemove', props)), cx({\n 'multi-value__remove': true\n }, className)),\n 'aria-label': \"Remove \".concat(children || 'option')\n }, removeProps),\n selectProps: selectProps\n }));\n });\n};\n\nvar optionCSS = function optionCSS(_ref) {\n var isDisabled = _ref.isDisabled,\n isFocused = _ref.isFocused,\n isSelected = _ref.isSelected,\n _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return {\n label: 'option',\n backgroundColor: isSelected ? colors.primary : isFocused ? colors.primary25 : 'transparent',\n color: isDisabled ? colors.neutral20 : isSelected ? colors.neutral0 : 'inherit',\n cursor: 'default',\n display: 'block',\n fontSize: 'inherit',\n padding: \"\".concat(spacing.baseUnit * 2, \"px \").concat(spacing.baseUnit * 3, \"px\"),\n width: '100%',\n userSelect: 'none',\n WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',\n // provide some affordance on touch devices\n ':active': {\n backgroundColor: !isDisabled ? isSelected ? colors.primary : colors.primary50 : undefined\n }\n };\n};\n\nvar Option = function Option(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n isDisabled = props.isDisabled,\n isFocused = props.isFocused,\n isSelected = props.isSelected,\n innerRef = props.innerRef,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('option', props),\n className: cx({\n option: true,\n 'option--is-disabled': isDisabled,\n 'option--is-focused': isFocused,\n 'option--is-selected': isSelected\n }, className),\n ref: innerRef,\n \"aria-disabled\": isDisabled\n }, innerProps), children);\n};\n\nvar placeholderCSS = function placeholderCSS(_ref) {\n var _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return {\n label: 'placeholder',\n color: colors.neutral50,\n gridArea: '1 / 1 / 2 / 3',\n marginLeft: spacing.baseUnit / 2,\n marginRight: spacing.baseUnit / 2\n };\n};\n\nvar Placeholder = function Placeholder(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('placeholder', props),\n className: cx({\n placeholder: true\n }, className)\n }, innerProps), children);\n};\n\nvar css = function css(_ref) {\n var isDisabled = _ref.isDisabled,\n _ref$theme = _ref.theme,\n spacing = _ref$theme.spacing,\n colors = _ref$theme.colors;\n return {\n label: 'singleValue',\n color: isDisabled ? colors.neutral40 : colors.neutral80,\n gridArea: '1 / 1 / 2 / 3',\n marginLeft: spacing.baseUnit / 2,\n marginRight: spacing.baseUnit / 2,\n maxWidth: '100%',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap'\n };\n};\n\nvar SingleValue = function SingleValue(props) {\n var children = props.children,\n className = props.className,\n cx = props.cx,\n getStyles = props.getStyles,\n isDisabled = props.isDisabled,\n innerProps = props.innerProps;\n return jsx(\"div\", _extends({\n css: getStyles('singleValue', props),\n className: cx({\n 'single-value': true,\n 'single-value--is-disabled': isDisabled\n }, className)\n }, innerProps), children);\n};\n\nvar components = {\n ClearIndicator: ClearIndicator,\n Control: Control,\n DropdownIndicator: DropdownIndicator,\n DownChevron: DownChevron,\n CrossIcon: CrossIcon,\n Group: Group,\n GroupHeading: GroupHeading,\n IndicatorsContainer: IndicatorsContainer,\n IndicatorSeparator: IndicatorSeparator,\n Input: Input,\n LoadingIndicator: LoadingIndicator,\n Menu: Menu,\n MenuList: MenuList,\n MenuPortal: MenuPortal,\n LoadingMessage: LoadingMessage,\n NoOptionsMessage: NoOptionsMessage,\n MultiValue: MultiValue,\n MultiValueContainer: MultiValueContainer,\n MultiValueLabel: MultiValueLabel,\n MultiValueRemove: MultiValueRemove,\n Option: Option,\n Placeholder: Placeholder,\n SelectContainer: SelectContainer,\n SingleValue: SingleValue,\n ValueContainer: ValueContainer\n};\nvar defaultComponents = function defaultComponents(props) {\n return _objectSpread2(_objectSpread2({}, components), props.components);\n};\n\nexport { isMobileDevice as A, multiValueAsValue as B, singleValueAsValue as C, valueTernary as D, classNames as E, defaultComponents as F, notNullish as G, isDocumentElement as H, cleanValue as I, scrollIntoView as J, noop as K, handleInputChange as L, MenuPlacer as M, _createSuper as _, _objectSpread2 as a, clearIndicatorCSS as b, components as c, containerCSS as d, css$1 as e, dropdownIndicatorCSS as f, groupCSS as g, groupHeadingCSS as h, indicatorsContainerCSS as i, indicatorSeparatorCSS as j, inputCSS as k, loadingIndicatorCSS as l, loadingMessageCSS as m, menuCSS as n, menuListCSS as o, menuPortalCSS as p, multiValueCSS as q, multiValueLabelCSS as r, supportsPassiveEvents as s, multiValueRemoveCSS as t, noOptionsMessageCSS as u, optionCSS as v, placeholderCSS as w, css as x, valueContainerCSS as y, isTouchCapable as z };\n","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","import { a as _objectSpread2 } from './index-c7a4d7ce.esm.js';\nimport _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';\nimport _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';\nimport { useState, useCallback } from 'react';\n\nvar _excluded = [\"defaultInputValue\", \"defaultMenuIsOpen\", \"defaultValue\", \"inputValue\", \"menuIsOpen\", \"onChange\", \"onInputChange\", \"onMenuClose\", \"onMenuOpen\", \"value\"];\nfunction useStateManager(_ref) {\n var _ref$defaultInputValu = _ref.defaultInputValue,\n defaultInputValue = _ref$defaultInputValu === void 0 ? '' : _ref$defaultInputValu,\n _ref$defaultMenuIsOpe = _ref.defaultMenuIsOpen,\n defaultMenuIsOpen = _ref$defaultMenuIsOpe === void 0 ? false : _ref$defaultMenuIsOpe,\n _ref$defaultValue = _ref.defaultValue,\n defaultValue = _ref$defaultValue === void 0 ? null : _ref$defaultValue,\n propsInputValue = _ref.inputValue,\n propsMenuIsOpen = _ref.menuIsOpen,\n propsOnChange = _ref.onChange,\n propsOnInputChange = _ref.onInputChange,\n propsOnMenuClose = _ref.onMenuClose,\n propsOnMenuOpen = _ref.onMenuOpen,\n propsValue = _ref.value,\n restSelectProps = _objectWithoutProperties(_ref, _excluded);\n\n var _useState = useState(propsInputValue !== undefined ? propsInputValue : defaultInputValue),\n _useState2 = _slicedToArray(_useState, 2),\n stateInputValue = _useState2[0],\n setStateInputValue = _useState2[1];\n\n var _useState3 = useState(propsMenuIsOpen !== undefined ? propsMenuIsOpen : defaultMenuIsOpen),\n _useState4 = _slicedToArray(_useState3, 2),\n stateMenuIsOpen = _useState4[0],\n setStateMenuIsOpen = _useState4[1];\n\n var _useState5 = useState(propsValue !== undefined ? propsValue : defaultValue),\n _useState6 = _slicedToArray(_useState5, 2),\n stateValue = _useState6[0],\n setStateValue = _useState6[1];\n\n var onChange = useCallback(function (value, actionMeta) {\n if (typeof propsOnChange === 'function') {\n propsOnChange(value, actionMeta);\n }\n\n setStateValue(value);\n }, [propsOnChange]);\n var onInputChange = useCallback(function (value, actionMeta) {\n var newValue;\n\n if (typeof propsOnInputChange === 'function') {\n newValue = propsOnInputChange(value, actionMeta);\n }\n\n setStateInputValue(newValue !== undefined ? newValue : value);\n }, [propsOnInputChange]);\n var onMenuOpen = useCallback(function () {\n if (typeof propsOnMenuOpen === 'function') {\n propsOnMenuOpen();\n }\n\n setStateMenuIsOpen(true);\n }, [propsOnMenuOpen]);\n var onMenuClose = useCallback(function () {\n if (typeof propsOnMenuClose === 'function') {\n propsOnMenuClose();\n }\n\n setStateMenuIsOpen(false);\n }, [propsOnMenuClose]);\n var inputValue = propsInputValue !== undefined ? propsInputValue : stateInputValue;\n var menuIsOpen = propsMenuIsOpen !== undefined ? propsMenuIsOpen : stateMenuIsOpen;\n var value = propsValue !== undefined ? propsValue : stateValue;\n return _objectSpread2(_objectSpread2({}, restSelectProps), {}, {\n inputValue: inputValue,\n menuIsOpen: menuIsOpen,\n onChange: onChange,\n onInputChange: onInputChange,\n onMenuClose: onMenuClose,\n onMenuOpen: onMenuOpen,\n value: value\n });\n}\n\nexport { useStateManager as u };\n","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithoutHoles from \"./arrayWithoutHoles.js\";\nimport iterableToArray from \"./iterableToArray.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableSpread from \"./nonIterableSpread.js\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","var safeIsNaN = Number.isNaN ||\n function ponyfill(value) {\n return typeof value === 'number' && value !== value;\n };\nfunction isEqual(first, second) {\n if (first === second) {\n return true;\n }\n if (safeIsNaN(first) && safeIsNaN(second)) {\n return true;\n }\n return false;\n}\nfunction areInputsEqual(newInputs, lastInputs) {\n if (newInputs.length !== lastInputs.length) {\n return false;\n }\n for (var i = 0; i < newInputs.length; i++) {\n if (!isEqual(newInputs[i], lastInputs[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction memoizeOne(resultFn, isEqual) {\n if (isEqual === void 0) { isEqual = areInputsEqual; }\n var lastThis;\n var lastArgs = [];\n var lastResult;\n var calledOnce = false;\n function memoized() {\n var newArgs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n newArgs[_i] = arguments[_i];\n }\n if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {\n return lastResult;\n }\n lastResult = resultFn.apply(this, newArgs);\n calledOnce = true;\n lastThis = this;\n lastArgs = newArgs;\n return lastResult;\n }\n return memoized;\n}\n\nexport default memoizeOne;\n","import _extends from '@babel/runtime/helpers/esm/extends';\nimport { a as _objectSpread2, s as supportsPassiveEvents, b as clearIndicatorCSS, d as containerCSS, e as css$1, f as dropdownIndicatorCSS, g as groupCSS, h as groupHeadingCSS, i as indicatorsContainerCSS, j as indicatorSeparatorCSS, k as inputCSS, l as loadingIndicatorCSS, m as loadingMessageCSS, n as menuCSS, o as menuListCSS, p as menuPortalCSS, q as multiValueCSS, r as multiValueLabelCSS, t as multiValueRemoveCSS, u as noOptionsMessageCSS, v as optionCSS, w as placeholderCSS, x as css$2, y as valueContainerCSS, z as isTouchCapable, A as isMobileDevice, _ as _createSuper, B as multiValueAsValue, C as singleValueAsValue, D as valueTernary, E as classNames, F as defaultComponents, G as notNullish, H as isDocumentElement, I as cleanValue, J as scrollIntoView, K as noop, M as MenuPlacer } from './index-c7a4d7ce.esm.js';\nimport _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';\nimport _createClass from '@babel/runtime/helpers/esm/createClass';\nimport _inherits from '@babel/runtime/helpers/esm/inherits';\nimport _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray';\nimport * as React from 'react';\nimport { useMemo, Fragment, useRef, useCallback, useEffect, Component } from 'react';\nimport { jsx, css } from '@emotion/react';\nimport memoizeOne from 'memoize-one';\nimport _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';\n\nfunction _EMOTION_STRINGIFIED_CSS_ERROR__$1() { return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\"; }\n\nvar _ref = process.env.NODE_ENV === \"production\" ? {\n name: \"7pg0cj-a11yText\",\n styles: \"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap\"\n} : {\n name: \"1f43avz-a11yText-A11yText\",\n styles: \"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap;label:A11yText;\",\n map: \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkExMXlUZXh0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNSSIsImZpbGUiOiJBMTF5VGV4dC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQGpzeCBqc3ggKi9cbmltcG9ydCB7IGpzeCB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLy8gQXNzaXN0aXZlIHRleHQgdG8gZGVzY3JpYmUgdmlzdWFsIGVsZW1lbnRzLiBIaWRkZW4gZm9yIHNpZ2h0ZWQgdXNlcnMuXG5jb25zdCBBMTF5VGV4dCA9IChwcm9wczogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ10pID0+IChcbiAgPHNwYW5cbiAgICBjc3M9e3tcbiAgICAgIGxhYmVsOiAnYTExeVRleHQnLFxuICAgICAgekluZGV4OiA5OTk5LFxuICAgICAgYm9yZGVyOiAwLFxuICAgICAgY2xpcDogJ3JlY3QoMXB4LCAxcHgsIDFweCwgMXB4KScsXG4gICAgICBoZWlnaHQ6IDEsXG4gICAgICB3aWR0aDogMSxcbiAgICAgIHBvc2l0aW9uOiAnYWJzb2x1dGUnLFxuICAgICAgb3ZlcmZsb3c6ICdoaWRkZW4nLFxuICAgICAgcGFkZGluZzogMCxcbiAgICAgIHdoaXRlU3BhY2U6ICdub3dyYXAnLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IGRlZmF1bHQgQTExeVRleHQ7XG4iXX0= */\",\n toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1\n};\n\nvar A11yText = function A11yText(props) {\n return jsx(\"span\", _extends({\n css: _ref\n }, props));\n};\n\nvar defaultAriaLiveMessages = {\n guidance: function guidance(props) {\n var isSearchable = props.isSearchable,\n isMulti = props.isMulti,\n isDisabled = props.isDisabled,\n tabSelectsValue = props.tabSelectsValue,\n context = props.context;\n\n switch (context) {\n case 'menu':\n return \"Use Up and Down to choose options\".concat(isDisabled ? '' : ', press Enter to select the currently focused option', \", press Escape to exit the menu\").concat(tabSelectsValue ? ', press Tab to select the option and exit the menu' : '', \".\");\n\n case 'input':\n return \"\".concat(props['aria-label'] || 'Select', \" is focused \").concat(isSearchable ? ',type to refine list' : '', \", press Down to open the menu, \").concat(isMulti ? ' press left to focus selected values' : '');\n\n case 'value':\n return 'Use left and right to toggle between focused values, press Backspace to remove the currently focused value';\n\n default:\n return '';\n }\n },\n onChange: function onChange(props) {\n var action = props.action,\n _props$label = props.label,\n label = _props$label === void 0 ? '' : _props$label,\n labels = props.labels,\n isDisabled = props.isDisabled;\n\n switch (action) {\n case 'deselect-option':\n case 'pop-value':\n case 'remove-value':\n return \"option \".concat(label, \", deselected.\");\n\n case 'clear':\n return 'All selected options have been cleared.';\n\n case 'initial-input-focus':\n return \"option\".concat(labels.length > 1 ? 's' : '', \" \").concat(labels.join(','), \", selected.\");\n\n case 'select-option':\n return isDisabled ? \"option \".concat(label, \" is disabled. Select another option.\") : \"option \".concat(label, \", selected.\");\n\n default:\n return '';\n }\n },\n onFocus: function onFocus(props) {\n var context = props.context,\n focused = props.focused,\n options = props.options,\n _props$label2 = props.label,\n label = _props$label2 === void 0 ? '' : _props$label2,\n selectValue = props.selectValue,\n isDisabled = props.isDisabled,\n isSelected = props.isSelected;\n\n var getArrayIndex = function getArrayIndex(arr, item) {\n return arr && arr.length ? \"\".concat(arr.indexOf(item) + 1, \" of \").concat(arr.length) : '';\n };\n\n if (context === 'value' && selectValue) {\n return \"value \".concat(label, \" focused, \").concat(getArrayIndex(selectValue, focused), \".\");\n }\n\n if (context === 'menu') {\n var disabled = isDisabled ? ' disabled' : '';\n var status = \"\".concat(isSelected ? 'selected' : 'focused').concat(disabled);\n return \"option \".concat(label, \" \").concat(status, \", \").concat(getArrayIndex(options, focused), \".\");\n }\n\n return '';\n },\n onFilter: function onFilter(props) {\n var inputValue = props.inputValue,\n resultsMessage = props.resultsMessage;\n return \"\".concat(resultsMessage).concat(inputValue ? ' for search term ' + inputValue : '', \".\");\n }\n};\n\nvar LiveRegion = function LiveRegion(props) {\n var ariaSelection = props.ariaSelection,\n focusedOption = props.focusedOption,\n focusedValue = props.focusedValue,\n focusableOptions = props.focusableOptions,\n isFocused = props.isFocused,\n selectValue = props.selectValue,\n selectProps = props.selectProps,\n id = props.id;\n var ariaLiveMessages = selectProps.ariaLiveMessages,\n getOptionLabel = selectProps.getOptionLabel,\n inputValue = selectProps.inputValue,\n isMulti = selectProps.isMulti,\n isOptionDisabled = selectProps.isOptionDisabled,\n isSearchable = selectProps.isSearchable,\n menuIsOpen = selectProps.menuIsOpen,\n options = selectProps.options,\n screenReaderStatus = selectProps.screenReaderStatus,\n tabSelectsValue = selectProps.tabSelectsValue;\n var ariaLabel = selectProps['aria-label'];\n var ariaLive = selectProps['aria-live']; // Update aria live message configuration when prop changes\n\n var messages = useMemo(function () {\n return _objectSpread2(_objectSpread2({}, defaultAriaLiveMessages), ariaLiveMessages || {});\n }, [ariaLiveMessages]); // Update aria live selected option when prop changes\n\n var ariaSelected = useMemo(function () {\n var message = '';\n\n if (ariaSelection && messages.onChange) {\n var option = ariaSelection.option,\n selectedOptions = ariaSelection.options,\n removedValue = ariaSelection.removedValue,\n removedValues = ariaSelection.removedValues,\n value = ariaSelection.value; // select-option when !isMulti does not return option so we assume selected option is value\n\n var asOption = function asOption(val) {\n return !Array.isArray(val) ? val : null;\n }; // If there is just one item from the action then get its label\n\n\n var selected = removedValue || option || asOption(value);\n var label = selected ? getOptionLabel(selected) : ''; // If there are multiple items from the action then return an array of labels\n\n var multiSelected = selectedOptions || removedValues || undefined;\n var labels = multiSelected ? multiSelected.map(getOptionLabel) : [];\n\n var onChangeProps = _objectSpread2({\n // multiSelected items are usually items that have already been selected\n // or set by the user as a default value so we assume they are not disabled\n isDisabled: selected && isOptionDisabled(selected, selectValue),\n label: label,\n labels: labels\n }, ariaSelection);\n\n message = messages.onChange(onChangeProps);\n }\n\n return message;\n }, [ariaSelection, messages, isOptionDisabled, selectValue, getOptionLabel]);\n var ariaFocused = useMemo(function () {\n var focusMsg = '';\n var focused = focusedOption || focusedValue;\n var isSelected = !!(focusedOption && selectValue && selectValue.includes(focusedOption));\n\n if (focused && messages.onFocus) {\n var onFocusProps = {\n focused: focused,\n label: getOptionLabel(focused),\n isDisabled: isOptionDisabled(focused, selectValue),\n isSelected: isSelected,\n options: options,\n context: focused === focusedOption ? 'menu' : 'value',\n selectValue: selectValue\n };\n focusMsg = messages.onFocus(onFocusProps);\n }\n\n return focusMsg;\n }, [focusedOption, focusedValue, getOptionLabel, isOptionDisabled, messages, options, selectValue]);\n var ariaResults = useMemo(function () {\n var resultsMsg = '';\n\n if (menuIsOpen && options.length && messages.onFilter) {\n var resultsMessage = screenReaderStatus({\n count: focusableOptions.length\n });\n resultsMsg = messages.onFilter({\n inputValue: inputValue,\n resultsMessage: resultsMessage\n });\n }\n\n return resultsMsg;\n }, [focusableOptions, inputValue, menuIsOpen, messages, options, screenReaderStatus]);\n var ariaGuidance = useMemo(function () {\n var guidanceMsg = '';\n\n if (messages.guidance) {\n var context = focusedValue ? 'value' : menuIsOpen ? 'menu' : 'input';\n guidanceMsg = messages.guidance({\n 'aria-label': ariaLabel,\n context: context,\n isDisabled: focusedOption && isOptionDisabled(focusedOption, selectValue),\n isMulti: isMulti,\n isSearchable: isSearchable,\n tabSelectsValue: tabSelectsValue\n });\n }\n\n return guidanceMsg;\n }, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue]);\n var ariaContext = \"\".concat(ariaFocused, \" \").concat(ariaResults, \" \").concat(ariaGuidance);\n var ScreenReaderText = jsx(Fragment, null, jsx(\"span\", {\n id: \"aria-selection\"\n }, ariaSelected), jsx(\"span\", {\n id: \"aria-context\"\n }, ariaContext));\n var isInitialFocus = (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus';\n return jsx(Fragment, null, jsx(A11yText, {\n id: id\n }, isInitialFocus && ScreenReaderText), jsx(A11yText, {\n \"aria-live\": ariaLive,\n \"aria-atomic\": \"false\",\n \"aria-relevant\": \"additions text\"\n }, isFocused && !isInitialFocus && ScreenReaderText));\n};\n\nvar diacritics = [{\n base: 'A',\n letters: \"A\\u24B6\\uFF21\\xC0\\xC1\\xC2\\u1EA6\\u1EA4\\u1EAA\\u1EA8\\xC3\\u0100\\u0102\\u1EB0\\u1EAE\\u1EB4\\u1EB2\\u0226\\u01E0\\xC4\\u01DE\\u1EA2\\xC5\\u01FA\\u01CD\\u0200\\u0202\\u1EA0\\u1EAC\\u1EB6\\u1E00\\u0104\\u023A\\u2C6F\"\n}, {\n base: 'AA',\n letters: \"\\uA732\"\n}, {\n base: 'AE',\n letters: \"\\xC6\\u01FC\\u01E2\"\n}, {\n base: 'AO',\n letters: \"\\uA734\"\n}, {\n base: 'AU',\n letters: \"\\uA736\"\n}, {\n base: 'AV',\n letters: \"\\uA738\\uA73A\"\n}, {\n base: 'AY',\n letters: \"\\uA73C\"\n}, {\n base: 'B',\n letters: \"B\\u24B7\\uFF22\\u1E02\\u1E04\\u1E06\\u0243\\u0182\\u0181\"\n}, {\n base: 'C',\n letters: \"C\\u24B8\\uFF23\\u0106\\u0108\\u010A\\u010C\\xC7\\u1E08\\u0187\\u023B\\uA73E\"\n}, {\n base: 'D',\n letters: \"D\\u24B9\\uFF24\\u1E0A\\u010E\\u1E0C\\u1E10\\u1E12\\u1E0E\\u0110\\u018B\\u018A\\u0189\\uA779\"\n}, {\n base: 'DZ',\n letters: \"\\u01F1\\u01C4\"\n}, {\n base: 'Dz',\n letters: \"\\u01F2\\u01C5\"\n}, {\n base: 'E',\n letters: \"E\\u24BA\\uFF25\\xC8\\xC9\\xCA\\u1EC0\\u1EBE\\u1EC4\\u1EC2\\u1EBC\\u0112\\u1E14\\u1E16\\u0114\\u0116\\xCB\\u1EBA\\u011A\\u0204\\u0206\\u1EB8\\u1EC6\\u0228\\u1E1C\\u0118\\u1E18\\u1E1A\\u0190\\u018E\"\n}, {\n base: 'F',\n letters: \"F\\u24BB\\uFF26\\u1E1E\\u0191\\uA77B\"\n}, {\n base: 'G',\n letters: \"G\\u24BC\\uFF27\\u01F4\\u011C\\u1E20\\u011E\\u0120\\u01E6\\u0122\\u01E4\\u0193\\uA7A0\\uA77D\\uA77E\"\n}, {\n base: 'H',\n letters: \"H\\u24BD\\uFF28\\u0124\\u1E22\\u1E26\\u021E\\u1E24\\u1E28\\u1E2A\\u0126\\u2C67\\u2C75\\uA78D\"\n}, {\n base: 'I',\n letters: \"I\\u24BE\\uFF29\\xCC\\xCD\\xCE\\u0128\\u012A\\u012C\\u0130\\xCF\\u1E2E\\u1EC8\\u01CF\\u0208\\u020A\\u1ECA\\u012E\\u1E2C\\u0197\"\n}, {\n base: 'J',\n letters: \"J\\u24BF\\uFF2A\\u0134\\u0248\"\n}, {\n base: 'K',\n letters: \"K\\u24C0\\uFF2B\\u1E30\\u01E8\\u1E32\\u0136\\u1E34\\u0198\\u2C69\\uA740\\uA742\\uA744\\uA7A2\"\n}, {\n base: 'L',\n letters: \"L\\u24C1\\uFF2C\\u013F\\u0139\\u013D\\u1E36\\u1E38\\u013B\\u1E3C\\u1E3A\\u0141\\u023D\\u2C62\\u2C60\\uA748\\uA746\\uA780\"\n}, {\n base: 'LJ',\n letters: \"\\u01C7\"\n}, {\n base: 'Lj',\n letters: \"\\u01C8\"\n}, {\n base: 'M',\n letters: \"M\\u24C2\\uFF2D\\u1E3E\\u1E40\\u1E42\\u2C6E\\u019C\"\n}, {\n base: 'N',\n letters: \"N\\u24C3\\uFF2E\\u01F8\\u0143\\xD1\\u1E44\\u0147\\u1E46\\u0145\\u1E4A\\u1E48\\u0220\\u019D\\uA790\\uA7A4\"\n}, {\n base: 'NJ',\n letters: \"\\u01CA\"\n}, {\n base: 'Nj',\n letters: \"\\u01CB\"\n}, {\n base: 'O',\n letters: \"O\\u24C4\\uFF2F\\xD2\\xD3\\xD4\\u1ED2\\u1ED0\\u1ED6\\u1ED4\\xD5\\u1E4C\\u022C\\u1E4E\\u014C\\u1E50\\u1E52\\u014E\\u022E\\u0230\\xD6\\u022A\\u1ECE\\u0150\\u01D1\\u020C\\u020E\\u01A0\\u1EDC\\u1EDA\\u1EE0\\u1EDE\\u1EE2\\u1ECC\\u1ED8\\u01EA\\u01EC\\xD8\\u01FE\\u0186\\u019F\\uA74A\\uA74C\"\n}, {\n base: 'OI',\n letters: \"\\u01A2\"\n}, {\n base: 'OO',\n letters: \"\\uA74E\"\n}, {\n base: 'OU',\n letters: \"\\u0222\"\n}, {\n base: 'P',\n letters: \"P\\u24C5\\uFF30\\u1E54\\u1E56\\u01A4\\u2C63\\uA750\\uA752\\uA754\"\n}, {\n base: 'Q',\n letters: \"Q\\u24C6\\uFF31\\uA756\\uA758\\u024A\"\n}, {\n base: 'R',\n letters: \"R\\u24C7\\uFF32\\u0154\\u1E58\\u0158\\u0210\\u0212\\u1E5A\\u1E5C\\u0156\\u1E5E\\u024C\\u2C64\\uA75A\\uA7A6\\uA782\"\n}, {\n base: 'S',\n letters: \"S\\u24C8\\uFF33\\u1E9E\\u015A\\u1E64\\u015C\\u1E60\\u0160\\u1E66\\u1E62\\u1E68\\u0218\\u015E\\u2C7E\\uA7A8\\uA784\"\n}, {\n base: 'T',\n letters: \"T\\u24C9\\uFF34\\u1E6A\\u0164\\u1E6C\\u021A\\u0162\\u1E70\\u1E6E\\u0166\\u01AC\\u01AE\\u023E\\uA786\"\n}, {\n base: 'TZ',\n letters: \"\\uA728\"\n}, {\n base: 'U',\n letters: \"U\\u24CA\\uFF35\\xD9\\xDA\\xDB\\u0168\\u1E78\\u016A\\u1E7A\\u016C\\xDC\\u01DB\\u01D7\\u01D5\\u01D9\\u1EE6\\u016E\\u0170\\u01D3\\u0214\\u0216\\u01AF\\u1EEA\\u1EE8\\u1EEE\\u1EEC\\u1EF0\\u1EE4\\u1E72\\u0172\\u1E76\\u1E74\\u0244\"\n}, {\n base: 'V',\n letters: \"V\\u24CB\\uFF36\\u1E7C\\u1E7E\\u01B2\\uA75E\\u0245\"\n}, {\n base: 'VY',\n letters: \"\\uA760\"\n}, {\n base: 'W',\n letters: \"W\\u24CC\\uFF37\\u1E80\\u1E82\\u0174\\u1E86\\u1E84\\u1E88\\u2C72\"\n}, {\n base: 'X',\n letters: \"X\\u24CD\\uFF38\\u1E8A\\u1E8C\"\n}, {\n base: 'Y',\n letters: \"Y\\u24CE\\uFF39\\u1EF2\\xDD\\u0176\\u1EF8\\u0232\\u1E8E\\u0178\\u1EF6\\u1EF4\\u01B3\\u024E\\u1EFE\"\n}, {\n base: 'Z',\n letters: \"Z\\u24CF\\uFF3A\\u0179\\u1E90\\u017B\\u017D\\u1E92\\u1E94\\u01B5\\u0224\\u2C7F\\u2C6B\\uA762\"\n}, {\n base: 'a',\n letters: \"a\\u24D0\\uFF41\\u1E9A\\xE0\\xE1\\xE2\\u1EA7\\u1EA5\\u1EAB\\u1EA9\\xE3\\u0101\\u0103\\u1EB1\\u1EAF\\u1EB5\\u1EB3\\u0227\\u01E1\\xE4\\u01DF\\u1EA3\\xE5\\u01FB\\u01CE\\u0201\\u0203\\u1EA1\\u1EAD\\u1EB7\\u1E01\\u0105\\u2C65\\u0250\"\n}, {\n base: 'aa',\n letters: \"\\uA733\"\n}, {\n base: 'ae',\n letters: \"\\xE6\\u01FD\\u01E3\"\n}, {\n base: 'ao',\n letters: \"\\uA735\"\n}, {\n base: 'au',\n letters: \"\\uA737\"\n}, {\n base: 'av',\n letters: \"\\uA739\\uA73B\"\n}, {\n base: 'ay',\n letters: \"\\uA73D\"\n}, {\n base: 'b',\n letters: \"b\\u24D1\\uFF42\\u1E03\\u1E05\\u1E07\\u0180\\u0183\\u0253\"\n}, {\n base: 'c',\n letters: \"c\\u24D2\\uFF43\\u0107\\u0109\\u010B\\u010D\\xE7\\u1E09\\u0188\\u023C\\uA73F\\u2184\"\n}, {\n base: 'd',\n letters: \"d\\u24D3\\uFF44\\u1E0B\\u010F\\u1E0D\\u1E11\\u1E13\\u1E0F\\u0111\\u018C\\u0256\\u0257\\uA77A\"\n}, {\n base: 'dz',\n letters: \"\\u01F3\\u01C6\"\n}, {\n base: 'e',\n letters: \"e\\u24D4\\uFF45\\xE8\\xE9\\xEA\\u1EC1\\u1EBF\\u1EC5\\u1EC3\\u1EBD\\u0113\\u1E15\\u1E17\\u0115\\u0117\\xEB\\u1EBB\\u011B\\u0205\\u0207\\u1EB9\\u1EC7\\u0229\\u1E1D\\u0119\\u1E19\\u1E1B\\u0247\\u025B\\u01DD\"\n}, {\n base: 'f',\n letters: \"f\\u24D5\\uFF46\\u1E1F\\u0192\\uA77C\"\n}, {\n base: 'g',\n letters: \"g\\u24D6\\uFF47\\u01F5\\u011D\\u1E21\\u011F\\u0121\\u01E7\\u0123\\u01E5\\u0260\\uA7A1\\u1D79\\uA77F\"\n}, {\n base: 'h',\n letters: \"h\\u24D7\\uFF48\\u0125\\u1E23\\u1E27\\u021F\\u1E25\\u1E29\\u1E2B\\u1E96\\u0127\\u2C68\\u2C76\\u0265\"\n}, {\n base: 'hv',\n letters: \"\\u0195\"\n}, {\n base: 'i',\n letters: \"i\\u24D8\\uFF49\\xEC\\xED\\xEE\\u0129\\u012B\\u012D\\xEF\\u1E2F\\u1EC9\\u01D0\\u0209\\u020B\\u1ECB\\u012F\\u1E2D\\u0268\\u0131\"\n}, {\n base: 'j',\n letters: \"j\\u24D9\\uFF4A\\u0135\\u01F0\\u0249\"\n}, {\n base: 'k',\n letters: \"k\\u24DA\\uFF4B\\u1E31\\u01E9\\u1E33\\u0137\\u1E35\\u0199\\u2C6A\\uA741\\uA743\\uA745\\uA7A3\"\n}, {\n base: 'l',\n letters: \"l\\u24DB\\uFF4C\\u0140\\u013A\\u013E\\u1E37\\u1E39\\u013C\\u1E3D\\u1E3B\\u017F\\u0142\\u019A\\u026B\\u2C61\\uA749\\uA781\\uA747\"\n}, {\n base: 'lj',\n letters: \"\\u01C9\"\n}, {\n base: 'm',\n letters: \"m\\u24DC\\uFF4D\\u1E3F\\u1E41\\u1E43\\u0271\\u026F\"\n}, {\n base: 'n',\n letters: \"n\\u24DD\\uFF4E\\u01F9\\u0144\\xF1\\u1E45\\u0148\\u1E47\\u0146\\u1E4B\\u1E49\\u019E\\u0272\\u0149\\uA791\\uA7A5\"\n}, {\n base: 'nj',\n letters: \"\\u01CC\"\n}, {\n base: 'o',\n letters: \"o\\u24DE\\uFF4F\\xF2\\xF3\\xF4\\u1ED3\\u1ED1\\u1ED7\\u1ED5\\xF5\\u1E4D\\u022D\\u1E4F\\u014D\\u1E51\\u1E53\\u014F\\u022F\\u0231\\xF6\\u022B\\u1ECF\\u0151\\u01D2\\u020D\\u020F\\u01A1\\u1EDD\\u1EDB\\u1EE1\\u1EDF\\u1EE3\\u1ECD\\u1ED9\\u01EB\\u01ED\\xF8\\u01FF\\u0254\\uA74B\\uA74D\\u0275\"\n}, {\n base: 'oi',\n letters: \"\\u01A3\"\n}, {\n base: 'ou',\n letters: \"\\u0223\"\n}, {\n base: 'oo',\n letters: \"\\uA74F\"\n}, {\n base: 'p',\n letters: \"p\\u24DF\\uFF50\\u1E55\\u1E57\\u01A5\\u1D7D\\uA751\\uA753\\uA755\"\n}, {\n base: 'q',\n letters: \"q\\u24E0\\uFF51\\u024B\\uA757\\uA759\"\n}, {\n base: 'r',\n letters: \"r\\u24E1\\uFF52\\u0155\\u1E59\\u0159\\u0211\\u0213\\u1E5B\\u1E5D\\u0157\\u1E5F\\u024D\\u027D\\uA75B\\uA7A7\\uA783\"\n}, {\n base: 's',\n letters: \"s\\u24E2\\uFF53\\xDF\\u015B\\u1E65\\u015D\\u1E61\\u0161\\u1E67\\u1E63\\u1E69\\u0219\\u015F\\u023F\\uA7A9\\uA785\\u1E9B\"\n}, {\n base: 't',\n letters: \"t\\u24E3\\uFF54\\u1E6B\\u1E97\\u0165\\u1E6D\\u021B\\u0163\\u1E71\\u1E6F\\u0167\\u01AD\\u0288\\u2C66\\uA787\"\n}, {\n base: 'tz',\n letters: \"\\uA729\"\n}, {\n base: 'u',\n letters: \"u\\u24E4\\uFF55\\xF9\\xFA\\xFB\\u0169\\u1E79\\u016B\\u1E7B\\u016D\\xFC\\u01DC\\u01D8\\u01D6\\u01DA\\u1EE7\\u016F\\u0171\\u01D4\\u0215\\u0217\\u01B0\\u1EEB\\u1EE9\\u1EEF\\u1EED\\u1EF1\\u1EE5\\u1E73\\u0173\\u1E77\\u1E75\\u0289\"\n}, {\n base: 'v',\n letters: \"v\\u24E5\\uFF56\\u1E7D\\u1E7F\\u028B\\uA75F\\u028C\"\n}, {\n base: 'vy',\n letters: \"\\uA761\"\n}, {\n base: 'w',\n letters: \"w\\u24E6\\uFF57\\u1E81\\u1E83\\u0175\\u1E87\\u1E85\\u1E98\\u1E89\\u2C73\"\n}, {\n base: 'x',\n letters: \"x\\u24E7\\uFF58\\u1E8B\\u1E8D\"\n}, {\n base: 'y',\n letters: \"y\\u24E8\\uFF59\\u1EF3\\xFD\\u0177\\u1EF9\\u0233\\u1E8F\\xFF\\u1EF7\\u1E99\\u1EF5\\u01B4\\u024F\\u1EFF\"\n}, {\n base: 'z',\n letters: \"z\\u24E9\\uFF5A\\u017A\\u1E91\\u017C\\u017E\\u1E93\\u1E95\\u01B6\\u0225\\u0240\\u2C6C\\uA763\"\n}];\nvar anyDiacritic = new RegExp('[' + diacritics.map(function (d) {\n return d.letters;\n}).join('') + ']', 'g');\nvar diacriticToBase = {};\n\nfor (var i = 0; i < diacritics.length; i++) {\n var diacritic = diacritics[i];\n\n for (var j = 0; j < diacritic.letters.length; j++) {\n diacriticToBase[diacritic.letters[j]] = diacritic.base;\n }\n}\n\nvar stripDiacritics = function stripDiacritics(str) {\n return str.replace(anyDiacritic, function (match) {\n return diacriticToBase[match];\n });\n};\n\nvar memoizedStripDiacriticsForInput = memoizeOne(stripDiacritics);\n\nvar trimString = function trimString(str) {\n return str.replace(/^\\s+|\\s+$/g, '');\n};\n\nvar defaultStringify = function defaultStringify(option) {\n return \"\".concat(option.label, \" \").concat(option.value);\n};\n\nvar createFilter = function createFilter(config) {\n return function (option, rawInput) {\n // eslint-disable-next-line no-underscore-dangle\n if (option.data.__isNew__) return true;\n\n var _ignoreCase$ignoreAcc = _objectSpread2({\n ignoreCase: true,\n ignoreAccents: true,\n stringify: defaultStringify,\n trim: true,\n matchFrom: 'any'\n }, config),\n ignoreCase = _ignoreCase$ignoreAcc.ignoreCase,\n ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents,\n stringify = _ignoreCase$ignoreAcc.stringify,\n trim = _ignoreCase$ignoreAcc.trim,\n matchFrom = _ignoreCase$ignoreAcc.matchFrom;\n\n var input = trim ? trimString(rawInput) : rawInput;\n var candidate = trim ? trimString(stringify(option)) : stringify(option);\n\n if (ignoreCase) {\n input = input.toLowerCase();\n candidate = candidate.toLowerCase();\n }\n\n if (ignoreAccents) {\n input = memoizedStripDiacriticsForInput(input);\n candidate = stripDiacritics(candidate);\n }\n\n return matchFrom === 'start' ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1;\n };\n};\n\nvar _excluded = [\"innerRef\"];\nfunction DummyInput(_ref) {\n var innerRef = _ref.innerRef,\n props = _objectWithoutProperties(_ref, _excluded);\n\n return jsx(\"input\", _extends({\n ref: innerRef\n }, props, {\n css: /*#__PURE__*/css({\n label: 'dummyInput',\n // get rid of any default styles\n background: 0,\n border: 0,\n // important! this hides the flashing cursor\n caretColor: 'transparent',\n fontSize: 'inherit',\n gridArea: '1 / 1 / 2 / 3',\n outline: 0,\n padding: 0,\n // important! without `width` browsers won't allow focus\n width: 1,\n // remove cursor on desktop\n color: 'transparent',\n // remove cursor on mobile whilst maintaining \"scroll into view\" behaviour\n left: -100,\n opacity: 0,\n position: 'relative',\n transform: 'scale(.01)'\n }, process.env.NODE_ENV === \"production\" ? \"\" : \";label:DummyInput;\", process.env.NODE_ENV === \"production\" ? \"\" : \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkR1bW15SW5wdXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNNIiwiZmlsZSI6IkR1bW15SW5wdXQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBSZWYgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIER1bW15SW5wdXQoe1xuICBpbm5lclJlZixcbiAgLi4ucHJvcHNcbn06IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snaW5wdXQnXSAmIHtcbiAgcmVhZG9ubHkgaW5uZXJSZWY6IFJlZjxIVE1MSW5wdXRFbGVtZW50Pjtcbn0pIHtcbiAgcmV0dXJuIChcbiAgICA8aW5wdXRcbiAgICAgIHJlZj17aW5uZXJSZWZ9XG4gICAgICB7Li4ucHJvcHN9XG4gICAgICBjc3M9e3tcbiAgICAgICAgbGFiZWw6ICdkdW1teUlucHV0JyxcbiAgICAgICAgLy8gZ2V0IHJpZCBvZiBhbnkgZGVmYXVsdCBzdHlsZXNcbiAgICAgICAgYmFja2dyb3VuZDogMCxcbiAgICAgICAgYm9yZGVyOiAwLFxuICAgICAgICAvLyBpbXBvcnRhbnQhIHRoaXMgaGlkZXMgdGhlIGZsYXNoaW5nIGN1cnNvclxuICAgICAgICBjYXJldENvbG9yOiAndHJhbnNwYXJlbnQnLFxuICAgICAgICBmb250U2l6ZTogJ2luaGVyaXQnLFxuICAgICAgICBncmlkQXJlYTogJzEgLyAxIC8gMiAvIDMnLFxuICAgICAgICBvdXRsaW5lOiAwLFxuICAgICAgICBwYWRkaW5nOiAwLFxuICAgICAgICAvLyBpbXBvcnRhbnQhIHdpdGhvdXQgYHdpZHRoYCBicm93c2VycyB3b24ndCBhbGxvdyBmb2N1c1xuICAgICAgICB3aWR0aDogMSxcblxuICAgICAgICAvLyByZW1vdmUgY3Vyc29yIG9uIGRlc2t0b3BcbiAgICAgICAgY29sb3I6ICd0cmFuc3BhcmVudCcsXG5cbiAgICAgICAgLy8gcmVtb3ZlIGN1cnNvciBvbiBtb2JpbGUgd2hpbHN0IG1haW50YWluaW5nIFwic2Nyb2xsIGludG8gdmlld1wiIGJlaGF2aW91clxuICAgICAgICBsZWZ0OiAtMTAwLFxuICAgICAgICBvcGFjaXR5OiAwLFxuICAgICAgICBwb3NpdGlvbjogJ3JlbGF0aXZlJyxcbiAgICAgICAgdHJhbnNmb3JtOiAnc2NhbGUoLjAxKScsXG4gICAgICB9fVxuICAgIC8+XG4gICk7XG59XG4iXX0= */\")\n }));\n}\n\nvar cancelScroll = function cancelScroll(event) {\n event.preventDefault();\n event.stopPropagation();\n};\n\nfunction useScrollCapture(_ref) {\n var isEnabled = _ref.isEnabled,\n onBottomArrive = _ref.onBottomArrive,\n onBottomLeave = _ref.onBottomLeave,\n onTopArrive = _ref.onTopArrive,\n onTopLeave = _ref.onTopLeave;\n var isBottom = useRef(false);\n var isTop = useRef(false);\n var touchStart = useRef(0);\n var scrollTarget = useRef(null);\n var handleEventDelta = useCallback(function (event, delta) {\n if (scrollTarget.current === null) return;\n var _scrollTarget$current = scrollTarget.current,\n scrollTop = _scrollTarget$current.scrollTop,\n scrollHeight = _scrollTarget$current.scrollHeight,\n clientHeight = _scrollTarget$current.clientHeight;\n var target = scrollTarget.current;\n var isDeltaPositive = delta > 0;\n var availableScroll = scrollHeight - clientHeight - scrollTop;\n var shouldCancelScroll = false; // reset bottom/top flags\n\n if (availableScroll > delta && isBottom.current) {\n if (onBottomLeave) onBottomLeave(event);\n isBottom.current = false;\n }\n\n if (isDeltaPositive && isTop.current) {\n if (onTopLeave) onTopLeave(event);\n isTop.current = false;\n } // bottom limit\n\n\n if (isDeltaPositive && delta > availableScroll) {\n if (onBottomArrive && !isBottom.current) {\n onBottomArrive(event);\n }\n\n target.scrollTop = scrollHeight;\n shouldCancelScroll = true;\n isBottom.current = true; // top limit\n } else if (!isDeltaPositive && -delta > scrollTop) {\n if (onTopArrive && !isTop.current) {\n onTopArrive(event);\n }\n\n target.scrollTop = 0;\n shouldCancelScroll = true;\n isTop.current = true;\n } // cancel scroll\n\n\n if (shouldCancelScroll) {\n cancelScroll(event);\n }\n }, [onBottomArrive, onBottomLeave, onTopArrive, onTopLeave]);\n var onWheel = useCallback(function (event) {\n handleEventDelta(event, event.deltaY);\n }, [handleEventDelta]);\n var onTouchStart = useCallback(function (event) {\n // set touch start so we can calculate touchmove delta\n touchStart.current = event.changedTouches[0].clientY;\n }, []);\n var onTouchMove = useCallback(function (event) {\n var deltaY = touchStart.current - event.changedTouches[0].clientY;\n handleEventDelta(event, deltaY);\n }, [handleEventDelta]);\n var startListening = useCallback(function (el) {\n // bail early if no element is available to attach to\n if (!el) return;\n var notPassive = supportsPassiveEvents ? {\n passive: false\n } : false;\n el.addEventListener('wheel', onWheel, notPassive);\n el.addEventListener('touchstart', onTouchStart, notPassive);\n el.addEventListener('touchmove', onTouchMove, notPassive);\n }, [onTouchMove, onTouchStart, onWheel]);\n var stopListening = useCallback(function (el) {\n // bail early if no element is available to detach from\n if (!el) return;\n el.removeEventListener('wheel', onWheel, false);\n el.removeEventListener('touchstart', onTouchStart, false);\n el.removeEventListener('touchmove', onTouchMove, false);\n }, [onTouchMove, onTouchStart, onWheel]);\n useEffect(function () {\n if (!isEnabled) return;\n var element = scrollTarget.current;\n startListening(element);\n return function () {\n stopListening(element);\n };\n }, [isEnabled, startListening, stopListening]);\n return function (element) {\n scrollTarget.current = element;\n };\n}\n\nvar STYLE_KEYS = ['boxSizing', 'height', 'overflow', 'paddingRight', 'position'];\nvar LOCK_STYLES = {\n boxSizing: 'border-box',\n // account for possible declaration `width: 100%;` on body\n overflow: 'hidden',\n position: 'relative',\n height: '100%'\n};\n\nfunction preventTouchMove(e) {\n e.preventDefault();\n}\n\nfunction allowTouchMove(e) {\n e.stopPropagation();\n}\n\nfunction preventInertiaScroll() {\n var top = this.scrollTop;\n var totalScroll = this.scrollHeight;\n var currentScroll = top + this.offsetHeight;\n\n if (top === 0) {\n this.scrollTop = 1;\n } else if (currentScroll === totalScroll) {\n this.scrollTop = top - 1;\n }\n} // `ontouchstart` check works on most browsers\n// `maxTouchPoints` works on IE10/11 and Surface\n\n\nfunction isTouchDevice() {\n return 'ontouchstart' in window || navigator.maxTouchPoints;\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\nvar activeScrollLocks = 0;\nvar listenerOptions = {\n capture: false,\n passive: false\n};\nfunction useScrollLock(_ref) {\n var isEnabled = _ref.isEnabled,\n _ref$accountForScroll = _ref.accountForScrollbars,\n accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;\n var originalStyles = useRef({});\n var scrollTarget = useRef(null);\n var addScrollLock = useCallback(function (touchScrollTarget) {\n if (!canUseDOM) return;\n var target = document.body;\n var targetStyle = target && target.style;\n\n if (accountForScrollbars) {\n // store any styles already applied to the body\n STYLE_KEYS.forEach(function (key) {\n var val = targetStyle && targetStyle[key];\n originalStyles.current[key] = val;\n });\n } // apply the lock styles and padding if this is the first scroll lock\n\n\n if (accountForScrollbars && activeScrollLocks < 1) {\n var currentPadding = parseInt(originalStyles.current.paddingRight, 10) || 0;\n var clientWidth = document.body ? document.body.clientWidth : 0;\n var adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0;\n Object.keys(LOCK_STYLES).forEach(function (key) {\n var val = LOCK_STYLES[key];\n\n if (targetStyle) {\n targetStyle[key] = val;\n }\n });\n\n if (targetStyle) {\n targetStyle.paddingRight = \"\".concat(adjustedPadding, \"px\");\n }\n } // account for touch devices\n\n\n if (target && isTouchDevice()) {\n // Mobile Safari ignores { overflow: hidden } declaration on the body.\n target.addEventListener('touchmove', preventTouchMove, listenerOptions); // Allow scroll on provided target\n\n if (touchScrollTarget) {\n touchScrollTarget.addEventListener('touchstart', preventInertiaScroll, listenerOptions);\n touchScrollTarget.addEventListener('touchmove', allowTouchMove, listenerOptions);\n }\n } // increment active scroll locks\n\n\n activeScrollLocks += 1;\n }, [accountForScrollbars]);\n var removeScrollLock = useCallback(function (touchScrollTarget) {\n if (!canUseDOM) return;\n var target = document.body;\n var targetStyle = target && target.style; // safely decrement active scroll locks\n\n activeScrollLocks = Math.max(activeScrollLocks - 1, 0); // reapply original body styles, if any\n\n if (accountForScrollbars && activeScrollLocks < 1) {\n STYLE_KEYS.forEach(function (key) {\n var val = originalStyles.current[key];\n\n if (targetStyle) {\n targetStyle[key] = val;\n }\n });\n } // remove touch listeners\n\n\n if (target && isTouchDevice()) {\n target.removeEventListener('touchmove', preventTouchMove, listenerOptions);\n\n if (touchScrollTarget) {\n touchScrollTarget.removeEventListener('touchstart', preventInertiaScroll, listenerOptions);\n touchScrollTarget.removeEventListener('touchmove', allowTouchMove, listenerOptions);\n }\n }\n }, [accountForScrollbars]);\n useEffect(function () {\n if (!isEnabled) return;\n var element = scrollTarget.current;\n addScrollLock(element);\n return function () {\n removeScrollLock(element);\n };\n }, [isEnabled, addScrollLock, removeScrollLock]);\n return function (element) {\n scrollTarget.current = element;\n };\n}\n\nfunction _EMOTION_STRINGIFIED_CSS_ERROR__() { return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\"; }\n\nvar blurSelectInput = function blurSelectInput() {\n return document.activeElement && document.activeElement.blur();\n};\n\nvar _ref2 = process.env.NODE_ENV === \"production\" ? {\n name: \"1kfdb0e\",\n styles: \"position:fixed;left:0;bottom:0;right:0;top:0\"\n} : {\n name: \"bp8cua-ScrollManager\",\n styles: \"position:fixed;left:0;bottom:0;right:0;top:0;label:ScrollManager;\",\n map: \"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlNjcm9sbE1hbmFnZXIudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQStDVSIsImZpbGUiOiJTY3JvbGxNYW5hZ2VyLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgRnJhZ21lbnQsIFJlYWN0RWxlbWVudCwgUmVmQ2FsbGJhY2sgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgdXNlU2Nyb2xsQ2FwdHVyZSBmcm9tICcuL3VzZVNjcm9sbENhcHR1cmUnO1xuaW1wb3J0IHVzZVNjcm9sbExvY2sgZnJvbSAnLi91c2VTY3JvbGxMb2NrJztcblxuaW50ZXJmYWNlIFByb3BzIHtcbiAgcmVhZG9ubHkgY2hpbGRyZW46IChyZWY6IFJlZkNhbGxiYWNrPEhUTUxFbGVtZW50PikgPT4gUmVhY3RFbGVtZW50O1xuICByZWFkb25seSBsb2NrRW5hYmxlZDogYm9vbGVhbjtcbiAgcmVhZG9ubHkgY2FwdHVyZUVuYWJsZWQ6IGJvb2xlYW47XG4gIHJlYWRvbmx5IG9uQm90dG9tQXJyaXZlPzogKGV2ZW50OiBXaGVlbEV2ZW50IHwgVG91Y2hFdmVudCkgPT4gdm9pZDtcbiAgcmVhZG9ubHkgb25Cb3R0b21MZWF2ZT86IChldmVudDogV2hlZWxFdmVudCB8IFRvdWNoRXZlbnQpID0+IHZvaWQ7XG4gIHJlYWRvbmx5IG9uVG9wQXJyaXZlPzogKGV2ZW50OiBXaGVlbEV2ZW50IHwgVG91Y2hFdmVudCkgPT4gdm9pZDtcbiAgcmVhZG9ubHkgb25Ub3BMZWF2ZT86IChldmVudDogV2hlZWxFdmVudCB8IFRvdWNoRXZlbnQpID0+IHZvaWQ7XG59XG5cbmNvbnN0IGJsdXJTZWxlY3RJbnB1dCA9ICgpID0+XG4gIGRvY3VtZW50LmFjdGl2ZUVsZW1lbnQgJiYgKGRvY3VtZW50LmFjdGl2ZUVsZW1lbnQgYXMgSFRNTEVsZW1lbnQpLmJsdXIoKTtcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gU2Nyb2xsTWFuYWdlcih7XG4gIGNoaWxkcmVuLFxuICBsb2NrRW5hYmxlZCxcbiAgY2FwdHVyZUVuYWJsZWQgPSB0cnVlLFxuICBvbkJvdHRvbUFycml2ZSxcbiAgb25Cb3R0b21MZWF2ZSxcbiAgb25Ub3BBcnJpdmUsXG4gIG9uVG9wTGVhdmUsXG59OiBQcm9wcykge1xuICBjb25zdCBzZXRTY3JvbGxDYXB0dXJlVGFyZ2V0ID0gdXNlU2Nyb2xsQ2FwdHVyZSh7XG4gICAgaXNFbmFibGVkOiBjYXB0dXJlRW5hYmxlZCxcbiAgICBvbkJvdHRvbUFycml2ZSxcbiAgICBvbkJvdHRvbUxlYXZlLFxuICAgIG9uVG9wQXJyaXZlLFxuICAgIG9uVG9wTGVhdmUsXG4gIH0pO1xuICBjb25zdCBzZXRTY3JvbGxMb2NrVGFyZ2V0ID0gdXNlU2Nyb2xsTG9jayh7IGlzRW5hYmxlZDogbG9ja0VuYWJsZWQgfSk7XG5cbiAgY29uc3QgdGFyZ2V0UmVmOiBSZWZDYWxsYmFjazxIVE1MRWxlbWVudD4gPSAoZWxlbWVudCkgPT4ge1xuICAgIHNldFNjcm9sbENhcHR1cmVUYXJnZXQoZWxlbWVudCk7XG4gICAgc2V0U2Nyb2xsTG9ja1RhcmdldChlbGVtZW50KTtcbiAgfTtcblxuICByZXR1cm4gKFxuICAgIDxGcmFnbWVudD5cbiAgICAgIHtsb2NrRW5hYmxlZCAmJiAoXG4gICAgICAgIDxkaXZcbiAgICAgICAgICBvbkNsaWNrPXtibHVyU2VsZWN0SW5wdXR9XG4gICAgICAgICAgY3NzPXt7IHBvc2l0aW9uOiAnZml4ZWQnLCBsZWZ0OiAwLCBib3R0b206IDAsIHJpZ2h0OiAwLCB0b3A6IDAgfX1cbiAgICAgICAgLz5cbiAgICAgICl9XG4gICAgICB7Y2hpbGRyZW4odGFyZ2V0UmVmKX1cbiAgICA8L0ZyYWdtZW50PlxuICApO1xufVxuIl19 */\",\n toString: _EMOTION_STRINGIFIED_CSS_ERROR__\n};\n\nfunction ScrollManager(_ref) {\n var children = _ref.children,\n lockEnabled = _ref.lockEnabled,\n _ref$captureEnabled = _ref.captureEnabled,\n captureEnabled = _ref$captureEnabled === void 0 ? true : _ref$captureEnabled,\n onBottomArrive = _ref.onBottomArrive,\n onBottomLeave = _ref.onBottomLeave,\n onTopArrive = _ref.onTopArrive,\n onTopLeave = _ref.onTopLeave;\n var setScrollCaptureTarget = useScrollCapture({\n isEnabled: captureEnabled,\n onBottomArrive: onBottomArrive,\n onBottomLeave: onBottomLeave,\n onTopArrive: onTopArrive,\n onTopLeave: onTopLeave\n });\n var setScrollLockTarget = useScrollLock({\n isEnabled: lockEnabled\n });\n\n var targetRef = function targetRef(element) {\n setScrollCaptureTarget(element);\n setScrollLockTarget(element);\n };\n\n return jsx(Fragment, null, lockEnabled && jsx(\"div\", {\n onClick: blurSelectInput,\n css: _ref2\n }), children(targetRef));\n}\n\nvar formatGroupLabel = function formatGroupLabel(group) {\n return group.label;\n};\nvar getOptionLabel$1 = function getOptionLabel(option) {\n return option.label;\n};\nvar getOptionValue$1 = function getOptionValue(option) {\n return option.value;\n};\nvar isOptionDisabled = function isOptionDisabled(option) {\n return !!option.isDisabled;\n};\n\nvar defaultStyles = {\n clearIndicator: clearIndicatorCSS,\n container: containerCSS,\n control: css$1,\n dropdownIndicator: dropdownIndicatorCSS,\n group: groupCSS,\n groupHeading: groupHeadingCSS,\n indicatorsContainer: indicatorsContainerCSS,\n indicatorSeparator: indicatorSeparatorCSS,\n input: inputCSS,\n loadingIndicator: loadingIndicatorCSS,\n loadingMessage: loadingMessageCSS,\n menu: menuCSS,\n menuList: menuListCSS,\n menuPortal: menuPortalCSS,\n multiValue: multiValueCSS,\n multiValueLabel: multiValueLabelCSS,\n multiValueRemove: multiValueRemoveCSS,\n noOptionsMessage: noOptionsMessageCSS,\n option: optionCSS,\n placeholder: placeholderCSS,\n singleValue: css$2,\n valueContainer: valueContainerCSS\n}; // Merge Utility\n// Allows consumers to extend a base Select with additional styles\n\nfunction mergeStyles(source) {\n var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n // initialize with source styles\n var styles = _objectSpread2({}, source); // massage in target styles\n\n\n Object.keys(target).forEach(function (keyAsString) {\n var key = keyAsString;\n\n if (source[key]) {\n styles[key] = function (rsCss, props) {\n return target[key](source[key](rsCss, props), props);\n };\n } else {\n styles[key] = target[key];\n }\n });\n return styles;\n}\n\nvar colors = {\n primary: '#2684FF',\n primary75: '#4C9AFF',\n primary50: '#B2D4FF',\n primary25: '#DEEBFF',\n danger: '#DE350B',\n dangerLight: '#FFBDAD',\n neutral0: 'hsl(0, 0%, 100%)',\n neutral5: 'hsl(0, 0%, 95%)',\n neutral10: 'hsl(0, 0%, 90%)',\n neutral20: 'hsl(0, 0%, 80%)',\n neutral30: 'hsl(0, 0%, 70%)',\n neutral40: 'hsl(0, 0%, 60%)',\n neutral50: 'hsl(0, 0%, 50%)',\n neutral60: 'hsl(0, 0%, 40%)',\n neutral70: 'hsl(0, 0%, 30%)',\n neutral80: 'hsl(0, 0%, 20%)',\n neutral90: 'hsl(0, 0%, 10%)'\n};\nvar borderRadius = 4; // Used to calculate consistent margin/padding on elements\n\nvar baseUnit = 4; // The minimum height of the control\n\nvar controlHeight = 38; // The amount of space between the control and menu */\n\nvar menuGutter = baseUnit * 2;\nvar spacing = {\n baseUnit: baseUnit,\n controlHeight: controlHeight,\n menuGutter: menuGutter\n};\nvar defaultTheme = {\n borderRadius: borderRadius,\n colors: colors,\n spacing: spacing\n};\n\nvar defaultProps = {\n 'aria-live': 'polite',\n backspaceRemovesValue: true,\n blurInputOnSelect: isTouchCapable(),\n captureMenuScroll: !isTouchCapable(),\n closeMenuOnSelect: true,\n closeMenuOnScroll: false,\n components: {},\n controlShouldRenderValue: true,\n escapeClearsValue: false,\n filterOption: createFilter(),\n formatGroupLabel: formatGroupLabel,\n getOptionLabel: getOptionLabel$1,\n getOptionValue: getOptionValue$1,\n isDisabled: false,\n isLoading: false,\n isMulti: false,\n isRtl: false,\n isSearchable: true,\n isOptionDisabled: isOptionDisabled,\n loadingMessage: function loadingMessage() {\n return 'Loading...';\n },\n maxMenuHeight: 300,\n minMenuHeight: 140,\n menuIsOpen: false,\n menuPlacement: 'bottom',\n menuPosition: 'absolute',\n menuShouldBlockScroll: false,\n menuShouldScrollIntoView: !isMobileDevice(),\n noOptionsMessage: function noOptionsMessage() {\n return 'No options';\n },\n openMenuOnFocus: false,\n openMenuOnClick: true,\n options: [],\n pageSize: 5,\n placeholder: 'Select...',\n screenReaderStatus: function screenReaderStatus(_ref) {\n var count = _ref.count;\n return \"\".concat(count, \" result\").concat(count !== 1 ? 's' : '', \" available\");\n },\n styles: {},\n tabIndex: 0,\n tabSelectsValue: true\n};\n\nfunction toCategorizedOption(props, option, selectValue, index) {\n var isDisabled = _isOptionDisabled(props, option, selectValue);\n\n var isSelected = _isOptionSelected(props, option, selectValue);\n\n var label = getOptionLabel(props, option);\n var value = getOptionValue(props, option);\n return {\n type: 'option',\n data: option,\n isDisabled: isDisabled,\n isSelected: isSelected,\n label: label,\n value: value,\n index: index\n };\n}\n\nfunction buildCategorizedOptions(props, selectValue) {\n return props.options.map(function (groupOrOption, groupOrOptionIndex) {\n if ('options' in groupOrOption) {\n var categorizedOptions = groupOrOption.options.map(function (option, optionIndex) {\n return toCategorizedOption(props, option, selectValue, optionIndex);\n }).filter(function (categorizedOption) {\n return isFocusable(props, categorizedOption);\n });\n return categorizedOptions.length > 0 ? {\n type: 'group',\n data: groupOrOption,\n options: categorizedOptions,\n index: groupOrOptionIndex\n } : undefined;\n }\n\n var categorizedOption = toCategorizedOption(props, groupOrOption, selectValue, groupOrOptionIndex);\n return isFocusable(props, categorizedOption) ? categorizedOption : undefined;\n }).filter(notNullish);\n}\n\nfunction buildFocusableOptionsFromCategorizedOptions(categorizedOptions) {\n return categorizedOptions.reduce(function (optionsAccumulator, categorizedOption) {\n if (categorizedOption.type === 'group') {\n optionsAccumulator.push.apply(optionsAccumulator, _toConsumableArray(categorizedOption.options.map(function (option) {\n return option.data;\n })));\n } else {\n optionsAccumulator.push(categorizedOption.data);\n }\n\n return optionsAccumulator;\n }, []);\n}\n\nfunction buildFocusableOptions(props, selectValue) {\n return buildFocusableOptionsFromCategorizedOptions(buildCategorizedOptions(props, selectValue));\n}\n\nfunction isFocusable(props, categorizedOption) {\n var _props$inputValue = props.inputValue,\n inputValue = _props$inputValue === void 0 ? '' : _props$inputValue;\n var data = categorizedOption.data,\n isSelected = categorizedOption.isSelected,\n label = categorizedOption.label,\n value = categorizedOption.value;\n return (!shouldHideSelectedOptions(props) || !isSelected) && _filterOption(props, {\n label: label,\n value: value,\n data: data\n }, inputValue);\n}\n\nfunction getNextFocusedValue(state, nextSelectValue) {\n var focusedValue = state.focusedValue,\n lastSelectValue = state.selectValue;\n var lastFocusedIndex = lastSelectValue.indexOf(focusedValue);\n\n if (lastFocusedIndex > -1) {\n var nextFocusedIndex = nextSelectValue.indexOf(focusedValue);\n\n if (nextFocusedIndex > -1) {\n // the focused value is still in the selectValue, return it\n return focusedValue;\n } else if (lastFocusedIndex < nextSelectValue.length) {\n // the focusedValue is not present in the next selectValue array by\n // reference, so return the new value at the same index\n return nextSelectValue[lastFocusedIndex];\n }\n }\n\n return null;\n}\n\nfunction getNextFocusedOption(state, options) {\n var lastFocusedOption = state.focusedOption;\n return lastFocusedOption && options.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options[0];\n}\n\nvar getOptionLabel = function getOptionLabel(props, data) {\n return props.getOptionLabel(data);\n};\n\nvar getOptionValue = function getOptionValue(props, data) {\n return props.getOptionValue(data);\n};\n\nfunction _isOptionDisabled(props, option, selectValue) {\n return typeof props.isOptionDisabled === 'function' ? props.isOptionDisabled(option, selectValue) : false;\n}\n\nfunction _isOptionSelected(props, option, selectValue) {\n if (selectValue.indexOf(option) > -1) return true;\n\n if (typeof props.isOptionSelected === 'function') {\n return props.isOptionSelected(option, selectValue);\n }\n\n var candidate = getOptionValue(props, option);\n return selectValue.some(function (i) {\n return getOptionValue(props, i) === candidate;\n });\n}\n\nfunction _filterOption(props, option, inputValue) {\n return props.filterOption ? props.filterOption(option, inputValue) : true;\n}\n\nvar shouldHideSelectedOptions = function shouldHideSelectedOptions(props) {\n var hideSelectedOptions = props.hideSelectedOptions,\n isMulti = props.isMulti;\n if (hideSelectedOptions === undefined) return isMulti;\n return hideSelectedOptions;\n};\n\nvar instanceId = 1;\n\nvar Select = /*#__PURE__*/function (_Component) {\n _inherits(Select, _Component);\n\n var _super = _createSuper(Select);\n\n // Misc. Instance Properties\n // ------------------------------\n // TODO\n // Refs\n // ------------------------------\n // Lifecycle\n // ------------------------------\n function Select(_props) {\n var _this;\n\n _classCallCheck(this, Select);\n\n _this = _super.call(this, _props);\n _this.state = {\n ariaSelection: null,\n focusedOption: null,\n focusedValue: null,\n inputIsHidden: false,\n isFocused: false,\n selectValue: [],\n clearFocusValueOnUpdate: false,\n prevWasFocused: false,\n inputIsHiddenAfterUpdate: undefined,\n prevProps: undefined\n };\n _this.blockOptionHover = false;\n _this.isComposing = false;\n _this.commonProps = void 0;\n _this.initialTouchX = 0;\n _this.initialTouchY = 0;\n _this.instancePrefix = '';\n _this.openAfterFocus = false;\n _this.scrollToFocusedOptionOnUpdate = false;\n _this.userIsDragging = void 0;\n _this.controlRef = null;\n\n _this.getControlRef = function (ref) {\n _this.controlRef = ref;\n };\n\n _this.focusedOptionRef = null;\n\n _this.getFocusedOptionRef = function (ref) {\n _this.focusedOptionRef = ref;\n };\n\n _this.menuListRef = null;\n\n _this.getMenuListRef = function (ref) {\n _this.menuListRef = ref;\n };\n\n _this.inputRef = null;\n\n _this.getInputRef = function (ref) {\n _this.inputRef = ref;\n };\n\n _this.focus = _this.focusInput;\n _this.blur = _this.blurInput;\n\n _this.onChange = function (newValue, actionMeta) {\n var _this$props = _this.props,\n onChange = _this$props.onChange,\n name = _this$props.name;\n actionMeta.name = name;\n\n _this.ariaOnChange(newValue, actionMeta);\n\n onChange(newValue, actionMeta);\n };\n\n _this.setValue = function (newValue, action, option) {\n var _this$props2 = _this.props,\n closeMenuOnSelect = _this$props2.closeMenuOnSelect,\n isMulti = _this$props2.isMulti,\n inputValue = _this$props2.inputValue;\n\n _this.onInputChange('', {\n action: 'set-value',\n prevInputValue: inputValue\n });\n\n if (closeMenuOnSelect) {\n _this.setState({\n inputIsHiddenAfterUpdate: !isMulti\n });\n\n _this.onMenuClose();\n } // when the select value should change, we should reset focusedValue\n\n\n _this.setState({\n clearFocusValueOnUpdate: true\n });\n\n _this.onChange(newValue, {\n action: action,\n option: option\n });\n };\n\n _this.selectOption = function (newValue) {\n var _this$props3 = _this.props,\n blurInputOnSelect = _this$props3.blurInputOnSelect,\n isMulti = _this$props3.isMulti,\n name = _this$props3.name;\n var selectValue = _this.state.selectValue;\n\n var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);\n\n var isDisabled = _this.isOptionDisabled(newValue, selectValue);\n\n if (deselected) {\n var candidate = _this.getOptionValue(newValue);\n\n _this.setValue(multiValueAsValue(selectValue.filter(function (i) {\n return _this.getOptionValue(i) !== candidate;\n })), 'deselect-option', newValue);\n } else if (!isDisabled) {\n // Select option if option is not disabled\n if (isMulti) {\n _this.setValue(multiValueAsValue([].concat(_toConsumableArray(selectValue), [newValue])), 'select-option', newValue);\n } else {\n _this.setValue(singleValueAsValue(newValue), 'select-option');\n }\n } else {\n _this.ariaOnChange(singleValueAsValue(newValue), {\n action: 'select-option',\n option: newValue,\n name: name\n });\n\n return;\n }\n\n if (blurInputOnSelect) {\n _this.blurInput();\n }\n };\n\n _this.removeValue = function (removedValue) {\n var isMulti = _this.props.isMulti;\n var selectValue = _this.state.selectValue;\n\n var candidate = _this.getOptionValue(removedValue);\n\n var newValueArray = selectValue.filter(function (i) {\n return _this.getOptionValue(i) !== candidate;\n });\n var newValue = valueTernary(isMulti, newValueArray, newValueArray[0] || null);\n\n _this.onChange(newValue, {\n action: 'remove-value',\n removedValue: removedValue\n });\n\n _this.focusInput();\n };\n\n _this.clearValue = function () {\n var selectValue = _this.state.selectValue;\n\n _this.onChange(valueTernary(_this.props.isMulti, [], null), {\n action: 'clear',\n removedValues: selectValue\n });\n };\n\n _this.popValue = function () {\n var isMulti = _this.props.isMulti;\n var selectValue = _this.state.selectValue;\n var lastSelectedValue = selectValue[selectValue.length - 1];\n var newValueArray = selectValue.slice(0, selectValue.length - 1);\n var newValue = valueTernary(isMulti, newValueArray, newValueArray[0] || null);\n\n _this.onChange(newValue, {\n action: 'pop-value',\n removedValue: lastSelectedValue\n });\n };\n\n _this.getValue = function () {\n return _this.state.selectValue;\n };\n\n _this.cx = function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return classNames.apply(void 0, [_this.props.classNamePrefix].concat(args));\n };\n\n _this.getOptionLabel = function (data) {\n return getOptionLabel(_this.props, data);\n };\n\n _this.getOptionValue = function (data) {\n return getOptionValue(_this.props, data);\n };\n\n _this.getStyles = function (key, props) {\n var base = defaultStyles[key](props);\n base.boxSizing = 'border-box';\n var custom = _this.props.styles[key];\n return custom ? custom(base, props) : base;\n };\n\n _this.getElementId = function (element) {\n return \"\".concat(_this.instancePrefix, \"-\").concat(element);\n };\n\n _this.getComponents = function () {\n return defaultComponents(_this.props);\n };\n\n _this.buildCategorizedOptions = function () {\n return buildCategorizedOptions(_this.props, _this.state.selectValue);\n };\n\n _this.getCategorizedOptions = function () {\n return _this.props.menuIsOpen ? _this.buildCategorizedOptions() : [];\n };\n\n _this.buildFocusableOptions = function () {\n return buildFocusableOptionsFromCategorizedOptions(_this.buildCategorizedOptions());\n };\n\n _this.getFocusableOptions = function () {\n return _this.props.menuIsOpen ? _this.buildFocusableOptions() : [];\n };\n\n _this.ariaOnChange = function (value, actionMeta) {\n _this.setState({\n ariaSelection: _objectSpread2({\n value: value\n }, actionMeta)\n });\n };\n\n _this.onMenuMouseDown = function (event) {\n if (event.button !== 0) {\n return;\n }\n\n event.stopPropagation();\n event.preventDefault();\n\n _this.focusInput();\n };\n\n _this.onMenuMouseMove = function (event) {\n _this.blockOptionHover = false;\n };\n\n _this.onControlMouseDown = function (event) {\n var openMenuOnClick = _this.props.openMenuOnClick;\n\n if (!_this.state.isFocused) {\n if (openMenuOnClick) {\n _this.openAfterFocus = true;\n }\n\n _this.focusInput();\n } else if (!_this.props.menuIsOpen) {\n if (openMenuOnClick) {\n _this.openMenu('first');\n }\n } else {\n if (event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') {\n _this.onMenuClose();\n }\n }\n\n if (event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') {\n event.preventDefault();\n }\n };\n\n _this.onDropdownIndicatorMouseDown = function (event) {\n // ignore mouse events that weren't triggered by the primary button\n if (event && event.type === 'mousedown' && event.button !== 0) {\n return;\n }\n\n if (_this.props.isDisabled) return;\n var _this$props4 = _this.props,\n isMulti = _this$props4.isMulti,\n menuIsOpen = _this$props4.menuIsOpen;\n\n _this.focusInput();\n\n if (menuIsOpen) {\n _this.setState({\n inputIsHiddenAfterUpdate: !isMulti\n });\n\n _this.onMenuClose();\n } else {\n _this.openMenu('first');\n }\n\n event.preventDefault();\n event.stopPropagation();\n };\n\n _this.onClearIndicatorMouseDown = function (event) {\n // ignore mouse events that weren't triggered by the primary button\n if (event && event.type === 'mousedown' && event.button !== 0) {\n return;\n }\n\n _this.clearValue();\n\n event.preventDefault();\n event.stopPropagation();\n _this.openAfterFocus = false;\n\n if (event.type === 'touchend') {\n _this.focusInput();\n } else {\n setTimeout(function () {\n return _this.focusInput();\n });\n }\n };\n\n _this.onScroll = function (event) {\n if (typeof _this.props.closeMenuOnScroll === 'boolean') {\n if (event.target instanceof HTMLElement && isDocumentElement(event.target)) {\n _this.props.onMenuClose();\n }\n } else if (typeof _this.props.closeMenuOnScroll === 'function') {\n if (_this.props.closeMenuOnScroll(event)) {\n _this.props.onMenuClose();\n }\n }\n };\n\n _this.onCompositionStart = function () {\n _this.isComposing = true;\n };\n\n _this.onCompositionEnd = function () {\n _this.isComposing = false;\n };\n\n _this.onTouchStart = function (_ref2) {\n var touches = _ref2.touches;\n var touch = touches && touches.item(0);\n\n if (!touch) {\n return;\n }\n\n _this.initialTouchX = touch.clientX;\n _this.initialTouchY = touch.clientY;\n _this.userIsDragging = false;\n };\n\n _this.onTouchMove = function (_ref3) {\n var touches = _ref3.touches;\n var touch = touches && touches.item(0);\n\n if (!touch) {\n return;\n }\n\n var deltaX = Math.abs(touch.clientX - _this.initialTouchX);\n var deltaY = Math.abs(touch.clientY - _this.initialTouchY);\n var moveThreshold = 5;\n _this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold;\n };\n\n _this.onTouchEnd = function (event) {\n if (_this.userIsDragging) return; // close the menu if the user taps outside\n // we're checking on event.target here instead of event.currentTarget, because we want to assert information\n // on events on child elements, not the document (which we've attached this handler to).\n\n if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) {\n _this.blurInput();\n } // reset move vars\n\n\n _this.initialTouchX = 0;\n _this.initialTouchY = 0;\n };\n\n _this.onControlTouchEnd = function (event) {\n if (_this.userIsDragging) return;\n\n _this.onControlMouseDown(event);\n };\n\n _this.onClearIndicatorTouchEnd = function (event) {\n if (_this.userIsDragging) return;\n\n _this.onClearIndicatorMouseDown(event);\n };\n\n _this.onDropdownIndicatorTouchEnd = function (event) {\n if (_this.userIsDragging) return;\n\n _this.onDropdownIndicatorMouseDown(event);\n };\n\n _this.handleInputChange = function (event) {\n var prevInputValue = _this.props.inputValue;\n var inputValue = event.currentTarget.value;\n\n _this.setState({\n inputIsHiddenAfterUpdate: false\n });\n\n _this.onInputChange(inputValue, {\n action: 'input-change',\n prevInputValue: prevInputValue\n });\n\n if (!_this.props.menuIsOpen) {\n _this.onMenuOpen();\n }\n };\n\n _this.onInputFocus = function (event) {\n if (_this.props.onFocus) {\n _this.props.onFocus(event);\n }\n\n _this.setState({\n inputIsHiddenAfterUpdate: false,\n isFocused: true\n });\n\n if (_this.openAfterFocus || _this.props.openMenuOnFocus) {\n _this.openMenu('first');\n }\n\n _this.openAfterFocus = false;\n };\n\n _this.onInputBlur = function (event) {\n var prevInputValue = _this.props.inputValue;\n\n if (_this.menuListRef && _this.menuListRef.contains(document.activeElement)) {\n _this.inputRef.focus();\n\n return;\n }\n\n if (_this.props.onBlur) {\n _this.props.onBlur(event);\n }\n\n _this.onInputChange('', {\n action: 'input-blur',\n prevInputValue: prevInputValue\n });\n\n _this.onMenuClose();\n\n _this.setState({\n focusedValue: null,\n isFocused: false\n });\n };\n\n _this.onOptionHover = function (focusedOption) {\n if (_this.blockOptionHover || _this.state.focusedOption === focusedOption) {\n return;\n }\n\n _this.setState({\n focusedOption: focusedOption\n });\n };\n\n _this.shouldHideSelectedOptions = function () {\n return shouldHideSelectedOptions(_this.props);\n };\n\n _this.onKeyDown = function (event) {\n var _this$props5 = _this.props,\n isMulti = _this$props5.isMulti,\n backspaceRemovesValue = _this$props5.backspaceRemovesValue,\n escapeClearsValue = _this$props5.escapeClearsValue,\n inputValue = _this$props5.inputValue,\n isClearable = _this$props5.isClearable,\n isDisabled = _this$props5.isDisabled,\n menuIsOpen = _this$props5.menuIsOpen,\n onKeyDown = _this$props5.onKeyDown,\n tabSelectsValue = _this$props5.tabSelectsValue,\n openMenuOnFocus = _this$props5.openMenuOnFocus;\n var _this$state = _this.state,\n focusedOption = _this$state.focusedOption,\n focusedValue = _this$state.focusedValue,\n selectValue = _this$state.selectValue;\n if (isDisabled) return;\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n\n if (event.defaultPrevented) {\n return;\n }\n } // Block option hover events when the user has just pressed a key\n\n\n _this.blockOptionHover = true;\n\n switch (event.key) {\n case 'ArrowLeft':\n if (!isMulti || inputValue) return;\n\n _this.focusValue('previous');\n\n break;\n\n case 'ArrowRight':\n if (!isMulti || inputValue) return;\n\n _this.focusValue('next');\n\n break;\n\n case 'Delete':\n case 'Backspace':\n if (inputValue) return;\n\n if (focusedValue) {\n _this.removeValue(focusedValue);\n } else {\n if (!backspaceRemovesValue) return;\n\n if (isMulti) {\n _this.popValue();\n } else if (isClearable) {\n _this.clearValue();\n }\n }\n\n break;\n\n case 'Tab':\n if (_this.isComposing) return;\n\n if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || // don't capture the event if the menu opens on focus and the focused\n // option is already selected; it breaks the flow of navigation\n openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) {\n return;\n }\n\n _this.selectOption(focusedOption);\n\n break;\n\n case 'Enter':\n if (event.keyCode === 229) {\n // ignore the keydown event from an Input Method Editor(IME)\n // ref. https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode\n break;\n }\n\n if (menuIsOpen) {\n if (!focusedOption) return;\n if (_this.isComposing) return;\n\n _this.selectOption(focusedOption);\n\n break;\n }\n\n return;\n\n case 'Escape':\n if (menuIsOpen) {\n _this.setState({\n inputIsHiddenAfterUpdate: false\n });\n\n _this.onInputChange('', {\n action: 'menu-close',\n prevInputValue: inputValue\n });\n\n _this.onMenuClose();\n } else if (isClearable && escapeClearsValue) {\n _this.clearValue();\n }\n\n break;\n\n case ' ':\n // space\n if (inputValue) {\n return;\n }\n\n if (!menuIsOpen) {\n _this.openMenu('first');\n\n break;\n }\n\n if (!focusedOption) return;\n\n _this.selectOption(focusedOption);\n\n break;\n\n case 'ArrowUp':\n if (menuIsOpen) {\n _this.focusOption('up');\n } else {\n _this.openMenu('last');\n }\n\n break;\n\n case 'ArrowDown':\n if (menuIsOpen) {\n _this.focusOption('down');\n } else {\n _this.openMenu('first');\n }\n\n break;\n\n case 'PageUp':\n if (!menuIsOpen) return;\n\n _this.focusOption('pageup');\n\n break;\n\n case 'PageDown':\n if (!menuIsOpen) return;\n\n _this.focusOption('pagedown');\n\n break;\n\n case 'Home':\n if (!menuIsOpen) return;\n\n _this.focusOption('first');\n\n break;\n\n case 'End':\n if (!menuIsOpen) return;\n\n _this.focusOption('last');\n\n break;\n\n default:\n return;\n }\n\n event.preventDefault();\n };\n\n _this.instancePrefix = 'react-select-' + (_this.props.instanceId || ++instanceId);\n _this.state.selectValue = cleanValue(_props.value);\n return _this;\n }\n\n _createClass(Select, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.startListeningComposition();\n this.startListeningToTouch();\n\n if (this.props.closeMenuOnScroll && document && document.addEventListener) {\n // Listen to all scroll events, and filter them out inside of 'onScroll'\n document.addEventListener('scroll', this.onScroll, true);\n }\n\n if (this.props.autoFocus) {\n this.focusInput();\n }\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var _this$props6 = this.props,\n isDisabled = _this$props6.isDisabled,\n menuIsOpen = _this$props6.menuIsOpen;\n var isFocused = this.state.isFocused;\n\n if ( // ensure focus is restored correctly when the control becomes enabled\n isFocused && !isDisabled && prevProps.isDisabled || // ensure focus is on the Input when the menu opens\n isFocused && menuIsOpen && !prevProps.menuIsOpen) {\n this.focusInput();\n }\n\n if (isFocused && isDisabled && !prevProps.isDisabled) {\n // ensure select state gets blurred in case Select is programatically disabled while focused\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({\n isFocused: false\n }, this.onMenuClose);\n } // scroll the focused option into view if necessary\n\n\n if (this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate) {\n scrollIntoView(this.menuListRef, this.focusedOptionRef);\n this.scrollToFocusedOptionOnUpdate = false;\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.stopListeningComposition();\n this.stopListeningToTouch();\n document.removeEventListener('scroll', this.onScroll, true);\n } // ==============================\n // Consumer Handlers\n // ==============================\n\n }, {\n key: \"onMenuOpen\",\n value: function onMenuOpen() {\n this.props.onMenuOpen();\n }\n }, {\n key: \"onMenuClose\",\n value: function onMenuClose() {\n this.onInputChange('', {\n action: 'menu-close',\n prevInputValue: this.props.inputValue\n });\n this.props.onMenuClose();\n }\n }, {\n key: \"onInputChange\",\n value: function onInputChange(newValue, actionMeta) {\n this.props.onInputChange(newValue, actionMeta);\n } // ==============================\n // Methods\n // ==============================\n\n }, {\n key: \"focusInput\",\n value: function focusInput() {\n if (!this.inputRef) return;\n this.inputRef.focus();\n }\n }, {\n key: \"blurInput\",\n value: function blurInput() {\n if (!this.inputRef) return;\n this.inputRef.blur();\n } // aliased for consumers\n\n }, {\n key: \"openMenu\",\n value: function openMenu(focusOption) {\n var _this2 = this;\n\n var _this$state2 = this.state,\n selectValue = _this$state2.selectValue,\n isFocused = _this$state2.isFocused;\n var focusableOptions = this.buildFocusableOptions();\n var openAtIndex = focusOption === 'first' ? 0 : focusableOptions.length - 1;\n\n if (!this.props.isMulti) {\n var selectedIndex = focusableOptions.indexOf(selectValue[0]);\n\n if (selectedIndex > -1) {\n openAtIndex = selectedIndex;\n }\n } // only scroll if the menu isn't already open\n\n\n this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef);\n this.setState({\n inputIsHiddenAfterUpdate: false,\n focusedValue: null,\n focusedOption: focusableOptions[openAtIndex]\n }, function () {\n return _this2.onMenuOpen();\n });\n }\n }, {\n key: \"focusValue\",\n value: function focusValue(direction) {\n var _this$state3 = this.state,\n selectValue = _this$state3.selectValue,\n focusedValue = _this$state3.focusedValue; // Only multiselects support value focusing\n\n if (!this.props.isMulti) return;\n this.setState({\n focusedOption: null\n });\n var focusedIndex = selectValue.indexOf(focusedValue);\n\n if (!focusedValue) {\n focusedIndex = -1;\n }\n\n var lastIndex = selectValue.length - 1;\n var nextFocus = -1;\n if (!selectValue.length) return;\n\n switch (direction) {\n case 'previous':\n if (focusedIndex === 0) {\n // don't cycle from the start to the end\n nextFocus = 0;\n } else if (focusedIndex === -1) {\n // if nothing is focused, focus the last value first\n nextFocus = lastIndex;\n } else {\n nextFocus = focusedIndex - 1;\n }\n\n break;\n\n case 'next':\n if (focusedIndex > -1 && focusedIndex < lastIndex) {\n nextFocus = focusedIndex + 1;\n }\n\n break;\n }\n\n this.setState({\n inputIsHidden: nextFocus !== -1,\n focusedValue: selectValue[nextFocus]\n });\n }\n }, {\n key: \"focusOption\",\n value: function focusOption() {\n var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'first';\n var pageSize = this.props.pageSize;\n var focusedOption = this.state.focusedOption;\n var options = this.getFocusableOptions();\n if (!options.length) return;\n var nextFocus = 0; // handles 'first'\n\n var focusedIndex = options.indexOf(focusedOption);\n\n if (!focusedOption) {\n focusedIndex = -1;\n }\n\n if (direction === 'up') {\n nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1;\n } else if (direction === 'down') {\n nextFocus = (focusedIndex + 1) % options.length;\n } else if (direction === 'pageup') {\n nextFocus = focusedIndex - pageSize;\n if (nextFocus < 0) nextFocus = 0;\n } else if (direction === 'pagedown') {\n nextFocus = focusedIndex + pageSize;\n if (nextFocus > options.length - 1) nextFocus = options.length - 1;\n } else if (direction === 'last') {\n nextFocus = options.length - 1;\n }\n\n this.scrollToFocusedOptionOnUpdate = true;\n this.setState({\n focusedOption: options[nextFocus],\n focusedValue: null\n });\n }\n }, {\n key: \"getTheme\",\n value: // ==============================\n // Getters\n // ==============================\n function getTheme() {\n // Use the default theme if there are no customizations.\n if (!this.props.theme) {\n return defaultTheme;\n } // If the theme prop is a function, assume the function\n // knows how to merge the passed-in default theme with\n // its own modifications.\n\n\n if (typeof this.props.theme === 'function') {\n return this.props.theme(defaultTheme);\n } // Otherwise, if a plain theme object was passed in,\n // overlay it with the default theme.\n\n\n return _objectSpread2(_objectSpread2({}, defaultTheme), this.props.theme);\n }\n }, {\n key: \"getCommonProps\",\n value: function getCommonProps() {\n var clearValue = this.clearValue,\n cx = this.cx,\n getStyles = this.getStyles,\n getValue = this.getValue,\n selectOption = this.selectOption,\n setValue = this.setValue,\n props = this.props;\n var isMulti = props.isMulti,\n isRtl = props.isRtl,\n options = props.options;\n var hasValue = this.hasValue();\n return {\n clearValue: clearValue,\n cx: cx,\n getStyles: getStyles,\n getValue: getValue,\n hasValue: hasValue,\n isMulti: isMulti,\n isRtl: isRtl,\n options: options,\n selectOption: selectOption,\n selectProps: props,\n setValue: setValue,\n theme: this.getTheme()\n };\n }\n }, {\n key: \"hasValue\",\n value: function hasValue() {\n var selectValue = this.state.selectValue;\n return selectValue.length > 0;\n }\n }, {\n key: \"hasOptions\",\n value: function hasOptions() {\n return !!this.getFocusableOptions().length;\n }\n }, {\n key: \"isClearable\",\n value: function isClearable() {\n var _this$props7 = this.props,\n isClearable = _this$props7.isClearable,\n isMulti = _this$props7.isMulti; // single select, by default, IS NOT clearable\n // multi select, by default, IS clearable\n\n if (isClearable === undefined) return isMulti;\n return isClearable;\n }\n }, {\n key: \"isOptionDisabled\",\n value: function isOptionDisabled(option, selectValue) {\n return _isOptionDisabled(this.props, option, selectValue);\n }\n }, {\n key: \"isOptionSelected\",\n value: function isOptionSelected(option, selectValue) {\n return _isOptionSelected(this.props, option, selectValue);\n }\n }, {\n key: \"filterOption\",\n value: function filterOption(option, inputValue) {\n return _filterOption(this.props, option, inputValue);\n }\n }, {\n key: \"formatOptionLabel\",\n value: function formatOptionLabel(data, context) {\n if (typeof this.props.formatOptionLabel === 'function') {\n var _inputValue = this.props.inputValue;\n var _selectValue = this.state.selectValue;\n return this.props.formatOptionLabel(data, {\n context: context,\n inputValue: _inputValue,\n selectValue: _selectValue\n });\n } else {\n return this.getOptionLabel(data);\n }\n }\n }, {\n key: \"formatGroupLabel\",\n value: function formatGroupLabel(data) {\n return this.props.formatGroupLabel(data);\n } // ==============================\n // Mouse Handlers\n // ==============================\n\n }, {\n key: \"startListeningComposition\",\n value: // ==============================\n // Composition Handlers\n // ==============================\n function startListeningComposition() {\n if (document && document.addEventListener) {\n document.addEventListener('compositionstart', this.onCompositionStart, false);\n document.addEventListener('compositionend', this.onCompositionEnd, false);\n }\n }\n }, {\n key: \"stopListeningComposition\",\n value: function stopListeningComposition() {\n if (document && document.removeEventListener) {\n document.removeEventListener('compositionstart', this.onCompositionStart);\n document.removeEventListener('compositionend', this.onCompositionEnd);\n }\n }\n }, {\n key: \"startListeningToTouch\",\n value: // ==============================\n // Touch Handlers\n // ==============================\n function startListeningToTouch() {\n if (document && document.addEventListener) {\n document.addEventListener('touchstart', this.onTouchStart, false);\n document.addEventListener('touchmove', this.onTouchMove, false);\n document.addEventListener('touchend', this.onTouchEnd, false);\n }\n }\n }, {\n key: \"stopListeningToTouch\",\n value: function stopListeningToTouch() {\n if (document && document.removeEventListener) {\n document.removeEventListener('touchstart', this.onTouchStart);\n document.removeEventListener('touchmove', this.onTouchMove);\n document.removeEventListener('touchend', this.onTouchEnd);\n }\n }\n }, {\n key: \"renderInput\",\n value: // ==============================\n // Renderers\n // ==============================\n function renderInput() {\n var _this$props8 = this.props,\n isDisabled = _this$props8.isDisabled,\n isSearchable = _this$props8.isSearchable,\n inputId = _this$props8.inputId,\n inputValue = _this$props8.inputValue,\n tabIndex = _this$props8.tabIndex,\n form = _this$props8.form,\n menuIsOpen = _this$props8.menuIsOpen;\n\n var _this$getComponents = this.getComponents(),\n Input = _this$getComponents.Input;\n\n var _this$state4 = this.state,\n inputIsHidden = _this$state4.inputIsHidden,\n ariaSelection = _this$state4.ariaSelection;\n var commonProps = this.commonProps;\n var id = inputId || this.getElementId('input'); // aria attributes makes the JSX \"noisy\", separated for clarity\n\n var ariaAttributes = _objectSpread2(_objectSpread2({\n 'aria-autocomplete': 'list',\n 'aria-expanded': menuIsOpen,\n 'aria-haspopup': true,\n 'aria-controls': this.getElementId('listbox'),\n 'aria-owns': this.getElementId('listbox'),\n 'aria-errormessage': this.props['aria-errormessage'],\n 'aria-invalid': this.props['aria-invalid'],\n 'aria-label': this.props['aria-label'],\n 'aria-labelledby': this.props['aria-labelledby'],\n role: 'combobox'\n }, !isSearchable && {\n 'aria-readonly': true\n }), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {\n 'aria-describedby': this.getElementId('live-region')\n } : {\n 'aria-describedby': this.getElementId('placeholder')\n });\n\n if (!isSearchable) {\n // use a dummy input to maintain focus/blur functionality\n return /*#__PURE__*/React.createElement(DummyInput, _extends({\n id: id,\n innerRef: this.getInputRef,\n onBlur: this.onInputBlur,\n onChange: noop,\n onFocus: this.onInputFocus,\n disabled: isDisabled,\n tabIndex: tabIndex,\n inputMode: \"none\",\n form: form,\n value: \"\"\n }, ariaAttributes));\n }\n\n return /*#__PURE__*/React.createElement(Input, _extends({}, commonProps, {\n autoCapitalize: \"none\",\n autoComplete: \"off\",\n autoCorrect: \"off\",\n id: id,\n innerRef: this.getInputRef,\n isDisabled: isDisabled,\n isHidden: inputIsHidden,\n onBlur: this.onInputBlur,\n onChange: this.handleInputChange,\n onFocus: this.onInputFocus,\n spellCheck: \"false\",\n tabIndex: tabIndex,\n form: form,\n type: \"text\",\n value: inputValue\n }, ariaAttributes));\n }\n }, {\n key: \"renderPlaceholderOrValue\",\n value: function renderPlaceholderOrValue() {\n var _this3 = this;\n\n var _this$getComponents2 = this.getComponents(),\n MultiValue = _this$getComponents2.MultiValue,\n MultiValueContainer = _this$getComponents2.MultiValueContainer,\n MultiValueLabel = _this$getComponents2.MultiValueLabel,\n MultiValueRemove = _this$getComponents2.MultiValueRemove,\n SingleValue = _this$getComponents2.SingleValue,\n Placeholder = _this$getComponents2.Placeholder;\n\n var commonProps = this.commonProps;\n var _this$props9 = this.props,\n controlShouldRenderValue = _this$props9.controlShouldRenderValue,\n isDisabled = _this$props9.isDisabled,\n isMulti = _this$props9.isMulti,\n inputValue = _this$props9.inputValue,\n placeholder = _this$props9.placeholder;\n var _this$state5 = this.state,\n selectValue = _this$state5.selectValue,\n focusedValue = _this$state5.focusedValue,\n isFocused = _this$state5.isFocused;\n\n if (!this.hasValue() || !controlShouldRenderValue) {\n return inputValue ? null : /*#__PURE__*/React.createElement(Placeholder, _extends({}, commonProps, {\n key: \"placeholder\",\n isDisabled: isDisabled,\n isFocused: isFocused,\n innerProps: {\n id: this.getElementId('placeholder')\n }\n }), placeholder);\n }\n\n if (isMulti) {\n return selectValue.map(function (opt, index) {\n var isOptionFocused = opt === focusedValue;\n var key = \"\".concat(_this3.getOptionLabel(opt), \"-\").concat(_this3.getOptionValue(opt));\n return /*#__PURE__*/React.createElement(MultiValue, _extends({}, commonProps, {\n components: {\n Container: MultiValueContainer,\n Label: MultiValueLabel,\n Remove: MultiValueRemove\n },\n isFocused: isOptionFocused,\n isDisabled: isDisabled,\n key: key,\n index: index,\n removeProps: {\n onClick: function onClick() {\n return _this3.removeValue(opt);\n },\n onTouchEnd: function onTouchEnd() {\n return _this3.removeValue(opt);\n },\n onMouseDown: function onMouseDown(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n },\n data: opt\n }), _this3.formatOptionLabel(opt, 'value'));\n });\n }\n\n if (inputValue) {\n return null;\n }\n\n var singleValue = selectValue[0];\n return /*#__PURE__*/React.createElement(SingleValue, _extends({}, commonProps, {\n data: singleValue,\n isDisabled: isDisabled\n }), this.formatOptionLabel(singleValue, 'value'));\n }\n }, {\n key: \"renderClearIndicator\",\n value: function renderClearIndicator() {\n var _this$getComponents3 = this.getComponents(),\n ClearIndicator = _this$getComponents3.ClearIndicator;\n\n var commonProps = this.commonProps;\n var _this$props10 = this.props,\n isDisabled = _this$props10.isDisabled,\n isLoading = _this$props10.isLoading;\n var isFocused = this.state.isFocused;\n\n if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) {\n return null;\n }\n\n var innerProps = {\n onMouseDown: this.onClearIndicatorMouseDown,\n onTouchEnd: this.onClearIndicatorTouchEnd,\n 'aria-hidden': 'true'\n };\n return /*#__PURE__*/React.createElement(ClearIndicator, _extends({}, commonProps, {\n innerProps: innerProps,\n isFocused: isFocused\n }));\n }\n }, {\n key: \"renderLoadingIndicator\",\n value: function renderLoadingIndicator() {\n var _this$getComponents4 = this.getComponents(),\n LoadingIndicator = _this$getComponents4.LoadingIndicator;\n\n var commonProps = this.commonProps;\n var _this$props11 = this.props,\n isDisabled = _this$props11.isDisabled,\n isLoading = _this$props11.isLoading;\n var isFocused = this.state.isFocused;\n if (!LoadingIndicator || !isLoading) return null;\n var innerProps = {\n 'aria-hidden': 'true'\n };\n return /*#__PURE__*/React.createElement(LoadingIndicator, _extends({}, commonProps, {\n innerProps: innerProps,\n isDisabled: isDisabled,\n isFocused: isFocused\n }));\n }\n }, {\n key: \"renderIndicatorSeparator\",\n value: function renderIndicatorSeparator() {\n var _this$getComponents5 = this.getComponents(),\n DropdownIndicator = _this$getComponents5.DropdownIndicator,\n IndicatorSeparator = _this$getComponents5.IndicatorSeparator; // separator doesn't make sense without the dropdown indicator\n\n\n if (!DropdownIndicator || !IndicatorSeparator) return null;\n var commonProps = this.commonProps;\n var isDisabled = this.props.isDisabled;\n var isFocused = this.state.isFocused;\n return /*#__PURE__*/React.createElement(IndicatorSeparator, _extends({}, commonProps, {\n isDisabled: isDisabled,\n isFocused: isFocused\n }));\n }\n }, {\n key: \"renderDropdownIndicator\",\n value: function renderDropdownIndicator() {\n var _this$getComponents6 = this.getComponents(),\n DropdownIndicator = _this$getComponents6.DropdownIndicator;\n\n if (!DropdownIndicator) return null;\n var commonProps = this.commonProps;\n var isDisabled = this.props.isDisabled;\n var isFocused = this.state.isFocused;\n var innerProps = {\n onMouseDown: this.onDropdownIndicatorMouseDown,\n onTouchEnd: this.onDropdownIndicatorTouchEnd,\n 'aria-hidden': 'true'\n };\n return /*#__PURE__*/React.createElement(DropdownIndicator, _extends({}, commonProps, {\n innerProps: innerProps,\n isDisabled: isDisabled,\n isFocused: isFocused\n }));\n }\n }, {\n key: \"renderMenu\",\n value: function renderMenu() {\n var _this4 = this;\n\n var _this$getComponents7 = this.getComponents(),\n Group = _this$getComponents7.Group,\n GroupHeading = _this$getComponents7.GroupHeading,\n Menu = _this$getComponents7.Menu,\n MenuList = _this$getComponents7.MenuList,\n MenuPortal = _this$getComponents7.MenuPortal,\n LoadingMessage = _this$getComponents7.LoadingMessage,\n NoOptionsMessage = _this$getComponents7.NoOptionsMessage,\n Option = _this$getComponents7.Option;\n\n var commonProps = this.commonProps;\n var focusedOption = this.state.focusedOption;\n var _this$props12 = this.props,\n captureMenuScroll = _this$props12.captureMenuScroll,\n inputValue = _this$props12.inputValue,\n isLoading = _this$props12.isLoading,\n loadingMessage = _this$props12.loadingMessage,\n minMenuHeight = _this$props12.minMenuHeight,\n maxMenuHeight = _this$props12.maxMenuHeight,\n menuIsOpen = _this$props12.menuIsOpen,\n menuPlacement = _this$props12.menuPlacement,\n menuPosition = _this$props12.menuPosition,\n menuPortalTarget = _this$props12.menuPortalTarget,\n menuShouldBlockScroll = _this$props12.menuShouldBlockScroll,\n menuShouldScrollIntoView = _this$props12.menuShouldScrollIntoView,\n noOptionsMessage = _this$props12.noOptionsMessage,\n onMenuScrollToTop = _this$props12.onMenuScrollToTop,\n onMenuScrollToBottom = _this$props12.onMenuScrollToBottom;\n if (!menuIsOpen) return null; // TODO: Internal Option Type here\n\n var render = function render(props, id) {\n var type = props.type,\n data = props.data,\n isDisabled = props.isDisabled,\n isSelected = props.isSelected,\n label = props.label,\n value = props.value;\n var isFocused = focusedOption === data;\n var onHover = isDisabled ? undefined : function () {\n return _this4.onOptionHover(data);\n };\n var onSelect = isDisabled ? undefined : function () {\n return _this4.selectOption(data);\n };\n var optionId = \"\".concat(_this4.getElementId('option'), \"-\").concat(id);\n var innerProps = {\n id: optionId,\n onClick: onSelect,\n onMouseMove: onHover,\n onMouseOver: onHover,\n tabIndex: -1\n };\n return /*#__PURE__*/React.createElement(Option, _extends({}, commonProps, {\n innerProps: innerProps,\n data: data,\n isDisabled: isDisabled,\n isSelected: isSelected,\n key: optionId,\n label: label,\n type: type,\n value: value,\n isFocused: isFocused,\n innerRef: isFocused ? _this4.getFocusedOptionRef : undefined\n }), _this4.formatOptionLabel(props.data, 'menu'));\n };\n\n var menuUI;\n\n if (this.hasOptions()) {\n menuUI = this.getCategorizedOptions().map(function (item) {\n if (item.type === 'group') {\n var _data = item.data,\n options = item.options,\n groupIndex = item.index;\n var groupId = \"\".concat(_this4.getElementId('group'), \"-\").concat(groupIndex);\n var headingId = \"\".concat(groupId, \"-heading\");\n return /*#__PURE__*/React.createElement(Group, _extends({}, commonProps, {\n key: groupId,\n data: _data,\n options: options,\n Heading: GroupHeading,\n headingProps: {\n id: headingId,\n data: item.data\n },\n label: _this4.formatGroupLabel(item.data)\n }), item.options.map(function (option) {\n return render(option, \"\".concat(groupIndex, \"-\").concat(option.index));\n }));\n } else if (item.type === 'option') {\n return render(item, \"\".concat(item.index));\n }\n });\n } else if (isLoading) {\n var message = loadingMessage({\n inputValue: inputValue\n });\n if (message === null) return null;\n menuUI = /*#__PURE__*/React.createElement(LoadingMessage, commonProps, message);\n } else {\n var _message = noOptionsMessage({\n inputValue: inputValue\n });\n\n if (_message === null) return null;\n menuUI = /*#__PURE__*/React.createElement(NoOptionsMessage, commonProps, _message);\n }\n\n var menuPlacementProps = {\n minMenuHeight: minMenuHeight,\n maxMenuHeight: maxMenuHeight,\n menuPlacement: menuPlacement,\n menuPosition: menuPosition,\n menuShouldScrollIntoView: menuShouldScrollIntoView\n };\n var menuElement = /*#__PURE__*/React.createElement(MenuPlacer, _extends({}, commonProps, menuPlacementProps), function (_ref4) {\n var ref = _ref4.ref,\n _ref4$placerProps = _ref4.placerProps,\n placement = _ref4$placerProps.placement,\n maxHeight = _ref4$placerProps.maxHeight;\n return /*#__PURE__*/React.createElement(Menu, _extends({}, commonProps, menuPlacementProps, {\n innerRef: ref,\n innerProps: {\n onMouseDown: _this4.onMenuMouseDown,\n onMouseMove: _this4.onMenuMouseMove,\n id: _this4.getElementId('listbox')\n },\n isLoading: isLoading,\n placement: placement\n }), /*#__PURE__*/React.createElement(ScrollManager, {\n captureEnabled: captureMenuScroll,\n onTopArrive: onMenuScrollToTop,\n onBottomArrive: onMenuScrollToBottom,\n lockEnabled: menuShouldBlockScroll\n }, function (scrollTargetRef) {\n return /*#__PURE__*/React.createElement(MenuList, _extends({}, commonProps, {\n innerRef: function innerRef(instance) {\n _this4.getMenuListRef(instance);\n\n scrollTargetRef(instance);\n },\n isLoading: isLoading,\n maxHeight: maxHeight,\n focusedOption: focusedOption\n }), menuUI);\n }));\n }); // positioning behaviour is almost identical for portalled and fixed,\n // so we use the same component. the actual portalling logic is forked\n // within the component based on `menuPosition`\n\n return menuPortalTarget || menuPosition === 'fixed' ? /*#__PURE__*/React.createElement(MenuPortal, _extends({}, commonProps, {\n appendTo: menuPortalTarget,\n controlElement: this.controlRef,\n menuPlacement: menuPlacement,\n menuPosition: menuPosition\n }), menuElement) : menuElement;\n }\n }, {\n key: \"renderFormField\",\n value: function renderFormField() {\n var _this5 = this;\n\n var _this$props13 = this.props,\n delimiter = _this$props13.delimiter,\n isDisabled = _this$props13.isDisabled,\n isMulti = _this$props13.isMulti,\n name = _this$props13.name;\n var selectValue = this.state.selectValue;\n if (!name || isDisabled) return;\n\n if (isMulti) {\n if (delimiter) {\n var value = selectValue.map(function (opt) {\n return _this5.getOptionValue(opt);\n }).join(delimiter);\n return /*#__PURE__*/React.createElement(\"input\", {\n name: name,\n type: \"hidden\",\n value: value\n });\n } else {\n var input = selectValue.length > 0 ? selectValue.map(function (opt, i) {\n return /*#__PURE__*/React.createElement(\"input\", {\n key: \"i-\".concat(i),\n name: name,\n type: \"hidden\",\n value: _this5.getOptionValue(opt)\n });\n }) : /*#__PURE__*/React.createElement(\"input\", {\n name: name,\n type: \"hidden\"\n });\n return /*#__PURE__*/React.createElement(\"div\", null, input);\n }\n } else {\n var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : '';\n\n return /*#__PURE__*/React.createElement(\"input\", {\n name: name,\n type: \"hidden\",\n value: _value\n });\n }\n }\n }, {\n key: \"renderLiveRegion\",\n value: function renderLiveRegion() {\n var commonProps = this.commonProps;\n var _this$state6 = this.state,\n ariaSelection = _this$state6.ariaSelection,\n focusedOption = _this$state6.focusedOption,\n focusedValue = _this$state6.focusedValue,\n isFocused = _this$state6.isFocused,\n selectValue = _this$state6.selectValue;\n var focusableOptions = this.getFocusableOptions();\n return /*#__PURE__*/React.createElement(LiveRegion, _extends({}, commonProps, {\n id: this.getElementId('live-region'),\n ariaSelection: ariaSelection,\n focusedOption: focusedOption,\n focusedValue: focusedValue,\n isFocused: isFocused,\n selectValue: selectValue,\n focusableOptions: focusableOptions\n }));\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$getComponents8 = this.getComponents(),\n Control = _this$getComponents8.Control,\n IndicatorsContainer = _this$getComponents8.IndicatorsContainer,\n SelectContainer = _this$getComponents8.SelectContainer,\n ValueContainer = _this$getComponents8.ValueContainer;\n\n var _this$props14 = this.props,\n className = _this$props14.className,\n id = _this$props14.id,\n isDisabled = _this$props14.isDisabled,\n menuIsOpen = _this$props14.menuIsOpen;\n var isFocused = this.state.isFocused;\n var commonProps = this.commonProps = this.getCommonProps();\n return /*#__PURE__*/React.createElement(SelectContainer, _extends({}, commonProps, {\n className: className,\n innerProps: {\n id: id,\n onKeyDown: this.onKeyDown\n },\n isDisabled: isDisabled,\n isFocused: isFocused\n }), this.renderLiveRegion(), /*#__PURE__*/React.createElement(Control, _extends({}, commonProps, {\n innerRef: this.getControlRef,\n innerProps: {\n onMouseDown: this.onControlMouseDown,\n onTouchEnd: this.onControlTouchEnd\n },\n isDisabled: isDisabled,\n isFocused: isFocused,\n menuIsOpen: menuIsOpen\n }), /*#__PURE__*/React.createElement(ValueContainer, _extends({}, commonProps, {\n isDisabled: isDisabled\n }), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React.createElement(IndicatorsContainer, _extends({}, commonProps, {\n isDisabled: isDisabled\n }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(props, state) {\n var prevProps = state.prevProps,\n clearFocusValueOnUpdate = state.clearFocusValueOnUpdate,\n inputIsHiddenAfterUpdate = state.inputIsHiddenAfterUpdate,\n ariaSelection = state.ariaSelection,\n isFocused = state.isFocused,\n prevWasFocused = state.prevWasFocused;\n var options = props.options,\n value = props.value,\n menuIsOpen = props.menuIsOpen,\n inputValue = props.inputValue,\n isMulti = props.isMulti;\n var selectValue = cleanValue(value);\n var newMenuOptionsState = {};\n\n if (prevProps && (value !== prevProps.value || options !== prevProps.options || menuIsOpen !== prevProps.menuIsOpen || inputValue !== prevProps.inputValue)) {\n var focusableOptions = menuIsOpen ? buildFocusableOptions(props, selectValue) : [];\n var focusedValue = clearFocusValueOnUpdate ? getNextFocusedValue(state, selectValue) : null;\n var focusedOption = getNextFocusedOption(state, focusableOptions);\n newMenuOptionsState = {\n selectValue: selectValue,\n focusedOption: focusedOption,\n focusedValue: focusedValue,\n clearFocusValueOnUpdate: false\n };\n } // some updates should toggle the state of the input visibility\n\n\n var newInputIsHiddenState = inputIsHiddenAfterUpdate != null && props !== prevProps ? {\n inputIsHidden: inputIsHiddenAfterUpdate,\n inputIsHiddenAfterUpdate: undefined\n } : {};\n var newAriaSelection = ariaSelection;\n var hasKeptFocus = isFocused && prevWasFocused;\n\n if (isFocused && !hasKeptFocus) {\n // If `value` or `defaultValue` props are not empty then announce them\n // when the Select is initially focused\n newAriaSelection = {\n value: valueTernary(isMulti, selectValue, selectValue[0] || null),\n options: selectValue,\n action: 'initial-input-focus'\n };\n hasKeptFocus = !prevWasFocused;\n } // If the 'initial-input-focus' action has been set already\n // then reset the ariaSelection to null\n\n\n if ((ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus') {\n newAriaSelection = null;\n }\n\n return _objectSpread2(_objectSpread2(_objectSpread2({}, newMenuOptionsState), newInputIsHiddenState), {}, {\n prevProps: props,\n ariaSelection: newAriaSelection,\n prevWasFocused: hasKeptFocus\n });\n }\n }]);\n\n return Select;\n}(Component);\n\nSelect.defaultProps = defaultProps;\n\nexport { Select as S, getOptionLabel$1 as a, defaultProps as b, createFilter as c, defaultTheme as d, getOptionValue$1 as g, mergeStyles as m };\n","import { u as useStateManager } from './useStateManager-783b07d5.esm.js';\nexport { u as useStateManager } from './useStateManager-783b07d5.esm.js';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport * as React from 'react';\nimport { forwardRef, Component } from 'react';\nimport { S as Select } from './Select-126cf1dd.esm.js';\nexport { c as createFilter, d as defaultTheme, m as mergeStyles } from './Select-126cf1dd.esm.js';\nimport _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';\nimport _createClass from '@babel/runtime/helpers/esm/createClass';\nimport _inherits from '@babel/runtime/helpers/esm/inherits';\nimport { _ as _createSuper } from './index-c7a4d7ce.esm.js';\nexport { c as components } from './index-c7a4d7ce.esm.js';\nimport { CacheProvider } from '@emotion/react';\nimport createCache from '@emotion/cache';\nimport memoizeOne from 'memoize-one';\nimport '@babel/runtime/helpers/slicedToArray';\nimport '@babel/runtime/helpers/objectWithoutProperties';\nimport '@babel/runtime/helpers/toConsumableArray';\nimport '@babel/runtime/helpers/taggedTemplateLiteral';\nimport '@babel/runtime/helpers/typeof';\nimport '@babel/runtime/helpers/defineProperty';\nimport 'react-dom';\n\nvar StateManagedSelect = /*#__PURE__*/forwardRef(function (props, ref) {\n var baseSelectProps = useStateManager(props);\n return /*#__PURE__*/React.createElement(Select, _extends({\n ref: ref\n }, baseSelectProps));\n});\n\nvar NonceProvider = /*#__PURE__*/function (_Component) {\n _inherits(NonceProvider, _Component);\n\n var _super = _createSuper(NonceProvider);\n\n function NonceProvider(props) {\n var _this;\n\n _classCallCheck(this, NonceProvider);\n\n _this = _super.call(this, props);\n\n _this.createEmotionCache = function (nonce, key) {\n return createCache({\n nonce: nonce,\n key: key\n });\n };\n\n _this.createEmotionCache = memoizeOne(_this.createEmotionCache);\n return _this;\n }\n\n _createClass(NonceProvider, [{\n key: \"render\",\n value: function render() {\n var emotionCache = this.createEmotionCache(this.props.nonce, this.props.cacheKey);\n return /*#__PURE__*/React.createElement(CacheProvider, {\n value: emotionCache\n }, this.props.children);\n }\n }]);\n\n return NonceProvider;\n}(Component);\n\nexport default StateManagedSelect;\nexport { NonceProvider };\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nexport const ArrowIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n direction,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''} ${direction || ''}`;\n\n return (\n \n \n \n );\n};\n\nexport default ArrowIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst BabySeatIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} `;\n\n return (\n \n \n \n );\n};\n\nexport default BabySeatIcon;\n","import './icon.scss';\n\nimport React from 'react';\n\nimport { IconProps } from './icons';\n\nconst ChildSeatIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} `;\n\n return (\n \n \n \n \n \n );\n};\n\nexport default ChildSeatIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst BoosterSeatIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} `;\n\n return (\n \n \n \n );\n};\n\nexport default BoosterSeatIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst BriefcaseIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default BriefcaseIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst CalendarIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default CalendarIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst CalendarNewIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n\n );\n};\n\nexport default CalendarNewIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nexport const CameraIcon: React.FC = ({\n fill,\n width = 24,\n color,\n height,\n onClick,\n className,\n direction,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''} ${direction || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default CameraIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst CaretIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n direction = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} ${\n direction || ''\n }`;\n\n return (\n \n \n \n );\n};\n\nexport default CaretIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst CarIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n direction = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} ${direction}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default CarIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst CarRightIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n \n \n );\n};\n\nexport default CarRightIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst CheckIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n );\n};\n\nexport default CheckIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst CircleCheckIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default CircleCheckIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst CircleIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n );\n};\n\nexport default CircleIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst CirclePlusIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default CirclePlusIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst ClockIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n direction = 'left',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} ${direction || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default ClockIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst DangerIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default DangerIcon;\n","import React from 'react';\nimport { IconProps } from '../../types/icons';\nimport './icon.scss';\n\nconst EyeIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n\n \n );\n};\n\nexport default EyeIcon;\n","import React from 'react';\nimport { IconProps } from '../../types/icons';\nimport './icon.scss';\n\nconst HashtagIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n );\n};\n\nexport default HashtagIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst LocationIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default LocationIcon;\n","import React from 'react';\nimport { IconProps } from '../../types/icons';\nimport './icon.scss';\n\nconst MapIcon: React.FC = ({\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-stroke-color-${color} ${className}`;\n\n return (\n \n \n \n );\n};\n\nexport default MapIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst LogoutIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} `;\n\n return (\n \n \n \n );\n};\n\nexport default LogoutIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst LuggageIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} `;\n\n return (\n \n \n \n );\n};\n\nexport default LuggageIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst MeetAndGreetIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} `;\n\n return (\n \n \n \n );\n};\n\nexport default MeetAndGreetIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst MeetingPointIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} `;\n\n return (\n \n \n \n );\n};\n\nexport default MeetingPointIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst MinusPersonIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default MinusPersonIcon;\n","import React from 'react';\nimport { IconProps } from '../../types/icons';\nimport './icon.scss';\n\nconst NotesIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n \n \n \n );\n};\n\nexport default NotesIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst PenIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default PenIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst PersonIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default PersonIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst PetsIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} `;\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n\nexport default PetsIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst PhoneIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default PhoneIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst PhoneRingIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default PhoneRingIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nexport const PhotoIcon: React.FC = ({\n fill,\n width = 24,\n color,\n height,\n onClick,\n className,\n direction,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''} ${direction || ''}`;\n\n return (\n \n \n \n \n \n );\n};\n\nexport default PhotoIcon;\n","import React from 'react';\nimport './icon.scss';\n\nexport const PlaneIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n direction,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''} ${direction || ''}`;\n\n return (\n \n \n \n );\n};\n\nexport default PlaneIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst PlayIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default PlayIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst PlusPersonIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default PlusPersonIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nexport const PointOfInterestIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n direction,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''} ${direction || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default PointOfInterestIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst ProfileIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default ProfileIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst QuestionMarkIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default QuestionMarkIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nexport const SadFaceIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n direction,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''} ${direction || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default SadFaceIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nexport const SeaportIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n direction,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''} ${direction || ''}`;\n\n return (\n \n \n \n );\n};\n\nexport default SeaportIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst SearchIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n );\n};\n\nexport default SearchIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst SmsIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n );\n};\n\nexport default SmsIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst SortSizeIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n \n );\n};\n\nexport default SortSizeIcon;\n","import React from 'react';\nimport { IconProps } from '../../types/icons';\nimport './icon.scss';\n\nconst TimerIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n direction = 'left',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className} ${direction || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default TimerIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nexport const TrainIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n direction,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''} ${direction || ''}`;\n\n return (\n \n \n \n \n \n \n \n \n \n \n );\n};\n\nexport default TrainIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst TrashIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default TrashIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst WhatsAppIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''}`;\n\n return (\n \n \n \n );\n};\n\nexport default WhatsAppIcon;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst ShipIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className,\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className || ''}`;\n\n return (\n \n \n \n );\n};\n\nexport default ShipIcon;\n","import React, { FunctionComponent } from 'react';\nimport Select, {\n components,\n OptionProps,\n SingleValueProps,\n PlaceholderProps,\n StylesConfig,\n} from 'react-select';\nimport { DropdownProps, IData } from '../../types/dropdown';\nimport { CaretIcon, CheckIcon, XIcon } from '../icons';\nimport Typography from '../typography/Typography';\nimport './dropdown.scss';\n\n/**\n* CUSTOM STYLES\n*/\n\nconst defaultStyles: StylesConfig = {\n control: (css, state) => ({\n ...css,\n height: '48px',\n padding: '0',\n backgroundColor: '#fff',\n borderRadius: '8px',\n boxShadow: 'none',\n border: state.isDisabled ? '1px solid #dfe2e5' : '1px solid #AFB6BE',\n overflowX: 'hidden',\n }),\n indicatorsContainer: (css) => ({\n ...css,\n position: 'absolute',\n right: '0',\n border: 'none',\n top: '50%',\n transform: 'translateY(-50%)',\n height: '30px',\n backgroundColor: 'white',\n paddingRight: '21px',\n paddingLeft: '17px',\n }),\n container: (css) => ({\n ...css,\n position: 'relative',\n }),\n menu: (css) => ({\n ...css,\n width: '100%',\n marginTop: 8,\n zIndex: 5,\n minWidth: 270,\n backgroundColor: 'white',\n position: 'absolute',\n top: '56px',\n padding: '16px',\n // height: props.height,\n maxHeight: 300,\n boxShadow:\n '0px 2px 4px rgba(97, 97, 97, 0.18), 0px 4px 8px rgba(97, 97, 97, 0.18)',\n borderRadius: 12,\n }),\n menuList: (css) => ({\n ...css,\n maxHeight: 200,\n paddingTop: 0,\n borderTop: '2px solid white',\n paddingRight: '10px',\n '::-webkit-scrollbar': {\n width: '4px',\n height: '0px',\n },\n '::-webkit-scrollbar-track': {\n background: '#fff',\n },\n '::-webkit-scrollbar-thumb': {\n background: '#C4C4C4',\n borderRadius: '8px',\n },\n '::-webkit-scrollbar-thumb:hover': {\n background: '#555',\n },\n }),\n option: (css, state) => ({\n ...css,\n position: state.isMulti ? 'relative' : 'static',\n display: 'flex',\n alignItems: 'center',\n fontWeight: 600,\n fontSize: '16px',\n lineHeight: '24px',\n padding: '10px 0 10px 10px',\n color: '#38414a',\n backgroundColor: state.isSelected || state.isFocused ? '#ebf6f9' : '#fff',\n '&:hover': {\n borderRadius: '8px',\n },\n cursor: 'pointer',\n borderRadius: state.isFocused || state.isSelected ? '8px' : 'none',\n '.option-remove-button': {\n position: 'absolute',\n top: '50%',\n transform: 'translateY(-50%)',\n right: '8px',\n },\n marginBottom: '8px',\n }),\n placeholder: (css, state) => ({\n ...css,\n color: state.isDisabled ? '#dfe2e5' : '#7e8a96',\n }),\n multiValue: (css) => ({\n ...css,\n backgroundColor: 'transparent',\n '.css-xb97g8': {\n display: 'none',\n },\n }),\n valueContainer: (css, state) => ({\n ...css,\n fontFamily: 'Rubik, sans-serif',\n clear: 'both',\n display: (state.isMulti && state.hasValue) ? 'inline-block' : 'flex',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n }),\n};\n\n/**\n * CUSTOM DROPDOWN INDICATOR COMPONENT\n */\n\nconst DropdownIndicator: FunctionComponent = ({ selectProps }: any) => (\n
\n \n
\n);\n\nconst MultiValueContainer:FunctionComponent = ({ selectProps, data }: any) => {\n const values = selectProps.value;\n if (values) {\n return values[values.length - 1].label === data.label\n ? data.label\n : `${data.label}, `;\n } return '';\n};\n\n/**\n * CUSTOM OPTION COMPONENT (OPTIONS IN THE MENU LIST)\n */\n\nconst Option: FunctionComponent = (props) => {\n const data = props.data as IData;\n const isMulti = props.isMulti;\n const isSelected = props.isSelected;\n\n const renderIcon = () => {\n if (typeof data.icon === 'string') {\n return ;\n }\n return {data.icon};\n };\n\n return (\n \n
\n {data.icon && renderIcon()}\n {data.label}\n {isMulti && isSelected && (\n \n )}\n
\n
\n );\n};\n\n/**\n * CUSTOM SINGLE VALUE COMPONENT (CURRENT VALUE)\n */\n\nconst SingleValue: FunctionComponent = (props) => {\n const data = props.data as IData;\n\n const renderIcon = () => {\n if (typeof data.icon === 'string') {\n return ;\n }\n return {data.icon};\n };\n\n return (\n \n
\n {data.icon && renderIcon()}\n {data.label}\n
\n
\n );\n};\n\n/**\n * CUSTOM Placeholder COMPONENT\n */\n\nconst Placeholder: FunctionComponent = (props) => {\n const placeholder = props?.selectProps?.placeholder;\n return (\n \n
\n {placeholder}\n
\n
\n );\n};\n\n/**\n * DROPDOWN COMPONENT\n */\n\nconst Dropdown: FunctionComponent = ({\n data,\n value,\n onChange,\n onBlur,\n label,\n disabled,\n isSearchable = false,\n placeholder,\n className = '',\n confirmed = false,\n defaultValue,\n isMulti,\n styles,\n fullWidth,\n closeMenuOnSelect,\n}) => (\n
\n \n {label}\n \n\n option.value === value) || null })}\n placeholder={placeholder}\n styles={styles || defaultStyles}\n isDisabled={disabled}\n isSearchable={isSearchable}\n defaultValue={data.filter((option: any) => defaultValue === option.value)}\n autoFocus\n backspaceRemovesValue={false}\n hideSelectedOptions={false}\n isClearable={false}\n tabSelectsValue={false}\n menuPlacement=\"auto\"\n closeMenuOnSelect={closeMenuOnSelect}\n />\n\n {confirmed && (\n \n )}\n
\n);\n\nexport default Dropdown;\n","import React, {\n FunctionComponent, ReactElement,\n} from 'react';\nimport { StylesConfig } from 'react-select';\nimport { IData } from '../../types/dropdown';\nimport Divider from '../divider/Divider';\nimport Dropdown from '../dropdown/Dropdown';\nimport Typography from '../typography/Typography';\nimport './popUp.scss';\n\ntype PopUpItem = {\n label: string,\n icon: ReactElement,\n onClick: () => void,\n}\n\ntype PopUpProps = {\n isOpen: boolean,\n togglePopUp: () => void,\n items: PopUpItem[],\n top?: number,\n left?: number,\n className?: string\n itemClassName?: string,\n langSelect?: boolean,\n onLanguageChange?: (langValue: IData) => void;\n langOptions?: IData[],\n langValue?: string,\n langDefaultValue?: string,\n noOverlay?: boolean;\n}\n\nconst languageSelectStyles: StylesConfig = {\n control: (css) => ({\n ...css,\n height: '64px',\n padding: '0',\n backgroundColor: '#fff',\n boxShadow: 'none',\n border: 'none',\n borderBottom: '1px solid #dfe2e5',\n borderRadius: 'none',\n borderColor: '#dfe2e5s',\n '&:hover': {\n borderColor: '#dfe2e5s',\n },\n }),\n indicatorsContainer: (css) => ({\n ...css,\n order: 1,\n border: 'none',\n }),\n container: (css) => ({\n ...css,\n position: 'relative',\n }),\n menu: (css) => ({\n ...css,\n width: '100%',\n backgroundColor: 'white',\n maxHeight: 180,\n position: 'static',\n boxShadow: 'none',\n }),\n menuList: (css) => ({\n ...css,\n maxHeight: 180,\n paddingTop: 0,\n border: 'none',\n margin: '0',\n '::-webkit-scrollbar': {\n width: '4px',\n height: '0px',\n },\n '::-webkit-scrollbar-track': {\n background: '#fff',\n },\n '::-webkit-scrollbar-thumb': {\n background: '#C4C4C4',\n borderRadius: '8px',\n },\n '::-webkit-scrollbar-thumb:hover': {\n background: '#555',\n },\n }),\n option: (css, state) => ({\n ...css,\n display: 'flex',\n alignItems: 'center',\n fontSize: '16px',\n lineHeight: '24px',\n padding: '10px 0 10px 10px',\n color: '#38414a',\n backgroundColor: state.isFocused || state.isSelected ? '#e6f4f8' : '#fff',\n '&:hover': {\n borderRadius: '4px',\n },\n cursor: 'pointer',\n borderRadius: state.isSelected ? '8px' : 'none',\n 'span:nth-child(2)': {\n fontWeight: state.isSelected ? 600 : 400,\n },\n }),\n placeholder: (css, state) => ({\n ...css,\n color: state.isDisabled ? '#dfe2e5' : '#7e8a96',\n }),\n singleValue: (css) => ({\n ...css,\n '.icon-container': {\n marginLeft: '0px',\n },\n }),\n valueContainer: (css) => ({\n ...css,\n paddingLeft: '0px',\n }),\n};\n\nconst PopUp: FunctionComponent = ({\n isOpen,\n togglePopUp,\n items,\n top = 72,\n left = 16,\n className = '',\n itemClassName = '',\n langSelect,\n onLanguageChange,\n langOptions,\n langValue,\n langDefaultValue,\n noOverlay = false,\n}) => (\n <>\n
\n \n {items.map((item: PopUpItem) => (\n
\n {\n togglePopUp();\n item.onClick();\n }}\n className={`pop-up-list-item d-flex align-items-center p-v-19 pointer ${itemClassName}`}\n >\n {item.icon}\n {item.label}\n
\n \n
\n ))}\n {langSelect && (\n \n )}\n
\n \n);\n\nexport default PopUp;\n","import React, { ChangeEventHandler, FunctionComponent } from 'react';\nimport './imageUpload.scss';\nimport ProfileIcon from '../icons/ProfileIcon';\nimport Typography from '../typography/Typography';\n\ntype ImageUploadProps = {\n onChange: ChangeEventHandler;\n photo?: string;\n className?: string;\n title?: string;\n alt?: string;\n existingPhotoText?: string;\n newPhotoText?: string;\n}\n\nconst ImageUpload: FunctionComponent = ({\n onChange,\n photo = '',\n className = '',\n title = 'Your profile picture',\n alt = 'Driver',\n existingPhotoText = 'Change photo',\n newPhotoText = 'Upload a photo',\n}) => (\n
\n \n { title }\n \n
\n {photo ? (\n \n ) : (\n
\n \n
\n )}\n\n \n \n
\n
\n);\n\nexport default ImageUpload;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bigint: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/*!\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\tvar nativeCodeString = '[native code]';\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) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\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","export default function requiredArgs(required, args) {\n if (args.length < required) {\n throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n }\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isDate\n * @category Common Helpers\n * @summary Is the given value a date?\n *\n * @description\n * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.\n *\n * @param {*} value - the value to check\n * @returns {boolean} true if the given value is a date\n * @throws {TypeError} 1 arguments required\n *\n * @example\n * // For a valid date:\n * const result = isDate(new Date())\n * //=> true\n *\n * @example\n * // For an invalid date:\n * const result = isDate(new Date(NaN))\n * //=> true\n *\n * @example\n * // For some value:\n * const result = isDate('2014-02-31')\n * //=> false\n *\n * @example\n * // For an object:\n * const result = isDate({})\n * //=> false\n */\n\nexport default function isDate(value) {\n requiredArgs(1, arguments);\n return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @param {Date|Number} argument - the value to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\n\nexport default function toDate(argument) {\n requiredArgs(1, arguments);\n var argStr = Object.prototype.toString.call(argument); // Clone the date\n\n if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n } else if (typeof argument === 'number' || argStr === '[object Number]') {\n return new Date(argument);\n } else {\n if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(\"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments\"); // eslint-disable-next-line no-console\n\n console.warn(new Error().stack);\n }\n\n return new Date(NaN);\n }\n}","import isDate from \"../isDate/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {*} date - the date to check\n * @returns {Boolean} the date is valid\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // For the valid date:\n * const result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertable into a date:\n * const result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * const result = isValid(new Date(''))\n * //=> false\n */\n\nexport default function isValid(dirtyDate) {\n requiredArgs(1, arguments);\n\n if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {\n return false;\n }\n\n var date = toDate(dirtyDate);\n return !isNaN(Number(date));\n}","export default function toInteger(dirtyNumber) {\n if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n return NaN;\n }\n\n var number = Number(dirtyNumber);\n\n if (isNaN(number)) {\n return number;\n }\n\n return number < 0 ? Math.ceil(number) : Math.floor(number);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the milliseconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\n\nexport default function addMilliseconds(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var timestamp = toDate(dirtyDate).getTime();\n var amount = toInteger(dirtyAmount);\n return new Date(timestamp + amount);\n}","import addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name subMilliseconds\n * @category Millisecond Helpers\n * @summary Subtract the specified number of milliseconds from the given date.\n *\n * @description\n * Subtract the specified number of milliseconds from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the milliseconds subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:\n * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:29.250\n */\n\nexport default function subMilliseconds(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, -amount);\n}","import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_DAY = 86400000;\nexport default function getUTCDayOfYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var timestamp = date.getTime();\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n var startOfYearTimestamp = date.getTime();\n var difference = timestamp - startOfYearTimestamp;\n return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;\n}","import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function startOfUTCISOWeek(dirtyDate) {\n requiredArgs(1, arguments);\n var weekStartsOn = 1;\n var date = toDate(dirtyDate);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n}","import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nexport default function getUTCISOWeekYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getUTCFullYear();\n var fourthOfJanuaryOfNextYear = new Date(0);\n fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);\n var fourthOfJanuaryOfThisYear = new Date(0);\n fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}","import getUTCISOWeekYear from \"../getUTCISOWeekYear/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function startOfUTCISOWeekYear(dirtyDate) {\n requiredArgs(1, arguments);\n var year = getUTCISOWeekYear(dirtyDate);\n var fourthOfJanuary = new Date(0);\n fourthOfJanuary.setUTCFullYear(year, 0, 4);\n fourthOfJanuary.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCISOWeek(fourthOfJanuary);\n return date;\n}","import toDate from \"../../toDate/index.js\";\nimport startOfUTCISOWeek from \"../startOfUTCISOWeek/index.js\";\nimport startOfUTCISOWeekYear from \"../startOfUTCISOWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_WEEK = 604800000;\nexport default function getUTCISOWeek(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}","var defaultOptions = {};\nexport function getDefaultOptions() {\n return defaultOptions;\n}\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}","import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function startOfUTCWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n}","import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function getUTCWeekYear(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getUTCFullYear();\n var defaultOptions = getDefaultOptions();\n var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var firstWeekOfNextYear = new Date(0);\n firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);\n var firstWeekOfThisYear = new Date(0);\n firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}","import getUTCWeekYear from \"../getUTCWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function startOfUTCWeekYear(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);\n var year = getUTCWeekYear(dirtyDate, options);\n var firstWeek = new Date(0);\n firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCWeek(firstWeek, options);\n return date;\n}","import toDate from \"../../toDate/index.js\";\nimport startOfUTCWeek from \"../startOfUTCWeek/index.js\";\nimport startOfUTCWeekYear from \"../startOfUTCWeekYear/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nvar MILLISECONDS_IN_WEEK = 604800000;\nexport default function getUTCWeek(dirtyDate, options) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}","export default function addLeadingZeros(number, targetLength) {\n var sign = number < 0 ? '-' : '';\n var output = Math.abs(number).toString();\n\n while (output.length < targetLength) {\n output = '0' + output;\n }\n\n return sign + output;\n}","import addLeadingZeros from \"../../addLeadingZeros/index.js\";\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | |\n * | d | Day of month | D | |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | m | Minute | M | Month |\n * | s | Second | S | Fraction of second |\n * | y | Year (abs) | Y | |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n */\n\nvar formatters = {\n // Year\n y: function y(date, token) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)\n\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);\n },\n // Month\n M: function M(date, token) {\n var month = date.getUTCMonth();\n return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);\n },\n // Day of the month\n d: function d(date, token) {\n return addLeadingZeros(date.getUTCDate(), token.length);\n },\n // AM or PM\n a: function a(date, token) {\n var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';\n\n switch (token) {\n case 'a':\n case 'aa':\n return dayPeriodEnumValue.toUpperCase();\n\n case 'aaa':\n return dayPeriodEnumValue;\n\n case 'aaaaa':\n return dayPeriodEnumValue[0];\n\n case 'aaaa':\n default:\n return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';\n }\n },\n // Hour [1-12]\n h: function h(date, token) {\n return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);\n },\n // Hour [0-23]\n H: function H(date, token) {\n return addLeadingZeros(date.getUTCHours(), token.length);\n },\n // Minute\n m: function m(date, token) {\n return addLeadingZeros(date.getUTCMinutes(), token.length);\n },\n // Second\n s: function s(date, token) {\n return addLeadingZeros(date.getUTCSeconds(), token.length);\n },\n // Fraction of second\n S: function S(date, token) {\n var numberOfDigits = token.length;\n var milliseconds = date.getUTCMilliseconds();\n var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));\n return addLeadingZeros(fractionalSeconds, token.length);\n }\n};\nexport default formatters;","import getUTCDayOfYear from \"../../../_lib/getUTCDayOfYear/index.js\";\nimport getUTCISOWeek from \"../../../_lib/getUTCISOWeek/index.js\";\nimport getUTCISOWeekYear from \"../../../_lib/getUTCISOWeekYear/index.js\";\nimport getUTCWeek from \"../../../_lib/getUTCWeek/index.js\";\nimport getUTCWeekYear from \"../../../_lib/getUTCWeekYear/index.js\";\nimport addLeadingZeros from \"../../addLeadingZeros/index.js\";\nimport lightFormatters from \"../lightFormatters/index.js\";\nvar dayPeriodEnum = {\n am: 'am',\n pm: 'pm',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n};\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\nvar formatters = {\n // Era\n G: function G(date, token, localize) {\n var era = date.getUTCFullYear() > 0 ? 1 : 0;\n\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return localize.era(era, {\n width: 'abbreviated'\n });\n // A, B\n\n case 'GGGGG':\n return localize.era(era, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n\n case 'GGGG':\n default:\n return localize.era(era, {\n width: 'wide'\n });\n }\n },\n // Year\n y: function y(date, token, localize) {\n // Ordinal number\n if (token === 'yo') {\n var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)\n\n var year = signedYear > 0 ? signedYear : 1 - signedYear;\n return localize.ordinalNumber(year, {\n unit: 'year'\n });\n }\n\n return lightFormatters.y(date, token);\n },\n // Local week-numbering year\n Y: function Y(date, token, localize, options) {\n var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)\n\n var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year\n\n if (token === 'YY') {\n var twoDigitYear = weekYear % 100;\n return addLeadingZeros(twoDigitYear, 2);\n } // Ordinal number\n\n\n if (token === 'Yo') {\n return localize.ordinalNumber(weekYear, {\n unit: 'year'\n });\n } // Padding\n\n\n return addLeadingZeros(weekYear, token.length);\n },\n // ISO week-numbering year\n R: function R(date, token) {\n var isoWeekYear = getUTCISOWeekYear(date); // Padding\n\n return addLeadingZeros(isoWeekYear, token.length);\n },\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function u(date, token) {\n var year = date.getUTCFullYear();\n return addLeadingZeros(year, token.length);\n },\n // Quarter\n Q: function Q(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n return String(quarter);\n // 01, 02, 03, 04\n\n case 'QQ':\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n\n case 'Qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'QQQ':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'QQQQQ':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'QQQQ':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone quarter\n q: function q(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n return String(quarter);\n // 01, 02, 03, 04\n\n case 'qq':\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n\n case 'qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'qqq':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'qqqqq':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'qqqq':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Month\n M: function M(date, token, localize) {\n var month = date.getUTCMonth();\n\n switch (token) {\n case 'M':\n case 'MM':\n return lightFormatters.M(date, token);\n // 1st, 2nd, ..., 12th\n\n case 'Mo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n\n case 'MMM':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // J, F, ..., D\n\n case 'MMMMM':\n return localize.month(month, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n\n case 'MMMM':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone month\n L: function L(date, token, localize) {\n var month = date.getUTCMonth();\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return String(month + 1);\n // 01, 02, ..., 12\n\n case 'LL':\n return addLeadingZeros(month + 1, 2);\n // 1st, 2nd, ..., 12th\n\n case 'Lo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n\n case 'LLL':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // J, F, ..., D\n\n case 'LLLLL':\n return localize.month(month, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n\n case 'LLLL':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Local week of year\n w: function w(date, token, localize, options) {\n var week = getUTCWeek(date, options);\n\n if (token === 'wo') {\n return localize.ordinalNumber(week, {\n unit: 'week'\n });\n }\n\n return addLeadingZeros(week, token.length);\n },\n // ISO week of year\n I: function I(date, token, localize) {\n var isoWeek = getUTCISOWeek(date);\n\n if (token === 'Io') {\n return localize.ordinalNumber(isoWeek, {\n unit: 'week'\n });\n }\n\n return addLeadingZeros(isoWeek, token.length);\n },\n // Day of the month\n d: function d(date, token, localize) {\n if (token === 'do') {\n return localize.ordinalNumber(date.getUTCDate(), {\n unit: 'date'\n });\n }\n\n return lightFormatters.d(date, token);\n },\n // Day of year\n D: function D(date, token, localize) {\n var dayOfYear = getUTCDayOfYear(date);\n\n if (token === 'Do') {\n return localize.ordinalNumber(dayOfYear, {\n unit: 'dayOfYear'\n });\n }\n\n return addLeadingZeros(dayOfYear, token.length);\n },\n // Day of week\n E: function E(date, token, localize) {\n var dayOfWeek = date.getUTCDay();\n\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'EEEEE':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'EEEEEE':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'EEEE':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Local day of week\n e: function e(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case 'e':\n return String(localDayOfWeek);\n // Padded numerical value\n\n case 'ee':\n return addLeadingZeros(localDayOfWeek, 2);\n // 1st, 2nd, ..., 7th\n\n case 'eo':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n\n case 'eee':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'eeeee':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'eeeeee':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'eeee':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone local day of week\n c: function c(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n\n switch (token) {\n // Numerical value (same as in `e`)\n case 'c':\n return String(localDayOfWeek);\n // Padded numerical value\n\n case 'cc':\n return addLeadingZeros(localDayOfWeek, token.length);\n // 1st, 2nd, ..., 7th\n\n case 'co':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n\n case 'ccc':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // T\n\n case 'ccccc':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n\n case 'cccccc':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'standalone'\n });\n // Tuesday\n\n case 'cccc':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // ISO day of week\n i: function i(date, token, localize) {\n var dayOfWeek = date.getUTCDay();\n var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n\n switch (token) {\n // 2\n case 'i':\n return String(isoDayOfWeek);\n // 02\n\n case 'ii':\n return addLeadingZeros(isoDayOfWeek, token.length);\n // 2nd\n\n case 'io':\n return localize.ordinalNumber(isoDayOfWeek, {\n unit: 'day'\n });\n // Tue\n\n case 'iii':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'iiiii':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'iiiiii':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'iiii':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM or PM\n a: function a(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n\n switch (token) {\n case 'a':\n case 'aa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'aaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n }).toLowerCase();\n\n case 'aaaaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaa':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM, PM, midnight, noon\n b: function b(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n }\n\n switch (token) {\n case 'b':\n case 'bb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'bbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n }).toLowerCase();\n\n case 'bbbbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbb':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // in the morning, in the afternoon, in the evening, at night\n B: function B(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'BBBBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBB':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Hour [1-12]\n h: function h(date, token, localize) {\n if (token === 'ho') {\n var hours = date.getUTCHours() % 12;\n if (hours === 0) hours = 12;\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return lightFormatters.h(date, token);\n },\n // Hour [0-23]\n H: function H(date, token, localize) {\n if (token === 'Ho') {\n return localize.ordinalNumber(date.getUTCHours(), {\n unit: 'hour'\n });\n }\n\n return lightFormatters.H(date, token);\n },\n // Hour [0-11]\n K: function K(date, token, localize) {\n var hours = date.getUTCHours() % 12;\n\n if (token === 'Ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n // Hour [1-24]\n k: function k(date, token, localize) {\n var hours = date.getUTCHours();\n if (hours === 0) hours = 24;\n\n if (token === 'ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n // Minute\n m: function m(date, token, localize) {\n if (token === 'mo') {\n return localize.ordinalNumber(date.getUTCMinutes(), {\n unit: 'minute'\n });\n }\n\n return lightFormatters.m(date, token);\n },\n // Second\n s: function s(date, token, localize) {\n if (token === 'so') {\n return localize.ordinalNumber(date.getUTCSeconds(), {\n unit: 'second'\n });\n }\n\n return lightFormatters.s(date, token);\n },\n // Fraction of second\n S: function S(date, token) {\n return lightFormatters.S(date, token);\n },\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function X(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n if (timezoneOffset === 0) {\n return 'Z';\n }\n\n switch (token) {\n // Hours and optional minutes\n case 'X':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n\n case 'XXXX':\n case 'XX':\n // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n\n case 'XXXXX':\n case 'XXX': // Hours and minutes with `:` delimiter\n\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function x(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Hours and optional minutes\n case 'x':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n\n case 'xxxx':\n case 'xx':\n // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n\n case 'xxxxx':\n case 'xxx': // Hours and minutes with `:` delimiter\n\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (GMT)\n O: function O(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Short\n case 'O':\n case 'OO':\n case 'OOO':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n\n case 'OOOO':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (specific non-location)\n z: function z(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Short\n case 'z':\n case 'zz':\n case 'zzz':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n\n case 'zzzz':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Seconds timestamp\n t: function t(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = Math.floor(originalDate.getTime() / 1000);\n return addLeadingZeros(timestamp, token.length);\n },\n // Milliseconds timestamp\n T: function T(date, token, _localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = originalDate.getTime();\n return addLeadingZeros(timestamp, token.length);\n }\n};\n\nfunction formatTimezoneShort(offset, dirtyDelimiter) {\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = Math.floor(absOffset / 60);\n var minutes = absOffset % 60;\n\n if (minutes === 0) {\n return sign + String(hours);\n }\n\n var delimiter = dirtyDelimiter || '';\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);\n}\n\nfunction formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {\n if (offset % 60 === 0) {\n var sign = offset > 0 ? '-' : '+';\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n\n return formatTimezone(offset, dirtyDelimiter);\n}\n\nfunction formatTimezone(offset, dirtyDelimiter) {\n var delimiter = dirtyDelimiter || '';\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);\n var minutes = addLeadingZeros(absOffset % 60, 2);\n return sign + hours + delimiter + minutes;\n}\n\nexport default formatters;","var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'P':\n return formatLong.date({\n width: 'short'\n });\n\n case 'PP':\n return formatLong.date({\n width: 'medium'\n });\n\n case 'PPP':\n return formatLong.date({\n width: 'long'\n });\n\n case 'PPPP':\n default:\n return formatLong.date({\n width: 'full'\n });\n }\n};\n\nvar timeLongFormatter = function timeLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'p':\n return formatLong.time({\n width: 'short'\n });\n\n case 'pp':\n return formatLong.time({\n width: 'medium'\n });\n\n case 'ppp':\n return formatLong.time({\n width: 'long'\n });\n\n case 'pppp':\n default:\n return formatLong.time({\n width: 'full'\n });\n }\n};\n\nvar dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {\n var matchResult = pattern.match(/(P+)(p+)?/) || [];\n var datePattern = matchResult[1];\n var timePattern = matchResult[2];\n\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong);\n }\n\n var dateTimeFormat;\n\n switch (datePattern) {\n case 'P':\n dateTimeFormat = formatLong.dateTime({\n width: 'short'\n });\n break;\n\n case 'PP':\n dateTimeFormat = formatLong.dateTime({\n width: 'medium'\n });\n break;\n\n case 'PPP':\n dateTimeFormat = formatLong.dateTime({\n width: 'long'\n });\n break;\n\n case 'PPPP':\n default:\n dateTimeFormat = formatLong.dateTime({\n width: 'full'\n });\n break;\n }\n\n return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));\n};\n\nvar longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter\n};\nexport default longFormatters;","/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport default function getTimezoneOffsetInMilliseconds(date) {\n var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));\n utcDate.setUTCFullYear(date.getFullYear());\n return date.getTime() - utcDate.getTime();\n}","var protectedDayOfYearTokens = ['D', 'DD'];\nvar protectedWeekYearTokens = ['YY', 'YYYY'];\nexport function isProtectedDayOfYearToken(token) {\n return protectedDayOfYearTokens.indexOf(token) !== -1;\n}\nexport function isProtectedWeekYearToken(token) {\n return protectedWeekYearTokens.indexOf(token) !== -1;\n}\nexport function throwProtectedError(token, format, input) {\n if (token === 'YYYY') {\n throw new RangeError(\"Use `yyyy` instead of `YYYY` (in `\".concat(format, \"`) for formatting years to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'YY') {\n throw new RangeError(\"Use `yy` instead of `YY` (in `\".concat(format, \"`) for formatting years to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'D') {\n throw new RangeError(\"Use `d` instead of `D` (in `\".concat(format, \"`) for formatting days of the month to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n } else if (token === 'DD') {\n throw new RangeError(\"Use `dd` instead of `DD` (in `\".concat(format, \"`) for formatting days of the month to the input `\").concat(input, \"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\"));\n }\n}","var formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'less than a second',\n other: 'less than {{count}} seconds'\n },\n xSeconds: {\n one: '1 second',\n other: '{{count}} seconds'\n },\n halfAMinute: 'half a minute',\n lessThanXMinutes: {\n one: 'less than a minute',\n other: 'less than {{count}} minutes'\n },\n xMinutes: {\n one: '1 minute',\n other: '{{count}} minutes'\n },\n aboutXHours: {\n one: 'about 1 hour',\n other: 'about {{count}} hours'\n },\n xHours: {\n one: '1 hour',\n other: '{{count}} hours'\n },\n xDays: {\n one: '1 day',\n other: '{{count}} days'\n },\n aboutXWeeks: {\n one: 'about 1 week',\n other: 'about {{count}} weeks'\n },\n xWeeks: {\n one: '1 week',\n other: '{{count}} weeks'\n },\n aboutXMonths: {\n one: 'about 1 month',\n other: 'about {{count}} months'\n },\n xMonths: {\n one: '1 month',\n other: '{{count}} months'\n },\n aboutXYears: {\n one: 'about 1 year',\n other: 'about {{count}} years'\n },\n xYears: {\n one: '1 year',\n other: '{{count}} years'\n },\n overXYears: {\n one: 'over 1 year',\n other: 'over {{count}} years'\n },\n almostXYears: {\n one: 'almost 1 year',\n other: 'almost {{count}} years'\n }\n};\n\nvar formatDistance = function formatDistance(token, count, options) {\n var result;\n var tokenValue = formatDistanceLocale[token];\n\n if (typeof tokenValue === 'string') {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace('{{count}}', count.toString());\n }\n\n if (options !== null && options !== void 0 && options.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return 'in ' + result;\n } else {\n return result + ' ago';\n }\n }\n\n return result;\n};\n\nexport default formatDistance;","export default function buildFormatLongFn(args) {\n return function () {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n // TODO: Remove String()\n var width = options.width ? String(options.width) : args.defaultWidth;\n var format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}","import buildFormatLongFn from \"../../../_lib/buildFormatLongFn/index.js\";\nvar dateFormats = {\n full: 'EEEE, MMMM do, y',\n long: 'MMMM do, y',\n medium: 'MMM d, y',\n short: 'MM/dd/yyyy'\n};\nvar timeFormats = {\n full: 'h:mm:ss a zzzz',\n long: 'h:mm:ss a z',\n medium: 'h:mm:ss a',\n short: 'h:mm a'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nexport default formatLong;","var formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: 'P'\n};\n\nvar formatRelative = function formatRelative(token, _date, _baseDate, _options) {\n return formatRelativeLocale[token];\n};\n\nexport default formatRelative;","export default function buildLocalizeFn(args) {\n return function (dirtyIndex, options) {\n var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';\n var valuesArray;\n\n if (context === 'formatting' && args.formattingValues) {\n var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;\n var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;\n valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];\n } else {\n var _defaultWidth = args.defaultWidth;\n\n var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;\n\n valuesArray = args.values[_width] || args.values[_defaultWidth];\n }\n\n var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!\n\n return valuesArray[index];\n };\n}","import buildLocalizeFn from \"../../../_lib/buildLocalizeFn/index.js\";\nvar eraValues = {\n narrow: ['B', 'A'],\n abbreviated: ['BC', 'AD'],\n wide: ['Before Christ', 'Anno Domini']\n};\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],\n wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']\n}; // Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\n\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n};\nvar dayValues = {\n narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']\n};\nvar dayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n }\n};\n\nvar ordinalNumber = function ordinalNumber(dirtyNumber, _options) {\n var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`.\n //\n // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'.\n\n var rem100 = number % 100;\n\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + 'st';\n\n case 2:\n return number + 'nd';\n\n case 3:\n return number + 'rd';\n }\n }\n\n return number + 'th';\n};\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return quarter - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: 'wide'\n })\n};\nexport default localize;","export default function buildMatchFn(args) {\n return function (string) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var width = options.width;\n var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];\n var matchResult = string.match(matchPattern);\n\n if (!matchResult) {\n return null;\n }\n\n var matchedString = matchResult[0];\n var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];\n var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {\n return pattern.test(matchedString);\n }) : findKey(parsePatterns, function (pattern) {\n return pattern.test(matchedString);\n });\n var value;\n value = args.valueCallback ? args.valueCallback(key) : key;\n value = options.valueCallback ? options.valueCallback(value) : value;\n var rest = string.slice(matchedString.length);\n return {\n value: value,\n rest: rest\n };\n };\n}\n\nfunction findKey(object, predicate) {\n for (var key in object) {\n if (object.hasOwnProperty(key) && predicate(object[key])) {\n return key;\n }\n }\n\n return undefined;\n}\n\nfunction findIndex(array, predicate) {\n for (var key = 0; key < array.length; key++) {\n if (predicate(array[key])) {\n return key;\n }\n }\n\n return undefined;\n}","export default function buildMatchPatternFn(args) {\n return function (string) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var matchResult = string.match(args.matchPattern);\n if (!matchResult) return null;\n var matchedString = matchResult[0];\n var parseResult = string.match(args.parsePattern);\n if (!parseResult) return null;\n var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];\n value = options.valueCallback ? options.valueCallback(value) : value;\n var rest = string.slice(matchedString.length);\n return {\n value: value,\n rest: rest\n };\n };\n}","import buildMatchFn from \"../../../_lib/buildMatchFn/index.js\";\nimport buildMatchPatternFn from \"../../../_lib/buildMatchPatternFn/index.js\";\nvar matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i\n};\nvar parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\nvar matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i\n};\nvar parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value, 10);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\nexport default match;","import formatDistance from \"./_lib/formatDistance/index.js\";\nimport formatLong from \"./_lib/formatLong/index.js\";\nimport formatRelative from \"./_lib/formatRelative/index.js\";\nimport localize from \"./_lib/localize/index.js\";\nimport match from \"./_lib/match/index.js\";\n\n/**\n * @type {Locale}\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}\n * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}\n */\nvar locale = {\n code: 'en-US',\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0\n /* Sunday */\n ,\n firstWeekContainsDate: 1\n }\n};\nexport default locale;","import isValid from \"../isValid/index.js\";\nimport subMilliseconds from \"../subMilliseconds/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport formatters from \"../_lib/format/formatters/index.js\";\nimport longFormatters from \"../_lib/format/longFormatters/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport { isProtectedDayOfYearToken, isProtectedWeekYearToken, throwProtectedError } from \"../_lib/protectedTokens/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\nimport defaultLocale from \"../_lib/defaultLocale/index.js\"; // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\n\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\n\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'([^]*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\nvar unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n/**\n * @name format\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}\n * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param {Date|Number} date - the original date\n * @param {String} format - the string of tokens\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @returns {String} the formatted date string\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\n\nexport default function format(dirtyDate, dirtyFormatStr, options) {\n var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;\n\n requiredArgs(2, arguments);\n var formatStr = String(dirtyFormatStr);\n var defaultOptions = getDefaultOptions();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;\n var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n if (!locale.localize) {\n throw new RangeError('locale must contain localize property');\n }\n\n if (!locale.formatLong) {\n throw new RangeError('locale must contain formatLong property');\n }\n\n var originalDate = toDate(dirtyDate);\n\n if (!isValid(originalDate)) {\n throw new RangeError('Invalid time value');\n } // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376\n\n\n var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);\n var utcDate = subMilliseconds(originalDate, timezoneOffset);\n var formatterOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale,\n _originalDate: originalDate\n };\n var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n\n if (firstCharacter === 'p' || firstCharacter === 'P') {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n\n return substring;\n }).join('').match(formattingTokensRegExp).map(function (substring) {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return \"'\";\n }\n\n var firstCharacter = substring[0];\n\n if (firstCharacter === \"'\") {\n return cleanEscapedString(substring);\n }\n\n var formatter = formatters[firstCharacter];\n\n if (formatter) {\n if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {\n throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));\n }\n\n if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {\n throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));\n }\n\n return formatter(utcDate, substring, locale.localize, formatterOptions);\n }\n\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');\n }\n\n return substring;\n }).join('');\n return result;\n}\n\nfunction cleanEscapedString(input) {\n var matched = input.match(escapedStringRegExp);\n\n if (!matched) {\n return input;\n }\n\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_MINUTE = 60000;\n/**\n * @name addMinutes\n * @category Minute Helpers\n * @summary Add the specified number of minutes to the given date.\n *\n * @description\n * Add the specified number of minutes to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of minutes to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the minutes added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 30 minutes to 10 July 2014 12:00:00:\n * const result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)\n * //=> Thu Jul 10 2014 12:30:00\n */\n\nexport default function addMinutes(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_MINUTE);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_HOUR = 3600000;\n/**\n * @name addHours\n * @category Hour Helpers\n * @summary Add the specified number of hours to the given date.\n *\n * @description\n * Add the specified number of hours to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of hours to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the hours added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 2 hours to 10 July 2014 23:00:00:\n * const result = addHours(new Date(2014, 6, 10, 23, 0), 2)\n * //=> Fri Jul 11 2014 01:00:00\n */\n\nexport default function addHours(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_HOUR);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} - the new date with the days added\n * @throws {TypeError} - 2 arguments required\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\n\nexport default function addDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n\n if (!amount) {\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n\n date.setDate(date.getDate() + amount);\n return date;\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addDays from \"../addDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addWeeks\n * @category Week Helpers\n * @summary Add the specified number of weeks to the given date.\n *\n * @description\n * Add the specified number of week to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the weeks added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 4 weeks to 1 September 2014:\n * const result = addWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Sep 29 2014 00:00:00\n */\n\nexport default function addWeeks(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n var days = amount * 7;\n return addDays(dirtyDate, days);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the months added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * const result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n */\n\nexport default function addMonths(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n\n if (!amount) {\n // If 0 months, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n\n var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for\n // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and\n // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we\n // want except that dates will wrap around the end of a month, meaning that\n // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So\n // we'll default to the end of the desired month by adding 1 to the desired\n // month and using a date of 0 to back up one day to the end of the desired\n // month.\n\n var endOfDesiredMonth = new Date(date.getTime());\n endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);\n var daysInMonth = endOfDesiredMonth.getDate();\n\n if (dayOfMonth >= daysInMonth) {\n // If we're already at the end of the month, then this is the correct date\n // and we're done.\n return endOfDesiredMonth;\n } else {\n // Otherwise, we now know that setting the original day-of-month value won't\n // cause an overflow, so set the desired day-of-month. Note that we can't\n // just set the date of `endOfDesiredMonth` because that object may have had\n // its time changed in the unusual case where where a DST transition was on\n // the last day of the month and its local time was in the hour skipped or\n // repeated next to a DST transition. So we use `date` instead which is\n // guaranteed to still have the original time.\n date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);\n return date;\n }\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addQuarters\n * @category Quarter Helpers\n * @summary Add the specified number of year quarters to the given date.\n *\n * @description\n * Add the specified number of year quarters to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of quarters to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the quarters added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 1 quarter to 1 September 2014:\n * const result = addQuarters(new Date(2014, 8, 1), 1)\n * //=> Mon Dec 01 2014 00:00:00\n */\n\nexport default function addQuarters(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n var months = amount * 3;\n return addMonths(dirtyDate, months);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addYears\n * @category Year Helpers\n * @summary Add the specified number of years to the given date.\n *\n * @description\n * Add the specified number of years to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of years to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the years added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 years to 1 September 2014:\n * const result = addYears(new Date(2014, 8, 1), 5)\n * //=> Sun Sep 01 2019 00:00:00\n */\n\nexport default function addYears(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMonths(dirtyDate, amount * 12);\n}","import addDays from \"../addDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name subDays\n * @category Day Helpers\n * @summary Subtract the specified number of days from the given date.\n *\n * @description\n * Subtract the specified number of days from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the days subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 10 days from 1 September 2014:\n * const result = subDays(new Date(2014, 8, 1), 10)\n * //=> Fri Aug 22 2014 00:00:00\n */\n\nexport default function subDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addDays(dirtyDate, -amount);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addWeeks from \"../addWeeks/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name subWeeks\n * @category Week Helpers\n * @summary Subtract the specified number of weeks from the given date.\n *\n * @description\n * Subtract the specified number of weeks from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of weeks to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the weeks subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 4 weeks from 1 September 2014:\n * const result = subWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Aug 04 2014 00:00:00\n */\n\nexport default function subWeeks(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addWeeks(dirtyDate, -amount);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the months subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * const result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function subMonths(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMonths(dirtyDate, -amount);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addQuarters from \"../addQuarters/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name subQuarters\n * @category Quarter Helpers\n * @summary Subtract the specified number of year quarters from the given date.\n *\n * @description\n * Subtract the specified number of year quarters from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of quarters to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the quarters subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 3 quarters from 1 September 2014:\n * const result = subQuarters(new Date(2014, 8, 1), 3)\n * //=> Sun Dec 01 2013 00:00:00\n */\n\nexport default function subQuarters(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addQuarters(dirtyDate, -amount);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addYears from \"../addYears/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name subYears\n * @category Year Helpers\n * @summary Subtract the specified number of years from the given date.\n *\n * @description\n * Subtract the specified number of years from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of years to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the years subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 5 years from 1 September 2014:\n * const result = subYears(new Date(2014, 8, 1), 5)\n * //=> Tue Sep 01 2009 00:00:00\n */\n\nexport default function subYears(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addYears(dirtyDate, -amount);\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getSeconds\n * @category Second Helpers\n * @summary Get the seconds of the given date.\n *\n * @description\n * Get the seconds of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the seconds\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the seconds of 29 February 2012 11:45:05.123:\n * const result = getSeconds(new Date(2012, 1, 29, 11, 45, 5, 123))\n * //=> 5\n */\n\nexport default function getSeconds(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var seconds = date.getSeconds();\n return seconds;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getMinutes\n * @category Minute Helpers\n * @summary Get the minutes of the given date.\n *\n * @description\n * Get the minutes of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the minutes\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the minutes of 29 February 2012 11:45:05:\n * const result = getMinutes(new Date(2012, 1, 29, 11, 45, 5))\n * //=> 45\n */\n\nexport default function getMinutes(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var minutes = date.getMinutes();\n return minutes;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getHours\n * @category Hour Helpers\n * @summary Get the hours of the given date.\n *\n * @description\n * Get the hours of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the hours\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the hours of 29 February 2012 11:45:00:\n * const result = getHours(new Date(2012, 1, 29, 11, 45))\n * //=> 11\n */\n\nexport default function getHours(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var hours = date.getHours();\n return hours;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getDay\n * @category Weekday Helpers\n * @summary Get the day of the week of the given date.\n *\n * @description\n * Get the day of the week of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {0|1|2|3|4|5|6} the day of week, 0 represents Sunday\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which day of the week is 29 February 2012?\n * const result = getDay(new Date(2012, 1, 29))\n * //=> 3\n */\n\nexport default function getDay(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var day = date.getDay();\n return day;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getDate\n * @category Day Helpers\n * @summary Get the day of the month of the given date.\n *\n * @description\n * Get the day of the month of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the day of month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which day of the month is 29 February 2012?\n * const result = getDate(new Date(2012, 1, 29))\n * //=> 29\n */\n\nexport default function getDate(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var dayOfMonth = date.getDate();\n return dayOfMonth;\n}","import toDate from \"../toDate/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\";\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @returns {Date} the start of a week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function startOfWeek(dirtyDate, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(1, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = date.getDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setDate(date.getDate() - diff);\n date.setHours(0, 0, 0, 0);\n return date;\n}","import startOfWeek from \"../startOfWeek/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfISOWeek\n * @category ISO Week Helpers\n * @summary Return the start of an ISO week for the given date.\n *\n * @description\n * Return the start of an ISO week for the given date.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of an ISO week\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of an ISO week for 2 September 2014 11:55:00:\n * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function startOfISOWeek(dirtyDate) {\n requiredArgs(1, arguments);\n return startOfWeek(dirtyDate, {\n weekStartsOn: 1\n });\n}","import toDate from \"../toDate/index.js\";\nimport startOfISOWeek from \"../startOfISOWeek/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Get the ISO week-numbering year of the given date.\n *\n * @description\n * Get the ISO week-numbering year of the given date,\n * which always starts 3 days before the year's first Thursday.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the ISO week-numbering year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which ISO-week numbering year is 2 January 2005?\n * const result = getISOWeekYear(new Date(2005, 0, 2))\n * //=> 2004\n */\n\nexport default function getISOWeekYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getFullYear();\n var fourthOfJanuaryOfNextYear = new Date(0);\n fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);\n var startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);\n var fourthOfJanuaryOfThisYear = new Date(0);\n fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);\n var startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}","import getISOWeekYear from \"../getISOWeekYear/index.js\";\nimport startOfISOWeek from \"../startOfISOWeek/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Return the start of an ISO week-numbering year for the given date.\n *\n * @description\n * Return the start of an ISO week-numbering year,\n * which always starts 3 days before the year's first Thursday.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of an ISO week-numbering year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of an ISO week-numbering year for 2 July 2005:\n * const result = startOfISOWeekYear(new Date(2005, 6, 2))\n * //=> Mon Jan 03 2005 00:00:00\n */\n\nexport default function startOfISOWeekYear(dirtyDate) {\n requiredArgs(1, arguments);\n var year = getISOWeekYear(dirtyDate);\n var fourthOfJanuary = new Date(0);\n fourthOfJanuary.setFullYear(year, 0, 4);\n fourthOfJanuary.setHours(0, 0, 0, 0);\n var date = startOfISOWeek(fourthOfJanuary);\n return date;\n}","import toDate from \"../toDate/index.js\";\nimport startOfISOWeek from \"../startOfISOWeek/index.js\";\nimport startOfISOWeekYear from \"../startOfISOWeekYear/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_WEEK = 604800000;\n/**\n * @name getISOWeek\n * @category ISO Week Helpers\n * @summary Get the ISO week of the given date.\n *\n * @description\n * Get the ISO week of the given date.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the ISO week\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which week of the ISO-week numbering year is 2 January 2005?\n * const result = getISOWeek(new Date(2005, 0, 2))\n * //=> 53\n */\n\nexport default function getISOWeek(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var diff = startOfISOWeek(date).getTime() - startOfISOWeekYear(date).getTime(); // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getMonth\n * @category Month Helpers\n * @summary Get the month of the given date.\n *\n * @description\n * Get the month of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which month is 29 February 2012?\n * const result = getMonth(new Date(2012, 1, 29))\n * //=> 1\n */\n\nexport default function getMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var month = date.getMonth();\n return month;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getQuarter\n * @category Quarter Helpers\n * @summary Get the year quarter of the given date.\n *\n * @description\n * Get the year quarter of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the quarter\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which quarter is 2 July 2014?\n * const result = getQuarter(new Date(2014, 6, 2))\n * //=> 3\n */\n\nexport default function getQuarter(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var quarter = Math.floor(date.getMonth() / 3) + 1;\n return quarter;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getYear\n * @category Year Helpers\n * @summary Get the year of the given date.\n *\n * @description\n * Get the year of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which year is 2 July 2014?\n * const result = getYear(new Date(2014, 6, 2))\n * //=> 2014\n */\n\nexport default function getYear(dirtyDate) {\n requiredArgs(1, arguments);\n return toDate(dirtyDate).getFullYear();\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getTime\n * @category Timestamp Helpers\n * @summary Get the milliseconds timestamp of the given date.\n *\n * @description\n * Get the milliseconds timestamp of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the timestamp\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the timestamp of 29 February 2012 11:45:05.123:\n * const result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123))\n * //=> 1330515905123\n */\n\nexport default function getTime(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var timestamp = date.getTime();\n return timestamp;\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name setSeconds\n * @category Second Helpers\n * @summary Set the seconds to the given date.\n *\n * @description\n * Set the seconds to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} seconds - the seconds of the new date\n * @returns {Date} the new date with the seconds set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set 45 seconds to 1 September 2014 11:30:40:\n * const result = setSeconds(new Date(2014, 8, 1, 11, 30, 40), 45)\n * //=> Mon Sep 01 2014 11:30:45\n */\n\nexport default function setSeconds(dirtyDate, dirtySeconds) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var seconds = toInteger(dirtySeconds);\n date.setSeconds(seconds);\n return date;\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name setMinutes\n * @category Minute Helpers\n * @summary Set the minutes to the given date.\n *\n * @description\n * Set the minutes to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} minutes - the minutes of the new date\n * @returns {Date} the new date with the minutes set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set 45 minutes to 1 September 2014 11:30:40:\n * const result = setMinutes(new Date(2014, 8, 1, 11, 30, 40), 45)\n * //=> Mon Sep 01 2014 11:45:40\n */\n\nexport default function setMinutes(dirtyDate, dirtyMinutes) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var minutes = toInteger(dirtyMinutes);\n date.setMinutes(minutes);\n return date;\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name setHours\n * @category Hour Helpers\n * @summary Set the hours to the given date.\n *\n * @description\n * Set the hours to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} hours - the hours of the new date\n * @returns {Date} the new date with the hours set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set 4 hours to 1 September 2014 11:30:00:\n * const result = setHours(new Date(2014, 8, 1, 11, 30), 4)\n * //=> Mon Sep 01 2014 04:30:00\n */\n\nexport default function setHours(dirtyDate, dirtyHours) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var hours = toInteger(dirtyHours);\n date.setHours(hours);\n return date;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getDaysInMonth\n * @category Month Helpers\n * @summary Get the number of days in a month of the given date.\n *\n * @description\n * Get the number of days in a month of the given date.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the number of days in a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // How many days are in February 2000?\n * const result = getDaysInMonth(new Date(2000, 1))\n * //=> 29\n */\n\nexport default function getDaysInMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getFullYear();\n var monthIndex = date.getMonth();\n var lastDayOfMonth = new Date(0);\n lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);\n lastDayOfMonth.setHours(0, 0, 0, 0);\n return lastDayOfMonth.getDate();\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport getDaysInMonth from \"../getDaysInMonth/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name setMonth\n * @category Month Helpers\n * @summary Set the month to the given date.\n *\n * @description\n * Set the month to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} month - the month of the new date\n * @returns {Date} the new date with the month set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set February to 1 September 2014:\n * const result = setMonth(new Date(2014, 8, 1), 1)\n * //=> Sat Feb 01 2014 00:00:00\n */\n\nexport default function setMonth(dirtyDate, dirtyMonth) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var month = toInteger(dirtyMonth);\n var year = date.getFullYear();\n var day = date.getDate();\n var dateWithDesiredMonth = new Date(0);\n dateWithDesiredMonth.setFullYear(year, month, 15);\n dateWithDesiredMonth.setHours(0, 0, 0, 0);\n var daysInMonth = getDaysInMonth(dateWithDesiredMonth); // Set the last day of the new month\n // if the original date was the last day of the longer month\n\n date.setMonth(month, Math.min(day, daysInMonth));\n return date;\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport setMonth from \"../setMonth/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name setQuarter\n * @category Quarter Helpers\n * @summary Set the year quarter to the given date.\n *\n * @description\n * Set the year quarter to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} quarter - the quarter of the new date\n * @returns {Date} the new date with the quarter set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set the 2nd quarter to 2 July 2014:\n * const result = setQuarter(new Date(2014, 6, 2), 2)\n * //=> Wed Apr 02 2014 00:00:00\n */\n\nexport default function setQuarter(dirtyDate, dirtyQuarter) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var quarter = toInteger(dirtyQuarter);\n var oldQuarter = Math.floor(date.getMonth() / 3) + 1;\n var diff = quarter - oldQuarter;\n return setMonth(date, date.getMonth() + diff * 3);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name setYear\n * @category Year Helpers\n * @summary Set the year to the given date.\n *\n * @description\n * Set the year to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} year - the year of the new date\n * @returns {Date} the new date with the year set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set year 2013 to 1 September 2014:\n * const result = setYear(new Date(2014, 8, 1), 2013)\n * //=> Sun Sep 01 2013 00:00:00\n */\n\nexport default function setYear(dirtyDate, dirtyYear) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var year = toInteger(dirtyYear); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date\n\n if (isNaN(date.getTime())) {\n return new Date(NaN);\n }\n\n date.setFullYear(year);\n return date;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name min\n * @category Common Helpers\n * @summary Returns the earliest of the given dates.\n *\n * @description\n * Returns the earliest of the given dates.\n *\n * @param {Date[]|Number[]} datesArray - the dates to compare\n * @returns {Date} - the earliest of the dates\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which of these dates is the earliest?\n * const result = min([\n * new Date(1989, 6, 10),\n * new Date(1987, 1, 11),\n * new Date(1995, 6, 2),\n * new Date(1990, 0, 1)\n * ])\n * //=> Wed Feb 11 1987 00:00:00\n */\n\nexport default function min(dirtyDatesArray) {\n requiredArgs(1, arguments);\n var datesArray; // `dirtyDatesArray` is Array, Set or Map, or object with custom `forEach` method\n\n if (dirtyDatesArray && typeof dirtyDatesArray.forEach === 'function') {\n datesArray = dirtyDatesArray; // If `dirtyDatesArray` is Array-like Object, convert to Array.\n } else if (_typeof(dirtyDatesArray) === 'object' && dirtyDatesArray !== null) {\n datesArray = Array.prototype.slice.call(dirtyDatesArray);\n } else {\n // `dirtyDatesArray` is non-iterable, return Invalid Date\n return new Date(NaN);\n }\n\n var result;\n datesArray.forEach(function (dirtyDate) {\n var currentDate = toDate(dirtyDate);\n\n if (result === undefined || result > currentDate || isNaN(currentDate.getDate())) {\n result = currentDate;\n }\n });\n return result || new Date(NaN);\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name max\n * @category Common Helpers\n * @summary Return the latest of the given dates.\n *\n * @description\n * Return the latest of the given dates.\n *\n * @param {Date[]|Number[]} datesArray - the dates to compare\n * @returns {Date} the latest of the dates\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which of these dates is the latest?\n * const result = max([\n * new Date(1989, 6, 10),\n * new Date(1987, 1, 11),\n * new Date(1995, 6, 2),\n * new Date(1990, 0, 1)\n * ])\n * //=> Sun Jul 02 1995 00:00:00\n */\n\nexport default function max(dirtyDatesArray) {\n requiredArgs(1, arguments);\n var datesArray; // `dirtyDatesArray` is Array, Set or Map, or object with custom `forEach` method\n\n if (dirtyDatesArray && typeof dirtyDatesArray.forEach === 'function') {\n datesArray = dirtyDatesArray; // If `dirtyDatesArray` is Array-like Object, convert to Array.\n } else if (_typeof(dirtyDatesArray) === 'object' && dirtyDatesArray !== null) {\n datesArray = Array.prototype.slice.call(dirtyDatesArray);\n } else {\n // `dirtyDatesArray` is non-iterable, return Invalid Date\n return new Date(NaN);\n }\n\n var result;\n datesArray.forEach(function (dirtyDate) {\n var currentDate = toDate(dirtyDate);\n\n if (result === undefined || result < currentDate || isNaN(Number(currentDate))) {\n result = currentDate;\n }\n });\n return result || new Date(NaN);\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a day\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\n\nexport default function startOfDay(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setHours(0, 0, 0, 0);\n return date;\n}","import getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport startOfDay from \"../startOfDay/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_DAY = 86400000;\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar days\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\n\nexport default function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var startOfDayLeft = startOfDay(dirtyDateLeft);\n var startOfDayRight = startOfDay(dirtyDateRight);\n var timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);\n var timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight); // Round the number of days to the nearest integer\n // because the number of milliseconds in a day is not constant\n // (e.g. it's different in the day of the daylight saving time clock shift)\n\n return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY);\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInCalendarMonths\n * @category Month Helpers\n * @summary Get the number of calendar months between the given dates.\n *\n * @description\n * Get the number of calendar months between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar months\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInCalendarMonths(\n * new Date(2014, 8, 1),\n * new Date(2014, 0, 31)\n * )\n * //=> 8\n */\n\nexport default function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear();\n var monthDiff = dateLeft.getMonth() - dateRight.getMonth();\n return yearDiff * 12 + monthDiff;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInCalendarYears\n * @category Year Helpers\n * @summary Get the number of calendar years between the given dates.\n *\n * @description\n * Get the number of calendar years between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar years are between 31 December 2013 and 11 February 2015?\n * const result = differenceInCalendarYears(\n * new Date(2015, 1, 11),\n * new Date(2013, 11, 31)\n * )\n * //=> 2\n */\n\nexport default function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n return dateLeft.getFullYear() - dateRight.getFullYear();\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfMonth\n * @category Month Helpers\n * @summary Return the start of a month for the given date.\n *\n * @description\n * Return the start of a month for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a month for 2 September 2014 11:55:00:\n * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function startOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n return date;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfQuarter\n * @category Quarter Helpers\n * @summary Return the start of a year quarter for the given date.\n *\n * @description\n * Return the start of a year quarter for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a quarter\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a quarter for 2 September 2014 11:55:00:\n * const result = startOfQuarter(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Jul 01 2014 00:00:00\n */\n\nexport default function startOfQuarter(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var currentMonth = date.getMonth();\n var month = currentMonth - currentMonth % 3;\n date.setMonth(month, 1);\n date.setHours(0, 0, 0, 0);\n return date;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name startOfYear\n * @category Year Helpers\n * @summary Return the start of a year for the given date.\n *\n * @description\n * Return the start of a year for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a year for 2 September 2014 11:55:00:\n * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Jan 01 2014 00:00:00\n */\n\nexport default function startOfYear(dirtyDate) {\n requiredArgs(1, arguments);\n var cleanDate = toDate(dirtyDate);\n var date = new Date(0);\n date.setFullYear(cleanDate.getFullYear(), 0, 1);\n date.setHours(0, 0, 0, 0);\n return date;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfDay\n * @category Day Helpers\n * @summary Return the end of a day for the given date.\n *\n * @description\n * Return the end of a day for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a day\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a day for 2 September 2014 11:55:00:\n * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 23:59:59.999\n */\n\nexport default function endOfDay(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n date.setHours(23, 59, 59, 999);\n return date;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfMonth\n * @category Month Helpers\n * @summary Return the end of a month for the given date.\n *\n * @description\n * Return the end of a month for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a month for 2 September 2014 11:55:00:\n * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 23:59:59.999\n */\n\nexport default function endOfMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var month = date.getMonth();\n date.setFullYear(date.getFullYear(), month + 1, 0);\n date.setHours(23, 59, 59, 999);\n return date;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name endOfYear\n * @category Year Helpers\n * @summary Return the end of a year for the given date.\n *\n * @description\n * Return the end of a year for the given date.\n * The result will be in the local timezone.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a year for 2 September 2014 11:55:00:\n * const result = endOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Dec 31 2014 23:59:59.999\n */\n\nexport default function endOfYear(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getFullYear();\n date.setFullYear(year + 1, 0, 0);\n date.setHours(23, 59, 59, 999);\n return date;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isEqual\n * @category Common Helpers\n * @summary Are the given dates equal?\n *\n * @description\n * Are the given dates equal?\n *\n * @param {Date|Number} dateLeft - the first date to compare\n * @param {Date|Number} dateRight - the second date to compare\n * @returns {Boolean} the dates are equal\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?\n * const result = isEqual(\n * new Date(2014, 6, 2, 6, 30, 45, 0),\n * new Date(2014, 6, 2, 6, 30, 45, 500)\n * )\n * //=> false\n */\n\nexport default function isEqual(dirtyLeftDate, dirtyRightDate) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyLeftDate);\n var dateRight = toDate(dirtyRightDate);\n return dateLeft.getTime() === dateRight.getTime();\n}","import startOfDay from \"../startOfDay/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isSameDay\n * @category Day Helpers\n * @summary Are the given dates in the same day (and year and month)?\n *\n * @description\n * Are the given dates in the same day (and year and month)?\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same day (and year and month)\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?\n * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))\n * //=> true\n *\n * @example\n * // Are 4 September and 4 October in the same day?\n * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))\n * //=> false\n *\n * @example\n * // Are 4 September, 2014 and 4 September, 2015 in the same day?\n * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))\n * //=> false\n */\n\nexport default function isSameDay(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeftStartOfDay = startOfDay(dirtyDateLeft);\n var dateRightStartOfDay = startOfDay(dirtyDateRight);\n return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isSameMonth\n * @category Month Helpers\n * @summary Are the given dates in the same month (and year)?\n *\n * @description\n * Are the given dates in the same month (and year)?\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same month (and year)\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 2 September 2014 and 25 September 2014 in the same month?\n * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))\n * //=> true\n *\n * @example\n * // Are 2 September 2014 and 25 September 2015 in the same month?\n * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))\n * //=> false\n */\n\nexport default function isSameMonth(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth();\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isSameYear\n * @category Year Helpers\n * @summary Are the given dates in the same year?\n *\n * @description\n * Are the given dates in the same year?\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same year\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 2 September 2014 and 25 September 2014 in the same year?\n * const result = isSameYear(new Date(2014, 8, 2), new Date(2014, 8, 25))\n * //=> true\n */\n\nexport default function isSameYear(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n return dateLeft.getFullYear() === dateRight.getFullYear();\n}","import startOfQuarter from \"../startOfQuarter/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isSameQuarter\n * @category Quarter Helpers\n * @summary Are the given dates in the same quarter (and year)?\n *\n * @description\n * Are the given dates in the same quarter (and year)?\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same quarter (and year)\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 1 January 2014 and 8 March 2014 in the same quarter?\n * const result = isSameQuarter(new Date(2014, 0, 1), new Date(2014, 2, 8))\n * //=> true\n *\n * @example\n * // Are 1 January 2014 and 1 January 2015 in the same quarter?\n * const result = isSameQuarter(new Date(2014, 0, 1), new Date(2015, 0, 1))\n * //=> false\n */\n\nexport default function isSameQuarter(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeftStartOfQuarter = startOfQuarter(dirtyDateLeft);\n var dateRightStartOfQuarter = startOfQuarter(dirtyDateRight);\n return dateLeftStartOfQuarter.getTime() === dateRightStartOfQuarter.getTime();\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isAfter\n * @category Common Helpers\n * @summary Is the first date after the second one?\n *\n * @description\n * Is the first date after the second one?\n *\n * @param {Date|Number} date - the date that should be after the other one to return true\n * @param {Date|Number} dateToCompare - the date to compare with\n * @returns {Boolean} the first date is after the second date\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Is 10 July 1989 after 11 February 1987?\n * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> true\n */\n\nexport default function isAfter(dirtyDate, dirtyDateToCompare) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var dateToCompare = toDate(dirtyDateToCompare);\n return date.getTime() > dateToCompare.getTime();\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isBefore\n * @category Common Helpers\n * @summary Is the first date before the second one?\n *\n * @description\n * Is the first date before the second one?\n *\n * @param {Date|Number} date - the date that should be before the other one to return true\n * @param {Date|Number} dateToCompare - the date to compare with\n * @returns {Boolean} the first date is before the second date\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Is 10 July 1989 before 11 February 1987?\n * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> false\n */\n\nexport default function isBefore(dirtyDate, dirtyDateToCompare) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var dateToCompare = toDate(dirtyDateToCompare);\n return date.getTime() < dateToCompare.getTime();\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n\n/**\n * @name isWithinInterval\n * @category Interval Helpers\n * @summary Is the given date within the interval?\n *\n * @description\n * Is the given date within the interval? (Including start and end.)\n *\n * @param {Date|Number} date - the date to check\n * @param {Interval} interval - the interval to check\n * @returns {Boolean} the date is within the interval\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // For the date within the interval:\n * isWithinInterval(new Date(2014, 0, 3), {\n * start: new Date(2014, 0, 1),\n * end: new Date(2014, 0, 7)\n * })\n * //=> true\n *\n * @example\n * // For the date outside of the interval:\n * isWithinInterval(new Date(2014, 0, 10), {\n * start: new Date(2014, 0, 1),\n * end: new Date(2014, 0, 7)\n * })\n * //=> false\n *\n * @example\n * // For date equal to interval start:\n * isWithinInterval(date, { start, end: date }) // => true\n *\n * @example\n * // For date equal to interval end:\n * isWithinInterval(date, { start: date, end }) // => true\n */\nexport default function isWithinInterval(dirtyDate, interval) {\n requiredArgs(2, arguments);\n var time = toDate(dirtyDate).getTime();\n var startTime = toDate(interval.start).getTime();\n var endTime = toDate(interval.end).getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date`\n\n if (!(startTime <= endTime)) {\n throw new RangeError('Invalid interval');\n }\n\n return time >= startTime && time <= endTime;\n}","export default function assign(target, object) {\n if (target == null) {\n throw new TypeError('assign requires that input parameter not be null or undefined');\n }\n\n for (var property in object) {\n if (Object.prototype.hasOwnProperty.call(object, property)) {\n ;\n target[property] = object[property];\n }\n }\n\n return target;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar TIMEZONE_UNIT_PRIORITY = 10;\nexport var Setter = /*#__PURE__*/function () {\n function Setter() {\n _classCallCheck(this, Setter);\n\n _defineProperty(this, \"subPriority\", 0);\n }\n\n _createClass(Setter, [{\n key: \"validate\",\n value: function validate(_utcDate, _options) {\n return true;\n }\n }]);\n\n return Setter;\n}();\nexport var ValueSetter = /*#__PURE__*/function (_Setter) {\n _inherits(ValueSetter, _Setter);\n\n var _super = _createSuper(ValueSetter);\n\n function ValueSetter(value, validateValue, setValue, priority, subPriority) {\n var _this;\n\n _classCallCheck(this, ValueSetter);\n\n _this = _super.call(this);\n _this.value = value;\n _this.validateValue = validateValue;\n _this.setValue = setValue;\n _this.priority = priority;\n\n if (subPriority) {\n _this.subPriority = subPriority;\n }\n\n return _this;\n }\n\n _createClass(ValueSetter, [{\n key: \"validate\",\n value: function validate(utcDate, options) {\n return this.validateValue(utcDate, this.value, options);\n }\n }, {\n key: \"set\",\n value: function set(utcDate, flags, options) {\n return this.setValue(utcDate, flags, this.value, options);\n }\n }]);\n\n return ValueSetter;\n}(Setter);\nexport var DateToSystemTimezoneSetter = /*#__PURE__*/function (_Setter2) {\n _inherits(DateToSystemTimezoneSetter, _Setter2);\n\n var _super2 = _createSuper(DateToSystemTimezoneSetter);\n\n function DateToSystemTimezoneSetter() {\n var _this2;\n\n _classCallCheck(this, DateToSystemTimezoneSetter);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this2 = _super2.call.apply(_super2, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this2), \"priority\", TIMEZONE_UNIT_PRIORITY);\n\n _defineProperty(_assertThisInitialized(_this2), \"subPriority\", -1);\n\n return _this2;\n }\n\n _createClass(DateToSystemTimezoneSetter, [{\n key: \"set\",\n value: function set(date, flags) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n var convertedDate = new Date(0);\n convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());\n convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());\n return convertedDate;\n }\n }]);\n\n return DateToSystemTimezoneSetter;\n}(Setter);","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { ValueSetter } from \"./Setter.js\";\nexport var Parser = /*#__PURE__*/function () {\n function Parser() {\n _classCallCheck(this, Parser);\n }\n\n _createClass(Parser, [{\n key: \"run\",\n value: function run(dateString, token, match, options) {\n var result = this.parse(dateString, token, match, options);\n\n if (!result) {\n return null;\n }\n\n return {\n setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),\n rest: result.rest\n };\n }\n }, {\n key: \"validate\",\n value: function validate(_utcDate, _value, _options) {\n return true;\n }\n }]);\n\n return Parser;\n}();","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nexport var EraParser = /*#__PURE__*/function (_Parser) {\n _inherits(EraParser, _Parser);\n\n var _super = _createSuper(EraParser);\n\n function EraParser() {\n var _this;\n\n _classCallCheck(this, EraParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 140);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['R', 'u', 't', 'T']);\n\n return _this;\n }\n\n _createClass(EraParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return match.era(dateString, {\n width: 'abbreviated'\n }) || match.era(dateString, {\n width: 'narrow'\n });\n // A, B\n\n case 'GGGGG':\n return match.era(dateString, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n\n case 'GGGG':\n default:\n return match.era(dateString, {\n width: 'wide'\n }) || match.era(dateString, {\n width: 'abbreviated'\n }) || match.era(dateString, {\n width: 'narrow'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n flags.era = value;\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return EraParser;\n}(Parser);","/**\n * Days in 1 week.\n *\n * @name daysInWeek\n * @constant\n * @type {number}\n * @default\n */\nexport var daysInWeek = 7;\n/**\n * Days in 1 year\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n *\n * @name daysInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var daysInYear = 365.2425;\n/**\n * Maximum allowed time.\n *\n * @name maxTime\n * @constant\n * @type {number}\n * @default\n */\n\nexport var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n/**\n * Milliseconds in 1 minute\n *\n * @name millisecondsInMinute\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInMinute = 60000;\n/**\n * Milliseconds in 1 hour\n *\n * @name millisecondsInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInHour = 3600000;\n/**\n * Milliseconds in 1 second\n *\n * @name millisecondsInSecond\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInSecond = 1000;\n/**\n * Minimum allowed time.\n *\n * @name minTime\n * @constant\n * @type {number}\n * @default\n */\n\nexport var minTime = -maxTime;\n/**\n * Minutes in 1 hour\n *\n * @name minutesInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var minutesInHour = 60;\n/**\n * Months in 1 quarter\n *\n * @name monthsInQuarter\n * @constant\n * @type {number}\n * @default\n */\n\nexport var monthsInQuarter = 3;\n/**\n * Months in 1 year\n *\n * @name monthsInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var monthsInYear = 12;\n/**\n * Quarters in 1 year\n *\n * @name quartersInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var quartersInYear = 4;\n/**\n * Seconds in 1 hour\n *\n * @name secondsInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInHour = 3600;\n/**\n * Seconds in 1 minute\n *\n * @name secondsInMinute\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInMinute = 60;\n/**\n * Seconds in 1 day\n *\n * @name secondsInDay\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInDay = secondsInHour * 24;\n/**\n * Seconds in 1 week\n *\n * @name secondsInWeek\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInWeek = secondsInDay * 7;\n/**\n * Seconds in 1 year\n *\n * @name secondsInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInYear = secondsInDay * daysInYear;\n/**\n * Seconds in 1 month\n *\n * @name secondsInMonth\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInMonth = secondsInYear / 12;\n/**\n * Seconds in 1 quarter\n *\n * @name secondsInQuarter\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInQuarter = secondsInMonth * 3;","export var numericPatterns = {\n month: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n date: /^(3[0-1]|[0-2]?\\d)/,\n // 0 to 31\n dayOfYear: /^(36[0-6]|3[0-5]\\d|[0-2]?\\d?\\d)/,\n // 0 to 366\n week: /^(5[0-3]|[0-4]?\\d)/,\n // 0 to 53\n hour23h: /^(2[0-3]|[0-1]?\\d)/,\n // 0 to 23\n hour24h: /^(2[0-4]|[0-1]?\\d)/,\n // 0 to 24\n hour11h: /^(1[0-1]|0?\\d)/,\n // 0 to 11\n hour12h: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n minute: /^[0-5]?\\d/,\n // 0 to 59\n second: /^[0-5]?\\d/,\n // 0 to 59\n singleDigit: /^\\d/,\n // 0 to 9\n twoDigits: /^\\d{1,2}/,\n // 0 to 99\n threeDigits: /^\\d{1,3}/,\n // 0 to 999\n fourDigits: /^\\d{1,4}/,\n // 0 to 9999\n anyDigitsSigned: /^-?\\d+/,\n singleDigitSigned: /^-?\\d/,\n // 0 to 9, -0 to -9\n twoDigitsSigned: /^-?\\d{1,2}/,\n // 0 to 99, -0 to -99\n threeDigitsSigned: /^-?\\d{1,3}/,\n // 0 to 999, -0 to -999\n fourDigitsSigned: /^-?\\d{1,4}/ // 0 to 9999, -0 to -9999\n\n};\nexport var timezonePatterns = {\n basicOptionalMinutes: /^([+-])(\\d{2})(\\d{2})?|Z/,\n basic: /^([+-])(\\d{2})(\\d{2})|Z/,\n basicOptionalSeconds: /^([+-])(\\d{2})(\\d{2})((\\d{2}))?|Z/,\n extended: /^([+-])(\\d{2}):(\\d{2})|Z/,\n extendedOptionalSeconds: /^([+-])(\\d{2}):(\\d{2})(:(\\d{2}))?|Z/\n};","import { millisecondsInHour, millisecondsInMinute, millisecondsInSecond } from \"../../constants/index.js\";\nimport { numericPatterns } from \"./constants.js\";\nexport function mapValue(parseFnResult, mapFn) {\n if (!parseFnResult) {\n return parseFnResult;\n }\n\n return {\n value: mapFn(parseFnResult.value),\n rest: parseFnResult.rest\n };\n}\nexport function parseNumericPattern(pattern, dateString) {\n var matchResult = dateString.match(pattern);\n\n if (!matchResult) {\n return null;\n }\n\n return {\n value: parseInt(matchResult[0], 10),\n rest: dateString.slice(matchResult[0].length)\n };\n}\nexport function parseTimezonePattern(pattern, dateString) {\n var matchResult = dateString.match(pattern);\n\n if (!matchResult) {\n return null;\n } // Input is 'Z'\n\n\n if (matchResult[0] === 'Z') {\n return {\n value: 0,\n rest: dateString.slice(1)\n };\n }\n\n var sign = matchResult[1] === '+' ? 1 : -1;\n var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;\n var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;\n var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;\n return {\n value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),\n rest: dateString.slice(matchResult[0].length)\n };\n}\nexport function parseAnyDigitsSigned(dateString) {\n return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);\n}\nexport function parseNDigits(n, dateString) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigit, dateString);\n\n case 2:\n return parseNumericPattern(numericPatterns.twoDigits, dateString);\n\n case 3:\n return parseNumericPattern(numericPatterns.threeDigits, dateString);\n\n case 4:\n return parseNumericPattern(numericPatterns.fourDigits, dateString);\n\n default:\n return parseNumericPattern(new RegExp('^\\\\d{1,' + n + '}'), dateString);\n }\n}\nexport function parseNDigitsSigned(n, dateString) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);\n\n case 2:\n return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);\n\n case 3:\n return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);\n\n case 4:\n return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);\n\n default:\n return parseNumericPattern(new RegExp('^-?\\\\d{1,' + n + '}'), dateString);\n }\n}\nexport function dayPeriodEnumToHours(dayPeriod) {\n switch (dayPeriod) {\n case 'morning':\n return 4;\n\n case 'evening':\n return 17;\n\n case 'pm':\n case 'noon':\n case 'afternoon':\n return 12;\n\n case 'am':\n case 'midnight':\n case 'night':\n default:\n return 0;\n }\n}\nexport function normalizeTwoDigitYear(twoDigitYear, currentYear) {\n var isCommonEra = currentYear > 0; // Absolute number of the current year:\n // 1 -> 1 AC\n // 0 -> 1 BC\n // -1 -> 2 BC\n\n var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;\n var result;\n\n if (absCurrentYear <= 50) {\n result = twoDigitYear || 100;\n } else {\n var rangeEnd = absCurrentYear + 50;\n var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;\n var isPreviousCentury = twoDigitYear >= rangeEnd % 100;\n result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);\n }\n\n return isCommonEra ? result : 1 - result;\n}\nexport function isLeapYearIndex(year) {\n return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, normalizeTwoDigitYear, parseNDigits } from \"../utils.js\";\n// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns\n// | Year | y | yy | yyy | yyyy | yyyyy |\n// |----------|-------|----|-------|-------|-------|\n// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\nexport var YearParser = /*#__PURE__*/function (_Parser) {\n _inherits(YearParser, _Parser);\n\n var _super = _createSuper(YearParser);\n\n function YearParser() {\n var _this;\n\n _classCallCheck(this, YearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(YearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'yy'\n };\n };\n\n switch (token) {\n case 'y':\n return mapValue(parseNDigits(4, dateString), valueCallback);\n\n case 'yo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'year'\n }), valueCallback);\n\n default:\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value.isTwoDigitYear || value.year > 0;\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n var currentYear = date.getUTCFullYear();\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n\n var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return YearParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits, normalizeTwoDigitYear, mapValue } from \"../utils.js\";\nimport getUTCWeekYear from \"../../../_lib/getUTCWeekYear/index.js\";\nimport startOfUTCWeek from \"../../../_lib/startOfUTCWeek/index.js\";\n// Local week-numbering year\nexport var LocalWeekYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalWeekYearParser, _Parser);\n\n var _super = _createSuper(LocalWeekYearParser);\n\n function LocalWeekYearParser() {\n var _this;\n\n _classCallCheck(this, LocalWeekYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);\n\n return _this;\n }\n\n _createClass(LocalWeekYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'YY'\n };\n };\n\n switch (token) {\n case 'Y':\n return mapValue(parseNDigits(4, dateString), valueCallback);\n\n case 'Yo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'year'\n }), valueCallback);\n\n default:\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value.isTwoDigitYear || value.year > 0;\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value, options) {\n var currentYear = getUTCWeekYear(date, options);\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n\n var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n }]);\n\n return LocalWeekYearParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigitsSigned } from \"../utils.js\";\nimport startOfUTCISOWeek from \"../../../_lib/startOfUTCISOWeek/index.js\"; // ISO week-numbering year\n\nexport var ISOWeekYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOWeekYearParser, _Parser);\n\n var _super = _createSuper(ISOWeekYearParser);\n\n function ISOWeekYearParser() {\n var _this;\n\n _classCallCheck(this, ISOWeekYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['G', 'y', 'Y', 'u', 'Q', 'q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ISOWeekYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n if (token === 'R') {\n return parseNDigitsSigned(4, dateString);\n }\n\n return parseNDigitsSigned(token.length, dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n var firstWeekOfYear = new Date(0);\n firstWeekOfYear.setUTCFullYear(value, 0, 4);\n firstWeekOfYear.setUTCHours(0, 0, 0, 0);\n return startOfUTCISOWeek(firstWeekOfYear);\n }\n }]);\n\n return ISOWeekYearParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigitsSigned } from \"../utils.js\";\nexport var ExtendedYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(ExtendedYearParser, _Parser);\n\n var _super = _createSuper(ExtendedYearParser);\n\n function ExtendedYearParser() {\n var _this;\n\n _classCallCheck(this, ExtendedYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 130);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['G', 'y', 'Y', 'R', 'w', 'I', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ExtendedYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n if (token === 'u') {\n return parseNDigitsSigned(4, dateString);\n }\n\n return parseNDigitsSigned(token.length, dateString);\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return ExtendedYearParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits } from \"../utils.js\";\nexport var QuarterParser = /*#__PURE__*/function (_Parser) {\n _inherits(QuarterParser, _Parser);\n\n var _super = _createSuper(QuarterParser);\n\n function QuarterParser() {\n var _this;\n\n _classCallCheck(this, QuarterParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 120);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(QuarterParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n case 'QQ':\n // 01, 02, 03, 04\n return parseNDigits(token.length, dateString);\n // 1st, 2nd, 3rd, 4th\n\n case 'Qo':\n return match.ordinalNumber(dateString, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'QQQ':\n return match.quarter(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'QQQQQ':\n return match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'QQQQ':\n default:\n return match.quarter(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 4;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return QuarterParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseNDigits } from \"../utils.js\";\nexport var StandAloneQuarterParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneQuarterParser, _Parser);\n\n var _super = _createSuper(StandAloneQuarterParser);\n\n function StandAloneQuarterParser() {\n var _this;\n\n _classCallCheck(this, StandAloneQuarterParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 120);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(StandAloneQuarterParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n case 'qq':\n // 01, 02, 03, 04\n return parseNDigits(token.length, dateString);\n // 1st, 2nd, 3rd, 4th\n\n case 'qo':\n return match.ordinalNumber(dateString, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'qqq':\n return match.quarter(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'qqqqq':\n return match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'qqqq':\n default:\n return match.quarter(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 4;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return StandAloneQuarterParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { mapValue, parseNDigits, parseNumericPattern } from \"../utils.js\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nexport var MonthParser = /*#__PURE__*/function (_Parser) {\n _inherits(MonthParser, _Parser);\n\n var _super = _createSuper(MonthParser);\n\n function MonthParser() {\n var _this;\n\n _classCallCheck(this, MonthParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 110);\n\n return _this;\n }\n\n _createClass(MonthParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n return value - 1;\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'M':\n return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);\n // 01, 02, ..., 12\n\n case 'MM':\n return mapValue(parseNDigits(2, dateString), valueCallback);\n // 1st, 2nd, ..., 12th\n\n case 'Mo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'month'\n }), valueCallback);\n // Jan, Feb, ..., Dec\n\n case 'MMM':\n return match.month(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // J, F, ..., D\n\n case 'MMMMM':\n return match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n\n case 'MMMM':\n default:\n return match.month(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return MonthParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits, mapValue } from \"../utils.js\";\nexport var StandAloneMonthParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneMonthParser, _Parser);\n\n var _super = _createSuper(StandAloneMonthParser);\n\n function StandAloneMonthParser() {\n var _this;\n\n _classCallCheck(this, StandAloneMonthParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 110);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(StandAloneMonthParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n return value - 1;\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);\n // 01, 02, ..., 12\n\n case 'LL':\n return mapValue(parseNDigits(2, dateString), valueCallback);\n // 1st, 2nd, ..., 12th\n\n case 'Lo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'month'\n }), valueCallback);\n // Jan, Feb, ..., Dec\n\n case 'LLL':\n return match.month(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // J, F, ..., D\n\n case 'LLLLL':\n return match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n\n case 'LLLL':\n default:\n return match.month(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return StandAloneMonthParser;\n}(Parser);","import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport getUTCWeek from \"../getUTCWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function setUTCWeek(dirtyDate, dirtyWeek, options) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var week = toInteger(dirtyWeek);\n var diff = getUTCWeek(date, options) - week;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nimport setUTCWeek from \"../../../_lib/setUTCWeek/index.js\";\nimport startOfUTCWeek from \"../../../_lib/startOfUTCWeek/index.js\"; // Local week of year\n\nexport var LocalWeekParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalWeekParser, _Parser);\n\n var _super = _createSuper(LocalWeekParser);\n\n function LocalWeekParser() {\n var _this;\n\n _classCallCheck(this, LocalWeekParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 100);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']);\n\n return _this;\n }\n\n _createClass(LocalWeekParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'w':\n return parseNumericPattern(numericPatterns.week, dateString);\n\n case 'wo':\n return match.ordinalNumber(dateString, {\n unit: 'week'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 53;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n return startOfUTCWeek(setUTCWeek(date, value, options), options);\n }\n }]);\n\n return LocalWeekParser;\n}(Parser);","import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport getUTCISOWeek from \"../getUTCISOWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nexport default function setUTCISOWeek(dirtyDate, dirtyISOWeek) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var isoWeek = toInteger(dirtyISOWeek);\n var diff = getUTCISOWeek(date) - isoWeek;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nimport setUTCISOWeek from \"../../../_lib/setUTCISOWeek/index.js\";\nimport startOfUTCISOWeek from \"../../../_lib/startOfUTCISOWeek/index.js\"; // ISO week of year\n\nexport var ISOWeekParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOWeekParser, _Parser);\n\n var _super = _createSuper(ISOWeekParser);\n\n function ISOWeekParser() {\n var _this;\n\n _classCallCheck(this, ISOWeekParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 100);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ISOWeekParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'I':\n return parseNumericPattern(numericPatterns.week, dateString);\n\n case 'Io':\n return match.ordinalNumber(dateString, {\n unit: 'week'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 53;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n return startOfUTCISOWeek(setUTCISOWeek(date, value));\n }\n }]);\n\n return ISOWeekParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { isLeapYearIndex, parseNDigits, parseNumericPattern } from \"../utils.js\";\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nvar DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nvar DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // Day of the month\n\nexport var DateParser = /*#__PURE__*/function (_Parser) {\n _inherits(DateParser, _Parser);\n\n var _super = _createSuper(DateParser);\n\n function DateParser() {\n var _this;\n\n _classCallCheck(this, DateParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"subPriority\", 1);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DateParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'd':\n return parseNumericPattern(numericPatterns.date, dateString);\n\n case 'do':\n return match.ordinalNumber(dateString, {\n unit: 'date'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(date, value) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex(year);\n var month = date.getUTCMonth();\n\n if (isLeapYear) {\n return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];\n } else {\n return value >= 1 && value <= DAYS_IN_MONTH[month];\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCDate(value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return DateParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits, isLeapYearIndex } from \"../utils.js\";\nexport var DayOfYearParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayOfYearParser, _Parser);\n\n var _super = _createSuper(DayOfYearParser);\n\n function DayOfYearParser() {\n var _this;\n\n _classCallCheck(this, DayOfYearParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"subpriority\", 1);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DayOfYearParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'D':\n case 'DD':\n return parseNumericPattern(numericPatterns.dayOfYear, dateString);\n\n case 'Do':\n return match.ordinalNumber(dateString, {\n unit: 'date'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(date, value) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex(year);\n\n if (isLeapYear) {\n return value >= 1 && value <= 366;\n } else {\n return value >= 1 && value <= 365;\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMonth(0, value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return DayOfYearParser;\n}(Parser);","import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nimport { getDefaultOptions } from \"../defaultOptions/index.js\";\nexport default function setUTCDay(dirtyDate, dirtyDay, options) {\n var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;\n\n requiredArgs(2, arguments);\n var defaultOptions = getDefaultOptions();\n var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = toInteger(dirtyDay);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Day of week\n\nexport var DayParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayParser, _Parser);\n\n var _super = _createSuper(DayParser);\n\n function DayParser() {\n var _this;\n\n _classCallCheck(this, DayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['D', 'i', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n\n case 'EEEEE':\n return match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'EEEEEE':\n return match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n\n case 'EEEE':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return DayParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Local day of week\n\nexport var LocalDayParser = /*#__PURE__*/function (_Parser) {\n _inherits(LocalDayParser, _Parser);\n\n var _super = _createSuper(LocalDayParser);\n\n function LocalDayParser() {\n var _this;\n\n _classCallCheck(this, LocalDayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(LocalDayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match, options) {\n var valueCallback = function valueCallback(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n\n switch (token) {\n // 3\n case 'e':\n case 'ee':\n // 03\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n // 3rd\n\n case 'eo':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'day'\n }), valueCallback);\n // Tue\n\n case 'eee':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n\n case 'eeeee':\n return match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'eeeeee':\n return match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n\n case 'eeee':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return LocalDayParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\"; // Stand-alone local day of week\n\nexport var StandAloneLocalDayParser = /*#__PURE__*/function (_Parser) {\n _inherits(StandAloneLocalDayParser, _Parser);\n\n var _super = _createSuper(StandAloneLocalDayParser);\n\n function StandAloneLocalDayParser() {\n var _this;\n\n _classCallCheck(this, StandAloneLocalDayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']);\n\n return _this;\n }\n\n _createClass(StandAloneLocalDayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match, options) {\n var valueCallback = function valueCallback(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n\n switch (token) {\n // 3\n case 'c':\n case 'cc':\n // 03\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n // 3rd\n\n case 'co':\n return mapValue(match.ordinalNumber(dateString, {\n unit: 'day'\n }), valueCallback);\n // Tue\n\n case 'ccc':\n return match.day(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // T\n\n case 'ccccc':\n return match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n\n case 'cccccc':\n return match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tuesday\n\n case 'cccc':\n default:\n return match.day(dateString, {\n width: 'wide',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'short',\n context: 'standalone'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 6;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return StandAloneLocalDayParser;\n}(Parser);","import toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\";\nimport toInteger from \"../toInteger/index.js\";\nexport default function setUTCISODay(dirtyDate, dirtyDay) {\n requiredArgs(2, arguments);\n var day = toInteger(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nimport setUTCISODay from \"../../../_lib/setUTCISODay/index.js\"; // ISO day of week\n\nexport var ISODayParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISODayParser, _Parser);\n\n var _super = _createSuper(ISODayParser);\n\n function ISODayParser() {\n var _this;\n\n _classCallCheck(this, ISODayParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 90);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'E', 'e', 'c', 't', 'T']);\n\n return _this;\n }\n\n _createClass(ISODayParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n var valueCallback = function valueCallback(value) {\n if (value === 0) {\n return 7;\n }\n\n return value;\n };\n\n switch (token) {\n // 2\n case 'i':\n case 'ii':\n // 02\n return parseNDigits(token.length, dateString);\n // 2nd\n\n case 'io':\n return match.ordinalNumber(dateString, {\n unit: 'day'\n });\n // Tue\n\n case 'iii':\n return mapValue(match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // T\n\n case 'iiiii':\n return mapValue(match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // Tu\n\n case 'iiiiii':\n return mapValue(match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n // Tuesday\n\n case 'iiii':\n default:\n return mapValue(match.day(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'short',\n context: 'formatting'\n }) || match.day(dateString, {\n width: 'narrow',\n context: 'formatting'\n }), valueCallback);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 7;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date = setUTCISODay(date, value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n }]);\n\n return ISODayParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\";\nexport var AMPMParser = /*#__PURE__*/function (_Parser) {\n _inherits(AMPMParser, _Parser);\n\n var _super = _createSuper(AMPMParser);\n\n function AMPMParser() {\n var _this;\n\n _classCallCheck(this, AMPMParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['b', 'B', 'H', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(AMPMParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaaa':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaa':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n\n return AMPMParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\";\nexport var AMPMMidnightParser = /*#__PURE__*/function (_Parser) {\n _inherits(AMPMMidnightParser, _Parser);\n\n var _super = _createSuper(AMPMMidnightParser);\n\n function AMPMMidnightParser() {\n var _this;\n\n _classCallCheck(this, AMPMMidnightParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'B', 'H', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(AMPMMidnightParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbbb':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbb':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n\n return AMPMMidnightParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { dayPeriodEnumToHours } from \"../utils.js\"; // in the morning, in the afternoon, in the evening, at night\n\nexport var DayPeriodParser = /*#__PURE__*/function (_Parser) {\n _inherits(DayPeriodParser, _Parser);\n\n var _super = _createSuper(DayPeriodParser);\n\n function DayPeriodParser() {\n var _this;\n\n _classCallCheck(this, DayPeriodParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 80);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 't', 'T']);\n\n return _this;\n }\n\n _createClass(DayPeriodParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBBB':\n return match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBB':\n default:\n return match.dayPeriod(dateString, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(dateString, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n }]);\n\n return DayPeriodParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour1to12Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour1to12Parser, _Parser);\n\n var _super = _createSuper(Hour1to12Parser);\n\n function Hour1to12Parser() {\n var _this;\n\n _classCallCheck(this, Hour1to12Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['H', 'K', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour1to12Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'h':\n return parseNumericPattern(numericPatterns.hour12h, dateString);\n\n case 'ho':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 12;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var isPM = date.getUTCHours() >= 12;\n\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else if (!isPM && value === 12) {\n date.setUTCHours(0, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n\n return date;\n }\n }]);\n\n return Hour1to12Parser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour0to23Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour0to23Parser, _Parser);\n\n var _super = _createSuper(Hour0to23Parser);\n\n function Hour0to23Parser() {\n var _this;\n\n _classCallCheck(this, Hour0to23Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 'h', 'K', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour0to23Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'H':\n return parseNumericPattern(numericPatterns.hour23h, dateString);\n\n case 'Ho':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 23;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCHours(value, 0, 0, 0);\n return date;\n }\n }]);\n\n return Hour0to23Parser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour0To11Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour0To11Parser, _Parser);\n\n var _super = _createSuper(Hour0To11Parser);\n\n function Hour0To11Parser() {\n var _this;\n\n _classCallCheck(this, Hour0To11Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['h', 'H', 'k', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour0To11Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'K':\n return parseNumericPattern(numericPatterns.hour11h, dateString);\n\n case 'Ko':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 11;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var isPM = date.getUTCHours() >= 12;\n\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n\n return date;\n }\n }]);\n\n return Hour0To11Parser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var Hour1To24Parser = /*#__PURE__*/function (_Parser) {\n _inherits(Hour1To24Parser, _Parser);\n\n var _super = _createSuper(Hour1To24Parser);\n\n function Hour1To24Parser() {\n var _this;\n\n _classCallCheck(this, Hour1To24Parser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 70);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['a', 'b', 'h', 'H', 'K', 't', 'T']);\n\n return _this;\n }\n\n _createClass(Hour1To24Parser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'k':\n return parseNumericPattern(numericPatterns.hour24h, dateString);\n\n case 'ko':\n return match.ordinalNumber(dateString, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 1 && value <= 24;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n var hours = value <= 24 ? value % 24 : value;\n date.setUTCHours(hours, 0, 0, 0);\n return date;\n }\n }]);\n\n return Hour1To24Parser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var MinuteParser = /*#__PURE__*/function (_Parser) {\n _inherits(MinuteParser, _Parser);\n\n var _super = _createSuper(MinuteParser);\n\n function MinuteParser() {\n var _this;\n\n _classCallCheck(this, MinuteParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 60);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n\n return _this;\n }\n\n _createClass(MinuteParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 'm':\n return parseNumericPattern(numericPatterns.minute, dateString);\n\n case 'mo':\n return match.ordinalNumber(dateString, {\n unit: 'minute'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 59;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMinutes(value, 0, 0);\n return date;\n }\n }]);\n\n return MinuteParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { numericPatterns } from \"../constants.js\";\nimport { parseNumericPattern, parseNDigits } from \"../utils.js\";\nexport var SecondParser = /*#__PURE__*/function (_Parser) {\n _inherits(SecondParser, _Parser);\n\n var _super = _createSuper(SecondParser);\n\n function SecondParser() {\n var _this;\n\n _classCallCheck(this, SecondParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 50);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n\n return _this;\n }\n\n _createClass(SecondParser, [{\n key: \"parse\",\n value: function parse(dateString, token, match) {\n switch (token) {\n case 's':\n return parseNumericPattern(numericPatterns.second, dateString);\n\n case 'so':\n return match.ordinalNumber(dateString, {\n unit: 'second'\n });\n\n default:\n return parseNDigits(token.length, dateString);\n }\n }\n }, {\n key: \"validate\",\n value: function validate(_date, value) {\n return value >= 0 && value <= 59;\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCSeconds(value, 0);\n return date;\n }\n }]);\n\n return SecondParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { mapValue, parseNDigits } from \"../utils.js\";\nexport var FractionOfSecondParser = /*#__PURE__*/function (_Parser) {\n _inherits(FractionOfSecondParser, _Parser);\n\n var _super = _createSuper(FractionOfSecondParser);\n\n function FractionOfSecondParser() {\n var _this;\n\n _classCallCheck(this, FractionOfSecondParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 30);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T']);\n\n return _this;\n }\n\n _createClass(FractionOfSecondParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n var valueCallback = function valueCallback(value) {\n return Math.floor(value * Math.pow(10, -token.length + 3));\n };\n\n return mapValue(parseNDigits(token.length, dateString), valueCallback);\n }\n }, {\n key: \"set\",\n value: function set(date, _flags, value) {\n date.setUTCMilliseconds(value);\n return date;\n }\n }]);\n\n return FractionOfSecondParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { timezonePatterns } from \"../constants.js\";\nimport { parseTimezonePattern } from \"../utils.js\"; // Timezone (ISO-8601. +00:00 is `'Z'`)\n\nexport var ISOTimezoneWithZParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOTimezoneWithZParser, _Parser);\n\n var _super = _createSuper(ISOTimezoneWithZParser);\n\n function ISOTimezoneWithZParser() {\n var _this;\n\n _classCallCheck(this, ISOTimezoneWithZParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 10);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T', 'x']);\n\n return _this;\n }\n\n _createClass(ISOTimezoneWithZParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n switch (token) {\n case 'X':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);\n\n case 'XX':\n return parseTimezonePattern(timezonePatterns.basic, dateString);\n\n case 'XXXX':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);\n\n case 'XXXXX':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);\n\n case 'XXX':\n default:\n return parseTimezonePattern(timezonePatterns.extended, dateString);\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n return new Date(date.getTime() - value);\n }\n }]);\n\n return ISOTimezoneWithZParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { timezonePatterns } from \"../constants.js\";\nimport { parseTimezonePattern } from \"../utils.js\"; // Timezone (ISO-8601)\n\nexport var ISOTimezoneParser = /*#__PURE__*/function (_Parser) {\n _inherits(ISOTimezoneParser, _Parser);\n\n var _super = _createSuper(ISOTimezoneParser);\n\n function ISOTimezoneParser() {\n var _this;\n\n _classCallCheck(this, ISOTimezoneParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 10);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", ['t', 'T', 'X']);\n\n return _this;\n }\n\n _createClass(ISOTimezoneParser, [{\n key: \"parse\",\n value: function parse(dateString, token) {\n switch (token) {\n case 'x':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);\n\n case 'xx':\n return parseTimezonePattern(timezonePatterns.basic, dateString);\n\n case 'xxxx':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);\n\n case 'xxxxx':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);\n\n case 'xxx':\n default:\n return parseTimezonePattern(timezonePatterns.extended, dateString);\n }\n }\n }, {\n key: \"set\",\n value: function set(date, flags, value) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n return new Date(date.getTime() - value);\n }\n }]);\n\n return ISOTimezoneParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseAnyDigitsSigned } from \"../utils.js\";\nexport var TimestampSecondsParser = /*#__PURE__*/function (_Parser) {\n _inherits(TimestampSecondsParser, _Parser);\n\n var _super = _createSuper(TimestampSecondsParser);\n\n function TimestampSecondsParser() {\n var _this;\n\n _classCallCheck(this, TimestampSecondsParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 40);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", '*');\n\n return _this;\n }\n\n _createClass(TimestampSecondsParser, [{\n key: \"parse\",\n value: function parse(dateString) {\n return parseAnyDigitsSigned(dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n return [new Date(value * 1000), {\n timestampIsSet: true\n }];\n }\n }]);\n\n return TimestampSecondsParser;\n}(Parser);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Parser } from \"../Parser.js\";\nimport { parseAnyDigitsSigned } from \"../utils.js\";\nexport var TimestampMillisecondsParser = /*#__PURE__*/function (_Parser) {\n _inherits(TimestampMillisecondsParser, _Parser);\n\n var _super = _createSuper(TimestampMillisecondsParser);\n\n function TimestampMillisecondsParser() {\n var _this;\n\n _classCallCheck(this, TimestampMillisecondsParser);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"priority\", 20);\n\n _defineProperty(_assertThisInitialized(_this), \"incompatibleTokens\", '*');\n\n return _this;\n }\n\n _createClass(TimestampMillisecondsParser, [{\n key: \"parse\",\n value: function parse(dateString) {\n return parseAnyDigitsSigned(dateString);\n }\n }, {\n key: \"set\",\n value: function set(_date, _flags, value) {\n return [new Date(value), {\n timestampIsSet: true\n }];\n }\n }]);\n\n return TimestampMillisecondsParser;\n}(Parser);","import { EraParser } from \"./EraParser.js\";\nimport { YearParser } from \"./YearParser.js\";\nimport { LocalWeekYearParser } from \"./LocalWeekYearParser.js\";\nimport { ISOWeekYearParser } from \"./ISOWeekYearParser.js\";\nimport { ExtendedYearParser } from \"./ExtendedYearParser.js\";\nimport { QuarterParser } from \"./QuarterParser.js\";\nimport { StandAloneQuarterParser } from \"./StandAloneQuarterParser.js\";\nimport { MonthParser } from \"./MonthParser.js\";\nimport { StandAloneMonthParser } from \"./StandAloneMonthParser.js\";\nimport { LocalWeekParser } from \"./LocalWeekParser.js\";\nimport { ISOWeekParser } from \"./ISOWeekParser.js\";\nimport { DateParser } from \"./DateParser.js\";\nimport { DayOfYearParser } from \"./DayOfYearParser.js\";\nimport { DayParser } from \"./DayParser.js\";\nimport { LocalDayParser } from \"./LocalDayParser.js\";\nimport { StandAloneLocalDayParser } from \"./StandAloneLocalDayParser.js\";\nimport { ISODayParser } from \"./ISODayParser.js\";\nimport { AMPMParser } from \"./AMPMParser.js\";\nimport { AMPMMidnightParser } from \"./AMPMMidnightParser.js\";\nimport { DayPeriodParser } from \"./DayPeriodParser.js\";\nimport { Hour1to12Parser } from \"./Hour1to12Parser.js\";\nimport { Hour0to23Parser } from \"./Hour0to23Parser.js\";\nimport { Hour0To11Parser } from \"./Hour0To11Parser.js\";\nimport { Hour1To24Parser } from \"./Hour1To24Parser.js\";\nimport { MinuteParser } from \"./MinuteParser.js\";\nimport { SecondParser } from \"./SecondParser.js\";\nimport { FractionOfSecondParser } from \"./FractionOfSecondParser.js\";\nimport { ISOTimezoneWithZParser } from \"./ISOTimezoneWithZParser.js\";\nimport { ISOTimezoneParser } from \"./ISOTimezoneParser.js\";\nimport { TimestampSecondsParser } from \"./TimestampSecondsParser.js\";\nimport { TimestampMillisecondsParser } from \"./TimestampMillisecondsParser.js\";\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O* | Timezone (GMT) |\n * | p | | P | |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n */\n\nexport var parsers = {\n G: new EraParser(),\n y: new YearParser(),\n Y: new LocalWeekYearParser(),\n R: new ISOWeekYearParser(),\n u: new ExtendedYearParser(),\n Q: new QuarterParser(),\n q: new StandAloneQuarterParser(),\n M: new MonthParser(),\n L: new StandAloneMonthParser(),\n w: new LocalWeekParser(),\n I: new ISOWeekParser(),\n d: new DateParser(),\n D: new DayOfYearParser(),\n E: new DayParser(),\n e: new LocalDayParser(),\n c: new StandAloneLocalDayParser(),\n i: new ISODayParser(),\n a: new AMPMParser(),\n b: new AMPMMidnightParser(),\n B: new DayPeriodParser(),\n h: new Hour1to12Parser(),\n H: new Hour0to23Parser(),\n K: new Hour0To11Parser(),\n k: new Hour1To24Parser(),\n m: new MinuteParser(),\n s: new SecondParser(),\n S: new FractionOfSecondParser(),\n X: new ISOTimezoneWithZParser(),\n x: new ISOTimezoneParser(),\n t: new TimestampSecondsParser(),\n T: new TimestampMillisecondsParser()\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nimport defaultLocale from \"../_lib/defaultLocale/index.js\";\nimport subMilliseconds from \"../subMilliseconds/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport assign from \"../_lib/assign/index.js\";\nimport longFormatters from \"../_lib/format/longFormatters/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport { isProtectedDayOfYearToken, isProtectedWeekYearToken, throwProtectedError } from \"../_lib/protectedTokens/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport { DateToSystemTimezoneSetter } from \"./_lib/Setter.js\";\nimport { parsers } from \"./_lib/parsers/index.js\";\nimport { getDefaultOptions } from \"../_lib/defaultOptions/index.js\"; // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\n\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\n\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'([^]*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\nvar notWhitespaceRegExp = /\\S/;\nvar unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n/**\n * @name parse\n * @category Common Helpers\n * @summary Parse the date.\n *\n * @description\n * Return the date parsed from string using the given format string.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters in the format string wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n *\n * Format of the format string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 5 below the table).\n *\n * Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited\n * and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:\n *\n * ```javascript\n * parse('23 AM', 'HH a', new Date())\n * //=> RangeError: The format string mustn't contain `HH` and `a` at the same time\n * ```\n *\n * See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true\n *\n * Accepted format string patterns:\n * | Unit |Prior| Pattern | Result examples | Notes |\n * |---------------------------------|-----|---------|-----------------------------------|-------|\n * | Era | 140 | G..GGG | AD, BC | |\n * | | | GGGG | Anno Domini, Before Christ | 2 |\n * | | | GGGGG | A, B | |\n * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |\n * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | yy | 44, 01, 00, 17 | 4 |\n * | | | yyy | 044, 001, 123, 999 | 4 |\n * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |\n * | | | yyyyy | ... | 2,4 |\n * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |\n * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | YY | 44, 01, 00, 17 | 4,6 |\n * | | | YYY | 044, 001, 123, 999 | 4 |\n * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |\n * | | | YYYYY | ... | 2,4 |\n * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |\n * | | | RR | -43, 01, 00, 17 | 4,5 |\n * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |\n * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |\n * | | | RRRRR | ... | 2,4,5 |\n * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |\n * | | | uu | -43, 01, 99, -99 | 4 |\n * | | | uuu | -043, 001, 123, 999, -999 | 4 |\n * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |\n * | | | uuuuu | ... | 2,4 |\n * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |\n * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | QQ | 01, 02, 03, 04 | |\n * | | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |\n * | | | qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | qq | 01, 02, 03, 04 | |\n * | | | qqq | Q1, Q2, Q3, Q4 | |\n * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | | qqqqq | 1, 2, 3, 4 | 3 |\n * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |\n * | | | Mo | 1st, 2nd, ..., 12th | 5 |\n * | | | MM | 01, 02, ..., 12 | |\n * | | | MMM | Jan, Feb, ..., Dec | |\n * | | | MMMM | January, February, ..., December | 2 |\n * | | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |\n * | | | Lo | 1st, 2nd, ..., 12th | 5 |\n * | | | LL | 01, 02, ..., 12 | |\n * | | | LLL | Jan, Feb, ..., Dec | |\n * | | | LLLL | January, February, ..., December | 2 |\n * | | | LLLLL | J, F, ..., D | |\n * | Local week of year | 100 | w | 1, 2, ..., 53 | |\n * | | | wo | 1st, 2nd, ..., 53th | 5 |\n * | | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |\n * | | | Io | 1st, 2nd, ..., 53th | 5 |\n * | | | II | 01, 02, ..., 53 | 5 |\n * | Day of month | 90 | d | 1, 2, ..., 31 | |\n * | | | do | 1st, 2nd, ..., 31st | 5 |\n * | | | dd | 01, 02, ..., 31 | |\n * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |\n * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |\n * | | | DD | 01, 02, ..., 365, 366 | 7 |\n * | | | DDD | 001, 002, ..., 365, 366 | |\n * | | | DDDD | ... | 2 |\n * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | | EEEEE | M, T, W, T, F, S, S | |\n * | | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |\n * | | | io | 1st, 2nd, ..., 7th | 5 |\n * | | | ii | 01, 02, ..., 07 | 5 |\n * | | | iii | Mon, Tue, Wed, ..., Sun | 5 |\n * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |\n * | | | iiiii | M, T, W, T, F, S, S | 5 |\n * | | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 5 |\n * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |\n * | | | eo | 2nd, 3rd, ..., 1st | 5 |\n * | | | ee | 02, 03, ..., 01 | |\n * | | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | | eeeee | M, T, W, T, F, S, S | |\n * | | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |\n * | | | co | 2nd, 3rd, ..., 1st | 5 |\n * | | | cc | 02, 03, ..., 01 | |\n * | | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | | ccccc | M, T, W, T, F, S, S | |\n * | | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | 80 | a..aaa | AM, PM | |\n * | | | aaaa | a.m., p.m. | 2 |\n * | | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |\n * | | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | | bbbbb | a, p, n, mi | |\n * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |\n * | | | BBBB | at night, in the morning, ... | 2 |\n * | | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |\n * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |\n * | | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |\n * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |\n * | | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |\n * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |\n * | | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |\n * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |\n * | | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | 60 | m | 0, 1, ..., 59 | |\n * | | | mo | 0th, 1st, ..., 59th | 5 |\n * | | | mm | 00, 01, ..., 59 | |\n * | Second | 50 | s | 0, 1, ..., 59 | |\n * | | | so | 0th, 1st, ..., 59th | 5 |\n * | | | ss | 00, 01, ..., 59 | |\n * | Seconds timestamp | 40 | t | 512969520 | |\n * | | | tt | ... | 2 |\n * | Fraction of second | 30 | S | 0, 1, ..., 9 | |\n * | | | SS | 00, 01, ..., 99 | |\n * | | | SSS | 000, 001, ..., 999 | |\n * | | | SSSS | ... | 2 |\n * | Milliseconds timestamp | 20 | T | 512969520900 | |\n * | | | TT | ... | 2 |\n * | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |\n * | | | XX | -0800, +0530, Z | |\n * | | | XXX | -08:00, +05:30, Z | |\n * | | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |\n * | | | xx | -0800, +0530, +0000 | |\n * | | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Long localized date | NA | P | 05/29/1453 | 5,8 |\n * | | | PP | May 29, 1453 | |\n * | | | PPP | May 29th, 1453 | |\n * | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |\n * | Long localized time | NA | p | 12:00 AM | 5,8 |\n * | | | pp | 12:00:00 AM | |\n * | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |\n * | | | PPpp | May 29, 1453, 12:00:00 AM | |\n * | | | PPPpp | May 29th, 1453 at ... | |\n * | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular.\n * In `format` function, they will produce different result:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * `parse` will try to match both formatting and stand-alone units interchangably.\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table:\n * - for numerical units (`yyyyyyyy`) `parse` will try to match a number\n * as wide as the sequence\n * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.\n * These variations are marked with \"2\" in the last column of the table.\n *\n * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 4. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:\n *\n * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`\n *\n * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`\n *\n * while `uu` will just assign the year as is:\n *\n * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`\n *\n * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}\n * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).\n *\n * 5. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based\n * on the given locale.\n *\n * using `en-US` locale: `P` => `MM/dd/yyyy`\n * using `en-US` locale: `p` => `hh:mm a`\n * using `pt-BR` locale: `P` => `dd/MM/yyyy`\n * using `pt-BR` locale: `p` => `HH:mm`\n *\n * Values will be assigned to the date in the descending order of its unit's priority.\n * Units of an equal priority overwrite each other in the order of appearance.\n *\n * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),\n * the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.\n *\n * `referenceDate` must be passed for correct work of the function.\n * If you're not sure which `referenceDate` to supply, create a new instance of Date:\n * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`\n * In this case parsing will be done in the context of the current date.\n * If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,\n * then `Invalid Date` will be returned.\n *\n * The result may vary by locale.\n *\n * If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.\n *\n * If parsing failed, `Invalid Date` will be returned.\n * Invalid Date is a Date, whose time value is NaN.\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {String} dateString - the string to parse\n * @param {String} formatString - the string of tokens\n * @param {Date|Number} referenceDate - defines values missing from the parsed dateString\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;\n * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @returns {Date} the parsed date\n * @throws {TypeError} 3 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.locale` must contain `match` property\n * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws {RangeError} format string contains an unescaped latin alphabet character\n *\n * @example\n * // Parse 11 February 2014 from middle-endian format:\n * var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())\n * //=> Tue Feb 11 2014 00:00:00\n *\n * @example\n * // Parse 28th of February in Esperanto locale in the context of 2010 year:\n * import eo from 'date-fns/locale/eo'\n * var result = parse('28-a de februaro', \"do 'de' MMMM\", new Date(2010, 0, 1), {\n * locale: eo\n * })\n * //=> Sun Feb 28 2010 00:00:00\n */\n\nexport default function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, options) {\n var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;\n\n requiredArgs(3, arguments);\n var dateString = String(dirtyDateString);\n var formatString = String(dirtyFormatString);\n var defaultOptions = getDefaultOptions();\n var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;\n\n if (!locale.match) {\n throw new RangeError('locale must contain match property');\n }\n\n var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n if (formatString === '') {\n if (dateString === '') {\n return toDate(dirtyReferenceDate);\n } else {\n return new Date(NaN);\n }\n }\n\n var subFnOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale\n }; // If timezone isn't specified, it will be set to the system timezone\n\n var setters = [new DateToSystemTimezoneSetter()];\n var tokens = formatString.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n\n if (firstCharacter in longFormatters) {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n\n return substring;\n }).join('').match(formattingTokensRegExp);\n var usedTokens = [];\n\n var _iterator = _createForOfIteratorHelper(tokens),\n _step;\n\n try {\n var _loop = function _loop() {\n var token = _step.value;\n\n if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token)) {\n throwProtectedError(token, formatString, dirtyDateString);\n }\n\n if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {\n throwProtectedError(token, formatString, dirtyDateString);\n }\n\n var firstCharacter = token[0];\n var parser = parsers[firstCharacter];\n\n if (parser) {\n var incompatibleTokens = parser.incompatibleTokens;\n\n if (Array.isArray(incompatibleTokens)) {\n var incompatibleToken = usedTokens.find(function (usedToken) {\n return incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter;\n });\n\n if (incompatibleToken) {\n throw new RangeError(\"The format string mustn't contain `\".concat(incompatibleToken.fullToken, \"` and `\").concat(token, \"` at the same time\"));\n }\n } else if (parser.incompatibleTokens === '*' && usedTokens.length > 0) {\n throw new RangeError(\"The format string mustn't contain `\".concat(token, \"` and any other token at the same time\"));\n }\n\n usedTokens.push({\n token: firstCharacter,\n fullToken: token\n });\n var parseResult = parser.run(dateString, token, locale.match, subFnOptions);\n\n if (!parseResult) {\n return {\n v: new Date(NaN)\n };\n }\n\n setters.push(parseResult.setter);\n dateString = parseResult.rest;\n } else {\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');\n } // Replace two single quote characters with one single quote character\n\n\n if (token === \"''\") {\n token = \"'\";\n } else if (firstCharacter === \"'\") {\n token = cleanEscapedString(token);\n } // Cut token from string, or, if string doesn't match the token, return Invalid Date\n\n\n if (dateString.indexOf(token) === 0) {\n dateString = dateString.slice(token.length);\n } else {\n return {\n v: new Date(NaN)\n };\n }\n }\n };\n\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var _ret = _loop();\n\n if (_typeof(_ret) === \"object\") return _ret.v;\n } // Check if the remaining input contains something other than whitespace\n\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {\n return new Date(NaN);\n }\n\n var uniquePrioritySetters = setters.map(function (setter) {\n return setter.priority;\n }).sort(function (a, b) {\n return b - a;\n }).filter(function (priority, index, array) {\n return array.indexOf(priority) === index;\n }).map(function (priority) {\n return setters.filter(function (setter) {\n return setter.priority === priority;\n }).sort(function (a, b) {\n return b.subPriority - a.subPriority;\n });\n }).map(function (setterArray) {\n return setterArray[0];\n });\n var date = toDate(dirtyReferenceDate);\n\n if (isNaN(date.getTime())) {\n return new Date(NaN);\n } // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n\n\n var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));\n var flags = {};\n\n var _iterator2 = _createForOfIteratorHelper(uniquePrioritySetters),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var setter = _step2.value;\n\n if (!setter.validate(utcDate, subFnOptions)) {\n return new Date(NaN);\n }\n\n var result = setter.set(utcDate, flags, subFnOptions); // Result is tuple (date, flags)\n\n if (Array.isArray(result)) {\n utcDate = result[0];\n assign(flags, result[1]); // Result is date\n } else {\n utcDate = result;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n\n return utcDate;\n}\n\nfunction cleanEscapedString(input) {\n return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, \"'\");\n}","import { millisecondsInHour, millisecondsInMinute } from \"../constants/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name parseISO\n * @category Common Helpers\n * @summary Parse ISO string\n *\n * @description\n * Parse the given string in ISO 8601 format and return an instance of Date.\n *\n * Function accepts complete ISO 8601 formats as well as partial implementations.\n * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601\n *\n * If the argument isn't a string, the function cannot parse the string or\n * the values are invalid, it returns Invalid Date.\n *\n * @param {String} argument - the value to convert\n * @param {Object} [options] - an object with options.\n * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Convert string '2014-02-11T11:30:30' to date:\n * const result = parseISO('2014-02-11T11:30:30')\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert string '+02014101' to date,\n * // if the additional number of digits in the extended year format is 1:\n * const result = parseISO('+02014101', { additionalDigits: 1 })\n * //=> Fri Apr 11 2014 00:00:00\n */\n\nexport default function parseISO(argument, options) {\n var _options$additionalDi;\n\n requiredArgs(1, arguments);\n var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);\n\n if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {\n throw new RangeError('additionalDigits must be 0, 1 or 2');\n }\n\n if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {\n return new Date(NaN);\n }\n\n var dateStrings = splitDateString(argument);\n var date;\n\n if (dateStrings.date) {\n var parseYearResult = parseYear(dateStrings.date, additionalDigits);\n date = parseDate(parseYearResult.restDateString, parseYearResult.year);\n }\n\n if (!date || isNaN(date.getTime())) {\n return new Date(NaN);\n }\n\n var timestamp = date.getTime();\n var time = 0;\n var offset;\n\n if (dateStrings.time) {\n time = parseTime(dateStrings.time);\n\n if (isNaN(time)) {\n return new Date(NaN);\n }\n }\n\n if (dateStrings.timezone) {\n offset = parseTimezone(dateStrings.timezone);\n\n if (isNaN(offset)) {\n return new Date(NaN);\n }\n } else {\n var dirtyDate = new Date(timestamp + time); // js parsed string assuming it's in UTC timezone\n // but we need it to be parsed in our timezone\n // so we use utc values to build date in our timezone.\n // Year values from 0 to 99 map to the years 1900 to 1999\n // so set year explicitly with setFullYear.\n\n var result = new Date(0);\n result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());\n result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());\n return result;\n }\n\n return new Date(timestamp + time + offset);\n}\nvar patterns = {\n dateTimeDelimiter: /[T ]/,\n timeZoneDelimiter: /[Z ]/i,\n timezone: /([Z+-].*)$/\n};\nvar dateRegex = /^-?(?:(\\d{3})|(\\d{2})(?:-?(\\d{2}))?|W(\\d{2})(?:-?(\\d{1}))?|)$/;\nvar timeRegex = /^(\\d{2}(?:[.,]\\d*)?)(?::?(\\d{2}(?:[.,]\\d*)?))?(?::?(\\d{2}(?:[.,]\\d*)?))?$/;\nvar timezoneRegex = /^([+-])(\\d{2})(?::?(\\d{2}))?$/;\n\nfunction splitDateString(dateString) {\n var dateStrings = {};\n var array = dateString.split(patterns.dateTimeDelimiter);\n var timeString; // The regex match should only return at maximum two array elements.\n // [date], [time], or [date, time].\n\n if (array.length > 2) {\n return dateStrings;\n }\n\n if (/:/.test(array[0])) {\n timeString = array[0];\n } else {\n dateStrings.date = array[0];\n timeString = array[1];\n\n if (patterns.timeZoneDelimiter.test(dateStrings.date)) {\n dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];\n timeString = dateString.substr(dateStrings.date.length, dateString.length);\n }\n }\n\n if (timeString) {\n var token = patterns.timezone.exec(timeString);\n\n if (token) {\n dateStrings.time = timeString.replace(token[1], '');\n dateStrings.timezone = token[1];\n } else {\n dateStrings.time = timeString;\n }\n }\n\n return dateStrings;\n}\n\nfunction parseYear(dateString, additionalDigits) {\n var regex = new RegExp('^(?:(\\\\d{4}|[+-]\\\\d{' + (4 + additionalDigits) + '})|(\\\\d{2}|[+-]\\\\d{' + (2 + additionalDigits) + '})$)');\n var captures = dateString.match(regex); // Invalid ISO-formatted year\n\n if (!captures) return {\n year: NaN,\n restDateString: ''\n };\n var year = captures[1] ? parseInt(captures[1]) : null;\n var century = captures[2] ? parseInt(captures[2]) : null; // either year or century is null, not both\n\n return {\n year: century === null ? year : century * 100,\n restDateString: dateString.slice((captures[1] || captures[2]).length)\n };\n}\n\nfunction parseDate(dateString, year) {\n // Invalid ISO-formatted year\n if (year === null) return new Date(NaN);\n var captures = dateString.match(dateRegex); // Invalid ISO-formatted string\n\n if (!captures) return new Date(NaN);\n var isWeekDate = !!captures[4];\n var dayOfYear = parseDateUnit(captures[1]);\n var month = parseDateUnit(captures[2]) - 1;\n var day = parseDateUnit(captures[3]);\n var week = parseDateUnit(captures[4]);\n var dayOfWeek = parseDateUnit(captures[5]) - 1;\n\n if (isWeekDate) {\n if (!validateWeekDate(year, week, dayOfWeek)) {\n return new Date(NaN);\n }\n\n return dayOfISOWeekYear(year, week, dayOfWeek);\n } else {\n var date = new Date(0);\n\n if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {\n return new Date(NaN);\n }\n\n date.setUTCFullYear(year, month, Math.max(dayOfYear, day));\n return date;\n }\n}\n\nfunction parseDateUnit(value) {\n return value ? parseInt(value) : 1;\n}\n\nfunction parseTime(timeString) {\n var captures = timeString.match(timeRegex);\n if (!captures) return NaN; // Invalid ISO-formatted time\n\n var hours = parseTimeUnit(captures[1]);\n var minutes = parseTimeUnit(captures[2]);\n var seconds = parseTimeUnit(captures[3]);\n\n if (!validateTime(hours, minutes, seconds)) {\n return NaN;\n }\n\n return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;\n}\n\nfunction parseTimeUnit(value) {\n return value && parseFloat(value.replace(',', '.')) || 0;\n}\n\nfunction parseTimezone(timezoneString) {\n if (timezoneString === 'Z') return 0;\n var captures = timezoneString.match(timezoneRegex);\n if (!captures) return 0;\n var sign = captures[1] === '+' ? -1 : 1;\n var hours = parseInt(captures[2]);\n var minutes = captures[3] && parseInt(captures[3]) || 0;\n\n if (!validateTimezone(hours, minutes)) {\n return NaN;\n }\n\n return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);\n}\n\nfunction dayOfISOWeekYear(isoWeekYear, week, day) {\n var date = new Date(0);\n date.setUTCFullYear(isoWeekYear, 0, 4);\n var fourthOfJanuaryDay = date.getUTCDay() || 7;\n var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n} // Validation functions\n// February is null to handle the leap year (using ||)\n\n\nvar daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\nfunction isLeapYearIndex(year) {\n return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}\n\nfunction validateDate(year, month, date) {\n return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));\n}\n\nfunction validateDayOfYearDate(year, dayOfYear) {\n return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);\n}\n\nfunction validateWeekDate(_year, week, day) {\n return week >= 1 && week <= 53 && day >= 0 && day <= 6;\n}\n\nfunction validateTime(hours, minutes, seconds) {\n if (hours === 24) {\n return minutes === 0 && seconds === 0;\n }\n\n return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;\n}\n\nfunction validateTimezone(_hours, minutes) {\n return minutes >= 0 && minutes <= 59;\n}","import {createElement,Component}from'react';import {findDOMNode}from'react-dom';function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n\n _setPrototypeOf(subClass, superClass);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}/**\n * Check whether some DOM node is our Component's node.\n */\nfunction isNodeFound(current, componentNode, ignoreClass) {\n if (current === componentNode) {\n return true;\n } // SVG elements do not technically reside in the rendered DOM, so\n // they do not have classList directly, but they offer a link to their\n // corresponding element, which can have classList. This extra check is for\n // that case.\n // See: http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGUseElement\n // Discussion: https://github.com/Pomax/react-onclickoutside/pull/17\n\n\n if (current.correspondingElement) {\n return current.correspondingElement.classList.contains(ignoreClass);\n }\n\n return current.classList.contains(ignoreClass);\n}\n/**\n * Try to find our node in a hierarchy of nodes, returning the document\n * node as highest node if our node is not found in the path up.\n */\n\nfunction findHighest(current, componentNode, ignoreClass) {\n if (current === componentNode) {\n return true;\n } // If source=local then this event came from 'somewhere'\n // inside and should be ignored. We could handle this with\n // a layered approach, too, but that requires going back to\n // thinking in terms of Dom node nesting, running counter\n // to React's 'you shouldn't care about the DOM' philosophy.\n // Also cover shadowRoot node by checking current.host\n\n\n while (current.parentNode || current.host) {\n // Only check normal node without shadowRoot\n if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {\n return true;\n }\n\n current = current.parentNode || current.host;\n }\n\n return current;\n}\n/**\n * Check if the browser scrollbar was clicked\n */\n\nfunction clickedScrollbar(evt) {\n return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;\n}// ideally will get replaced with external dep\n// when rafrex/detect-passive-events#4 and rafrex/detect-passive-events#5 get merged in\nvar testPassiveEventSupport = function testPassiveEventSupport() {\n if (typeof window === 'undefined' || typeof window.addEventListener !== 'function') {\n return;\n }\n\n var passive = false;\n var options = Object.defineProperty({}, 'passive', {\n get: function get() {\n passive = true;\n }\n });\n\n var noop = function noop() {};\n\n window.addEventListener('testPassiveEventSupport', noop, options);\n window.removeEventListener('testPassiveEventSupport', noop, options);\n return passive;\n};function autoInc(seed) {\n if (seed === void 0) {\n seed = 0;\n }\n\n return function () {\n return ++seed;\n };\n}\n\nvar uid = autoInc();var passiveEventSupport;\nvar handlersMap = {};\nvar enabledInstances = {};\nvar touchEvents = ['touchstart', 'touchmove'];\nvar IGNORE_CLASS_NAME = 'ignore-react-onclickoutside';\n/**\n * Options for addEventHandler and removeEventHandler\n */\n\nfunction getEventHandlerOptions(instance, eventName) {\n var handlerOptions = null;\n var isTouchEvent = touchEvents.indexOf(eventName) !== -1;\n\n if (isTouchEvent && passiveEventSupport) {\n handlerOptions = {\n passive: !instance.props.preventDefault\n };\n }\n\n return handlerOptions;\n}\n/**\n * This function generates the HOC function that you'll use\n * in order to impart onOutsideClick listening to an\n * arbitrary component. It gets called at the end of the\n * bootstrapping code to yield an instance of the\n * onClickOutsideHOC function defined inside setupHOC().\n */\n\n\nfunction onClickOutsideHOC(WrappedComponent, config) {\n var _class, _temp;\n\n var componentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';\n return _temp = _class = /*#__PURE__*/function (_Component) {\n _inheritsLoose(onClickOutside, _Component);\n\n function onClickOutside(props) {\n var _this;\n\n _this = _Component.call(this, props) || this;\n\n _this.__outsideClickHandler = function (event) {\n if (typeof _this.__clickOutsideHandlerProp === 'function') {\n _this.__clickOutsideHandlerProp(event);\n\n return;\n }\n\n var instance = _this.getInstance();\n\n if (typeof instance.props.handleClickOutside === 'function') {\n instance.props.handleClickOutside(event);\n return;\n }\n\n if (typeof instance.handleClickOutside === 'function') {\n instance.handleClickOutside(event);\n return;\n }\n\n throw new Error(\"WrappedComponent: \" + componentName + \" lacks a handleClickOutside(event) function for processing outside click events.\");\n };\n\n _this.__getComponentNode = function () {\n var instance = _this.getInstance();\n\n if (config && typeof config.setClickOutsideRef === 'function') {\n return config.setClickOutsideRef()(instance);\n }\n\n if (typeof instance.setClickOutsideRef === 'function') {\n return instance.setClickOutsideRef();\n }\n\n return findDOMNode(instance);\n };\n\n _this.enableOnClickOutside = function () {\n if (typeof document === 'undefined' || enabledInstances[_this._uid]) {\n return;\n }\n\n if (typeof passiveEventSupport === 'undefined') {\n passiveEventSupport = testPassiveEventSupport();\n }\n\n enabledInstances[_this._uid] = true;\n var events = _this.props.eventTypes;\n\n if (!events.forEach) {\n events = [events];\n }\n\n handlersMap[_this._uid] = function (event) {\n if (_this.componentNode === null) return;\n\n if (_this.props.preventDefault) {\n event.preventDefault();\n }\n\n if (_this.props.stopPropagation) {\n event.stopPropagation();\n }\n\n if (_this.props.excludeScrollbar && clickedScrollbar(event)) return;\n var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;\n\n if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {\n return;\n }\n\n _this.__outsideClickHandler(event);\n };\n\n events.forEach(function (eventName) {\n document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));\n });\n };\n\n _this.disableOnClickOutside = function () {\n delete enabledInstances[_this._uid];\n var fn = handlersMap[_this._uid];\n\n if (fn && typeof document !== 'undefined') {\n var events = _this.props.eventTypes;\n\n if (!events.forEach) {\n events = [events];\n }\n\n events.forEach(function (eventName) {\n return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));\n });\n delete handlersMap[_this._uid];\n }\n };\n\n _this.getRef = function (ref) {\n return _this.instanceRef = ref;\n };\n\n _this._uid = uid();\n return _this;\n }\n /**\n * Access the WrappedComponent's instance.\n */\n\n\n var _proto = onClickOutside.prototype;\n\n _proto.getInstance = function getInstance() {\n if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {\n return this;\n }\n\n var ref = this.instanceRef;\n return ref.getInstance ? ref.getInstance() : ref;\n };\n\n /**\n * Add click listeners to the current document,\n * linked to this component's state.\n */\n _proto.componentDidMount = function componentDidMount() {\n // If we are in an environment without a DOM such\n // as shallow rendering or snapshots then we exit\n // early to prevent any unhandled errors being thrown.\n if (typeof document === 'undefined' || !document.createElement) {\n return;\n }\n\n var instance = this.getInstance();\n\n if (config && typeof config.handleClickOutside === 'function') {\n this.__clickOutsideHandlerProp = config.handleClickOutside(instance);\n\n if (typeof this.__clickOutsideHandlerProp !== 'function') {\n throw new Error(\"WrappedComponent: \" + componentName + \" lacks a function for processing outside click events specified by the handleClickOutside config option.\");\n }\n }\n\n this.componentNode = this.__getComponentNode(); // return early so we dont initiate onClickOutside\n\n if (this.props.disableOnClickOutside) return;\n this.enableOnClickOutside();\n };\n\n _proto.componentDidUpdate = function componentDidUpdate() {\n this.componentNode = this.__getComponentNode();\n }\n /**\n * Remove all document's event listeners for this component\n */\n ;\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.disableOnClickOutside();\n }\n /**\n * Can be called to explicitly enable event listening\n * for clicks and touches outside of this element.\n */\n ;\n\n /**\n * Pass-through render\n */\n _proto.render = function render() {\n // eslint-disable-next-line no-unused-vars\n var _this$props = this.props;\n _this$props.excludeScrollbar;\n var props = _objectWithoutPropertiesLoose(_this$props, [\"excludeScrollbar\"]);\n\n if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {\n props.ref = this.getRef;\n } else {\n props.wrappedRef = this.getRef;\n }\n\n props.disableOnClickOutside = this.disableOnClickOutside;\n props.enableOnClickOutside = this.enableOnClickOutside;\n return createElement(WrappedComponent, props);\n };\n\n return onClickOutside;\n }(Component), _class.displayName = \"OnClickOutside(\" + componentName + \")\", _class.defaultProps = {\n eventTypes: ['mousedown', 'touchstart'],\n excludeScrollbar: config && config.excludeScrollbar || false,\n outsideClickIgnoreClass: IGNORE_CLASS_NAME,\n preventDefault: false,\n stopPropagation: false\n }, _class.getClass = function () {\n return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;\n }, _temp;\n}export default onClickOutsideHOC;export{IGNORE_CLASS_NAME};","import * as React from 'react';\nexport var ManagerReferenceNodeContext = React.createContext();\nexport var ManagerReferenceNodeSetterContext = React.createContext();\nexport function Manager(_ref) {\n var children = _ref.children;\n\n var _React$useState = React.useState(null),\n referenceNode = _React$useState[0],\n setReferenceNode = _React$useState[1];\n\n var hasUnmounted = React.useRef(false);\n React.useEffect(function () {\n return function () {\n hasUnmounted.current = true;\n };\n }, []);\n var handleSetReferenceNode = React.useCallback(function (node) {\n if (!hasUnmounted.current) {\n setReferenceNode(node);\n }\n }, []);\n return /*#__PURE__*/React.createElement(ManagerReferenceNodeContext.Provider, {\n value: referenceNode\n }, /*#__PURE__*/React.createElement(ManagerReferenceNodeSetterContext.Provider, {\n value: handleSetReferenceNode\n }, children));\n}","import * as React from 'react';\n\n/**\n * Takes an argument and if it's an array, returns the first item in the array,\n * otherwise returns the argument. Used for Preact compatibility.\n */\nexport var unwrapArray = function unwrapArray(arg) {\n return Array.isArray(arg) ? arg[0] : arg;\n};\n/**\n * Takes a maybe-undefined function and arbitrary args and invokes the function\n * only if it is defined.\n */\n\nexport var safeInvoke = function safeInvoke(fn) {\n if (typeof fn === 'function') {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return fn.apply(void 0, args);\n }\n};\n/**\n * Sets a ref using either a ref callback or a ref object\n */\n\nexport var setRef = function setRef(ref, node) {\n // if its a function call it\n if (typeof ref === 'function') {\n return safeInvoke(ref, node);\n } // otherwise we should treat it as a ref object\n else if (ref != null) {\n ref.current = node;\n }\n};\n/**\n * Simple ponyfill for Object.fromEntries\n */\n\nexport var fromEntries = function fromEntries(entries) {\n return entries.reduce(function (acc, _ref) {\n var key = _ref[0],\n value = _ref[1];\n acc[key] = value;\n return acc;\n }, {});\n};\n/**\n * Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs\n */\n\nexport var useIsomorphicLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? React.useLayoutEffect : React.useEffect;","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}","import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","export default function getUAString() {\n var uaData = navigator.userAgentData;\n\n if (uaData != null && uaData.brands) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n\n return navigator.userAgent;\n}","import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}","import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n if (!isHTMLElement(arrowElement)) {\n console.error(['Popper: \"arrow\" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: \"arrow\" modifier\\'s `element` must be a child of the popper', 'element.'].join(' '));\n }\n\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref) {\n var x = _ref.x,\n y = _ref.y;\n var win = window;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n\n if (process.env.NODE_ENV !== \"production\") {\n var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';\n\n if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {\n return transitionProperty.indexOf(property) >= 0;\n })) {\n console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: \"transform\", \"top\", \"right\", \"bottom\", \"left\".', '\\n\\n', 'Disable the \"computeStyles\" modifier\\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\\n\\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));\n }\n }\n\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}","import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, \"auto\" cannot be used to allow \"bottom-start\".', 'Use \"auto-start\" instead.'].join(' '));\n }\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport getComputedStyle from \"./dom-utils/getComputedStyle.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport validateModifiers from \"./utils/validateModifiers.js\";\nimport uniqueBy from \"./utils/uniqueBy.js\";\nimport getBasePlacement from \"./utils/getBasePlacement.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nimport { auto } from \"./enums.js\";\nvar INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';\nvar INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n }); // Validate the provided modifiers so that the consumer will get warned\n // if one of the modifiers is invalid for any reason\n\n if (process.env.NODE_ENV !== \"production\") {\n var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {\n var name = _ref.name;\n return name;\n });\n validateModifiers(modifiers);\n\n if (getBasePlacement(state.options.placement) === auto) {\n var flipModifier = state.orderedModifiers.find(function (_ref2) {\n var name = _ref2.name;\n return name === 'flip';\n });\n\n if (!flipModifier) {\n console.error(['Popper: \"auto\" placements require the \"flip\" modifier be', 'present and enabled to work.'].join(' '));\n }\n }\n\n var _getComputedStyle = getComputedStyle(popper),\n marginTop = _getComputedStyle.marginTop,\n marginRight = _getComputedStyle.marginRight,\n marginBottom = _getComputedStyle.marginBottom,\n marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can\n // cause bugs with positioning, so we'll warn the consumer\n\n\n if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {\n return parseFloat(margin);\n })) {\n console.warn(['Popper: CSS \"margin\" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));\n }\n }\n\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n var __debug_loops__ = 0;\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (process.env.NODE_ENV !== \"production\") {\n __debug_loops__ += 1;\n\n if (__debug_loops__ > 100) {\n console.error(INFINITE_LOOP_ERROR);\n break;\n }\n }\n\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref3) {\n var name = _ref3.name,\n _ref3$options = _ref3.options,\n options = _ref3$options === void 0 ? {} : _ref3$options,\n effect = _ref3.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","/* global Map:readonly, Set:readonly, ArrayBuffer:readonly */\n\nvar hasElementType = typeof Element !== 'undefined';\nvar hasMap = typeof Map === 'function';\nvar hasSet = typeof Set === 'function';\nvar hasArrayBuffer = typeof ArrayBuffer === 'function' && !!ArrayBuffer.isView;\n\n// Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js\n\nfunction equal(a, b) {\n // START: fast-deep-equal es6/index.js 3.1.1\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n // START: Modifications:\n // 1. Extra `has &&` helpers in initial condition allow es6 code\n // to co-exist with es5.\n // 2. Replace `for of` with es5 compliant iteration using `for`.\n // Basically, take:\n //\n // ```js\n // for (i of a.entries())\n // if (!b.has(i[0])) return false;\n // ```\n //\n // ... and convert to:\n //\n // ```js\n // it = a.entries();\n // while (!(i = it.next()).done)\n // if (!b.has(i.value[0])) return false;\n // ```\n //\n // **Note**: `i` access switches to `i.value`.\n var it;\n if (hasMap && (a instanceof Map) && (b instanceof Map)) {\n if (a.size !== b.size) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!b.has(i.value[0])) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!equal(i.value[1], b.get(i.value[0]))) return false;\n return true;\n }\n\n if (hasSet && (a instanceof Set) && (b instanceof Set)) {\n if (a.size !== b.size) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!b.has(i.value[0])) return false;\n return true;\n }\n // END: Modifications\n\n if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i]) return false;\n return true;\n }\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n // END: fast-deep-equal\n\n // START: react-fast-compare\n // custom handling for DOM elements\n if (hasElementType && a instanceof Element) return false;\n\n // custom handling for React/Preact\n for (i = length; i-- !== 0;) {\n if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {\n // React-specific: avoid traversing React elements' _owner\n // Preact-specific: avoid traversing Preact elements' __v and __o\n // __v = $_original / $_vnode\n // __o = $_owner\n // These properties contain circular references and are not needed when\n // comparing the actual elements (and not their owners)\n // .$$typeof and ._store on just reasonable markers of elements\n\n continue;\n }\n\n // all other properties should be traversed as usual\n if (!equal(a[keys[i]], b[keys[i]])) return false;\n }\n // END: react-fast-compare\n\n // START: fast-deep-equal\n return true;\n }\n\n return a !== a && b !== b;\n}\n// end fast-deep-equal\n\nmodule.exports = function isEqual(a, b) {\n try {\n return equal(a, b);\n } catch (error) {\n if (((error.message || '').match(/stack|recursion/i))) {\n // warn on circular references, don't crash\n // browsers give this different errors name and messages:\n // chrome/safari: \"RangeError\", \"Maximum call stack size exceeded\"\n // firefox: \"InternalError\", too much recursion\"\n // edge: \"Error\", \"Out of stack space\"\n console.warn('react-fast-compare cannot handle circular refs');\n return false;\n }\n // some other error. we should definitely know about these\n throw error;\n }\n};\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { createPopper as defaultCreatePopper } from '@popperjs/core';\nimport isEqual from 'react-fast-compare';\nimport { fromEntries, useIsomorphicLayoutEffect } from './utils';\nvar EMPTY_MODIFIERS = [];\nexport var usePopper = function usePopper(referenceElement, popperElement, options) {\n if (options === void 0) {\n options = {};\n }\n\n var prevOptions = React.useRef(null);\n var optionsWithDefaults = {\n onFirstUpdate: options.onFirstUpdate,\n placement: options.placement || 'bottom',\n strategy: options.strategy || 'absolute',\n modifiers: options.modifiers || EMPTY_MODIFIERS\n };\n\n var _React$useState = React.useState({\n styles: {\n popper: {\n position: optionsWithDefaults.strategy,\n left: '0',\n top: '0'\n },\n arrow: {\n position: 'absolute'\n }\n },\n attributes: {}\n }),\n state = _React$useState[0],\n setState = _React$useState[1];\n\n var updateStateModifier = React.useMemo(function () {\n return {\n name: 'updateState',\n enabled: true,\n phase: 'write',\n fn: function fn(_ref) {\n var state = _ref.state;\n var elements = Object.keys(state.elements);\n ReactDOM.flushSync(function () {\n setState({\n styles: fromEntries(elements.map(function (element) {\n return [element, state.styles[element] || {}];\n })),\n attributes: fromEntries(elements.map(function (element) {\n return [element, state.attributes[element]];\n }))\n });\n });\n },\n requires: ['computeStyles']\n };\n }, []);\n var popperOptions = React.useMemo(function () {\n var newOptions = {\n onFirstUpdate: optionsWithDefaults.onFirstUpdate,\n placement: optionsWithDefaults.placement,\n strategy: optionsWithDefaults.strategy,\n modifiers: [].concat(optionsWithDefaults.modifiers, [updateStateModifier, {\n name: 'applyStyles',\n enabled: false\n }])\n };\n\n if (isEqual(prevOptions.current, newOptions)) {\n return prevOptions.current || newOptions;\n } else {\n prevOptions.current = newOptions;\n return newOptions;\n }\n }, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);\n var popperInstanceRef = React.useRef();\n useIsomorphicLayoutEffect(function () {\n if (popperInstanceRef.current) {\n popperInstanceRef.current.setOptions(popperOptions);\n }\n }, [popperOptions]);\n useIsomorphicLayoutEffect(function () {\n if (referenceElement == null || popperElement == null) {\n return;\n }\n\n var createPopper = options.createPopper || defaultCreatePopper;\n var popperInstance = createPopper(referenceElement, popperElement, popperOptions);\n popperInstanceRef.current = popperInstance;\n return function () {\n popperInstance.destroy();\n popperInstanceRef.current = null;\n };\n }, [referenceElement, popperElement, options.createPopper]);\n return {\n state: popperInstanceRef.current ? popperInstanceRef.current.state : null,\n styles: state.styles,\n attributes: state.attributes,\n update: popperInstanceRef.current ? popperInstanceRef.current.update : null,\n forceUpdate: popperInstanceRef.current ? popperInstanceRef.current.forceUpdate : null\n };\n};","import * as React from 'react';\nimport { ManagerReferenceNodeContext } from './Manager';\nimport { unwrapArray, setRef } from './utils';\nimport { usePopper } from './usePopper';\n\nvar NOOP = function NOOP() {\n return void 0;\n};\n\nvar NOOP_PROMISE = function NOOP_PROMISE() {\n return Promise.resolve(null);\n};\n\nvar EMPTY_MODIFIERS = [];\nexport function Popper(_ref) {\n var _ref$placement = _ref.placement,\n placement = _ref$placement === void 0 ? 'bottom' : _ref$placement,\n _ref$strategy = _ref.strategy,\n strategy = _ref$strategy === void 0 ? 'absolute' : _ref$strategy,\n _ref$modifiers = _ref.modifiers,\n modifiers = _ref$modifiers === void 0 ? EMPTY_MODIFIERS : _ref$modifiers,\n referenceElement = _ref.referenceElement,\n onFirstUpdate = _ref.onFirstUpdate,\n innerRef = _ref.innerRef,\n children = _ref.children;\n var referenceNode = React.useContext(ManagerReferenceNodeContext);\n\n var _React$useState = React.useState(null),\n popperElement = _React$useState[0],\n setPopperElement = _React$useState[1];\n\n var _React$useState2 = React.useState(null),\n arrowElement = _React$useState2[0],\n setArrowElement = _React$useState2[1];\n\n React.useEffect(function () {\n setRef(innerRef, popperElement);\n }, [innerRef, popperElement]);\n var options = React.useMemo(function () {\n return {\n placement: placement,\n strategy: strategy,\n onFirstUpdate: onFirstUpdate,\n modifiers: [].concat(modifiers, [{\n name: 'arrow',\n enabled: arrowElement != null,\n options: {\n element: arrowElement\n }\n }])\n };\n }, [placement, strategy, onFirstUpdate, modifiers, arrowElement]);\n\n var _usePopper = usePopper(referenceElement || referenceNode, popperElement, options),\n state = _usePopper.state,\n styles = _usePopper.styles,\n forceUpdate = _usePopper.forceUpdate,\n update = _usePopper.update;\n\n var childrenProps = React.useMemo(function () {\n return {\n ref: setPopperElement,\n style: styles.popper,\n placement: state ? state.placement : placement,\n hasPopperEscaped: state && state.modifiersData.hide ? state.modifiersData.hide.hasPopperEscaped : null,\n isReferenceHidden: state && state.modifiersData.hide ? state.modifiersData.hide.isReferenceHidden : null,\n arrowProps: {\n style: styles.arrow,\n ref: setArrowElement\n },\n forceUpdate: forceUpdate || NOOP,\n update: update || NOOP_PROMISE\n };\n }, [setPopperElement, setArrowElement, placement, state, styles, update, forceUpdate]);\n return unwrapArray(children)(childrenProps);\n}","import * as React from 'react';\nimport warning from 'warning';\nimport { ManagerReferenceNodeSetterContext } from './Manager';\nimport { safeInvoke, unwrapArray, setRef } from './utils';\nexport function Reference(_ref) {\n var children = _ref.children,\n innerRef = _ref.innerRef;\n var setReferenceNode = React.useContext(ManagerReferenceNodeSetterContext);\n var refHandler = React.useCallback(function (node) {\n setRef(innerRef, node);\n safeInvoke(setReferenceNode, node);\n }, [innerRef, setReferenceNode]); // ran on unmount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n\n React.useEffect(function () {\n return function () {\n return setRef(innerRef, null);\n };\n }, []);\n React.useEffect(function () {\n warning(Boolean(setReferenceNode), '`Reference` should not be used outside of a `Manager` component.');\n }, [setReferenceNode]);\n return unwrapArray(children)({\n ref: refHandler\n });\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport toDate from \"../toDate/index.js\";\nimport setMonth from \"../setMonth/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n\n/**\n * @name set\n * @category Common Helpers\n * @summary Set date values to a given date.\n *\n * @description\n * Set date values to a given date.\n *\n * Sets time values to date from object `values`.\n * A value is not set if it is undefined or null or doesn't exist in `values`.\n *\n * Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts\n * to use native `Date#setX` methods. If you use this function, you may not want to include the\n * other `setX` functions that date-fns provides if you are concerned about the bundle size.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Object} values - an object with options\n * @param {Number} [values.year] - the number of years to be set\n * @param {Number} [values.month] - the number of months to be set\n * @param {Number} [values.date] - the number of days to be set\n * @param {Number} [values.hours] - the number of hours to be set\n * @param {Number} [values.minutes] - the number of minutes to be set\n * @param {Number} [values.seconds] - the number of seconds to be set\n * @param {Number} [values.milliseconds] - the number of milliseconds to be set\n * @returns {Date} the new date with options set\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `values` must be an object\n *\n * @example\n * // Transform 1 September 2014 into 20 October 2015 in a single line:\n * const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })\n * //=> Tue Oct 20 2015 00:00:00\n *\n * @example\n * // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:\n * const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })\n * //=> Mon Sep 01 2014 12:23:45\n */\nexport default function set(dirtyDate, values) {\n requiredArgs(2, arguments);\n\n if (_typeof(values) !== 'object' || values === null) {\n throw new RangeError('values parameter must be an object');\n }\n\n var date = toDate(dirtyDate); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date\n\n if (isNaN(date.getTime())) {\n return new Date(NaN);\n }\n\n if (values.year != null) {\n date.setFullYear(values.year);\n }\n\n if (values.month != null) {\n date = setMonth(date, values.month);\n }\n\n if (values.date != null) {\n date.setDate(toInteger(values.date));\n }\n\n if (values.hours != null) {\n date.setHours(toInteger(values.hours));\n }\n\n if (values.minutes != null) {\n date.setMinutes(toInteger(values.minutes));\n }\n\n if (values.seconds != null) {\n date.setSeconds(toInteger(values.seconds));\n }\n\n if (values.milliseconds != null) {\n date.setMilliseconds(toInteger(values.milliseconds));\n }\n\n return date;\n}","import e,{createRef as t}from\"react\";import\"prop-types\";import r from\"classnames\";import n from\"date-fns/isDate\";import o from\"date-fns/isValid\";import a from\"date-fns/format\";import s from\"date-fns/addMinutes\";import i from\"date-fns/addHours\";import p from\"date-fns/addDays\";import c from\"date-fns/addWeeks\";import l from\"date-fns/addMonths\";import d from\"date-fns/addQuarters\";import u from\"date-fns/addYears\";import\"date-fns/subMinutes\";import\"date-fns/subHours\";import h from\"date-fns/subDays\";import m from\"date-fns/subWeeks\";import f from\"date-fns/subMonths\";import y from\"date-fns/subQuarters\";import v from\"date-fns/subYears\";import D from\"date-fns/getSeconds\";import w from\"date-fns/getMinutes\";import g from\"date-fns/getHours\";import k from\"date-fns/getDay\";import b from\"date-fns/getDate\";import S from\"date-fns/getISOWeek\";import C from\"date-fns/getMonth\";import _ from\"date-fns/getQuarter\";import M from\"date-fns/getYear\";import P from\"date-fns/getTime\";import E from\"date-fns/setSeconds\";import N from\"date-fns/setMinutes\";import x from\"date-fns/setHours\";import Y from\"date-fns/setMonth\";import O from\"date-fns/setQuarter\";import I from\"date-fns/setYear\";import T from\"date-fns/min\";import L from\"date-fns/max\";import R from\"date-fns/differenceInCalendarDays\";import F from\"date-fns/differenceInCalendarMonths\";import\"date-fns/differenceInCalendarWeeks\";import A from\"date-fns/differenceInCalendarYears\";import K from\"date-fns/startOfDay\";import B from\"date-fns/startOfWeek\";import W from\"date-fns/startOfMonth\";import j from\"date-fns/startOfQuarter\";import Q from\"date-fns/startOfYear\";import H from\"date-fns/endOfDay\";import\"date-fns/endOfWeek\";import V from\"date-fns/endOfMonth\";import q from\"date-fns/endOfYear\";import U from\"date-fns/isEqual\";import $ from\"date-fns/isSameDay\";import z from\"date-fns/isSameMonth\";import G from\"date-fns/isSameYear\";import J from\"date-fns/isSameQuarter\";import X from\"date-fns/isAfter\";import Z from\"date-fns/isBefore\";import ee from\"date-fns/isWithinInterval\";import te from\"date-fns/toDate\";import re from\"date-fns/parse\";import ne from\"date-fns/parseISO\";import oe from\"react-onclickoutside\";import ae from\"react-dom\";import{Popper as se,Manager as ie,Reference as pe}from\"react-popper\";import ce from\"date-fns/set\";function le(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function de(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,n=t.maxDate,o=t.excludeDates,a=t.excludeDateIntervals,s=t.includeDates,i=t.includeDateIntervals,p=t.filterDate;return it(e,{minDate:r,maxDate:n})||o&&o.some((function(t){return He(e,t)}))||a&&a.some((function(t){var r=t.start,n=t.end;return ee(e,{start:r,end:n})}))||s&&!s.some((function(t){return He(e,t)}))||i&&!i.some((function(t){var r=t.start,n=t.end;return ee(e,{start:r,end:n})}))||p&&!p(Pe(e))||!1}function tt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.excludeDates,n=t.excludeDateIntervals;return n&&n.length>0?n.some((function(t){var r=t.start,n=t.end;return ee(e,{start:r,end:n})})):r&&r.some((function(t){return He(e,t)}))||!1}function rt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,n=t.maxDate,o=t.excludeDates,a=t.includeDates,s=t.filterDate;return it(e,{minDate:W(r),maxDate:V(n)})||o&&o.some((function(t){return je(e,t)}))||a&&!a.some((function(t){return je(e,t)}))||s&&!s(Pe(e))||!1}function nt(e,t,r,n){var o=M(e),a=C(e),s=M(t),i=C(t),p=M(n);return o===s&&o===p?a<=r&&r<=i:o=r||po:void 0}function ot(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,n=t.maxDate,o=t.excludeDates,a=t.includeDates,s=t.filterDate;return it(e,{minDate:r,maxDate:n})||o&&o.some((function(t){return Qe(e,t)}))||a&&!a.some((function(t){return Qe(e,t)}))||s&&!s(Pe(e))||!1}function at(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,n=t.maxDate,o=t.excludeDates,a=t.includeDates,s=t.filterDate,i=new Date(e,0,1);return it(i,{minDate:Q(r),maxDate:q(n)})||o&&o.some((function(e){return We(i,e)}))||a&&!a.some((function(e){return We(i,e)}))||s&&!s(Pe(i))||!1}function st(e,t,r,n){var o=M(e),a=_(e),s=M(t),i=_(t),p=M(n);return o===s&&o===p?a<=r&&r<=i:o=r||po:void 0}function it(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,n=t.maxDate;return r&&R(e,r)<0||n&&R(e,n)>0}function pt(e,t){return t.some((function(t){return g(t)===g(e)&&w(t)===w(e)}))}function ct(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.excludeTimes,n=t.includeTimes,o=t.filterTime;return r&&pt(e,r)||n&&!pt(e,n)||o&&!o(e)||!1}function lt(e,t){var r=t.minTime,n=t.maxTime;if(!r||!n)throw new Error(\"Both minTime and maxTime props required\");var o,a=Pe(),s=x(N(a,w(e)),g(e)),i=x(N(a,w(r)),g(r)),p=x(N(a,w(n)),g(n));try{o=!ee(s,{start:i,end:p})}catch(e){o=!1}return o}function dt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,n=t.includeDates,o=f(e,1);return r&&F(r,o)>0||n&&n.every((function(e){return F(e,o)>0}))||!1}function ut(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.maxDate,n=t.includeDates,o=l(e,1);return r&&F(o,r)>0||n&&n.every((function(e){return F(o,e)>0}))||!1}function ht(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,n=t.includeDates,o=v(e,1);return r&&A(r,o)>0||n&&n.every((function(e){return A(e,o)>0}))||!1}function mt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.maxDate,n=t.includeDates,o=u(e,1);return r&&A(o,r)>0||n&&n.every((function(e){return A(o,e)>0}))||!1}function ft(e){var t=e.minDate,r=e.includeDates;if(r&&t){var n=r.filter((function(e){return R(e,t)>=0}));return T(n)}return r?T(r):t}function yt(e){var t=e.maxDate,r=e.includeDates;if(r&&t){var n=r.filter((function(e){return R(e,t)<=0}));return L(n)}return r?L(r):t}function vt(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"react-datepicker__day--highlighted\",r=new Map,o=0,a=e.length;o1&&void 0!==arguments[1]?arguments[1]:12,r=Math.ceil(M(e)/t)*t,n=r-(t-1);return{startPeriod:n,endPeriod:r}}function kt(e,t,r,n){for(var o=[],a=0;a<2*t+1;a++){var s=e+t-a,i=!0;r&&(i=M(r)<=s),n&&i&&(i=M(n)>=s),i&&o.push(s)}return o}var bt=oe(function(n){De(a,e.Component);var o=Se(a);function a(r){var n;he(this,a),ye(ke(n=o.call(this,r)),\"renderOptions\",(function(){var t=n.props.year,r=n.state.yearsList.map((function(r){return e.createElement(\"div\",{className:t===r?\"react-datepicker__year-option react-datepicker__year-option--selected_year\":\"react-datepicker__year-option\",key:r,onClick:n.onChange.bind(ke(n),r),\"aria-selected\":t===r?\"true\":void 0},t===r?e.createElement(\"span\",{className:\"react-datepicker__year-option--selected\"},\"✓\"):\"\",r)})),o=n.props.minDate?M(n.props.minDate):null,a=n.props.maxDate?M(n.props.maxDate):null;return a&&n.state.yearsList.find((function(e){return e===a}))||r.unshift(e.createElement(\"div\",{className:\"react-datepicker__year-option\",key:\"upcoming\",onClick:n.incrementYears},e.createElement(\"a\",{className:\"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming\"}))),o&&n.state.yearsList.find((function(e){return e===o}))||r.push(e.createElement(\"div\",{className:\"react-datepicker__year-option\",key:\"previous\",onClick:n.decrementYears},e.createElement(\"a\",{className:\"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous\"}))),r})),ye(ke(n),\"onChange\",(function(e){n.props.onChange(e)})),ye(ke(n),\"handleClickOutside\",(function(){n.props.onCancel()})),ye(ke(n),\"shiftYears\",(function(e){var t=n.state.yearsList.map((function(t){return t+e}));n.setState({yearsList:t})})),ye(ke(n),\"incrementYears\",(function(){return n.shiftYears(1)})),ye(ke(n),\"decrementYears\",(function(){return n.shiftYears(-1)}));var s=r.yearDropdownItemNumber,i=r.scrollableYearDropdown,p=s||(i?10:5);return n.state={yearsList:kt(n.props.year,p,n.props.minDate,n.props.maxDate)},n.dropdownRef=t(),n}return fe(a,[{key:\"componentDidMount\",value:function(){var e=this.dropdownRef.current;if(e){var t=e.children?Array.from(e.children):null,r=t?t.find((function(e){return e.ariaSelected})):null;e.scrollTop=r?r.offsetTop+(r.clientHeight-e.clientHeight)/2:(e.scrollHeight-e.clientHeight)/2}}},{key:\"render\",value:function(){var t=r({\"react-datepicker__year-dropdown\":!0,\"react-datepicker__year-dropdown--scrollable\":this.props.scrollableYearDropdown});return e.createElement(\"div\",{className:t,ref:this.dropdownRef},this.renderOptions())}}]),a}()),St=function(t){De(n,e.Component);var r=Se(n);function n(){var t;he(this,n);for(var o=arguments.length,a=new Array(o),s=0;s0&&void 0!==arguments[0]?arguments[0]:{},r=!1;0===t.getTabIndex()&&!e.isInputFocused&&t.isSameDay(t.props.preSelection)&&(document.activeElement&&document.activeElement!==document.body||(r=!0),t.props.inline&&!t.props.shouldFocusDayInline&&(r=!1),t.props.containerRef&&t.props.containerRef.current&&t.props.containerRef.current.contains(document.activeElement)&&document.activeElement.classList.contains(\"react-datepicker__day\")&&(r=!0)),r&&t.dayEl.current.focus({preventScroll:!0})})),ye(ke(t),\"renderDayContents\",(function(){return t.props.monthShowsDuplicateDaysEnd&&t.isAfterMonth()||t.props.monthShowsDuplicateDaysStart&&t.isBeforeMonth()?null:t.props.renderDayContents?t.props.renderDayContents(b(t.props.day),t.props.day):b(t.props.day)})),ye(ke(t),\"render\",(function(){return e.createElement(\"div\",{ref:t.dayEl,className:t.getClassNames(t.props.day),onKeyDown:t.handleOnKeyDown,onClick:t.handleClick,onMouseEnter:t.handleMouseEnter,tabIndex:t.getTabIndex(),\"aria-label\":t.getAriaLabel(),role:\"option\",\"aria-disabled\":t.isDisabled(),\"aria-current\":t.isCurrentDay()?\"date\":void 0,\"aria-selected\":t.isSelected()},t.renderDayContents())})),t}return fe(o,[{key:\"componentDidMount\",value:function(){this.handleFocusDay()}},{key:\"componentDidUpdate\",value:function(e){this.handleFocusDay(e)}}]),o}(),xt=function(t){De(o,e.Component);var n=Se(o);function o(){var e;he(this,o);for(var t=arguments.length,r=new Array(t),a=0;a=6,p=!n&&!t.isWeekInMonth(s);if(i||p){if(!t.props.peekNextMonth)break;a=!0}}return r})),ye(ke(t),\"onMonthClick\",(function(e,r){t.handleDayClick(Fe(Y(t.props.day,r)),e)})),ye(ke(t),\"handleMonthNavigation\",(function(e,r){t.isDisabled(r)||t.isExcluded(r)||(t.props.setPreSelection(r),t.MONTH_REFS[e].current&&t.MONTH_REFS[e].current.focus())})),ye(ke(t),\"onMonthKeyDown\",(function(e,r){e.preventDefault();var n=e.key;if(!t.props.disabledKeyboardNavigation)switch(n){case\"Enter\":t.onMonthClick(e,r),t.props.setPreSelection(t.props.selected);break;case\"ArrowRight\":t.handleMonthNavigation(11===r?0:r+1,l(t.props.preSelection,1));break;case\"ArrowLeft\":t.handleMonthNavigation(0===r?11:r-1,f(t.props.preSelection,1));break;case\"ArrowUp\":t.handleMonthNavigation(r>=0&&r<=2?r+9:r-3,f(t.props.preSelection,3));break;case\"ArrowDown\":t.handleMonthNavigation(r>=9&&r<=11?r-9:r+3,l(t.props.preSelection,3))}})),ye(ke(t),\"onQuarterClick\",(function(e,r){t.handleDayClick(Ke(O(t.props.day,r)),e)})),ye(ke(t),\"handleQuarterNavigation\",(function(e,r){t.isDisabled(r)||t.isExcluded(r)||(t.props.setPreSelection(r),t.QUARTER_REFS[e-1].current&&t.QUARTER_REFS[e-1].current.focus())})),ye(ke(t),\"onQuarterKeyDown\",(function(e,r){var n=e.key;if(!t.props.disabledKeyboardNavigation)switch(n){case\"Enter\":t.onQuarterClick(e,r),t.props.setPreSelection(t.props.selected);break;case\"ArrowRight\":t.handleQuarterNavigation(4===r?1:r+1,d(t.props.preSelection,1));break;case\"ArrowLeft\":t.handleQuarterNavigation(1===r?4:r-1,y(t.props.preSelection,1))}})),ye(ke(t),\"getMonthClassNames\",(function(e){var n=t.props,o=n.day,a=n.startDate,s=n.endDate,i=n.selected,p=n.minDate,c=n.maxDate,l=n.preSelection,d=n.monthClassName,u=n.excludeDates,h=n.includeDates,m=d?d(Y(o,e)):void 0,f=Y(o,e);return r(\"react-datepicker__month-text\",\"react-datepicker__month-\".concat(e),m,{\"react-datepicker__month--disabled\":(p||c||u||h)&&rt(f,t.props),\"react-datepicker__month--selected\":t.isSelectedMonth(o,e,i),\"react-datepicker__month-text--keyboard-selected\":!t.props.disabledKeyboardNavigation&&C(l)===e,\"react-datepicker__month--in-range\":nt(a,s,e,o),\"react-datepicker__month--range-start\":t.isRangeStartMonth(e),\"react-datepicker__month--range-end\":t.isRangeEndMonth(e),\"react-datepicker__month-text--today\":t.isCurrentMonth(o,e)})})),ye(ke(t),\"getTabIndex\",(function(e){var r=C(t.props.preSelection);return t.props.disabledKeyboardNavigation||e!==r?\"-1\":\"0\"})),ye(ke(t),\"getQuarterTabIndex\",(function(e){var r=_(t.props.preSelection);return t.props.disabledKeyboardNavigation||e!==r?\"-1\":\"0\"})),ye(ke(t),\"getAriaLabel\",(function(e){var r=t.props,n=r.chooseDayAriaLabelPrefix,o=void 0===n?\"Choose\":n,a=r.disabledDayAriaLabelPrefix,s=void 0===a?\"Not available\":a,i=r.day,p=Y(i,e),c=t.isDisabled(p)||t.isExcluded(p)?s:o;return\"\".concat(c,\" \").concat(xe(p,\"MMMM yyyy\"))})),ye(ke(t),\"getQuarterClassNames\",(function(e){var n=t.props,o=n.day,a=n.startDate,s=n.endDate,i=n.selected,p=n.minDate,c=n.maxDate,l=n.preSelection;return r(\"react-datepicker__quarter-text\",\"react-datepicker__quarter-\".concat(e),{\"react-datepicker__quarter--disabled\":(p||c)&&ot(O(o,e),t.props),\"react-datepicker__quarter--selected\":t.isSelectedQuarter(o,e,i),\"react-datepicker__quarter-text--keyboard-selected\":_(l)===e,\"react-datepicker__quarter--in-range\":st(a,s,e,o),\"react-datepicker__quarter--range-start\":t.isRangeStartQuarter(e),\"react-datepicker__quarter--range-end\":t.isRangeEndQuarter(e)})})),ye(ke(t),\"renderMonths\",(function(){var r=t.props,n=r.showFullMonthYearPicker,o=r.showTwoColumnMonthYearPicker,a=r.showFourColumnMonthYearPicker,s=r.locale,i=r.day,p=r.selected;return(a?[[0,1,2,3],[4,5,6,7],[8,9,10,11]]:o?[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11]]:[[0,1,2],[3,4,5],[6,7,8],[9,10,11]]).map((function(r,o){return e.createElement(\"div\",{className:\"react-datepicker__month-wrapper\",key:o},r.map((function(r,o){return e.createElement(\"div\",{ref:t.MONTH_REFS[r],key:o,onClick:function(e){t.onMonthClick(e,r)},onKeyDown:function(e){t.onMonthKeyDown(e,r)},tabIndex:t.getTabIndex(r),className:t.getMonthClassNames(r),role:\"option\",\"aria-label\":t.getAriaLabel(r),\"aria-current\":t.isCurrentMonth(i,r)?\"date\":void 0,\"aria-selected\":t.isSelectedMonth(i,r,p)},n?Je(r,s):Xe(r,s))})))}))})),ye(ke(t),\"renderQuarters\",(function(){var r=t.props,n=r.day,o=r.selected;return e.createElement(\"div\",{className:\"react-datepicker__quarter-wrapper\"},[1,2,3,4].map((function(r,a){return e.createElement(\"div\",{key:a,ref:t.QUARTER_REFS[a],role:\"option\",onClick:function(e){t.onQuarterClick(e,r)},onKeyDown:function(e){t.onQuarterKeyDown(e,r)},className:t.getQuarterClassNames(r),\"aria-selected\":t.isSelectedQuarter(n,r,o),tabIndex:t.getQuarterTabIndex(r),\"aria-current\":t.isCurrentQuarter(n,r)?\"date\":void 0},Ze(r,t.props.locale))})))})),ye(ke(t),\"getClassNames\",(function(){var e=t.props;e.day;var n=e.selectingDate,o=e.selectsStart,a=e.selectsEnd,s=e.showMonthYearPicker,i=e.showQuarterYearPicker;return r(\"react-datepicker__month\",{\"react-datepicker__month--selecting-range\":n&&(o||a)},{\"react-datepicker__monthPicker\":s},{\"react-datepicker__quarterPicker\":i})})),t}return fe(o,[{key:\"render\",value:function(){var t=this.props,r=t.showMonthYearPicker,n=t.showQuarterYearPicker,o=t.day,a=t.ariaLabelPrefix,s=void 0===a?\"month \":a;return e.createElement(\"div\",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,\"aria-label\":\"\".concat(s,\" \").concat(xe(o,\"yyyy-MM\")),role:\"listbox\"},r?this.renderMonths():n?this.renderQuarters():this.renderWeeks())}}]),o}(),It=function(t){De(n,e.Component);var r=Se(n);function n(){var t;he(this,n);for(var o=arguments.length,a=new Array(o),i=0;i0&&void 0!==arguments[0]?arguments[0]:{}).className||\"\").split(/\\s+/);return Ft.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&a.props.onDropdownFocus()})),ye(ke(a),\"getDateInView\",(function(){var e=a.props,t=e.preSelection,r=e.selected,n=e.openToDate,o=ft(a.props),s=yt(a.props),i=Pe(),p=n||r||t;return p||(o&&Z(i,o)?o:s&&X(i,s)?s:i)})),ye(ke(a),\"increaseMonth\",(function(){a.setState((function(e){var t=e.date;return{date:l(t,1)}}),(function(){return a.handleMonthChange(a.state.date)}))})),ye(ke(a),\"decreaseMonth\",(function(){a.setState((function(e){var t=e.date;return{date:f(t,1)}}),(function(){return a.handleMonthChange(a.state.date)}))})),ye(ke(a),\"handleDayClick\",(function(e,t,r){a.props.onSelect(e,t,r),a.props.setPreSelection&&a.props.setPreSelection(e)})),ye(ke(a),\"handleDayMouseEnter\",(function(e){a.setState({selectingDate:e}),a.props.onDayMouseEnter&&a.props.onDayMouseEnter(e)})),ye(ke(a),\"handleMonthMouseLeave\",(function(){a.setState({selectingDate:null}),a.props.onMonthMouseLeave&&a.props.onMonthMouseLeave()})),ye(ke(a),\"handleYearChange\",(function(e){a.props.onYearChange&&(a.props.onYearChange(e),a.setState({isRenderAriaLiveMessage:!0})),a.props.adjustDateOnChange&&(a.props.onSelect&&a.props.onSelect(e),a.props.setOpen&&a.props.setOpen(!0)),a.props.setPreSelection&&a.props.setPreSelection(e)})),ye(ke(a),\"handleMonthChange\",(function(e){a.props.onMonthChange&&(a.props.onMonthChange(e),a.setState({isRenderAriaLiveMessage:!0})),a.props.adjustDateOnChange&&(a.props.onSelect&&a.props.onSelect(e),a.props.setOpen&&a.props.setOpen(!0)),a.props.setPreSelection&&a.props.setPreSelection(e)})),ye(ke(a),\"handleMonthYearChange\",(function(e){a.handleYearChange(e),a.handleMonthChange(e)})),ye(ke(a),\"changeYear\",(function(e){a.setState((function(t){var r=t.date;return{date:I(r,e)}}),(function(){return a.handleYearChange(a.state.date)}))})),ye(ke(a),\"changeMonth\",(function(e){a.setState((function(t){var r=t.date;return{date:Y(r,e)}}),(function(){return a.handleMonthChange(a.state.date)}))})),ye(ke(a),\"changeMonthYear\",(function(e){a.setState((function(t){var r=t.date;return{date:I(Y(r,C(e)),M(e))}}),(function(){return a.handleMonthYearChange(a.state.date)}))})),ye(ke(a),\"header\",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.state.date,n=Re(t,a.props.locale,a.props.calendarStartDay),o=[];return a.props.showWeekNumbers&&o.push(e.createElement(\"div\",{key:\"W\",className:\"react-datepicker__day-name\"},a.props.weekLabel||\"#\")),o.concat([0,1,2,3,4,5,6].map((function(t){var o=p(n,t),s=a.formatWeekday(o,a.props.locale),i=a.props.weekDayClassName?a.props.weekDayClassName(o):void 0;return e.createElement(\"div\",{key:t,className:r(\"react-datepicker__day-name\",i)},s)})))})),ye(ke(a),\"formatWeekday\",(function(e,t){return a.props.formatWeekDay?function(e,t,r){return\"function\"==typeof t?t(e,r):xe(e,\"EEEE\",r)}(e,a.props.formatWeekDay,t):a.props.useWeekdaysShort?function(e,t){return xe(e,\"EEE\",t)}(e,t):function(e,t){return xe(e,\"EEEEEE\",t)}(e,t)})),ye(ke(a),\"decreaseYear\",(function(){a.setState((function(e){var t=e.date;return{date:v(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),ye(ke(a),\"renderPreviousButton\",(function(){if(!a.props.renderCustomHeader){var t;switch(!0){case a.props.showMonthYearPicker:t=ht(a.state.date,a.props);break;case a.props.showYearPicker:t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,n=t.yearItemNumber,o=void 0===n?12:n,a=gt(Ae(v(e,o)),o).endPeriod,s=r&&M(r);return s&&s>a||!1}(a.state.date,a.props);break;default:t=dt(a.state.date,a.props)}if((a.props.forceShowMonthNavigation||a.props.showDisabledMonthNavigation||!t)&&!a.props.showTimeSelectOnly){var r=[\"react-datepicker__navigation\",\"react-datepicker__navigation--previous\"],n=a.decreaseMonth;(a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker)&&(n=a.decreaseYear),t&&a.props.showDisabledMonthNavigation&&(r.push(\"react-datepicker__navigation--previous--disabled\"),n=null);var o=a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker,s=a.props,i=s.previousMonthButtonLabel,p=s.previousYearButtonLabel,c=a.props,l=c.previousMonthAriaLabel,d=void 0===l?\"string\"==typeof i?i:\"Previous Month\":l,u=c.previousYearAriaLabel,h=void 0===u?\"string\"==typeof p?p:\"Previous Year\":u;return e.createElement(\"button\",{type:\"button\",className:r.join(\" \"),onClick:n,onKeyDown:a.props.handleOnKeyDown,\"aria-label\":o?h:d},e.createElement(\"span\",{className:[\"react-datepicker__navigation-icon\",\"react-datepicker__navigation-icon--previous\"].join(\" \")},o?a.props.previousYearButtonLabel:a.props.previousMonthButtonLabel))}}})),ye(ke(a),\"increaseYear\",(function(){a.setState((function(e){var t=e.date;return{date:u(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),ye(ke(a),\"renderNextButton\",(function(){if(!a.props.renderCustomHeader){var t;switch(!0){case a.props.showMonthYearPicker:t=mt(a.state.date,a.props);break;case a.props.showYearPicker:t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.maxDate,n=t.yearItemNumber,o=void 0===n?12:n,a=gt(u(e,o),o).startPeriod,s=r&&M(r);return s&&s0&&void 0!==arguments[0]?arguments[0]:a.state.date,r=[\"react-datepicker__current-month\"];return a.props.showYearDropdown&&r.push(\"react-datepicker__current-month--hasYearDropdown\"),a.props.showMonthDropdown&&r.push(\"react-datepicker__current-month--hasMonthDropdown\"),a.props.showMonthYearDropdown&&r.push(\"react-datepicker__current-month--hasMonthYearDropdown\"),e.createElement(\"div\",{className:r.join(\" \")},xe(t,a.props.dateFormat,a.props.locale))})),ye(ke(a),\"renderYearDropdown\",(function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showYearDropdown&&!t)return e.createElement(St,{adjustDateOnChange:a.props.adjustDateOnChange,date:a.state.date,onSelect:a.props.onSelect,setOpen:a.props.setOpen,dropdownMode:a.props.dropdownMode,onChange:a.changeYear,minDate:a.props.minDate,maxDate:a.props.maxDate,year:M(a.state.date),scrollableYearDropdown:a.props.scrollableYearDropdown,yearDropdownItemNumber:a.props.yearDropdownItemNumber})})),ye(ke(a),\"renderMonthDropdown\",(function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthDropdown&&!t)return e.createElement(_t,{dropdownMode:a.props.dropdownMode,locale:a.props.locale,onChange:a.changeMonth,month:C(a.state.date),useShortMonthInDropdown:a.props.useShortMonthInDropdown})})),ye(ke(a),\"renderMonthYearDropdown\",(function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthYearDropdown&&!t)return e.createElement(Et,{dropdownMode:a.props.dropdownMode,locale:a.props.locale,dateFormat:a.props.dateFormat,onChange:a.changeMonthYear,minDate:a.props.minDate,maxDate:a.props.maxDate,date:a.state.date,scrollableMonthYearDropdown:a.props.scrollableMonthYearDropdown})})),ye(ke(a),\"handleTodayButtonClick\",(function(e){a.props.onSelect(Be(),e),a.props.setPreSelection&&a.props.setPreSelection(Be())})),ye(ke(a),\"renderTodayButton\",(function(){if(a.props.todayButton&&!a.props.showTimeSelectOnly)return e.createElement(\"div\",{className:\"react-datepicker__today-button\",onClick:function(e){return a.handleTodayButtonClick(e)}},a.props.todayButton)})),ye(ke(a),\"renderDefaultHeader\",(function(t){var r=t.monthDate,n=t.i;return e.createElement(\"div\",{className:\"react-datepicker__header \".concat(a.props.showTimeSelect?\"react-datepicker__header--has-time-select\":\"\")},a.renderCurrentMonth(r),e.createElement(\"div\",{className:\"react-datepicker__header__dropdown react-datepicker__header__dropdown--\".concat(a.props.dropdownMode),onFocus:a.handleDropdownFocus},a.renderMonthDropdown(0!==n),a.renderMonthYearDropdown(0!==n),a.renderYearDropdown(0!==n)),e.createElement(\"div\",{className:\"react-datepicker__day-names\"},a.header(r)))})),ye(ke(a),\"renderCustomHeader\",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.monthDate,n=t.i;if(a.props.showTimeSelect&&!a.state.monthContainer||a.props.showTimeSelectOnly)return null;var o=dt(a.state.date,a.props),s=ut(a.state.date,a.props),i=ht(a.state.date,a.props),p=mt(a.state.date,a.props),c=!a.props.showMonthYearPicker&&!a.props.showQuarterYearPicker&&!a.props.showYearPicker;return e.createElement(\"div\",{className:\"react-datepicker__header react-datepicker__header--custom\",onFocus:a.props.onDropdownFocus},a.props.renderCustomHeader(de(de({},a.state),{},{customHeaderCount:n,monthDate:r,changeMonth:a.changeMonth,changeYear:a.changeYear,decreaseMonth:a.decreaseMonth,increaseMonth:a.increaseMonth,decreaseYear:a.decreaseYear,increaseYear:a.increaseYear,prevMonthButtonDisabled:o,nextMonthButtonDisabled:s,prevYearButtonDisabled:i,nextYearButtonDisabled:p})),c&&e.createElement(\"div\",{className:\"react-datepicker__day-names\"},a.header(r)))})),ye(ke(a),\"renderYearHeader\",(function(){var t=a.state.date,r=a.props,n=r.showYearPicker,o=gt(t,r.yearItemNumber),s=o.startPeriod,i=o.endPeriod;return e.createElement(\"div\",{className:\"react-datepicker__header react-datepicker-year-header\"},n?\"\".concat(s,\" - \").concat(i):M(t))})),ye(ke(a),\"renderHeader\",(function(e){switch(!0){case void 0!==a.props.renderCustomHeader:return a.renderCustomHeader(e);case a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker:return a.renderYearHeader(e);default:return a.renderDefaultHeader(e)}})),ye(ke(a),\"renderMonths\",(function(){if(!a.props.showTimeSelectOnly&&!a.props.showYearPicker){for(var t=[],r=a.props.showPreviousMonths?a.props.monthsShown-1:0,n=f(a.state.date,r),o=0;o0;t.push(e.createElement(\"div\",{key:p,ref:function(e){a.monthContainer=e},className:\"react-datepicker__month-container\"},a.renderHeader({monthDate:i,i:o}),e.createElement(Ot,{chooseDayAriaLabelPrefix:a.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:a.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:a.props.weekAriaLabelPrefix,ariaLabelPrefix:a.props.monthAriaLabelPrefix,onChange:a.changeMonthYear,day:i,dayClassName:a.props.dayClassName,calendarStartDay:a.props.calendarStartDay,monthClassName:a.props.monthClassName,onDayClick:a.handleDayClick,handleOnKeyDown:a.props.handleOnDayKeyDown,onDayMouseEnter:a.handleDayMouseEnter,onMouseLeave:a.handleMonthMouseLeave,onWeekSelect:a.props.onWeekSelect,orderInDisplay:o,formatWeekNumber:a.props.formatWeekNumber,locale:a.props.locale,minDate:a.props.minDate,maxDate:a.props.maxDate,excludeDates:a.props.excludeDates,excludeDateIntervals:a.props.excludeDateIntervals,highlightDates:a.props.highlightDates,selectingDate:a.state.selectingDate,includeDates:a.props.includeDates,includeDateIntervals:a.props.includeDateIntervals,inline:a.props.inline,shouldFocusDayInline:a.props.shouldFocusDayInline,fixedHeight:a.props.fixedHeight,filterDate:a.props.filterDate,preSelection:a.props.preSelection,setPreSelection:a.props.setPreSelection,selected:a.props.selected,selectsStart:a.props.selectsStart,selectsEnd:a.props.selectsEnd,selectsRange:a.props.selectsRange,selectsDisabledDaysInRange:a.props.selectsDisabledDaysInRange,showWeekNumbers:a.props.showWeekNumbers,startDate:a.props.startDate,endDate:a.props.endDate,peekNextMonth:a.props.peekNextMonth,setOpen:a.props.setOpen,shouldCloseOnSelect:a.props.shouldCloseOnSelect,renderDayContents:a.props.renderDayContents,disabledKeyboardNavigation:a.props.disabledKeyboardNavigation,showMonthYearPicker:a.props.showMonthYearPicker,showFullMonthYearPicker:a.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:a.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:a.props.showFourColumnMonthYearPicker,showYearPicker:a.props.showYearPicker,showQuarterYearPicker:a.props.showQuarterYearPicker,isInputFocused:a.props.isInputFocused,containerRef:a.containerRef,monthShowsDuplicateDaysEnd:c,monthShowsDuplicateDaysStart:d})))}return t}})),ye(ke(a),\"renderYears\",(function(){if(!a.props.showTimeSelectOnly)return a.props.showYearPicker?e.createElement(\"div\",{className:\"react-datepicker__year--container\"},a.renderHeader(),e.createElement(Tt,ve({onDayClick:a.handleDayClick,date:a.state.date},a.props))):void 0})),ye(ke(a),\"renderTimeSection\",(function(){if(a.props.showTimeSelect&&(a.state.monthContainer||a.props.showTimeSelectOnly))return e.createElement(It,{selected:a.props.selected,openToDate:a.props.openToDate,onChange:a.props.onTimeChange,timeClassName:a.props.timeClassName,format:a.props.timeFormat,includeTimes:a.props.includeTimes,intervals:a.props.timeIntervals,minTime:a.props.minTime,maxTime:a.props.maxTime,excludeTimes:a.props.excludeTimes,filterTime:a.props.filterTime,timeCaption:a.props.timeCaption,todayButton:a.props.todayButton,showMonthDropdown:a.props.showMonthDropdown,showMonthYearDropdown:a.props.showMonthYearDropdown,showYearDropdown:a.props.showYearDropdown,withPortal:a.props.withPortal,monthRef:a.state.monthContainer,injectTimes:a.props.injectTimes,locale:a.props.locale,handleOnKeyDown:a.props.handleOnKeyDown,showTimeSelectOnly:a.props.showTimeSelectOnly})})),ye(ke(a),\"renderInputTimeSection\",(function(){var t=new Date(a.props.selected),r=Ne(t)&&Boolean(a.props.selected)?\"\".concat(wt(t.getHours()),\":\").concat(wt(t.getMinutes())):\"\";if(a.props.showTimeInput)return e.createElement(Lt,{date:t,timeString:r,timeInputLabel:a.props.timeInputLabel,onChange:a.props.onTimeChange,customTimeInput:a.props.customTimeInput})})),ye(ke(a),\"renderAriaLiveRegion\",(function(){var t,r=gt(a.state.date,a.props.yearItemNumber),n=r.startPeriod,o=r.endPeriod;return t=a.props.showYearPicker?\"\".concat(n,\" - \").concat(o):a.props.showMonthYearPicker||a.props.showQuarterYearPicker?M(a.state.date):\"\".concat(Je(C(a.state.date),a.props.locale),\" \").concat(M(a.state.date)),e.createElement(\"span\",{role:\"alert\",\"aria-live\":\"polite\",className:\"react-datepicker__aria-live\"},a.state.isRenderAriaLiveMessage&&t)})),ye(ke(a),\"renderChildren\",(function(){if(a.props.children)return e.createElement(\"div\",{className:\"react-datepicker__children-container\"},a.props.children)})),a.containerRef=e.createRef(),a.state={date:a.getDateInView(),selectingDate:null,monthContainer:null,isRenderAriaLiveMessage:!1},a}return fe(o,[{key:\"componentDidMount\",value:function(){var e=this;this.props.showTimeSelect&&(this.assignMonthContainer=void e.setState({monthContainer:e.monthContainer}))}},{key:\"componentDidUpdate\",value:function(e){!this.props.preSelection||He(this.props.preSelection,e.preSelection)&&this.props.monthSelectedIn===e.monthSelectedIn?this.props.openToDate&&!He(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate}):this.setState({date:this.props.preSelection})}},{key:\"render\",value:function(){var t=this.props.container||Rt;return e.createElement(\"div\",{ref:this.containerRef},e.createElement(t,{className:r(\"react-datepicker\",this.props.className,{\"react-datepicker--time-only\":this.props.showTimeSelectOnly}),showPopperArrow:this.props.showPopperArrow,arrowProps:this.props.arrowProps},this.renderAriaLiveRegion(),this.renderPreviousButton(),this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.renderChildren()))}}],[{key:\"defaultProps\",get:function(){return{onDropdownFocus:function(){},monthsShown:1,monthSelectedIn:0,forceShowMonthNavigation:!1,timeCaption:\"Time\",previousYearButtonLabel:\"Previous Year\",nextYearButtonLabel:\"Next Year\",previousMonthButtonLabel:\"Previous Month\",nextMonthButtonLabel:\"Next Month\",customTimeInput:null,yearItemNumber:12}}}]),o}(),Kt=function(t){De(n,e.Component);var r=Se(n);function n(e){var t;return he(this,n),(t=r.call(this,e)).el=document.createElement(\"div\"),t}return fe(n,[{key:\"componentDidMount\",value:function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement(\"div\"),this.portalRoot.setAttribute(\"id\",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)}},{key:\"componentWillUnmount\",value:function(){this.portalRoot.removeChild(this.el)}},{key:\"render\",value:function(){return ae.createPortal(this.props.children,this.el)}}]),n}(),Bt=function(e){return!e.disabled&&-1!==e.tabIndex},Wt=function(t){De(n,e.Component);var r=Se(n);function n(t){var o;return he(this,n),ye(ke(o=r.call(this,t)),\"getTabChildren\",(function(){return Array.prototype.slice.call(o.tabLoopRef.current.querySelectorAll(\"[tabindex], a, button, input, select, textarea\"),1,-1).filter(Bt)})),ye(ke(o),\"handleFocusStart\",(function(e){var t=o.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),ye(ke(o),\"handleFocusEnd\",(function(e){var t=o.getTabChildren();t&&t.length>1&&t[0].focus()})),o.tabLoopRef=e.createRef(),o}return fe(n,[{key:\"render\",value:function(){return this.props.enableTabLoop?e.createElement(\"div\",{className:\"react-datepicker__tab-loop\",ref:this.tabLoopRef},e.createElement(\"div\",{className:\"react-datepicker__tab-loop__start\",tabIndex:\"0\",onFocus:this.handleFocusStart}),this.props.children,e.createElement(\"div\",{className:\"react-datepicker__tab-loop__end\",tabIndex:\"0\",onFocus:this.handleFocusEnd})):this.props.children}}],[{key:\"defaultProps\",get:function(){return{enableTabLoop:!0}}}]),n}(),jt=function(t){De(o,e.Component);var n=Se(o);function o(){return he(this,o),n.apply(this,arguments)}return fe(o,[{key:\"render\",value:function(){var t,n=this.props,o=n.className,a=n.wrapperClassName,s=n.hidePopper,i=n.popperComponent,p=n.popperModifiers,c=n.popperPlacement,l=n.popperProps,d=n.targetComponent,u=n.enableTabLoop,h=n.popperOnKeyDown,m=n.portalId,f=n.portalHost;if(!s){var y=r(\"react-datepicker-popper\",o);t=e.createElement(se,ve({modifiers:p,placement:c},l),(function(t){var r=t.ref,n=t.style,o=t.placement,a=t.arrowProps;return e.createElement(Wt,{enableTabLoop:u},e.createElement(\"div\",{ref:r,style:n,className:y,\"data-placement\":o,onKeyDown:h},e.cloneElement(i,{arrowProps:a})))}))}this.props.popperContainer&&(t=e.createElement(this.props.popperContainer,{},t)),m&&!s&&(t=e.createElement(Kt,{portalId:m,portalHost:f},t));var v=r(\"react-datepicker-wrapper\",a);return e.createElement(ie,{className:\"react-datepicker-manager\"},e.createElement(pe,null,(function(t){var r=t.ref;return e.createElement(\"div\",{ref:r,className:v},d)})),t)}}],[{key:\"defaultProps\",get:function(){return{hidePopper:!0,popperModifiers:[],popperProps:{},popperPlacement:\"bottom-start\"}}}]),o}(),Qt=oe(At);var Ht=function(t){De(a,e.Component);var o=Se(a);function a(t){var s;return he(this,a),ye(ke(s=o.call(this,t)),\"getPreSelection\",(function(){return s.props.openToDate?s.props.openToDate:s.props.selectsEnd&&s.props.startDate?s.props.startDate:s.props.selectsStart&&s.props.endDate?s.props.endDate:Pe()})),ye(ke(s),\"calcInitialState\",(function(){var e,t=s.getPreSelection(),r=ft(s.props),n=yt(s.props),o=r&&Z(t,K(r))?r:n&&X(t,H(n))?n:t;return{open:s.props.startOpen||!1,preventFocus:!1,preSelection:null!==(e=s.props.selectsRange?s.props.startDate:s.props.selected)&&void 0!==e?e:o,highlightDates:vt(s.props.highlightDates),focused:!1,shouldFocusDayInline:!1,isRenderAriaLiveMessage:!1}})),ye(ke(s),\"clearPreventFocusTimeout\",(function(){s.preventFocusTimeout&&clearTimeout(s.preventFocusTimeout)})),ye(ke(s),\"setFocus\",(function(){s.input&&s.input.focus&&s.input.focus({preventScroll:!0})})),ye(ke(s),\"setBlur\",(function(){s.input&&s.input.blur&&s.input.blur(),s.cancelFocusInput()})),ye(ke(s),\"setOpen\",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];s.setState({open:e,preSelection:e&&s.state.open?s.state.preSelection:s.calcInitialState().preSelection,lastPreSelectChange:qt},(function(){e||s.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&s.setBlur(),s.setState({inputValue:null})}))}))})),ye(ke(s),\"inputOk\",(function(){return n(s.state.preSelection)})),ye(ke(s),\"isCalendarOpen\",(function(){return void 0===s.props.open?s.state.open&&!s.props.disabled&&!s.props.readOnly:s.props.open})),ye(ke(s),\"handleFocus\",(function(e){s.state.preventFocus||(s.props.onFocus(e),s.props.preventOpenOnFocus||s.props.readOnly||s.setOpen(!0)),s.setState({focused:!0})})),ye(ke(s),\"cancelFocusInput\",(function(){clearTimeout(s.inputFocusTimeout),s.inputFocusTimeout=null})),ye(ke(s),\"deferFocusInput\",(function(){s.cancelFocusInput(),s.inputFocusTimeout=setTimeout((function(){return s.setFocus()}),1)})),ye(ke(s),\"handleDropdownFocus\",(function(){s.cancelFocusInput()})),ye(ke(s),\"handleBlur\",(function(e){(!s.state.open||s.props.withPortal||s.props.showTimeInput)&&s.props.onBlur(e),s.setState({focused:!1})})),ye(ke(s),\"handleCalendarClickOutside\",(function(e){s.props.inline||s.setOpen(!1),s.props.onClickOutside(e),s.props.withPortal&&e.preventDefault()})),ye(ke(s),\"handleChange\",(function(){for(var e=arguments.length,t=new Array(e),r=0;r (new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString());\n\nexport const DatePicker = ({\n defaultValue,\n classes,\n dataTestId,\n disabled,\n ref,\n onChange,\n dateFormat = 'dd-MM-yyyy',\n maxDate = '2049-12-31',\n}: any) => {\n const defaultDate = defaultValue ? new Date(defaultValue) : null;\n const [date, setDate] = useState(defaultDate) as any;\n\n return (\n
\n {\n const formattedDate = getISOFormattedDateWithTimeZone(value).split('T')[0];\n setDate(value);\n onChange(formattedDate);\n }}\n minDate={new Date()}\n maxDate={new Date(maxDate)}\n popperPlacement=\"bottom-end\"\n className={`custom-datepicker ${classes || ''}`}\n data-testid={dataTestId}\n disabled={disabled}\n ref={ref}\n />\n
\n );\n};\n\nexport const TimePicker = ({\n defaultValue,\n classes,\n dataTestId,\n disabled,\n ref,\n onChange,\n dateFormat = 'HH:mm',\n timeFormat = 'HH:mm',\n}: any) => {\n const date = new Date();\n let hour: string;\n let minute: string;\n if (defaultValue) {\n hour = defaultValue.split(':')[0];\n minute = defaultValue.split(':')[1];\n date.setHours(parseInt(hour, 10), parseInt(minute, 10));\n }\n const [time, setTime] = useState(defaultValue ? date : null) as any;\n return (\n
\n {\n const formattedTime = value?.toTimeString().split(':').slice(0, 2).join(':');\n setTime(value);\n onChange(formattedTime);\n }}\n showTimeSelect\n showTimeSelectOnly\n timeIntervals={5}\n timeCaption=\"Time\"\n dateFormat={dateFormat}\n timeFormat={timeFormat}\n className={`custom-timepicker ${classes || ''}`}\n data-testid={dataTestId}\n disabled={disabled}\n ref={ref}\n />\n
\n );\n};\n","import React, { forwardRef } from 'react';\nimport { ICustomInput } from '../../types/input';\nimport { DatePicker, TimePicker } from '../dateTimePicker/DateTimePicker';\nimport Typography from '../typography/Typography';\nimport './input.scss';\nimport SearchIcon from '../icons/SearchIcon';\nimport CheckIcon from '../icons/CheckIcon';\nimport DangerIcon from '../icons/DangerIcon';\nimport { XIcon } from '../icons';\nimport Loader from '../loader/Loader';\n\nconst Input = forwardRef(\n (\n {\n name,\n onChange,\n onBlur,\n onWheel,\n onFocus,\n clear,\n hasValue,\n error = '',\n className = '',\n label,\n defaultValue = undefined,\n disabled = false,\n placeholder = '',\n type = 'text',\n nonEditable = false,\n search = false,\n confirmed = false,\n iconLeft,\n fullWidth = false,\n upperCase = false,\n clearButtonShow = false,\n loading = false,\n maxDate,\n ...props\n },\n ref,\n ) => {\n const classBase = 'custom-input';\n\n let classes = classBase;\n\n if (disabled) classes += ` ${classBase}-disabled`;\n if (nonEditable) classes += ` ${classBase}-non-editable`;\n if (hasValue) classes += ` ${classBase}-has-value`;\n if (search) classes += ` ${classBase}-search`;\n if (error) classes += ` ${classBase}-error`;\n if (!error && confirmed) classes += ` ${classBase}-success`;\n if (iconLeft) classes += ` ${classBase}-icon-left`;\n if (upperCase) classes += ' uppercase';\n\n const clearText = () => {\n const input = document.getElementsByName(name!)[0];\n if (input instanceof HTMLInputElement) {\n input.value = '';\n if (clear) clear();\n }\n };\n // Do not change the order of the elements, adjancent element selector is used for styling\n return (\n
\n {/* eslint-disable */}\n {type === 'custom-date'\n ? (\n \n )\n : type === 'custom-time'\n ? (\n \n )\n : (\n \n )}\n {/* eslint-enable */}\n {label || ''}\n {error && }\n {confirmed && !error && }\n {search && }\n {(search && clearButtonShow) && }\n {iconLeft && {iconLeft}}\n {loading && }\n {error && (\n \n {error}\n \n )}\n
\n );\n },\n);\n\nexport default Input;\n\nInput.displayName = 'Input';\n","import React from 'react';\nimport { INotificationProps } from '../../types/notification';\nimport CircleCheckIcon from '../icons/CircleCheckIcon';\nimport DangerIcon from '../icons/DangerIcon';\nimport XIcon from '../icons/XIcon';\nimport Typography from '../typography/Typography';\nimport './notification.scss';\n\nconst Notification: React.FC = ({\n variant,\n message,\n fullWidth,\n button,\n onClose,\n className = '',\n additionalText = '',\n isSnackBar = false,\n custom = false,\n customTitle = null,\n children = null,\n icon,\n}) => {\n const classBase = 'notification';\n\n const getColor = () => {\n if (variant === 'error') return 'red5';\n if (variant === 'success') return 'atlantis5';\n if (variant === 'neutral') return 'blue5';\n return 'asphalt7';\n };\n\n const getBgColor = () => {\n if (variant === 'error') return 'red1';\n if (variant === 'success') return 'atlantis1';\n if (variant === 'neutral') return 'blue1';\n return 'asphalt2';\n };\n\n const color = getColor();\n const bgColor = getBgColor();\n\n const renderIcon = () => {\n switch (variant) {\n case 'success':\n return (\n \n );\n case 'info': case 'neutral': case 'error':\n return (\n \n );\n default:\n return null;\n }\n };\n\n return (\n \n {customTitle\n ?
{customTitle}
\n : ''}\n \n {icon || renderIcon()}\n \n\n
\n\n
\n {custom\n ? (\n // eslint-disable-next-line\n <>{children}\n )\n : (\n \n {message}\n \n )}\n {onClose && (\n \n \n \n )}\n
\n\n {additionalText && (\n \n {additionalText}\n \n )}\n\n {button &&
{button}
}\n
\n\n
\n );\n};\n\nexport default Notification;\n","import React from 'react';\n\nvar isCheckBoxInput = (element) => element.type === 'checkbox';\n\nvar isDateObject = (value) => value instanceof Date;\n\nvar isNullOrUndefined = (value) => value == null;\n\nconst isObjectType = (value) => typeof value === 'object';\r\nvar isObject = (value) => !isNullOrUndefined(value) &&\r\n !Array.isArray(value) &&\r\n isObjectType(value) &&\r\n !isDateObject(value);\n\nvar getEventValue = (event) => isObject(event) && event.target\r\n ? isCheckBoxInput(event.target)\r\n ? event.target.checked\r\n : event.target.value\r\n : event;\n\nvar getNodeParentName = (name) => name.substring(0, name.search(/.\\d/)) || name;\n\nvar isNameInFieldArray = (names, name) => [...names].some((current) => getNodeParentName(name) === current);\n\nvar compact = (value) => value.filter(Boolean);\n\nvar isUndefined = (val) => val === undefined;\n\nvar get = (obj, path, defaultValue) => {\r\n if (!path || !isObject(obj)) {\r\n return defaultValue;\r\n }\r\n const result = compact(path.split(/[,[\\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], obj);\r\n return isUndefined(result) || result === obj\r\n ? isUndefined(obj[path])\r\n ? defaultValue\r\n : obj[path]\r\n : result;\r\n};\n\nconst EVENTS = {\r\n BLUR: 'blur',\r\n CHANGE: 'change',\r\n};\r\nconst VALIDATION_MODE = {\r\n onBlur: 'onBlur',\r\n onChange: 'onChange',\r\n onSubmit: 'onSubmit',\r\n onTouched: 'onTouched',\r\n all: 'all',\r\n};\r\nconst INPUT_VALIDATION_RULES = {\r\n max: 'max',\r\n min: 'min',\r\n maxLength: 'maxLength',\r\n minLength: 'minLength',\r\n pattern: 'pattern',\r\n required: 'required',\r\n validate: 'validate',\r\n};\n\nvar omit = (source, key) => {\r\n const copy = Object.assign({}, source);\r\n delete copy[key];\r\n return copy;\r\n};\n\nconst HookFormContext = React.createContext(null);\r\nconst useFormContext = () => React.useContext(HookFormContext);\r\nconst FormProvider = (props) => (React.createElement(HookFormContext.Provider, { value: omit(props, 'children') }, props.children));\n\nvar getProxyFormState = (formState, _proxyFormState, localProxyFormState, isRoot = true) => {\r\n function createGetter(prop) {\r\n return () => {\r\n if (prop in formState) {\r\n if (_proxyFormState[prop] !== VALIDATION_MODE.all) {\r\n _proxyFormState[prop] = !isRoot || VALIDATION_MODE.all;\r\n }\r\n localProxyFormState && (localProxyFormState[prop] = true);\r\n return formState[prop];\r\n }\r\n return undefined;\r\n };\r\n }\r\n const result = {};\r\n for (const key in formState) {\r\n Object.defineProperty(result, key, {\r\n get: createGetter(key),\r\n });\r\n }\r\n return result;\r\n};\n\nvar isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;\n\nvar shouldRenderFormState = (formStateData, _proxyFormState, isRoot) => {\r\n const formState = omit(formStateData, 'name');\r\n return (isEmptyObject(formState) ||\r\n Object.keys(formState).length >= Object.keys(_proxyFormState).length ||\r\n Object.keys(formState).find((key) => _proxyFormState[key] ===\r\n (!isRoot || VALIDATION_MODE.all)));\r\n};\n\nvar convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);\n\nvar shouldSubscribeByName = (name, signalName, exact) => exact && signalName\r\n ? name === signalName\r\n : !name ||\r\n !signalName ||\r\n name === signalName ||\r\n convertToArrayPayload(name).some((currentName) => currentName &&\r\n (currentName.startsWith(signalName) ||\r\n signalName.startsWith(currentName)));\n\nfunction useSubscribe(props) {\r\n const _props = React.useRef(props);\r\n _props.current = props;\r\n React.useEffect(() => {\r\n const tearDown = (subscription) => {\r\n if (subscription) {\r\n subscription.unsubscribe();\r\n }\r\n };\r\n const subscription = !props.disabled &&\r\n _props.current.subject.subscribe({\r\n next: _props.current.callback,\r\n });\r\n return () => tearDown(subscription);\r\n }, [props.disabled]);\r\n}\n\nfunction useFormState(props) {\r\n const methods = useFormContext();\r\n const { control = methods.control, disabled, name, exact } = props || {};\r\n const [formState, updateFormState] = React.useState(control._formState);\r\n const _localProxyFormState = React.useRef({\r\n isDirty: false,\r\n dirtyFields: false,\r\n touchedFields: false,\r\n isValidating: false,\r\n isValid: false,\r\n errors: false,\r\n });\r\n const _name = React.useRef(name);\r\n const _mounted = React.useRef(true);\r\n _name.current = name;\r\n const callback = React.useCallback((value) => _mounted.current &&\r\n shouldSubscribeByName(_name.current, value.name, exact) &&\r\n shouldRenderFormState(value, _localProxyFormState.current) &&\r\n updateFormState(Object.assign(Object.assign({}, control._formState), value)), [control, exact]);\r\n useSubscribe({\r\n disabled,\r\n callback,\r\n subject: control._subjects.state,\r\n });\r\n React.useEffect(() => () => {\r\n _mounted.current = false;\r\n }, []);\r\n return getProxyFormState(formState, control._proxyFormState, _localProxyFormState.current, false);\r\n}\n\nvar isString = (value) => typeof value === 'string';\n\nvar generateWatchOutput = (names, _names, formValues, isGlobal) => {\r\n const isArray = Array.isArray(names);\r\n if (isString(names)) {\r\n isGlobal && _names.watch.add(names);\r\n return get(formValues, names);\r\n }\r\n if (isArray) {\r\n return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName),\r\n get(formValues, fieldName)));\r\n }\r\n isGlobal && (_names.watchAll = true);\r\n return formValues;\r\n};\n\nvar isFunction = (value) => typeof value === 'function';\n\nvar objectHasFunction = (data) => {\r\n for (const key in data) {\r\n if (isFunction(data[key])) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\n\nfunction useWatch(props) {\r\n const methods = useFormContext();\r\n const { control = methods.control, name, defaultValue, disabled, exact, } = props || {};\r\n const _name = React.useRef(name);\r\n _name.current = name;\r\n const callback = React.useCallback((formState) => {\r\n if (shouldSubscribeByName(_name.current, formState.name, exact)) {\r\n const fieldValues = generateWatchOutput(_name.current, control._names, formState.values || control._formValues);\r\n updateValue(isUndefined(_name.current) ||\r\n (isObject(fieldValues) && !objectHasFunction(fieldValues))\r\n ? Object.assign({}, fieldValues) : Array.isArray(fieldValues)\r\n ? [...fieldValues]\r\n : isUndefined(fieldValues)\r\n ? defaultValue\r\n : fieldValues);\r\n }\r\n }, [control, exact, defaultValue]);\r\n useSubscribe({\r\n disabled,\r\n subject: control._subjects.watch,\r\n callback,\r\n });\r\n const [value, updateValue] = React.useState(isUndefined(defaultValue)\r\n ? control._getWatch(name)\r\n : defaultValue);\r\n React.useEffect(() => {\r\n control._removeUnmounted();\r\n });\r\n return value;\r\n}\n\nfunction useController(props) {\r\n const methods = useFormContext();\r\n const { name, control = methods.control, shouldUnregister } = props;\r\n const isArrayField = isNameInFieldArray(control._names.array, name);\r\n const value = useWatch({\r\n control,\r\n name,\r\n defaultValue: get(control._formValues, name, get(control._defaultValues, name, props.defaultValue)),\r\n exact: !isArrayField,\r\n });\r\n const formState = useFormState({\r\n control,\r\n name,\r\n });\r\n const _registerProps = React.useRef(control.register(name, Object.assign(Object.assign({}, props.rules), { value })));\r\n React.useEffect(() => {\r\n const updateMounted = (name, value) => {\r\n const field = get(control._fields, name);\r\n if (field) {\r\n field._f.mount = value;\r\n }\r\n };\r\n updateMounted(name, true);\r\n return () => {\r\n const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;\r\n (isArrayField\r\n ? _shouldUnregisterField && !control._stateFlags.action\r\n : _shouldUnregisterField)\r\n ? control.unregister(name)\r\n : updateMounted(name, false);\r\n };\r\n }, [name, control, isArrayField, shouldUnregister]);\r\n return {\r\n field: {\r\n name,\r\n value,\r\n onChange: React.useCallback((event) => {\r\n _registerProps.current.onChange({\r\n target: {\r\n value: getEventValue(event),\r\n name: name,\r\n },\r\n type: EVENTS.CHANGE,\r\n });\r\n }, [name]),\r\n onBlur: React.useCallback(() => {\r\n _registerProps.current.onBlur({\r\n target: {\r\n value: get(control._formValues, name),\r\n name: name,\r\n },\r\n type: EVENTS.BLUR,\r\n });\r\n }, [name, control]),\r\n ref: React.useCallback((elm) => {\r\n const field = get(control._fields, name);\r\n if (elm && field && elm.focus) {\r\n field._f.ref = {\r\n focus: () => elm.focus(),\r\n setCustomValidity: (message) => elm.setCustomValidity(message),\r\n reportValidity: () => elm.reportValidity(),\r\n };\r\n }\r\n }, [name, control]),\r\n },\r\n formState,\r\n fieldState: control.getFieldState(name, formState),\r\n };\r\n}\n\nconst Controller = (props) => props.render(useController(props));\n\nvar appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria\r\n ? Object.assign(Object.assign({}, errors[name]), { types: Object.assign(Object.assign({}, (errors[name] && errors[name].types ? errors[name].types : {})), { [type]: message || true }) }) : {};\n\nvar isKey = (value) => /^\\w*$/.test(value);\n\nvar stringToPath = (input) => compact(input.replace(/[\"|']|\\]/g, '').split(/\\.|\\[/));\n\nfunction set(object, path, value) {\r\n let index = -1;\r\n const tempPath = isKey(path) ? [path] : stringToPath(path);\r\n const length = tempPath.length;\r\n const lastIndex = length - 1;\r\n while (++index < length) {\r\n const key = tempPath[index];\r\n let newValue = value;\r\n if (index !== lastIndex) {\r\n const objValue = object[key];\r\n newValue =\r\n isObject(objValue) || Array.isArray(objValue)\r\n ? objValue\r\n : !isNaN(+tempPath[index + 1])\r\n ? []\r\n : {};\r\n }\r\n object[key] = newValue;\r\n object = object[key];\r\n }\r\n return object;\r\n}\n\nconst focusFieldBy = (fields, callback, fieldsNames) => {\r\n for (const key of fieldsNames || Object.keys(fields)) {\r\n const field = get(fields, key);\r\n if (field) {\r\n const _f = field._f;\r\n const current = omit(field, '_f');\r\n if (_f && callback(_f.name)) {\r\n if (_f.ref.focus && isUndefined(_f.ref.focus())) {\r\n break;\r\n }\r\n else if (_f.refs) {\r\n _f.refs[0].focus();\r\n break;\r\n }\r\n }\r\n else if (isObject(current)) {\r\n focusFieldBy(current, callback);\r\n }\r\n }\r\n }\r\n};\n\nvar generateId = () => {\r\n const d = typeof performance === 'undefined' ? Date.now() : performance.now() * 1000;\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\r\n const r = (Math.random() * 16 + d) % 16 | 0;\r\n return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);\r\n });\r\n};\n\nvar getFocusFieldName = (name, index, options = {}) => options.shouldFocus || isUndefined(options.shouldFocus)\r\n ? options.focusName ||\r\n `${name}.${isUndefined(options.focusIndex) ? index : options.focusIndex}.`\r\n : '';\n\nvar isWatched = (name, _names, isBlurEvent) => !isBlurEvent &&\r\n (_names.watchAll ||\r\n _names.watch.has(name) ||\r\n [..._names.watch].some((watchName) => name.startsWith(watchName) &&\r\n /^\\.\\w+/.test(name.slice(watchName.length))));\n\nfunction append(data, value) {\r\n return [...data, ...convertToArrayPayload(value)];\r\n}\n\nfunction cloneObject(data) {\r\n let copy;\r\n const isArray = Array.isArray(data);\r\n if (data instanceof Date) {\r\n copy = new Date(data);\r\n }\r\n else if (data instanceof Set) {\r\n copy = new Set(data);\r\n }\r\n else if (isArray || isObject(data)) {\r\n copy = isArray ? [] : {};\r\n for (const key in data) {\r\n if (isFunction(data[key])) {\r\n copy = data;\r\n break;\r\n }\r\n copy[key] = cloneObject(data[key]);\r\n }\r\n }\r\n else {\r\n return data;\r\n }\r\n return copy;\r\n}\n\nvar fillEmptyArray = (value) => Array.isArray(value) ? value.map(() => undefined) : undefined;\n\nfunction insert(data, index, value) {\r\n return [\r\n ...data.slice(0, index),\r\n ...convertToArrayPayload(value),\r\n ...data.slice(index),\r\n ];\r\n}\n\nvar moveArrayAt = (data, from, to) => {\r\n if (!Array.isArray(data)) {\r\n return [];\r\n }\r\n if (isUndefined(data[to])) {\r\n data[to] = undefined;\r\n }\r\n data.splice(to, 0, data.splice(from, 1)[0]);\r\n return data;\r\n};\n\nfunction prepend(data, value) {\r\n return [...convertToArrayPayload(value), ...convertToArrayPayload(data)];\r\n}\n\nfunction removeAtIndexes(data, indexes) {\r\n let i = 0;\r\n const temp = [...data];\r\n for (const index of indexes) {\r\n temp.splice(index - i, 1);\r\n i++;\r\n }\r\n return compact(temp).length ? temp : [];\r\n}\r\nvar removeArrayAt = (data, index) => isUndefined(index)\r\n ? []\r\n : removeAtIndexes(data, convertToArrayPayload(index).sort((a, b) => a - b));\n\nvar swapArrayAt = (data, indexA, indexB) => {\r\n data[indexA] = [data[indexB], (data[indexB] = data[indexA])][0];\r\n};\n\nvar updateAt = (fieldValues, index, value) => {\r\n fieldValues[index] = value;\r\n return fieldValues;\r\n};\n\nconst useFieldArray = (props) => {\r\n const methods = useFormContext();\r\n const { control = methods.control, name, keyName = 'id', shouldUnregister, } = props;\r\n const [fields, setFields] = React.useState(control._getFieldArray(name));\r\n const ids = React.useRef(control._getFieldArray(name).map(generateId));\r\n const _fieldIds = React.useRef(fields);\r\n const _name = React.useRef(name);\r\n const _actioned = React.useRef(false);\r\n _name.current = name;\r\n _fieldIds.current = fields;\r\n control._names.array.add(name);\r\n const callback = React.useCallback(({ values, name: fieldArrayName }) => {\r\n if (fieldArrayName === _name.current || !fieldArrayName) {\r\n const fieldValues = get(values, _name.current, []);\r\n setFields(fieldValues);\r\n ids.current = fieldValues.map(generateId);\r\n }\r\n }, []);\r\n useSubscribe({\r\n callback,\r\n subject: control._subjects.array,\r\n });\r\n const updateValues = React.useCallback((updatedFieldArrayValues) => {\r\n _actioned.current = true;\r\n set(control._formValues, name, updatedFieldArrayValues);\r\n }, [control, name]);\r\n const append$1 = (value, options) => {\r\n const appendValue = convertToArrayPayload(cloneObject(value));\r\n const updatedFieldArrayValues = append(control._getFieldArray(name), appendValue);\r\n control._names.focus = getFocusFieldName(name, updatedFieldArrayValues.length - 1, options);\r\n ids.current = append(ids.current, appendValue.map(generateId));\r\n setFields(updatedFieldArrayValues);\r\n updateValues(updatedFieldArrayValues);\r\n control._updateFieldArray(name, append, {\r\n argA: fillEmptyArray(value),\r\n }, updatedFieldArrayValues);\r\n };\r\n const prepend$1 = (value, options) => {\r\n const prependValue = convertToArrayPayload(cloneObject(value));\r\n const updatedFieldArrayValues = prepend(control._getFieldArray(name), prependValue);\r\n control._names.focus = getFocusFieldName(name, 0, options);\r\n ids.current = prepend(ids.current, prependValue.map(generateId));\r\n setFields(updatedFieldArrayValues);\r\n updateValues(updatedFieldArrayValues);\r\n control._updateFieldArray(name, prepend, {\r\n argA: fillEmptyArray(value),\r\n }, updatedFieldArrayValues);\r\n };\r\n const remove = (index) => {\r\n const updatedFieldArrayValues = removeArrayAt(control._getFieldArray(name), index);\r\n ids.current = removeArrayAt(ids.current, index);\r\n setFields(updatedFieldArrayValues);\r\n updateValues(updatedFieldArrayValues);\r\n control._updateFieldArray(name, removeArrayAt, {\r\n argA: index,\r\n }, updatedFieldArrayValues);\r\n };\r\n const insert$1 = (index, value, options) => {\r\n const insertValue = convertToArrayPayload(cloneObject(value));\r\n const updatedFieldArrayValues = insert(control._getFieldArray(name), index, insertValue);\r\n updateValues(updatedFieldArrayValues);\r\n control._names.focus = getFocusFieldName(name, index, options);\r\n ids.current = insert(ids.current, index, insertValue.map(generateId));\r\n setFields(updatedFieldArrayValues);\r\n control._updateFieldArray(name, insert, {\r\n argA: index,\r\n argB: fillEmptyArray(value),\r\n }, updatedFieldArrayValues);\r\n };\r\n const swap = (indexA, indexB) => {\r\n const updatedFieldArrayValues = control._getFieldArray(name);\r\n swapArrayAt(updatedFieldArrayValues, indexA, indexB);\r\n swapArrayAt(ids.current, indexA, indexB);\r\n setFields(updatedFieldArrayValues);\r\n updateValues(updatedFieldArrayValues);\r\n control._updateFieldArray(name, swapArrayAt, {\r\n argA: indexA,\r\n argB: indexB,\r\n }, updatedFieldArrayValues, false);\r\n };\r\n const move = (from, to) => {\r\n const updatedFieldArrayValues = control._getFieldArray(name);\r\n moveArrayAt(updatedFieldArrayValues, from, to);\r\n moveArrayAt(ids.current, from, to);\r\n setFields(updatedFieldArrayValues);\r\n updateValues(updatedFieldArrayValues);\r\n control._updateFieldArray(name, moveArrayAt, {\r\n argA: from,\r\n argB: to,\r\n }, updatedFieldArrayValues, false);\r\n };\r\n const update = (index, value) => {\r\n const updatedFieldArrayValues = updateAt(control._getFieldArray(name), index, value);\r\n ids.current = [...updatedFieldArrayValues].map((item, i) => !item || i === index ? generateId() : ids.current[i]);\r\n setFields([...updatedFieldArrayValues]);\r\n updateValues(updatedFieldArrayValues);\r\n control._updateFieldArray(name, updateAt, {\r\n argA: index,\r\n argB: value,\r\n }, updatedFieldArrayValues, true, false);\r\n };\r\n const replace = (value) => {\r\n const updatedFieldArrayValues = convertToArrayPayload(value);\r\n ids.current = updatedFieldArrayValues.map(generateId);\r\n updateValues([...updatedFieldArrayValues]);\r\n setFields([...updatedFieldArrayValues]);\r\n control._updateFieldArray(name, () => updatedFieldArrayValues, {}, [...updatedFieldArrayValues], true, false);\r\n };\r\n React.useEffect(() => {\r\n control._stateFlags.action = false;\r\n isWatched(name, control._names) && control._subjects.state.next({});\r\n if (_actioned.current) {\r\n control._executeSchema([name]).then((result) => {\r\n const error = get(result.errors, name);\r\n if (error && error.type && !get(control._formState.errors, name)) {\r\n set(control._formState.errors, name, error);\r\n control._subjects.state.next({\r\n errors: control._formState.errors,\r\n });\r\n }\r\n });\r\n }\r\n control._subjects.watch.next({\r\n name,\r\n values: control._formValues,\r\n });\r\n control._names.focus &&\r\n focusFieldBy(control._fields, (key) => key.startsWith(control._names.focus));\r\n control._names.focus = '';\r\n control._proxyFormState.isValid && control._updateValid();\r\n }, [fields, name, control]);\r\n React.useEffect(() => {\r\n !get(control._formValues, name) && set(control._formValues, name, []);\r\n return () => {\r\n (control._options.shouldUnregister || shouldUnregister) &&\r\n control.unregister(name);\r\n };\r\n }, [name, control, keyName, shouldUnregister]);\r\n return {\r\n swap: React.useCallback(swap, [updateValues, name, control]),\r\n move: React.useCallback(move, [updateValues, name, control]),\r\n prepend: React.useCallback(prepend$1, [updateValues, name, control]),\r\n append: React.useCallback(append$1, [updateValues, name, control]),\r\n remove: React.useCallback(remove, [updateValues, name, control]),\r\n insert: React.useCallback(insert$1, [updateValues, name, control]),\r\n update: React.useCallback(update, [updateValues, name, control]),\r\n replace: React.useCallback(replace, [updateValues, name, control]),\r\n fields: React.useMemo(() => fields.map((field, index) => (Object.assign(Object.assign({}, field), { [keyName]: ids.current[index] || generateId() }))), [fields, keyName]),\r\n };\r\n};\n\nfunction createSubject() {\r\n let _observers = [];\r\n const next = (value) => {\r\n for (const observer of _observers) {\r\n observer.next(value);\r\n }\r\n };\r\n const subscribe = (observer) => {\r\n _observers.push(observer);\r\n return {\r\n unsubscribe: () => {\r\n _observers = _observers.filter((o) => o !== observer);\r\n },\r\n };\r\n };\r\n const unsubscribe = () => {\r\n _observers = [];\r\n };\r\n return {\r\n get observers() {\r\n return _observers;\r\n },\r\n next,\r\n subscribe,\r\n unsubscribe,\r\n };\r\n}\n\nvar isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);\n\nfunction deepEqual(object1, object2) {\r\n if (isPrimitive(object1) || isPrimitive(object2)) {\r\n return object1 === object2;\r\n }\r\n if (isDateObject(object1) && isDateObject(object2)) {\r\n return object1.getTime() === object2.getTime();\r\n }\r\n const keys1 = Object.keys(object1);\r\n const keys2 = Object.keys(object2);\r\n if (keys1.length !== keys2.length) {\r\n return false;\r\n }\r\n for (const key of keys1) {\r\n const val1 = object1[key];\r\n if (!keys2.includes(key)) {\r\n return false;\r\n }\r\n if (key !== 'ref') {\r\n const val2 = object2[key];\r\n if ((isDateObject(val1) && isDateObject(val2)) ||\r\n (isObject(val1) && isObject(val2)) ||\r\n (Array.isArray(val1) && Array.isArray(val2))\r\n ? !deepEqual(val1, val2)\r\n : val1 !== val2) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n}\n\nvar getValidationModes = (mode) => ({\r\n isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,\r\n isOnBlur: mode === VALIDATION_MODE.onBlur,\r\n isOnChange: mode === VALIDATION_MODE.onChange,\r\n isOnAll: mode === VALIDATION_MODE.all,\r\n isOnTouch: mode === VALIDATION_MODE.onTouched,\r\n});\n\nvar isBoolean = (value) => typeof value === 'boolean';\n\nvar isFileInput = (element) => element.type === 'file';\n\nvar isHTMLElement = (value) => value instanceof HTMLElement;\n\nvar isMultipleSelect = (element) => element.type === `select-multiple`;\n\nvar isRadioInput = (element) => element.type === 'radio';\n\nvar isRadioOrCheckbox = (ref) => isRadioInput(ref) || isCheckBoxInput(ref);\n\nvar isWeb = typeof window !== 'undefined' &&\r\n typeof window.HTMLElement !== 'undefined' &&\r\n typeof document !== 'undefined';\n\nvar live = (ref) => isHTMLElement(ref) && ref.isConnected;\n\nfunction baseGet(object, updatePath) {\r\n const length = updatePath.slice(0, -1).length;\r\n let index = 0;\r\n while (index < length) {\r\n object = isUndefined(object) ? index++ : object[updatePath[index++]];\r\n }\r\n return object;\r\n}\r\nfunction unset(object, path) {\r\n const updatePath = isKey(path) ? [path] : stringToPath(path);\r\n const childObject = updatePath.length == 1 ? object : baseGet(object, updatePath);\r\n const key = updatePath[updatePath.length - 1];\r\n let previousObjRef;\r\n if (childObject) {\r\n delete childObject[key];\r\n }\r\n for (let k = 0; k < updatePath.slice(0, -1).length; k++) {\r\n let index = -1;\r\n let objectRef;\r\n const currentPaths = updatePath.slice(0, -(k + 1));\r\n const currentPathsLength = currentPaths.length - 1;\r\n if (k > 0) {\r\n previousObjRef = object;\r\n }\r\n while (++index < currentPaths.length) {\r\n const item = currentPaths[index];\r\n objectRef = objectRef ? objectRef[item] : object[item];\r\n if (currentPathsLength === index &&\r\n ((isObject(objectRef) && isEmptyObject(objectRef)) ||\r\n (Array.isArray(objectRef) &&\r\n !objectRef.filter((data) => (isObject(data) && !isEmptyObject(data)) || isBoolean(data)).length))) {\r\n previousObjRef ? delete previousObjRef[item] : delete object[item];\r\n }\r\n previousObjRef = objectRef;\r\n }\r\n }\r\n return object;\r\n}\n\nfunction markFieldsDirty(data, fields = {}) {\r\n const isParentNodeArray = Array.isArray(data);\r\n if (isObject(data) || isParentNodeArray) {\r\n for (const key in data) {\r\n if (Array.isArray(data[key]) ||\r\n (isObject(data[key]) && !objectHasFunction(data[key]))) {\r\n fields[key] = Array.isArray(data[key]) ? [] : {};\r\n markFieldsDirty(data[key], fields[key]);\r\n }\r\n else if (!isNullOrUndefined(data[key])) {\r\n fields[key] = true;\r\n }\r\n }\r\n }\r\n return fields;\r\n}\r\nfunction getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues) {\r\n const isParentNodeArray = Array.isArray(data);\r\n if (isObject(data) || isParentNodeArray) {\r\n for (const key in data) {\r\n if (Array.isArray(data[key]) ||\r\n (isObject(data[key]) && !objectHasFunction(data[key]))) {\r\n if (isUndefined(formValues) ||\r\n isPrimitive(dirtyFieldsFromValues[key])) {\r\n dirtyFieldsFromValues[key] = Array.isArray(data[key])\r\n ? markFieldsDirty(data[key], [])\r\n : Object.assign({}, markFieldsDirty(data[key]));\r\n }\r\n else {\r\n getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);\r\n }\r\n }\r\n else {\r\n dirtyFieldsFromValues[key] = !deepEqual(data[key], formValues[key]);\r\n }\r\n }\r\n }\r\n return dirtyFieldsFromValues;\r\n}\r\nvar getDirtyFields = (defaultValues, formValues) => getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));\n\nconst defaultResult = {\r\n value: false,\r\n isValid: false,\r\n};\r\nconst validResult = { value: true, isValid: true };\r\nvar getCheckboxValue = (options) => {\r\n if (Array.isArray(options)) {\r\n if (options.length > 1) {\r\n const values = options\r\n .filter((option) => option && option.checked && !option.disabled)\r\n .map((option) => option.value);\r\n return { value: values, isValid: !!values.length };\r\n }\r\n return options[0].checked && !options[0].disabled\r\n ? // @ts-expect-error expected to work in the browser\r\n options[0].attributes && !isUndefined(options[0].attributes.value)\r\n ? isUndefined(options[0].value) || options[0].value === ''\r\n ? validResult\r\n : { value: options[0].value, isValid: true }\r\n : validResult\r\n : defaultResult;\r\n }\r\n return defaultResult;\r\n};\n\nvar getFieldValueAs = (value, { valueAsNumber, valueAsDate, setValueAs }) => isUndefined(value)\r\n ? value\r\n : valueAsNumber\r\n ? value === ''\r\n ? NaN\r\n : +value\r\n : valueAsDate && isString(value)\r\n ? new Date(value)\r\n : setValueAs\r\n ? setValueAs(value)\r\n : value;\n\nconst defaultReturn = {\r\n isValid: false,\r\n value: null,\r\n};\r\nvar getRadioValue = (options) => Array.isArray(options)\r\n ? options.reduce((previous, option) => option && option.checked && !option.disabled\r\n ? {\r\n isValid: true,\r\n value: option.value,\r\n }\r\n : previous, defaultReturn)\r\n : defaultReturn;\n\nfunction getFieldValue(_f) {\r\n const ref = _f.ref;\r\n if (_f.refs ? _f.refs.every((ref) => ref.disabled) : ref.disabled) {\r\n return;\r\n }\r\n if (isFileInput(ref)) {\r\n return ref.files;\r\n }\r\n if (isRadioInput(ref)) {\r\n return getRadioValue(_f.refs).value;\r\n }\r\n if (isMultipleSelect(ref)) {\r\n return [...ref.selectedOptions].map(({ value }) => value);\r\n }\r\n if (isCheckBoxInput(ref)) {\r\n return getCheckboxValue(_f.refs).value;\r\n }\r\n return getFieldValueAs(isUndefined(ref.value) ? _f.ref.value : ref.value, _f);\r\n}\n\nvar getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {\r\n const fields = {};\r\n for (const name of fieldsNames) {\r\n const field = get(_fields, name);\r\n field && set(fields, name, field._f);\r\n }\r\n return {\r\n criteriaMode,\r\n names: [...fieldsNames],\r\n fields,\r\n shouldUseNativeValidation,\r\n };\r\n};\n\nvar isRegex = (value) => value instanceof RegExp;\n\nvar getRuleValue = (rule) => isUndefined(rule)\r\n ? undefined\r\n : isRegex(rule)\r\n ? rule.source\r\n : isObject(rule)\r\n ? isRegex(rule.value)\r\n ? rule.value.source\r\n : rule.value\r\n : rule;\n\nvar hasValidation = (options) => options.mount &&\r\n (options.required ||\r\n options.min ||\r\n options.max ||\r\n options.maxLength ||\r\n options.minLength ||\r\n options.pattern ||\r\n options.validate);\n\nfunction schemaErrorLookup(errors, _fields, name) {\r\n const error = get(errors, name);\r\n if (error || isKey(name)) {\r\n return {\r\n error,\r\n name,\r\n };\r\n }\r\n const names = name.split('.');\r\n while (names.length) {\r\n const fieldName = names.join('.');\r\n const field = get(_fields, fieldName);\r\n const foundError = get(errors, fieldName);\r\n if (field && !Array.isArray(field) && name !== fieldName) {\r\n return { name };\r\n }\r\n if (foundError && foundError.type) {\r\n return {\r\n name: fieldName,\r\n error: foundError,\r\n };\r\n }\r\n names.pop();\r\n }\r\n return {\r\n name,\r\n };\r\n}\n\nvar skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {\r\n if (mode.isOnAll) {\r\n return false;\r\n }\r\n else if (!isSubmitted && mode.isOnTouch) {\r\n return !(isTouched || isBlurEvent);\r\n }\r\n else if (isSubmitted ? reValidateMode.isOnBlur : mode.isOnBlur) {\r\n return !isBlurEvent;\r\n }\r\n else if (isSubmitted ? reValidateMode.isOnChange : mode.isOnChange) {\r\n return isBlurEvent;\r\n }\r\n return true;\r\n};\n\nvar unsetEmptyArray = (ref, name) => !compact(get(ref, name)).length && unset(ref, name);\n\nvar isMessage = (value) => isString(value) || React.isValidElement(value);\n\nfunction getValidateError(result, ref, type = 'validate') {\r\n if (isMessage(result) ||\r\n (Array.isArray(result) && result.every(isMessage)) ||\r\n (isBoolean(result) && !result)) {\r\n return {\r\n type,\r\n message: isMessage(result) ? result : '',\r\n ref,\r\n };\r\n }\r\n}\n\nvar getValueAndMessage = (validationData) => isObject(validationData) && !isRegex(validationData)\r\n ? validationData\r\n : {\r\n value: validationData,\r\n message: '',\r\n };\n\nvar validateField = async (field, inputValue, validateAllFieldCriteria, shouldUseNativeValidation) => {\r\n const { ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, disabled, } = field._f;\r\n if (!mount || disabled) {\r\n return {};\r\n }\r\n const inputRef = refs ? refs[0] : ref;\r\n const setCustomValidity = (message) => {\r\n if (shouldUseNativeValidation && inputRef.reportValidity) {\r\n inputRef.setCustomValidity(isBoolean(message) ? '' : message || ' ');\r\n inputRef.reportValidity();\r\n }\r\n };\r\n const error = {};\r\n const isRadio = isRadioInput(ref);\r\n const isCheckBox = isCheckBoxInput(ref);\r\n const isRadioOrCheckbox = isRadio || isCheckBox;\r\n const isEmpty = ((valueAsNumber || isFileInput(ref)) && !ref.value) ||\r\n inputValue === '' ||\r\n (Array.isArray(inputValue) && !inputValue.length);\r\n const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);\r\n const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {\r\n const message = exceedMax ? maxLengthMessage : minLengthMessage;\r\n error[name] = Object.assign({ type: exceedMax ? maxType : minType, message,\r\n ref }, appendErrorsCurry(exceedMax ? maxType : minType, message));\r\n };\r\n if (required &&\r\n ((!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue))) ||\r\n (isBoolean(inputValue) && !inputValue) ||\r\n (isCheckBox && !getCheckboxValue(refs).isValid) ||\r\n (isRadio && !getRadioValue(refs).isValid))) {\r\n const { value, message } = isMessage(required)\r\n ? { value: !!required, message: required }\r\n : getValueAndMessage(required);\r\n if (value) {\r\n error[name] = Object.assign({ type: INPUT_VALIDATION_RULES.required, message, ref: inputRef }, appendErrorsCurry(INPUT_VALIDATION_RULES.required, message));\r\n if (!validateAllFieldCriteria) {\r\n setCustomValidity(message);\r\n return error;\r\n }\r\n }\r\n }\r\n if (!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max))) {\r\n let exceedMax;\r\n let exceedMin;\r\n const maxOutput = getValueAndMessage(max);\r\n const minOutput = getValueAndMessage(min);\r\n if (!isNaN(inputValue)) {\r\n const valueNumber = ref.valueAsNumber ||\r\n parseFloat(inputValue);\r\n if (!isNullOrUndefined(maxOutput.value)) {\r\n exceedMax = valueNumber > maxOutput.value;\r\n }\r\n if (!isNullOrUndefined(minOutput.value)) {\r\n exceedMin = valueNumber < minOutput.value;\r\n }\r\n }\r\n else {\r\n const valueDate = ref.valueAsDate || new Date(inputValue);\r\n if (isString(maxOutput.value)) {\r\n exceedMax = valueDate > new Date(maxOutput.value);\r\n }\r\n if (isString(minOutput.value)) {\r\n exceedMin = valueDate < new Date(minOutput.value);\r\n }\r\n }\r\n if (exceedMax || exceedMin) {\r\n getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);\r\n if (!validateAllFieldCriteria) {\r\n setCustomValidity(error[name].message);\r\n return error;\r\n }\r\n }\r\n }\r\n if ((maxLength || minLength) && !isEmpty && isString(inputValue)) {\r\n const maxLengthOutput = getValueAndMessage(maxLength);\r\n const minLengthOutput = getValueAndMessage(minLength);\r\n const exceedMax = !isNullOrUndefined(maxLengthOutput.value) &&\r\n inputValue.length > maxLengthOutput.value;\r\n const exceedMin = !isNullOrUndefined(minLengthOutput.value) &&\r\n inputValue.length < minLengthOutput.value;\r\n if (exceedMax || exceedMin) {\r\n getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);\r\n if (!validateAllFieldCriteria) {\r\n setCustomValidity(error[name].message);\r\n return error;\r\n }\r\n }\r\n }\r\n if (pattern && !isEmpty && isString(inputValue)) {\r\n const { value: patternValue, message } = getValueAndMessage(pattern);\r\n if (isRegex(patternValue) && !inputValue.match(patternValue)) {\r\n error[name] = Object.assign({ type: INPUT_VALIDATION_RULES.pattern, message,\r\n ref }, appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message));\r\n if (!validateAllFieldCriteria) {\r\n setCustomValidity(message);\r\n return error;\r\n }\r\n }\r\n }\r\n if (validate) {\r\n if (isFunction(validate)) {\r\n const result = await validate(inputValue);\r\n const validateError = getValidateError(result, inputRef);\r\n if (validateError) {\r\n error[name] = Object.assign(Object.assign({}, validateError), appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message));\r\n if (!validateAllFieldCriteria) {\r\n setCustomValidity(validateError.message);\r\n return error;\r\n }\r\n }\r\n }\r\n else if (isObject(validate)) {\r\n let validationResult = {};\r\n for (const key in validate) {\r\n if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {\r\n break;\r\n }\r\n const validateError = getValidateError(await validate[key](inputValue), inputRef, key);\r\n if (validateError) {\r\n validationResult = Object.assign(Object.assign({}, validateError), appendErrorsCurry(key, validateError.message));\r\n setCustomValidity(validateError.message);\r\n if (validateAllFieldCriteria) {\r\n error[name] = validationResult;\r\n }\r\n }\r\n }\r\n if (!isEmptyObject(validationResult)) {\r\n error[name] = Object.assign({ ref: inputRef }, validationResult);\r\n if (!validateAllFieldCriteria) {\r\n return error;\r\n }\r\n }\r\n }\r\n }\r\n setCustomValidity(true);\r\n return error;\r\n};\n\nconst defaultOptions = {\r\n mode: VALIDATION_MODE.onSubmit,\r\n reValidateMode: VALIDATION_MODE.onChange,\r\n shouldFocusError: true,\r\n};\r\nfunction createFormControl(props = {}) {\r\n let _options = Object.assign(Object.assign({}, defaultOptions), props);\r\n let _formState = {\r\n isDirty: false,\r\n isValidating: false,\r\n dirtyFields: {},\r\n isSubmitted: false,\r\n submitCount: 0,\r\n touchedFields: {},\r\n isSubmitting: false,\r\n isSubmitSuccessful: false,\r\n isValid: false,\r\n errors: {},\r\n };\r\n let _fields = {};\r\n let _defaultValues = _options.defaultValues || {};\r\n let _formValues = _options.shouldUnregister\r\n ? {}\r\n : cloneObject(_defaultValues);\r\n let _stateFlags = {\r\n action: false,\r\n mount: false,\r\n watch: false,\r\n };\r\n let _names = {\r\n mount: new Set(),\r\n unMount: new Set(),\r\n array: new Set(),\r\n watch: new Set(),\r\n };\r\n let delayErrorCallback;\r\n let timer = 0;\r\n let validateFields = {};\r\n const _proxyFormState = {\r\n isDirty: false,\r\n dirtyFields: false,\r\n touchedFields: false,\r\n isValidating: false,\r\n isValid: false,\r\n errors: false,\r\n };\r\n const _subjects = {\r\n watch: createSubject(),\r\n array: createSubject(),\r\n state: createSubject(),\r\n };\r\n const validationModeBeforeSubmit = getValidationModes(_options.mode);\r\n const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);\r\n const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;\r\n const debounce = (callback, wait) => (...args) => {\r\n clearTimeout(timer);\r\n timer = window.setTimeout(() => callback(...args), wait);\r\n };\r\n const _updateValid = async (shouldSkipRender) => {\r\n let isValid = false;\r\n if (_proxyFormState.isValid) {\r\n isValid = _options.resolver\r\n ? isEmptyObject((await _executeSchema()).errors)\r\n : await executeBuildInValidation(_fields, true);\r\n if (!shouldSkipRender && isValid !== _formState.isValid) {\r\n _formState.isValid = isValid;\r\n _subjects.state.next({\r\n isValid,\r\n });\r\n }\r\n }\r\n return isValid;\r\n };\r\n const _updateFieldArray = (name, method, args, values = [], shouldSetValues = true, shouldSetFields = true) => {\r\n _stateFlags.action = true;\r\n if (shouldSetFields && Array.isArray(get(_fields, name))) {\r\n const fieldValues = method(get(_fields, name), args.argA, args.argB);\r\n shouldSetValues && set(_fields, name, fieldValues);\r\n }\r\n if (_proxyFormState.errors &&\r\n shouldSetFields &&\r\n Array.isArray(get(_formState.errors, name))) {\r\n const errors = method(get(_formState.errors, name), args.argA, args.argB);\r\n shouldSetValues && set(_formState.errors, name, errors);\r\n unsetEmptyArray(_formState.errors, name);\r\n }\r\n if (_proxyFormState.touchedFields &&\r\n Array.isArray(get(_formState.touchedFields, name))) {\r\n const touchedFields = method(get(_formState.touchedFields, name), args.argA, args.argB);\r\n shouldSetValues && set(_formState.touchedFields, name, touchedFields);\r\n }\r\n if (_proxyFormState.dirtyFields) {\r\n _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);\r\n }\r\n _subjects.state.next({\r\n isDirty: _getDirty(name, values),\r\n dirtyFields: _formState.dirtyFields,\r\n errors: _formState.errors,\r\n isValid: _formState.isValid,\r\n });\r\n };\r\n const updateErrors = (name, error) => (set(_formState.errors, name, error),\r\n _subjects.state.next({\r\n errors: _formState.errors,\r\n }));\r\n const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {\r\n const field = get(_fields, name);\r\n if (field) {\r\n const defaultValue = get(_formValues, name, isUndefined(value) ? get(_defaultValues, name) : value);\r\n isUndefined(defaultValue) ||\r\n (ref && ref.defaultChecked) ||\r\n shouldSkipSetValueAs\r\n ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f))\r\n : setFieldValue(name, defaultValue);\r\n _stateFlags.mount && _updateValid();\r\n }\r\n };\r\n const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {\r\n let isFieldDirty = false;\r\n const output = {\r\n name,\r\n };\r\n const isPreviousFieldTouched = get(_formState.touchedFields, name);\r\n if (_proxyFormState.isDirty) {\r\n const isPreviousFormDirty = _formState.isDirty;\r\n _formState.isDirty = output.isDirty = _getDirty();\r\n isFieldDirty = isPreviousFormDirty !== output.isDirty;\r\n }\r\n if (_proxyFormState.dirtyFields && (!isBlurEvent || shouldDirty)) {\r\n const isPreviousFieldDirty = get(_formState.dirtyFields, name);\r\n const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue);\r\n isCurrentFieldPristine\r\n ? unset(_formState.dirtyFields, name)\r\n : set(_formState.dirtyFields, name, true);\r\n output.dirtyFields = _formState.dirtyFields;\r\n isFieldDirty =\r\n isFieldDirty ||\r\n isPreviousFieldDirty !== get(_formState.dirtyFields, name);\r\n }\r\n if (isBlurEvent && !isPreviousFieldTouched) {\r\n set(_formState.touchedFields, name, isBlurEvent);\r\n output.touchedFields = _formState.touchedFields;\r\n isFieldDirty =\r\n isFieldDirty ||\r\n (_proxyFormState.touchedFields &&\r\n isPreviousFieldTouched !== isBlurEvent);\r\n }\r\n isFieldDirty && shouldRender && _subjects.state.next(output);\r\n return isFieldDirty ? output : {};\r\n };\r\n const shouldRenderByError = async (shouldSkipRender, name, isValid, error, fieldState) => {\r\n const previousFieldError = get(_formState.errors, name);\r\n const shouldUpdateValid = _proxyFormState.isValid && _formState.isValid !== isValid;\r\n if (props.delayError && error) {\r\n delayErrorCallback =\r\n delayErrorCallback || debounce(updateErrors, props.delayError);\r\n delayErrorCallback(name, error);\r\n }\r\n else {\r\n clearTimeout(timer);\r\n error\r\n ? set(_formState.errors, name, error)\r\n : unset(_formState.errors, name);\r\n }\r\n if (((error ? !deepEqual(previousFieldError, error) : previousFieldError) ||\r\n !isEmptyObject(fieldState) ||\r\n shouldUpdateValid) &&\r\n !shouldSkipRender) {\r\n const updatedFormState = Object.assign(Object.assign(Object.assign({}, fieldState), (shouldUpdateValid ? { isValid } : {})), { errors: _formState.errors, name });\r\n _formState = Object.assign(Object.assign({}, _formState), updatedFormState);\r\n _subjects.state.next(updatedFormState);\r\n }\r\n validateFields[name]--;\r\n if (_proxyFormState.isValidating && !validateFields[name]) {\r\n _subjects.state.next({\r\n isValidating: false,\r\n });\r\n validateFields = {};\r\n }\r\n };\r\n const _executeSchema = async (name) => _options.resolver\r\n ? await _options.resolver(Object.assign({}, _formValues), _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation))\r\n : {};\r\n const executeSchemaAndUpdateState = async (names) => {\r\n const { errors } = await _executeSchema();\r\n if (names) {\r\n for (const name of names) {\r\n const error = get(errors, name);\r\n error\r\n ? set(_formState.errors, name, error)\r\n : unset(_formState.errors, name);\r\n }\r\n }\r\n else {\r\n _formState.errors = errors;\r\n }\r\n return errors;\r\n };\r\n const executeBuildInValidation = async (fields, shouldOnlyCheckValid, context = {\r\n valid: true,\r\n }) => {\r\n for (const name in fields) {\r\n const field = fields[name];\r\n if (field) {\r\n const fieldReference = field._f;\r\n const fieldValue = omit(field, '_f');\r\n if (fieldReference) {\r\n const fieldError = await validateField(field, get(_formValues, fieldReference.name), shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation);\r\n if (fieldError[fieldReference.name]) {\r\n context.valid = false;\r\n if (shouldOnlyCheckValid) {\r\n break;\r\n }\r\n }\r\n if (!shouldOnlyCheckValid) {\r\n fieldError[fieldReference.name]\r\n ? set(_formState.errors, fieldReference.name, fieldError[fieldReference.name])\r\n : unset(_formState.errors, fieldReference.name);\r\n }\r\n }\r\n fieldValue &&\r\n (await executeBuildInValidation(fieldValue, shouldOnlyCheckValid, context));\r\n }\r\n }\r\n return context.valid;\r\n };\r\n const _removeUnmounted = () => {\r\n for (const name of _names.unMount) {\r\n const field = get(_fields, name);\r\n field &&\r\n (field._f.refs\r\n ? field._f.refs.every((ref) => !live(ref))\r\n : !live(field._f.ref)) &&\r\n unregister(name);\r\n }\r\n _names.unMount = new Set();\r\n };\r\n const _getDirty = (name, data) => (name && data && set(_formValues, name, data),\r\n !deepEqual(getValues(), _defaultValues));\r\n const _getWatch = (names, defaultValue, isGlobal) => {\r\n const fieldValues = Object.assign({}, (_stateFlags.mount\r\n ? _formValues\r\n : isUndefined(defaultValue)\r\n ? _defaultValues\r\n : isString(names)\r\n ? { [names]: defaultValue }\r\n : defaultValue));\r\n return generateWatchOutput(names, _names, fieldValues, isGlobal);\r\n };\r\n const _getFieldArray = (name) => compact(get(_stateFlags.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get(_defaultValues, name, []) : []));\r\n const setFieldValue = (name, value, options = {}) => {\r\n const field = get(_fields, name);\r\n let fieldValue = value;\r\n if (field) {\r\n const fieldReference = field._f;\r\n if (fieldReference) {\r\n !fieldReference.disabled &&\r\n set(_formValues, name, getFieldValueAs(value, fieldReference));\r\n fieldValue =\r\n isWeb && isHTMLElement(fieldReference.ref) && isNullOrUndefined(value)\r\n ? ''\r\n : value;\r\n if (isMultipleSelect(fieldReference.ref)) {\r\n [...fieldReference.ref.options].forEach((selectRef) => (selectRef.selected = fieldValue.includes(selectRef.value)));\r\n }\r\n else if (fieldReference.refs) {\r\n if (isCheckBoxInput(fieldReference.ref)) {\r\n fieldReference.refs.length > 1\r\n ? fieldReference.refs.forEach((checkboxRef) => (checkboxRef.checked = Array.isArray(fieldValue)\r\n ? !!fieldValue.find((data) => data === checkboxRef.value)\r\n : fieldValue === checkboxRef.value))\r\n : fieldReference.refs[0] &&\r\n (fieldReference.refs[0].checked = !!fieldValue);\r\n }\r\n else {\r\n fieldReference.refs.forEach((radioRef) => (radioRef.checked = radioRef.value === fieldValue));\r\n }\r\n }\r\n else if (!isFileInput(fieldReference.ref)) {\r\n fieldReference.ref.value = fieldValue;\r\n if (!fieldReference.ref.type) {\r\n _subjects.watch.next({\r\n name,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n (options.shouldDirty || options.shouldTouch) &&\r\n updateTouchAndDirty(name, fieldValue, options.shouldTouch, options.shouldDirty, true);\r\n options.shouldValidate && trigger(name);\r\n };\r\n const setValues = (name, value, options) => {\r\n for (const fieldKey in value) {\r\n const fieldValue = value[fieldKey];\r\n const fieldName = `${name}.${fieldKey}`;\r\n const field = get(_fields, fieldName);\r\n (_names.array.has(name) ||\r\n !isPrimitive(fieldValue) ||\r\n (field && !field._f)) &&\r\n !isDateObject(fieldValue)\r\n ? setValues(fieldName, fieldValue, options)\r\n : setFieldValue(fieldName, fieldValue, options);\r\n }\r\n };\r\n const setValue = (name, value, options = {}) => {\r\n const field = get(_fields, name);\r\n const isFieldArray = _names.array.has(name);\r\n const cloneValue = cloneObject(value);\r\n set(_formValues, name, cloneValue);\r\n if (isFieldArray) {\r\n _subjects.array.next({\r\n name,\r\n values: _formValues,\r\n });\r\n if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields) &&\r\n options.shouldDirty) {\r\n _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);\r\n _subjects.state.next({\r\n name,\r\n dirtyFields: _formState.dirtyFields,\r\n isDirty: _getDirty(name, cloneValue),\r\n });\r\n }\r\n }\r\n else {\r\n field && !field._f && !isNullOrUndefined(cloneValue)\r\n ? setValues(name, cloneValue, options)\r\n : setFieldValue(name, cloneValue, options);\r\n }\r\n isWatched(name, _names) && _subjects.state.next({});\r\n _subjects.watch.next({\r\n name,\r\n });\r\n };\r\n const onChange = async (event) => {\r\n const target = event.target;\r\n let name = target.name;\r\n const field = get(_fields, name);\r\n if (field) {\r\n let error;\r\n let isValid;\r\n const fieldValue = target.type\r\n ? getFieldValue(field._f)\r\n : getEventValue(event);\r\n const isBlurEvent = event.type === EVENTS.BLUR;\r\n const shouldSkipValidation = (!hasValidation(field._f) &&\r\n !_options.resolver &&\r\n !get(_formState.errors, name) &&\r\n !field._f.deps) ||\r\n skipValidation(isBlurEvent, get(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);\r\n const watched = isWatched(name, _names, isBlurEvent);\r\n set(_formValues, name, fieldValue);\r\n if (isBlurEvent) {\r\n field._f.onBlur && field._f.onBlur(event);\r\n }\r\n else if (field._f.onChange) {\r\n field._f.onChange(event);\r\n }\r\n const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent, false);\r\n const shouldRender = !isEmptyObject(fieldState) || watched;\r\n !isBlurEvent &&\r\n _subjects.watch.next({\r\n name,\r\n type: event.type,\r\n });\r\n if (shouldSkipValidation) {\r\n return (shouldRender &&\r\n _subjects.state.next(Object.assign({ name }, (watched ? {} : fieldState))));\r\n }\r\n !isBlurEvent && watched && _subjects.state.next({});\r\n validateFields[name] = validateFields[name] ? +1 : 1;\r\n _proxyFormState.isValidating &&\r\n _subjects.state.next({\r\n isValidating: true,\r\n });\r\n if (_options.resolver) {\r\n const { errors } = await _executeSchema([name]);\r\n const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);\r\n const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);\r\n error = errorLookupResult.error;\r\n name = errorLookupResult.name;\r\n isValid = isEmptyObject(errors);\r\n }\r\n else {\r\n error = (await validateField(field, get(_formValues, name), shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];\r\n isValid = await _updateValid(true);\r\n }\r\n field._f.deps && trigger(field._f.deps);\r\n shouldRenderByError(false, name, isValid, error, fieldState);\r\n }\r\n };\r\n const trigger = async (name, options = {}) => {\r\n let isValid;\r\n let validationResult;\r\n const fieldNames = convertToArrayPayload(name);\r\n _subjects.state.next({\r\n isValidating: true,\r\n });\r\n if (_options.resolver) {\r\n const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);\r\n isValid = isEmptyObject(errors);\r\n validationResult = name\r\n ? !fieldNames.some((name) => get(errors, name))\r\n : isValid;\r\n }\r\n else if (name) {\r\n validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {\r\n const field = get(_fields, fieldName);\r\n return await executeBuildInValidation(field && field._f ? { [fieldName]: field } : field);\r\n }))).every(Boolean);\r\n !(!validationResult && !_formState.isValid) && _updateValid();\r\n }\r\n else {\r\n validationResult = isValid = await executeBuildInValidation(_fields);\r\n }\r\n _subjects.state.next(Object.assign(Object.assign(Object.assign({}, (!isString(name) ||\r\n (_proxyFormState.isValid && isValid !== _formState.isValid)\r\n ? {}\r\n : { name })), (_options.resolver ? { isValid } : {})), { errors: _formState.errors, isValidating: false }));\r\n options.shouldFocus &&\r\n !validationResult &&\r\n focusFieldBy(_fields, (key) => get(_formState.errors, key), name ? fieldNames : _names.mount);\r\n return validationResult;\r\n };\r\n const getValues = (fieldNames) => {\r\n const values = Object.assign(Object.assign({}, _defaultValues), (_stateFlags.mount ? _formValues : {}));\r\n return isUndefined(fieldNames)\r\n ? values\r\n : isString(fieldNames)\r\n ? get(values, fieldNames)\r\n : fieldNames.map((name) => get(values, name));\r\n };\r\n const getFieldState = (name, formState) => ({\r\n invalid: !!get((formState || _formState).errors, name),\r\n isDirty: !!get((formState || _formState).dirtyFields, name),\r\n isTouched: !!get((formState || _formState).touchedFields, name),\r\n error: get((formState || _formState).errors, name),\r\n });\r\n const clearErrors = (name) => {\r\n name\r\n ? convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName))\r\n : (_formState.errors = {});\r\n _subjects.state.next({\r\n errors: _formState.errors,\r\n });\r\n };\r\n const setError = (name, error, options) => {\r\n const ref = (get(_fields, name, { _f: {} })._f || {}).ref;\r\n set(_formState.errors, name, Object.assign(Object.assign({}, error), { ref }));\r\n _subjects.state.next({\r\n name,\r\n errors: _formState.errors,\r\n isValid: false,\r\n });\r\n options && options.shouldFocus && ref && ref.focus && ref.focus();\r\n };\r\n const watch = (name, defaultValue) => isFunction(name)\r\n ? _subjects.watch.subscribe({\r\n next: (info) => name(_getWatch(undefined, defaultValue), info),\r\n })\r\n : _getWatch(name, defaultValue, true);\r\n const unregister = (name, options = {}) => {\r\n for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {\r\n _names.mount.delete(fieldName);\r\n _names.array.delete(fieldName);\r\n if (get(_fields, fieldName)) {\r\n if (!options.keepValue) {\r\n unset(_fields, fieldName);\r\n unset(_formValues, fieldName);\r\n }\r\n !options.keepError && unset(_formState.errors, fieldName);\r\n !options.keepDirty && unset(_formState.dirtyFields, fieldName);\r\n !options.keepTouched && unset(_formState.touchedFields, fieldName);\r\n !_options.shouldUnregister &&\r\n !options.keepDefaultValue &&\r\n unset(_defaultValues, fieldName);\r\n }\r\n }\r\n _subjects.watch.next({});\r\n _subjects.state.next(Object.assign(Object.assign({}, _formState), (!options.keepDirty ? {} : { isDirty: _getDirty() })));\r\n !options.keepIsValid && _updateValid();\r\n };\r\n const register = (name, options = {}) => {\r\n let field = get(_fields, name);\r\n const disabledIsDefined = isBoolean(options.disabled);\r\n set(_fields, name, {\r\n _f: Object.assign(Object.assign(Object.assign({}, (field && field._f ? field._f : { ref: { name } })), { name, mount: true }), options),\r\n });\r\n _names.mount.add(name);\r\n field\r\n ? disabledIsDefined &&\r\n set(_formValues, name, options.disabled\r\n ? undefined\r\n : get(_formValues, name, getFieldValue(field._f)))\r\n : updateValidAndValue(name, true, options.value);\r\n return Object.assign(Object.assign(Object.assign({}, (disabledIsDefined ? { disabled: options.disabled } : {})), (_options.shouldUseNativeValidation\r\n ? {\r\n required: !!options.required,\r\n min: getRuleValue(options.min),\r\n max: getRuleValue(options.max),\r\n minLength: getRuleValue(options.minLength),\r\n maxLength: getRuleValue(options.maxLength),\r\n pattern: getRuleValue(options.pattern),\r\n }\r\n : {})), { name,\r\n onChange, onBlur: onChange, ref: (ref) => {\r\n if (ref) {\r\n register(name, options);\r\n field = get(_fields, name);\r\n const fieldRef = isUndefined(ref.value)\r\n ? ref.querySelectorAll\r\n ? ref.querySelectorAll('input,select,textarea')[0] || ref\r\n : ref\r\n : ref;\r\n const radioOrCheckbox = isRadioOrCheckbox(fieldRef);\r\n const refs = field._f.refs || [];\r\n if (radioOrCheckbox\r\n ? refs.find((option) => option === fieldRef)\r\n : fieldRef === field._f.ref) {\r\n return;\r\n }\r\n set(_fields, name, {\r\n _f: Object.assign(Object.assign({}, field._f), (radioOrCheckbox\r\n ? {\r\n refs: refs.concat(fieldRef).filter(live),\r\n ref: { type: fieldRef.type, name },\r\n }\r\n : { ref: fieldRef })),\r\n });\r\n updateValidAndValue(name, false, undefined, fieldRef);\r\n }\r\n else {\r\n field = get(_fields, name, {});\r\n if (field._f) {\r\n field._f.mount = false;\r\n }\r\n (_options.shouldUnregister || options.shouldUnregister) &&\r\n !(isNameInFieldArray(_names.array, name) && _stateFlags.action) &&\r\n _names.unMount.add(name);\r\n }\r\n } });\r\n };\r\n const handleSubmit = (onValid, onInvalid) => async (e) => {\r\n if (e) {\r\n e.preventDefault && e.preventDefault();\r\n e.persist && e.persist();\r\n }\r\n let hasNoPromiseError = true;\r\n let fieldValues = _options.shouldUnregister\r\n ? cloneObject(_formValues)\r\n : Object.assign({}, _formValues);\r\n _subjects.state.next({\r\n isSubmitting: true,\r\n });\r\n try {\r\n if (_options.resolver) {\r\n const { errors, values } = await _executeSchema();\r\n _formState.errors = errors;\r\n fieldValues = values;\r\n }\r\n else {\r\n await executeBuildInValidation(_fields);\r\n }\r\n if (isEmptyObject(_formState.errors) &&\r\n Object.keys(_formState.errors).every((name) => get(fieldValues, name))) {\r\n _subjects.state.next({\r\n errors: {},\r\n isSubmitting: true,\r\n });\r\n await onValid(fieldValues, e);\r\n }\r\n else {\r\n onInvalid && (await onInvalid(_formState.errors, e));\r\n _options.shouldFocusError &&\r\n focusFieldBy(_fields, (key) => get(_formState.errors, key), _names.mount);\r\n }\r\n }\r\n catch (err) {\r\n hasNoPromiseError = false;\r\n throw err;\r\n }\r\n finally {\r\n _formState.isSubmitted = true;\r\n _subjects.state.next({\r\n isSubmitted: true,\r\n isSubmitting: false,\r\n isSubmitSuccessful: isEmptyObject(_formState.errors) && hasNoPromiseError,\r\n submitCount: _formState.submitCount + 1,\r\n errors: _formState.errors,\r\n });\r\n }\r\n };\r\n const resetField = (name, options = {}) => {\r\n if (get(_fields, name)) {\r\n if (isUndefined(options.defaultValue)) {\r\n setValue(name, get(_defaultValues, name));\r\n }\r\n else {\r\n setValue(name, options.defaultValue);\r\n set(_defaultValues, name, options.defaultValue);\r\n }\r\n if (!options.keepTouched) {\r\n unset(_formState.touchedFields, name);\r\n }\r\n if (!options.keepDirty) {\r\n unset(_formState.dirtyFields, name);\r\n _formState.isDirty = options.defaultValue\r\n ? _getDirty(name, get(_defaultValues, name))\r\n : _getDirty();\r\n }\r\n if (!options.keepError) {\r\n unset(_formState.errors, name);\r\n _proxyFormState.isValid && _updateValid();\r\n }\r\n _subjects.state.next(Object.assign({}, _formState));\r\n }\r\n };\r\n const reset = (formValues, keepStateOptions = {}) => {\r\n const updatedValues = formValues || _defaultValues;\r\n const cloneUpdatedValues = cloneObject(updatedValues);\r\n const values = formValues && !isEmptyObject(formValues)\r\n ? cloneUpdatedValues\r\n : _defaultValues;\r\n if (!keepStateOptions.keepDefaultValues) {\r\n _defaultValues = updatedValues;\r\n }\r\n if (!keepStateOptions.keepValues) {\r\n if (isWeb && isUndefined(formValues)) {\r\n for (const name of _names.mount) {\r\n const field = get(_fields, name);\r\n if (field && field._f) {\r\n const fieldReference = Array.isArray(field._f.refs)\r\n ? field._f.refs[0]\r\n : field._f.ref;\r\n try {\r\n isHTMLElement(fieldReference) &&\r\n fieldReference.closest('form').reset();\r\n break;\r\n }\r\n catch (_a) { }\r\n }\r\n }\r\n }\r\n _formValues = props.shouldUnregister\r\n ? keepStateOptions.keepDefaultValues\r\n ? cloneObject(_defaultValues)\r\n : {}\r\n : cloneUpdatedValues;\r\n _fields = {};\r\n _subjects.array.next({\r\n values,\r\n });\r\n _subjects.watch.next({\r\n values,\r\n });\r\n }\r\n _names = {\r\n mount: new Set(),\r\n unMount: new Set(),\r\n array: new Set(),\r\n watch: new Set(),\r\n watchAll: false,\r\n focus: '',\r\n };\r\n _stateFlags.mount =\r\n !_proxyFormState.isValid || !!keepStateOptions.keepIsValid;\r\n _stateFlags.watch = !!props.shouldUnregister;\r\n _subjects.state.next({\r\n submitCount: keepStateOptions.keepSubmitCount\r\n ? _formState.submitCount\r\n : 0,\r\n isDirty: keepStateOptions.keepDirty\r\n ? _formState.isDirty\r\n : keepStateOptions.keepDefaultValues\r\n ? !deepEqual(formValues, _defaultValues)\r\n : false,\r\n isSubmitted: keepStateOptions.keepIsSubmitted\r\n ? _formState.isSubmitted\r\n : false,\r\n dirtyFields: keepStateOptions.keepDirty\r\n ? _formState.dirtyFields\r\n : (keepStateOptions.keepDefaultValues && formValues\r\n ? Object.entries(formValues).reduce((previous, [key, value]) => (Object.assign(Object.assign({}, previous), { [key]: value !== get(_defaultValues, key) })), {})\r\n : {}),\r\n touchedFields: keepStateOptions.keepTouched\r\n ? _formState.touchedFields\r\n : {},\r\n errors: keepStateOptions.keepErrors\r\n ? _formState.errors\r\n : {},\r\n isSubmitting: false,\r\n isSubmitSuccessful: false,\r\n });\r\n };\r\n const setFocus = (name) => {\r\n const field = get(_fields, name)._f;\r\n (field.ref.focus ? field.ref : field.refs[0]).focus();\r\n };\r\n return {\r\n control: {\r\n register,\r\n unregister,\r\n getFieldState,\r\n _executeSchema,\r\n _getWatch,\r\n _getDirty,\r\n _updateValid,\r\n _removeUnmounted,\r\n _updateFieldArray,\r\n _getFieldArray,\r\n _subjects,\r\n _proxyFormState,\r\n get _fields() {\r\n return _fields;\r\n },\r\n set _fields(value) {\r\n _fields = value;\r\n },\r\n get _formValues() {\r\n return _formValues;\r\n },\r\n set _formValues(value) {\r\n _formValues = value;\r\n },\r\n get _stateFlags() {\r\n return _stateFlags;\r\n },\r\n set _stateFlags(value) {\r\n _stateFlags = value;\r\n },\r\n get _defaultValues() {\r\n return _defaultValues;\r\n },\r\n set _defaultValues(value) {\r\n _defaultValues = value;\r\n },\r\n get _names() {\r\n return _names;\r\n },\r\n set _names(value) {\r\n _names = value;\r\n },\r\n get _formState() {\r\n return _formState;\r\n },\r\n set _formState(value) {\r\n _formState = value;\r\n },\r\n get _options() {\r\n return _options;\r\n },\r\n set _options(value) {\r\n _options = Object.assign(Object.assign({}, _options), value);\r\n },\r\n },\r\n trigger,\r\n register,\r\n handleSubmit,\r\n watch,\r\n setValue,\r\n getValues,\r\n reset,\r\n resetField,\r\n clearErrors,\r\n unregister,\r\n setError,\r\n setFocus,\r\n getFieldState,\r\n };\r\n}\n\nfunction useForm(props = {}) {\r\n const _formControl = React.useRef();\r\n const [formState, updateFormState] = React.useState({\r\n isDirty: false,\r\n isValidating: false,\r\n dirtyFields: {},\r\n isSubmitted: false,\r\n submitCount: 0,\r\n touchedFields: {},\r\n isSubmitting: false,\r\n isSubmitSuccessful: false,\r\n isValid: false,\r\n errors: {},\r\n });\r\n if (_formControl.current) {\r\n _formControl.current.control._options = props;\r\n }\r\n else {\r\n _formControl.current = Object.assign(Object.assign({}, createFormControl(props)), { formState });\r\n }\r\n const control = _formControl.current.control;\r\n const callback = React.useCallback((value) => {\r\n if (shouldRenderFormState(value, control._proxyFormState, true)) {\r\n control._formState = Object.assign(Object.assign({}, control._formState), value);\r\n updateFormState(Object.assign({}, control._formState));\r\n }\r\n }, [control]);\r\n useSubscribe({\r\n subject: control._subjects.state,\r\n callback,\r\n });\r\n React.useEffect(() => {\r\n if (!control._stateFlags.mount) {\r\n control._proxyFormState.isValid && control._updateValid();\r\n control._stateFlags.mount = true;\r\n }\r\n if (control._stateFlags.watch) {\r\n control._stateFlags.watch = false;\r\n control._subjects.state.next({});\r\n }\r\n control._removeUnmounted();\r\n });\r\n _formControl.current.formState = getProxyFormState(formState, control._proxyFormState);\r\n return _formControl.current;\r\n}\n\nexport { Controller, FormProvider, appendErrors, get, set, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch };\n//# sourceMappingURL=index.esm.mjs.map\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar warn = function warn(s) {\n console.warn('[react-gtm]', s);\n};\n\nexports.default = warn;","'use strict';\n\nvar _warn = require('./utils/warn');\n\nvar _warn2 = _interopRequireDefault(_warn);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// https://developers.google.com/tag-manager/quickstart\n\nvar Snippets = {\n tags: function tags(_ref) {\n var id = _ref.id,\n events = _ref.events,\n dataLayer = _ref.dataLayer,\n dataLayerName = _ref.dataLayerName,\n preview = _ref.preview,\n auth = _ref.auth;\n\n var gtm_auth = '>m_auth=' + auth;\n var gtm_preview = '>m_preview=' + preview;\n\n if (!id) (0, _warn2.default)('GTM Id is required');\n\n var iframe = '\\n ';\n\n var script = '\\n (function(w,d,s,l,i){w[l]=w[l]||[];\\n w[l].push({\\'gtm.start\\': new Date().getTime(),event:\\'gtm.js\\', ' + JSON.stringify(events).slice(1, -1) + '});\\n var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!=\\'dataLayer\\'?\\'&l=\\'+l:\\'\\';\\n j.async=true;j.src=\\'https://www.googletagmanager.com/gtm.js?id=\\'+i+dl+\\'' + gtm_auth + gtm_preview + '>m_cookies_win=x\\';\\n f.parentNode.insertBefore(j,f);\\n })(window,document,\\'script\\',\\'' + dataLayerName + '\\',\\'' + id + '\\');';\n\n var dataLayerVar = this.dataLayer(dataLayer, dataLayerName);\n\n return {\n iframe: iframe,\n script: script,\n dataLayerVar: dataLayerVar\n };\n },\n dataLayer: function dataLayer(_dataLayer, dataLayerName) {\n return '\\n window.' + dataLayerName + ' = window.' + dataLayerName + ' || [];\\n window.' + dataLayerName + '.push(' + JSON.stringify(_dataLayer) + ')';\n }\n};\n\nmodule.exports = Snippets;","'use strict';\n\nvar _Snippets = require('./Snippets');\n\nvar _Snippets2 = _interopRequireDefault(_Snippets);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar TagManager = {\n dataScript: function dataScript(dataLayer) {\n var script = document.createElement('script');\n script.innerHTML = dataLayer;\n return script;\n },\n gtm: function gtm(args) {\n var snippets = _Snippets2.default.tags(args);\n\n var noScript = function noScript() {\n var noscript = document.createElement('noscript');\n noscript.innerHTML = snippets.iframe;\n return noscript;\n };\n\n var script = function script() {\n var script = document.createElement('script');\n script.innerHTML = snippets.script;\n return script;\n };\n\n var dataScript = this.dataScript(snippets.dataLayerVar);\n\n return {\n noScript: noScript,\n script: script,\n dataScript: dataScript\n };\n },\n initialize: function initialize(_ref) {\n var gtmId = _ref.gtmId,\n _ref$events = _ref.events,\n events = _ref$events === undefined ? {} : _ref$events,\n dataLayer = _ref.dataLayer,\n _ref$dataLayerName = _ref.dataLayerName,\n dataLayerName = _ref$dataLayerName === undefined ? 'dataLayer' : _ref$dataLayerName,\n _ref$auth = _ref.auth,\n auth = _ref$auth === undefined ? '' : _ref$auth,\n _ref$preview = _ref.preview,\n preview = _ref$preview === undefined ? '' : _ref$preview;\n\n var gtm = this.gtm({\n id: gtmId,\n events: events,\n dataLayer: dataLayer || undefined,\n dataLayerName: dataLayerName,\n auth: auth,\n preview: preview\n });\n if (dataLayer) document.head.appendChild(gtm.dataScript);\n document.head.insertBefore(gtm.script(), document.head.childNodes[0]);\n document.body.insertBefore(gtm.noScript(), document.body.childNodes[0]);\n },\n dataLayer: function dataLayer(_ref2) {\n var _dataLayer = _ref2.dataLayer,\n _ref2$dataLayerName = _ref2.dataLayerName,\n dataLayerName = _ref2$dataLayerName === undefined ? 'dataLayer' : _ref2$dataLayerName;\n\n if (window[dataLayerName]) return window[dataLayerName].push(_dataLayer);\n var snippets = _Snippets2.default.dataLayer(_dataLayer, dataLayerName);\n var dataScript = this.dataScript(snippets);\n document.head.insertBefore(dataScript, document.head.childNodes[0]);\n }\n};\n\nmodule.exports = TagManager;","'use strict';\n\nvar _TagManager = require('./TagManager');\n\nvar _TagManager2 = _interopRequireDefault(_TagManager);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nmodule.exports = _TagManager2.default;","/**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\n\nInvalidCharacterError.prototype = new Error();\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\nfunction polyfill (input) {\n var str = String(input).replace(/=+$/, '');\n if (str.length % 4 == 1) {\n throw new InvalidCharacterError(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = '';\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n}\n\n\nmodule.exports = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;\n","var atob = require('./atob');\n\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {\n var code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = '0' + code;\n }\n return '%' + code;\n }));\n}\n\nmodule.exports = function(str) {\n var output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw \"Illegal base64url string!\";\n }\n\n try{\n return b64DecodeUnicode(output);\n } catch (err) {\n return atob(output);\n }\n};\n","'use strict';\n\nvar base64_url_decode = require('./base64_url_decode');\n\nfunction InvalidTokenError(message) {\n this.message = message;\n}\n\nInvalidTokenError.prototype = new Error();\nInvalidTokenError.prototype.name = 'InvalidTokenError';\n\nmodule.exports = function (token,options) {\n if (typeof token !== 'string') {\n throw new InvalidTokenError('Invalid token specified');\n }\n\n options = options || {};\n var pos = options.header === true ? 0 : 1;\n try {\n return JSON.parse(base64_url_decode(token.split('.')[pos]));\n } catch (e) {\n throw new InvalidTokenError('Invalid token specified: ' + e.message);\n }\n};\n\nmodule.exports.InvalidTokenError = InvalidTokenError;\n","/**\n * @author Charles Markovich\n * @summary Check if JWT is expired\n * @description A global validator utility to share validation rules across all apps for a given project.\n * @public\n */\n\nvar jwtDecode = require('jwt-decode');\n\nconst isJwtExpired = (token) => {\n if (typeof(token) !== 'string' || !token) throw new Error('Invalid token provided');\n\n let isJwtExpired = false;\n const { exp } = jwtDecode(token);\n const currentTime = new Date().getTime() / 1000;\n\n if (currentTime > exp) isJwtExpired = true;\n\n return isJwtExpired;\n}\n\nmodule.exports.isJwtExpired = isJwtExpired;\n","export interface CountryProps {\n name: string,\n dial_code: number,\n country_code: string,\n flag: string,\n currency: string,\n currency_symbol: string,\n}\nexport const Countries: CountryProps[] = [{\n name: 'Afghanistan',\n dial_code: 93,\n country_code: 'AF',\n flag: '🇦🇫',\n currency: 'AFN',\n currency_symbol: 'Af',\n}, {\n name: 'Albania',\n dial_code: 355,\n country_code: 'AL',\n flag: '🇦🇱',\n currency: 'ALL',\n currency_symbol: 'L',\n}, {\n name: 'Algeria',\n dial_code: 213,\n country_code: 'DZ',\n flag: '🇩🇿',\n currency: 'DZD',\n currency_symbol: 'د.ج',\n}, {\n name: 'AmericanSamoa',\n dial_code: 1684,\n country_code: 'AS',\n flag: '🇦🇸',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Andorra',\n dial_code: 376,\n country_code: 'AD',\n flag: '🇦🇩',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Angola',\n dial_code: 244,\n country_code: 'AO',\n flag: '🇦🇴',\n currency: 'AOA',\n currency_symbol: 'Kz',\n}, {\n name: 'Anguilla',\n dial_code: 1264,\n country_code: 'AI',\n flag: '🇦🇮',\n currency: 'XCD',\n currency_symbol: '$',\n}, {\n name: 'Antigua and Barbuda',\n dial_code: 1268,\n country_code: 'AG',\n flag: '🇦🇬',\n currency: 'XCD',\n currency_symbol: '$',\n}, {\n name: 'Argentina',\n dial_code: 54,\n country_code: 'AR',\n flag: '🇦🇷',\n currency: 'ARS',\n currency_symbol: '$',\n}, {\n name: 'Armenia',\n dial_code: 374,\n country_code: 'AM',\n flag: '🇦🇲',\n currency: 'AMD',\n currency_symbol: 'Դ',\n}, {\n name: 'Aruba',\n dial_code: 297,\n country_code: 'AW',\n flag: '🇦🇼',\n currency: 'AWG',\n currency_symbol: 'ƒ',\n}, {\n name: 'Australia',\n dial_code: 61,\n country_code: 'AU',\n flag: '🇦🇺',\n currency: 'AUD',\n currency_symbol: '$',\n}, {\n name: 'Austria',\n dial_code: 43,\n country_code: 'AT',\n flag: '🇦🇹',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Azerbaijan',\n dial_code: 994,\n country_code: 'AZ',\n flag: '🇦🇿',\n currency: 'AZN',\n currency_symbol: 'ман',\n}, {\n name: 'Bahamas',\n dial_code: 1242,\n country_code: 'BS',\n flag: '🇧🇸',\n currency: 'BSD',\n currency_symbol: '$',\n}, {\n name: 'Bahrain',\n dial_code: 973,\n country_code: 'BH',\n flag: '🇧🇭',\n currency: 'BHD',\n currency_symbol: 'ب.د',\n}, {\n name: 'Bangladesh',\n dial_code: 880,\n country_code: 'BD',\n flag: '🇧🇩',\n currency: 'BDT',\n currency_symbol: '৳',\n}, {\n name: 'Barbados',\n dial_code: 1246,\n country_code: 'BB',\n flag: '🇧🇧',\n currency: 'BBD',\n currency_symbol: '$',\n}, {\n name: 'Belarus',\n dial_code: 375,\n country_code: 'BY',\n flag: '🇧🇾',\n currency: 'BYN',\n currency_symbol: 'Br',\n}, {\n name: 'Belgium',\n dial_code: 32,\n country_code: 'BE',\n flag: '🇧🇪',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Belize',\n dial_code: 501,\n country_code: 'BZ',\n flag: '🇧🇿',\n currency: 'BZD',\n currency_symbol: '$',\n}, {\n name: 'Benin',\n dial_code: 229,\n country_code: 'BJ',\n flag: '🇧🇯',\n currency: 'XAF',\n currency_symbol: '₣',\n}, {\n name: 'Bermuda',\n dial_code: 1441,\n country_code: 'BM',\n flag: '🇧🇲',\n currency: 'BMD',\n currency_symbol: '$',\n}, {\n name: 'Bhutan',\n dial_code: 975,\n country_code: 'BT',\n flag: '🇧🇹',\n currency: 'BTN',\n currency_symbol: 'Nu',\n}, {\n name: 'Plurinational State of Bolivia',\n dial_code: 591,\n country_code: 'BO',\n flag: '🇧🇴',\n currency: 'BOB',\n currency_symbol: 'Bs',\n}, {\n name: 'Bosnia and Herzegovina',\n dial_code: 387,\n country_code: 'BA',\n flag: '🇧🇦',\n currency: 'BAM',\n currency_symbol: 'КМ',\n}, {\n name: 'Botswana',\n dial_code: 267,\n country_code: 'BW',\n flag: '🇧🇼',\n currency: 'BWP',\n currency_symbol: 'P',\n}, {\n name: 'Brazil',\n dial_code: 55,\n country_code: 'BR',\n flag: '🇧🇷',\n currency: 'BRL',\n currency_symbol: 'R$',\n}, {\n name: 'British Indian Ocean Territory',\n dial_code: 246,\n country_code: 'IO',\n flag: '🇮🇴',\n currency: 'GBP',\n currency_symbol: '£',\n}, {\n name: 'Brunei Darussalam',\n dial_code: 673,\n country_code: 'BN',\n flag: '🇧🇳',\n currency: 'BND',\n currency_symbol: '$',\n}, {\n name: 'Bulgaria',\n dial_code: 359,\n country_code: 'BG',\n flag: '🇧🇬',\n currency: 'BGN',\n currency_symbol: 'лв',\n}, {\n name: 'Burkina Faso',\n dial_code: 226,\n country_code: 'BF',\n flag: '🇧🇫',\n currency: 'XAF',\n currency_symbol: '₣',\n}, {\n name: 'Burundi',\n dial_code: 257,\n country_code: 'BI',\n flag: '🇧🇮',\n currency: 'BIF',\n currency_symbol: '₣',\n}, {\n name: 'Cambodia',\n dial_code: 855,\n country_code: 'KH',\n flag: '🇰🇭',\n currency: 'KHR',\n currency_symbol: '៛',\n}, {\n name: 'Cameroon',\n dial_code: 237,\n country_code: 'CM',\n flag: '🇨🇲',\n currency: 'XAF',\n currency_symbol: '₣',\n}, {\n name: 'Canada',\n dial_code: 1,\n country_code: 'CA',\n flag: '🇨🇦',\n currency: 'CAD',\n currency_symbol: '$',\n}, {\n name: 'Cape Verde',\n dial_code: 238,\n country_code: 'CV',\n flag: '🇨🇻',\n currency: 'CVE',\n currency_symbol: '$',\n}, {\n name: 'Cayman Islands',\n dial_code: 345,\n country_code: 'KY',\n flag: '🇰🇾',\n currency: 'KYD',\n currency_symbol: '$',\n}, {\n name: 'Central African Republic',\n dial_code: 236,\n country_code: 'CF',\n flag: '🇨🇫',\n currency: 'XAF',\n currency_symbol: '₣',\n}, {\n name: 'Chad',\n dial_code: 235,\n country_code: 'TD',\n flag: '🇹🇩',\n currency: 'XAF',\n currency_symbol: '₣',\n}, {\n name: 'Chile',\n dial_code: 56,\n country_code: 'CL',\n flag: '🇨🇱',\n currency: 'CLP',\n currency_symbol: '$',\n}, {\n name: 'China',\n dial_code: 86,\n country_code: 'CN',\n flag: '🇨🇳',\n currency: 'CNY',\n currency_symbol: '¥',\n}, {\n name: 'Christmas Island',\n dial_code: 61,\n country_code: 'CX',\n flag: '🇨🇽',\n currency: 'AUD',\n currency_symbol: '$',\n}, {\n name: 'Cocos (Keeling) Islands',\n dial_code: 61,\n country_code: 'CC',\n flag: '🇨🇨',\n currency: 'AUD',\n currency_symbol: '$',\n}, {\n name: 'Colombia',\n dial_code: 57,\n country_code: 'CO',\n flag: '🇨🇴',\n currency: 'COP',\n currency_symbol: '$',\n}, {\n name: 'Comoros',\n dial_code: 269,\n country_code: 'KM',\n flag: '🇰🇲',\n currency: 'KMF',\n currency_symbol: 'CF',\n}, {\n name: 'Congo',\n dial_code: 242,\n country_code: 'CG',\n flag: '🇨🇬',\n currency: 'CDF',\n currency_symbol: '₣',\n}, {\n name: 'Democratic Republic of the Congo',\n dial_code: 243,\n country_code: 'CD',\n flag: '🇨🇩',\n currency: 'CDF',\n currency_symbol: 'FC',\n}, {\n name: 'Cook Islands',\n dial_code: 682,\n country_code: 'CK',\n flag: '🇨🇰',\n currency: 'NZD',\n currency_symbol: '$',\n}, {\n name: 'Costa Rica',\n dial_code: 506,\n country_code: 'CR',\n flag: '🇨🇷',\n currency: 'CRC',\n currency_symbol: '₡',\n}, {\n name: \"Cote d'Ivoire\",\n dial_code: 225,\n country_code: 'CI',\n flag: '🇨🇮',\n currency: 'XOF',\n currency_symbol: 'CFA',\n}, {\n name: 'Croatia',\n dial_code: 385,\n country_code: 'HR',\n flag: '🇭🇷',\n currency: 'HRK',\n currency_symbol: 'Kn',\n}, {\n name: 'Cuba',\n dial_code: 53,\n country_code: 'CU',\n flag: '🇨🇺',\n currency: 'CUP',\n currency_symbol: '$',\n}, {\n name: 'Cyprus',\n dial_code: 357,\n country_code: 'CY',\n flag: '🇨🇾',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Czech Republic',\n dial_code: 420,\n country_code: 'CZ',\n flag: '🇨🇿',\n currency: 'CZK',\n currency_symbol: 'Kč',\n}, {\n name: 'Denmark',\n dial_code: 45,\n country_code: 'DK',\n flag: '🇩🇰',\n currency: 'DKK',\n currency_symbol: 'kr',\n}, {\n name: 'Djibouti',\n dial_code: 253,\n country_code: 'DJ',\n flag: '🇩🇯',\n currency: 'DJF',\n currency_symbol: '₣',\n}, {\n name: 'Dominica',\n dial_code: 1767,\n country_code: 'DM',\n flag: '🇩🇲',\n currency: 'DOP',\n currency_symbol: '$',\n}, {\n name: 'Dominican Republic',\n dial_code: 1849,\n country_code: 'DO',\n flag: '🇩🇴',\n currency: 'DOP',\n currency_symbol: '$',\n}, {\n name: 'Dominican Republic',\n dial_code: 1809,\n country_code: 'DO',\n flag: '🇩🇴',\n currency: 'DOP',\n currency_symbol: '$',\n}, {\n name: 'Dominican Republic',\n dial_code: 1829,\n country_code: 'DO',\n flag: '🇩🇴',\n currency: 'DOP',\n currency_symbol: '$',\n}, {\n name: 'Ecuador',\n dial_code: 593,\n country_code: 'EC',\n flag: '🇪🇨',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Egypt',\n dial_code: 20,\n country_code: 'EG',\n flag: '🇪🇬',\n currency: 'EGP',\n currency_symbol: '£',\n}, {\n name: 'El Salvador',\n dial_code: 503,\n country_code: 'SV',\n flag: '🇸🇻',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Equatorial Guinea',\n dial_code: 240,\n country_code: 'GQ',\n flag: '🇬🇶',\n currency: 'XAF',\n currency_symbol: '₣',\n}, {\n name: 'Eritrea',\n dial_code: 291,\n country_code: 'ER',\n flag: '🇪🇷',\n currency: 'ERN',\n currency_symbol: 'Nfk',\n}, {\n name: 'Estonia',\n dial_code: 372,\n country_code: 'EE',\n flag: '🇪🇪',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Ethiopia',\n dial_code: 251,\n country_code: 'ET',\n flag: '🇪🇹',\n currency: 'ETB',\n currency_symbol: 'ብር',\n}, {\n name: 'Falkland Islands (Malvinas)',\n dial_code: 500,\n country_code: 'FK',\n flag: '🇫🇰',\n currency: 'FKP',\n currency_symbol: '£',\n}, {\n name: 'Faroe Islands',\n dial_code: 298,\n country_code: 'FO',\n flag: '🇫🇴',\n currency: 'FOK',\n currency_symbol: 'kr',\n}, {\n name: 'Fiji',\n dial_code: 679,\n country_code: 'FJ',\n flag: '🇫🇯',\n currency: 'FJD',\n currency_symbol: '$',\n}, {\n name: 'Finland',\n dial_code: 358,\n country_code: 'FI',\n flag: '🇫🇮',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'France',\n dial_code: 33,\n country_code: 'FR',\n flag: '🇫🇷',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'French Guiana',\n dial_code: 594,\n country_code: 'GF',\n flag: '🇬🇫',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'French Polynesia',\n dial_code: 689,\n country_code: 'PF',\n flag: '🇵🇫',\n currency: 'XPF',\n currency_symbol: '₣',\n}, {\n name: 'Gabon',\n dial_code: 241,\n country_code: 'GA',\n flag: '🇬🇦',\n currency: 'XAF',\n currency_symbol: '₣',\n}, {\n name: 'Gambia',\n dial_code: 220,\n country_code: 'GM',\n flag: '🇬🇲',\n currency: 'GMD',\n currency_symbol: 'D',\n}, {\n name: 'Georgia',\n dial_code: 995,\n country_code: 'GE',\n flag: '🇬🇪',\n currency: 'GEL',\n currency_symbol: 'ლ',\n}, {\n name: 'Germany',\n dial_code: 49,\n country_code: 'DE',\n flag: '🇩🇪',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Ghana',\n dial_code: 233,\n country_code: 'GH',\n flag: '🇬🇭',\n currency: 'GHS',\n currency_symbol: '₵',\n}, {\n name: 'Gibraltar',\n dial_code: 350,\n country_code: 'GI',\n flag: '🇬🇮',\n currency: 'GIP',\n currency_symbol: '£',\n}, {\n name: 'Greece',\n dial_code: 30,\n country_code: 'GR',\n flag: '🇬🇷',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Greenland',\n dial_code: 299,\n country_code: 'GL',\n flag: '🇬🇱',\n currency: 'DKK',\n currency_symbol: 'kr.',\n}, {\n name: 'Grenada',\n dial_code: 1473,\n country_code: 'GD',\n flag: '🇬🇩',\n currency: 'XCD',\n currency_symbol: '$',\n}, {\n name: 'Guadeloupe',\n dial_code: 590,\n country_code: 'GP',\n flag: '🇬🇵',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Guam',\n dial_code: 1671,\n country_code: 'GU',\n flag: '🇬🇺',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Guatemala',\n dial_code: 502,\n country_code: 'GT',\n flag: '🇬🇹',\n currency: 'GTQ',\n currency_symbol: 'Q',\n}, {\n name: 'Guernsey',\n dial_code: 44,\n country_code: 'GG',\n flag: '🇬🇬',\n currency: 'GBP',\n currency_symbol: '£',\n}, {\n name: 'Guinea',\n dial_code: 224,\n country_code: 'GN',\n flag: '🇬🇳',\n currency: 'GNF',\n currency_symbol: '₣',\n}, {\n name: 'Guinea-Bissau',\n dial_code: 245,\n country_code: 'GW',\n flag: '🇬🇼',\n currency: 'XAF',\n currency_symbol: '₣',\n}, {\n name: 'Guyana',\n dial_code: 595,\n country_code: 'GY',\n flag: '🇬🇾',\n currency: 'GYD',\n currency_symbol: '$',\n}, {\n name: 'Haiti',\n dial_code: 509,\n country_code: 'HT',\n flag: '🇭🇹',\n currency: 'HTG',\n currency_symbol: 'G',\n}, {\n name: 'Holy See (Vatican City State)',\n dial_code: 379,\n country_code: 'VA',\n flag: '🇻🇦',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Honduras',\n dial_code: 504,\n country_code: 'HN',\n flag: '🇭🇳',\n currency: 'HNL',\n currency_symbol: 'L',\n}, {\n name: 'Hong Kong',\n dial_code: 852,\n country_code: 'HK',\n flag: '🇭🇰',\n currency: 'HKD',\n currency_symbol: '$',\n}, {\n name: 'Hungary',\n dial_code: 36,\n country_code: 'HU',\n flag: '🇭🇺',\n currency: 'HUF',\n currency_symbol: 'Ft',\n}, {\n name: 'Iceland',\n dial_code: 354,\n country_code: 'IS',\n flag: '🇮🇸',\n currency: 'ISK',\n currency_symbol: 'Kr',\n}, {\n name: 'India',\n dial_code: 91,\n country_code: 'IN',\n flag: '🇮🇳',\n currency: 'INR',\n currency_symbol: '₹ ',\n}, {\n name: 'Indonesia',\n dial_code: 62,\n country_code: 'ID',\n flag: '🇮🇩',\n currency: 'IDR',\n currency_symbol: 'Rp',\n}, {\n name: 'Iran',\n dial_code: 98,\n country_code: 'IR',\n flag: '🇮🇷',\n currency: 'IRR',\n currency_symbol: '﷼',\n}, {\n name: 'Iraq',\n dial_code: 964,\n country_code: 'IQ',\n flag: '🇮🇶',\n currency: 'IQD',\n currency_symbol: 'ع.د',\n}, {\n name: 'Ireland',\n dial_code: 353,\n country_code: 'IE',\n flag: '🇮🇪',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Isle of Man',\n dial_code: 44,\n country_code: 'IM',\n flag: '🇮🇲',\n currency: 'IMP',\n currency_symbol: '£',\n}, {\n name: 'Israel',\n dial_code: 972,\n country_code: 'IL',\n flag: '🇮🇱',\n currency: 'ILS',\n currency_symbol: '₪',\n}, {\n name: 'Italy',\n dial_code: 39,\n country_code: 'IT',\n flag: '🇮🇹',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Jamaica',\n dial_code: 1876,\n country_code: 'JM',\n flag: '🇯🇲',\n currency: 'JMD',\n currency_symbol: '$',\n}, {\n name: 'Japan',\n dial_code: 81,\n country_code: 'JP',\n flag: '🇯🇵',\n currency: 'JPY',\n currency_symbol: '¥',\n}, {\n name: 'Jersey',\n dial_code: 44,\n country_code: 'JE',\n flag: '🇯🇪',\n currency: 'JEP',\n currency_symbol: '£',\n}, {\n name: 'Jordan',\n dial_code: 962,\n country_code: 'JO',\n flag: '🇯🇴',\n currency: 'JOD',\n currency_symbol: 'د.ا',\n}, {\n name: 'Kazakhstan',\n dial_code: 77,\n country_code: 'KZ',\n flag: '🇰🇿',\n currency: 'KZT',\n currency_symbol: '〒',\n}, {\n name: 'Kenya',\n dial_code: 254,\n country_code: 'KE',\n flag: '🇰🇪',\n currency: 'KES',\n currency_symbol: 'Sh',\n}, {\n name: 'Kiribati',\n dial_code: 686,\n country_code: 'KI',\n flag: '🇰🇮',\n currency: 'AUD',\n currency_symbol: '$',\n}, {\n name: \"Democratic People's Republic of Korea\",\n dial_code: 850,\n country_code: 'KP',\n flag: '🇰🇵',\n currency: 'KPW',\n currency_symbol: '₩',\n}, {\n name: 'Republic of Korea',\n dial_code: 82,\n country_code: 'KR',\n flag: '🇰🇷',\n currency: 'KRW',\n currency_symbol: '₩',\n}, {\n name: 'Kuwait',\n dial_code: 965,\n country_code: 'KW',\n flag: '🇰🇼',\n currency: 'KWD',\n currency_symbol: 'د.ك',\n}, {\n name: 'Kyrgyzstan',\n dial_code: 996,\n country_code: 'KG',\n flag: '🇰🇬',\n currency: 'KGS',\n currency_symbol: 'Лв',\n}, {\n name: \"Lao People's Democratic Republic\",\n dial_code: 856,\n country_code: 'LA',\n flag: '🇱🇦',\n currency: 'LAK',\n currency_symbol: '₭',\n}, {\n name: 'Latvia',\n dial_code: 371,\n country_code: 'LV',\n flag: '🇱🇻',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Lebanon',\n dial_code: 961,\n country_code: 'LB',\n flag: '🇱🇧',\n currency: 'LBP',\n currency_symbol: 'ل.ل',\n}, {\n name: 'Lesotho',\n dial_code: 266,\n country_code: 'LS',\n flag: '🇱🇸',\n currency: 'LSL',\n currency_symbol: 'L',\n}, {\n name: 'Liberia',\n dial_code: 231,\n country_code: 'LR',\n flag: '🇱🇷',\n currency: 'LRD',\n currency_symbol: '$',\n}, {\n name: 'Libyan Arab Jamahiriya',\n dial_code: 218,\n country_code: 'LY',\n flag: '🇱🇾',\n currency: 'LYD',\n currency_symbol: 'ل.د',\n}, {\n name: 'Liechtenstein',\n dial_code: 423,\n country_code: 'LI',\n flag: '🇱🇮',\n currency: 'CHF',\n currency_symbol: 'Fr',\n}, {\n name: 'Lithuania',\n dial_code: 370,\n country_code: 'LT',\n flag: '🇱🇹',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Luxembourg',\n dial_code: 352,\n country_code: 'LU',\n flag: '🇱🇺',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Macao',\n dial_code: 853,\n country_code: 'MO',\n flag: '🇲🇴',\n currency: 'MOP',\n currency_symbol: 'P',\n}, {\n name: 'Republic of North Macedonia',\n dial_code: 389,\n country_code: 'MK',\n flag: '🇲🇰',\n currency: 'MKD',\n currency_symbol: 'ден',\n}, {\n name: 'Madagascar',\n dial_code: 261,\n country_code: 'MG',\n flag: '🇲🇬',\n currency: 'MGA',\n currency_symbol: 'Ar',\n}, {\n name: 'Malawi',\n dial_code: 265,\n country_code: 'MW',\n flag: '🇲🇼',\n currency: 'MWK',\n currency_symbol: 'MK',\n}, {\n name: 'Malaysia',\n dial_code: 60,\n country_code: 'MY',\n flag: '🇲🇾',\n currency: 'MYR',\n currency_symbol: 'RM',\n}, {\n name: 'Maldives',\n dial_code: 960,\n country_code: 'MV',\n flag: '🇲🇻',\n currency: 'MVR',\n currency_symbol: 'ރ.',\n}, {\n name: 'Mali',\n dial_code: 223,\n country_code: 'ML',\n flag: '🇲🇱',\n currency: 'SOS',\n currency_symbol: 'Sh',\n}, {\n name: 'Malta',\n dial_code: 356,\n country_code: 'MT',\n flag: '🇲🇹',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Marshall Islands',\n dial_code: 692,\n country_code: 'MH',\n flag: '🇲🇭',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Martinique',\n dial_code: 596,\n country_code: 'MQ',\n flag: '🇲🇶',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Mauritania',\n dial_code: 222,\n country_code: 'MR',\n flag: '🇲🇷',\n currency: 'MRU',\n currency_symbol: 'UM',\n}, {\n name: 'Mauritius',\n dial_code: 230,\n country_code: 'MU',\n flag: '🇲🇺',\n currency: 'MUR',\n currency_symbol: '₨',\n}, {\n name: 'Mayotte',\n dial_code: 262,\n country_code: 'YT',\n flag: '🇾🇹',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Mexico',\n dial_code: 52,\n country_code: 'MX',\n flag: '🇲🇽',\n currency: 'MXN',\n currency_symbol: '$',\n}, {\n name: 'Federated States of Micronesia',\n dial_code: 691,\n country_code: 'FM',\n flag: '🇫🇲',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Republic of Moldova ',\n dial_code: 373,\n country_code: 'MD',\n flag: '🇲🇩',\n currency: 'MDL',\n currency_symbol: 'L',\n}, {\n name: 'Monaco',\n dial_code: 377,\n country_code: 'MC',\n flag: '🇲🇨',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Mongolia',\n dial_code: 976,\n country_code: 'MN',\n flag: '🇲🇳',\n currency: 'MNT',\n currency_symbol: '₮',\n}, {\n name: 'Montenegro',\n dial_code: 382,\n country_code: 'ME',\n flag: '🇲🇪',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Montserrat',\n dial_code: 1664,\n country_code: 'MS',\n flag: '🇲🇸',\n currency: 'XCD',\n currency_symbol: '$',\n}, {\n name: 'Morocco',\n dial_code: 212,\n country_code: 'MA',\n flag: '🇲🇦',\n currency: 'MAD',\n currency_symbol: 'د.م.',\n}, {\n name: 'Mozambique',\n dial_code: 258,\n country_code: 'MZ',\n flag: '🇲🇿',\n currency: 'MZN',\n currency_symbol: 'MTn',\n}, {\n name: 'Myanmar',\n dial_code: 95,\n country_code: 'MM',\n flag: '🇲🇲',\n currency: 'MMK',\n currency_symbol: 'K',\n}, {\n name: 'Namibia',\n dial_code: 264,\n country_code: 'NA',\n flag: '🇳🇦',\n currency: 'NAD',\n currency_symbol: '$',\n}, {\n name: 'Nauru',\n dial_code: 674,\n country_code: 'NR',\n flag: '🇳🇷',\n currency: 'AUD',\n currency_symbol: '$',\n}, {\n name: 'Nepal',\n dial_code: 977,\n country_code: 'NP',\n flag: '🇳🇵',\n currency: 'NPR',\n currency_symbol: '₨',\n}, {\n name: 'Netherlands',\n dial_code: 31,\n country_code: 'NL',\n flag: '🇳🇱',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Netherlands Antilles',\n dial_code: 599,\n country_code: 'AN',\n flag: '🇦🇳',\n currency: 'ANG',\n currency_symbol: 'ƒ',\n}, {\n name: 'New Caledonia',\n dial_code: 687,\n country_code: 'NC',\n flag: '🇳🇨',\n currency: 'XPF',\n currency_symbol: '₣',\n}, {\n name: 'New Zealand',\n dial_code: 64,\n country_code: 'NZ',\n flag: '🇳🇿',\n currency: 'NZD',\n currency_symbol: '$',\n}, {\n name: 'Nicaragua',\n dial_code: 505,\n country_code: 'NI',\n flag: '🇳🇮',\n currency: 'NIO',\n currency_symbol: 'C$',\n}, {\n name: 'Niger',\n dial_code: 227,\n country_code: 'NE',\n flag: '🇳🇪',\n currency: 'NGN',\n currency_symbol: '₦',\n}, {\n name: 'Nigeria',\n dial_code: 234,\n country_code: 'NG',\n flag: '🇳🇬',\n currency: 'NGN',\n currency_symbol: '₦',\n}, {\n name: 'Niue',\n dial_code: 683,\n country_code: 'NU',\n flag: '🇳🇺',\n currency: 'NZD',\n currency_symbol: '$',\n}, {\n name: 'Norfolk Island',\n dial_code: 672,\n country_code: 'NF',\n flag: '🇳🇫',\n currency: 'AUD',\n currency_symbol: '$',\n}, {\n name: 'Northern Mariana Islands',\n dial_code: 1670,\n country_code: 'MP',\n flag: '🇲🇵',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Norway',\n dial_code: 47,\n country_code: 'NO',\n flag: '🇳🇴',\n currency: 'NOK',\n currency_symbol: 'kr',\n}, {\n name: 'Oman',\n dial_code: 968,\n country_code: 'OM',\n flag: '🇴🇲',\n currency: 'OMR',\n currency_symbol: 'ر.ع.',\n}, {\n name: 'Pakistan',\n dial_code: 92,\n country_code: 'PK',\n flag: '🇵🇰',\n currency: 'PKR',\n currency_symbol: '₨',\n}, {\n name: 'Palau',\n dial_code: 680,\n country_code: 'PW',\n flag: '🇵🇼',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Palestine',\n dial_code: 970,\n country_code: 'PS',\n flag: '🇵🇸',\n currency: 'ILS',\n currency_symbol: '₪',\n}, {\n name: 'Panama',\n dial_code: 507,\n country_code: 'PA',\n flag: '🇵🇦',\n currency: 'PAB',\n currency_symbol: 'B/.',\n}, {\n name: 'Papua New Guinea',\n dial_code: 675,\n country_code: 'PG',\n flag: '🇵🇬',\n currency: 'PGK',\n currency_symbol: 'K',\n}, {\n name: 'Paraguay',\n dial_code: 595,\n country_code: 'PY',\n flag: '🇵🇾',\n currency: 'PYG',\n currency_symbol: '₲',\n}, {\n name: 'Peru',\n dial_code: 51,\n country_code: 'PE',\n flag: '🇵🇪',\n currency: 'PEN',\n currency_symbol: 'S/.',\n}, {\n name: 'Philippines',\n dial_code: 63,\n country_code: 'PH',\n flag: '🇵🇭',\n currency: 'PHP',\n currency_symbol: '₱',\n}, {\n name: 'Pitcairn',\n dial_code: 872,\n country_code: 'PN',\n flag: '🇵🇳',\n currency: 'NZD',\n currency_symbol: '$',\n}, {\n name: 'Poland',\n dial_code: 48,\n country_code: 'PL',\n flag: '🇵🇱',\n currency: 'PLN',\n currency_symbol: 'zł',\n}, {\n name: 'Portugal',\n dial_code: 351,\n country_code: 'PT',\n flag: '🇵🇹',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Puerto Rico',\n dial_code: 1939,\n country_code: 'PR',\n flag: '🇵🇷',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Qatar',\n dial_code: 974,\n country_code: 'QA',\n flag: '🇶🇦',\n currency: 'QAR',\n currency_symbol: 'ر.ق',\n}, {\n name: 'Romania',\n dial_code: 40,\n country_code: 'RO',\n flag: '🇷🇴',\n currency: 'RON',\n currency_symbol: 'L',\n}, {\n name: 'Russia',\n dial_code: 7,\n country_code: 'RU',\n flag: '🇷🇺',\n currency: 'RUB',\n currency_symbol: 'р.',\n}, {\n name: 'Rwanda',\n dial_code: 250,\n country_code: 'RW',\n flag: '🇷🇼',\n currency: 'RWF',\n currency_symbol: '₣',\n}, {\n name: 'Réunion',\n dial_code: 262,\n country_code: 'RE',\n flag: '🇷🇪',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Saint Barthélemy',\n dial_code: 590,\n country_code: 'BL',\n flag: '🇧🇱',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Saint Helena, Ascension and Tristan Da Cunha',\n dial_code: 290,\n country_code: 'SH',\n flag: '🇸🇭',\n currency: 'SHP',\n currency_symbol: '£',\n}, {\n name: 'Saint Kitts and Nevis',\n dial_code: 1869,\n country_code: 'KN',\n flag: '🇰🇳',\n currency: 'XCD',\n currency_symbol: '$',\n}, {\n name: 'Saint Lucia',\n dial_code: 1758,\n country_code: 'LC',\n flag: '🇱🇨',\n currency: 'XCD',\n currency_symbol: '$',\n}, {\n name: 'Saint Martin',\n dial_code: 590,\n country_code: 'MF',\n flag: '🇲🇫',\n currency: 'ANG',\n currency_symbol: 'ƒ',\n}, {\n name: 'Saint Pierre and Miquelon',\n dial_code: 508,\n country_code: 'PM',\n flag: '🇵🇲',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Saint Vincent and the Grenadines',\n dial_code: 1784,\n country_code: 'VC',\n flag: '🇻🇨',\n currency: 'XCD',\n currency_symbol: '$',\n}, {\n name: 'Samoa',\n dial_code: 685,\n country_code: 'WS',\n flag: '🇼🇸',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'San Marino',\n dial_code: 378,\n country_code: 'SM',\n flag: '🇸🇲',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Sao Tome and Principe',\n dial_code: 239,\n country_code: 'ST',\n flag: '🇸🇹',\n currency: 'STN',\n currency_symbol: 'Db',\n}, {\n name: 'Saudi Arabia',\n dial_code: 966,\n country_code: 'SA',\n flag: '🇸🇦',\n currency: 'SAR',\n currency_symbol: 'ر.س',\n}, {\n name: 'Senegal',\n dial_code: 221,\n country_code: 'SN',\n flag: '🇸🇳',\n currency: 'XAF',\n currency_symbol: '₣',\n}, {\n name: 'Serbia',\n dial_code: 381,\n country_code: 'RS',\n flag: '🇷🇸',\n currency: 'RSD',\n currency_symbol: 'din',\n}, {\n name: 'Seychelles',\n dial_code: 248,\n country_code: 'SC',\n flag: '🇸🇨',\n currency: 'SCR',\n currency_symbol: '₨',\n}, {\n name: 'Sierra Leone',\n dial_code: 232,\n country_code: 'SL',\n flag: '🇸🇱',\n currency: 'SLL',\n currency_symbol: 'Le',\n}, {\n name: 'Singapore',\n dial_code: 65,\n country_code: 'SG',\n flag: '🇸🇬',\n currency: 'BND',\n currency_symbol: '$',\n}, {\n name: 'Slovakia',\n dial_code: 421,\n country_code: 'SK',\n flag: '🇸🇰',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Slovenia',\n dial_code: 386,\n country_code: 'SI',\n flag: '🇸🇮',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Solomon Islands',\n dial_code: 677,\n country_code: 'SB',\n flag: '🇸🇧',\n currency: 'SBD',\n currency_symbol: '$',\n}, {\n name: 'Somalia',\n dial_code: 252,\n country_code: 'SO',\n flag: '🇸🇴',\n currency: 'SOS',\n currency_symbol: 'Sh',\n}, {\n name: 'South Africa',\n dial_code: 27,\n country_code: 'ZA',\n flag: '🇿🇦',\n currency: 'ZAR',\n currency_symbol: 'R',\n}, {\n name: 'South Georgia and the South Sandwich Islands',\n dial_code: 500,\n country_code: 'GS',\n flag: '🇬🇸',\n currency: 'GBP',\n currency_symbol: '£',\n}, {\n name: 'Spain',\n dial_code: 34,\n country_code: 'ES',\n flag: '🇪🇸',\n currency: 'EUR',\n currency_symbol: '€',\n}, {\n name: 'Sri Lanka',\n dial_code: 94,\n country_code: 'LK',\n flag: '🇱🇰',\n currency: 'LKR',\n currency_symbol: 'Rs',\n}, {\n name: 'Sudan',\n dial_code: 249,\n country_code: 'SD',\n flag: '🇸🇩',\n currency: 'SDG',\n currency_symbol: '£',\n}, {\n name: 'Suriname',\n dial_code: 597,\n country_code: 'SR',\n flag: '🇸🇷',\n currency: 'SRD',\n currency_symbol: '$',\n}, {\n name: 'Svalbard and Jan Mayen',\n dial_code: 47,\n country_code: 'SJ',\n flag: '🇸🇯',\n currency: 'NOK',\n currency_symbol: 'kr',\n}, {\n name: 'Swaziland',\n dial_code: 268,\n country_code: 'SZ',\n flag: '🇸🇿',\n currency: 'SZL',\n currency_symbol: 'L',\n}, {\n name: 'Sweden',\n dial_code: 46,\n country_code: 'SE',\n flag: '🇸🇪',\n currency: 'SEK',\n currency_symbol: 'kr',\n}, {\n name: 'Switzerland',\n dial_code: 41,\n country_code: 'CH',\n flag: '🇨🇭',\n currency: 'CHF',\n currency_symbol: '₣',\n}, {\n name: 'Arab Republic of Syria',\n dial_code: 963,\n country_code: 'SY',\n flag: '🇸🇾',\n currency: 'SYP',\n currency_symbol: '£S',\n}, {\n name: 'Taiwan',\n dial_code: 886,\n country_code: 'TW',\n flag: '🇹🇼',\n currency: 'TWD',\n currency_symbol: ' 圓',\n}, {\n name: 'Tajikistan',\n dial_code: 992,\n country_code: 'TJ',\n flag: '🇹🇯',\n currency: 'TJS',\n currency_symbol: 'ЅМ',\n}, {\n name: 'Tanzania',\n dial_code: 255,\n country_code: 'TZ',\n flag: '🇹🇿',\n currency: 'TZS',\n currency_symbol: 'Tsh',\n}, {\n name: 'Thailand',\n dial_code: 66,\n country_code: 'TH',\n flag: '🇹🇭',\n currency: 'THB',\n currency_symbol: '฿',\n}, {\n name: 'Timor-Leste',\n dial_code: 670,\n country_code: 'TL',\n flag: '🇹🇱',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Togo',\n dial_code: 228,\n country_code: 'TG',\n flag: '🇹🇬',\n currency: 'XAF',\n currency_symbol: '₣',\n}, {\n name: 'Tokelau',\n dial_code: 690,\n country_code: 'TK',\n flag: '🇹🇰',\n currency: 'NZD',\n currency_symbol: '$',\n}, {\n name: 'Tonga',\n dial_code: 676,\n country_code: 'TO',\n flag: '🇹🇴',\n currency: 'TOP',\n currency_symbol: 'T$',\n}, {\n name: 'Trinidad and Tobago',\n dial_code: 1868,\n country_code: 'TT',\n flag: '🇹🇹',\n currency: 'TTD',\n currency_symbol: '$',\n}, {\n name: 'Tunisia',\n dial_code: 216,\n country_code: 'TN',\n flag: '🇹🇳',\n currency: 'TND',\n currency_symbol: 'د.ت',\n}, {\n name: 'Turkey',\n dial_code: 90,\n country_code: 'TR',\n flag: '🇹🇷',\n currency: 'TRY',\n currency_symbol: '₺',\n}, {\n name: 'Turkmenistan',\n dial_code: 993,\n country_code: 'TM',\n flag: '🇹🇲',\n currency: 'TMT',\n currency_symbol: 'm',\n}, {\n name: 'Turks and Caicos Islands',\n dial_code: 1649,\n country_code: 'TC',\n flag: '🇹🇨',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Tuvalu',\n dial_code: 688,\n country_code: 'TV',\n flag: '🇹🇻',\n currency: 'AUD',\n currency_symbol: '$',\n}, {\n name: 'Uganda',\n dial_code: 256,\n country_code: 'UG',\n flag: '🇺🇬',\n currency: 'UGX',\n currency_symbol: 'Sh',\n}, {\n name: 'Ukraine',\n dial_code: 380,\n country_code: 'UA',\n flag: '🇺🇦',\n currency: 'UAH',\n currency_symbol: '₴',\n}, {\n name: 'United Arab Emirates',\n dial_code: 971,\n country_code: 'AE',\n flag: '🇦🇪',\n currency: 'AED',\n currency_symbol: 'د.إ',\n}, {\n name: 'United Kingdom',\n dial_code: 44,\n country_code: 'GB',\n flag: '🇬🇧',\n currency: 'GDP',\n currency_symbol: '£',\n}, {\n name: 'United States',\n dial_code: 1,\n country_code: 'US',\n flag: '🇺🇸',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Uruguay',\n dial_code: 598,\n country_code: 'UY',\n flag: '🇺🇾',\n currency: 'UYU',\n currency_symbol: '$',\n}, {\n name: 'Uzbekistan',\n dial_code: 998,\n country_code: 'UZ',\n flag: '🇺🇿',\n currency: 'UZS',\n currency_symbol: 'сум',\n}, {\n name: 'Vanuatu',\n dial_code: 678,\n country_code: 'VU',\n flag: '🇻🇺',\n currency: 'VUV',\n currency_symbol: 'Vt',\n}, {\n name: 'Bolivarian Republic of Venezuela',\n dial_code: 58,\n country_code: 'VE',\n flag: '🇻🇪',\n currency: 'VES',\n currency_symbol: 'Bs',\n}, {\n name: 'Vietnam',\n dial_code: 84,\n country_code: 'VN',\n flag: '🇻🇳',\n currency: 'VND',\n currency_symbol: '₫',\n}, {\n name: 'Virgin Islands, British',\n dial_code: 1284,\n country_code: 'VG',\n flag: '🇻🇬',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Virgin Islands, U.S.',\n dial_code: 1340,\n country_code: 'VI',\n flag: '🇻🇮',\n currency: 'USD',\n currency_symbol: '$',\n}, {\n name: 'Wallis and Futuna',\n dial_code: 681,\n country_code: 'WF',\n flag: '🇼🇫',\n currency: 'XPF',\n currency_symbol: '₣',\n}, {\n name: 'Yemen',\n dial_code: 967,\n country_code: 'YE',\n flag: '🇾🇪',\n currency: 'YER',\n currency_symbol: '﷼',\n}, {\n name: 'Zambia',\n dial_code: 260,\n country_code: 'ZM',\n flag: '🇿🇲',\n currency: 'ZMW',\n currency_symbol: 'ZK',\n}, {\n name: 'Zimbabwe',\n dial_code: 263,\n country_code: 'ZW',\n flag: '🇿🇼',\n currency: 'ZWL',\n currency_symbol: '$',\n}, {\n name: 'Åland Islands',\n dial_code: 358,\n country_code: 'AX',\n flag: '🇦🇽',\n currency: 'EUR',\n currency_symbol: '€',\n}];\n","import React, {\n FunctionComponent,\n useEffect,\n useState,\n} from 'react';\nimport Select, { components, StylesConfig, OptionProps } from 'react-select';\nimport Typography from '../typography/Typography';\nimport Input from '../input/Input';\nimport CaretIcon from '../icons/CaretIcon';\nimport { Countries } from '../../types/services/countries';\nimport './phoneInput.scss';\nimport '../../shared/style/style.scss';\n\ninterface IData {\n value: string;\n label: string;\n dialCode: number;\n path?: string;\n}\n\ninterface DropdownProps {\n path?: string;\n onChange: (number: string) => void;\n label?: string;\n initialValue?: string;\n searchLabel?: string;\n className?: string;\n fillContent?: boolean;\n}\n\nconst optionsData = Countries.map((country) => ({\n value: country.country_code,\n label: country.name,\n dialCode: country.dial_code,\n path: '',\n}));\n\nconst generateOptionsDataWithFlagPath = function (path: string) {\n if (path) {\n return Countries.map((country) => ({\n value: country.country_code,\n label: country.name,\n dialCode: country.dial_code,\n path: `${path}/${country.country_code.toLowerCase()}.svg`,\n }));\n }\n return optionsData;\n};\n\nconst Option = (props: OptionProps) => {\n const { data } = props;\n return (\n
\n \n \n {data.label}\n {` +${data.dialCode}`}\n \n
\n );\n};\n\nconst Blanket = (props: JSX.IntrinsicElements['div']) => (\n \n);\n\nconst DropdownIndicator = () => (\n
\n \n \n \n
\n);\n\nconst styles: StylesConfig = {\n control: (css) => ({\n ...css,\n height: '48px',\n padding: '0 16px',\n backgroundColor: '#fff',\n borderRadius: '8px',\n boxShadow: 'none',\n border: '1px solid #AFB6BE',\n }),\n indicatorsContainer: (css) => ({\n ...css,\n display: 'flex',\n order: -1,\n }),\n container: (css) => ({\n ...css,\n position: 'relative',\n }),\n menu: (css) => ({\n ...css,\n zIndex: 2,\n }),\n menuList: (css) => ({\n ...css,\n maxHeight: 200,\n paddingTop: 0,\n borderTop: '2px solid white',\n }),\n option: (css, state) => ({\n ...css,\n display: 'flex',\n alignItems: 'center',\n color: '#38414a',\n backgroundColor: state.isFocused || state.isSelected ? '#e6f4f8' : '#fff',\n '&:active': {\n backgroundColor: '#e6f4f8',\n },\n }),\n};\n\nconst PhoneInput: FunctionComponent = ({\n onChange,\n initialValue,\n label = 'Your mobile number',\n searchLabel = 'Search...',\n path = '',\n className = '',\n fillContent = false,\n}) => {\n const splittedPhoneValues = initialValue?.split(' ');\n let initialOption;\n const optionsDataWithPath = path ? generateOptionsDataWithFlagPath(path) : optionsData;\n\n if (initialValue && splittedPhoneValues && splittedPhoneValues[0]) {\n initialOption = optionsDataWithPath.find(\n (country) => country.dialCode === Number(splittedPhoneValues[0]),\n ) || optionsDataWithPath[149];\n }\n else {\n initialOption = optionsDataWithPath[149];\n }\n const [phoneInput, setPhoneInput] = useState(\n (splittedPhoneValues && splittedPhoneValues[1]) || '',\n );\n const [successInput, setSuccessInput] = React.useState(false);\n const [prefix, setPrefix] = React.useState({\n value: initialOption.value,\n label: `+${initialOption.dialCode}`,\n dialCode: initialOption.dialCode,\n path: initialOption.path,\n });\n\n const [isOpen, setisOpen] = useState(false);\n const [focus, setFocus] = useState(false);\n\n const handlePrefix = (selectOption: IData) => {\n setisOpen(!isOpen);\n setPrefix({\n value: selectOption.value,\n label: `+${selectOption.dialCode}`,\n dialCode: selectOption.dialCode,\n path: selectOption.path,\n });\n };\n\n useEffect(() => {\n if (!prefix?.dialCode || !phoneInput || phoneInput.length < 6) {\n setSuccessInput(false);\n\n return;\n }\n\n setSuccessInput(true);\n\n const phoneNumber = `+${prefix.dialCode} ${phoneInput.replace(/ /g, '')}`;\n\n if (onChange) onChange(phoneNumber);\n }, [prefix, phoneInput]);\n\n return (\n
\n \n \n {label}\n \n
\n
setisOpen(!isOpen)}>\n \n {`+${prefix.dialCode}`}\n \n
\n
\n {\n // @ts-ignore\n setPhoneInput(e?.currentTarget?.value);\n }}\n onFocus={() => setFocus(true)}\n onBlur={() => setFocus(false)}\n value={phoneInput}\n onWheel={(e: WheelEvent) => (e.target as HTMLInputElement).blur()}\n data-testid=\"input_phone-number\"\n />\n
\n {isOpen\n ? (\n
\n {\n if (input[0] === '+') {\n input = input.substring(1);\n }\n if (!Number.isNaN(Number(input[0]))) {\n return candidate.data.dialCode.toString().includes(input);\n }\n return candidate.label.toLowerCase().includes(input.toLowerCase());\n }}\n />\n
\n )\n : null}\n {isOpen ? setisOpen(!isOpen)} /> : null}\n
\n );\n};\n\nexport default PhoneInput;\n\nPhoneInput.displayName = 'PhoneInput';\n","export var zeroRightClassName = 'right-scroll-bar-position';\nexport var fullWidthClassName = 'width-before-scroll-bar';\nexport var noScrollbarsClassName = 'with-scroll-bars-hidden';\n/**\n * Name of a CSS variable containing the amount of \"hidden\" scrollbar\n * ! might be undefined ! use will fallback!\n */\nexport var removedBarSizeVariable = '--removed-body-scroll-bar-size';\n","/**\n * Assigns a value for a given ref, no matter of the ref format\n * @param {RefObject} ref - a callback function or ref object\n * @param value - a new value\n *\n * @see https://github.com/theKashey/use-callback-ref#assignref\n * @example\n * const refObject = useRef();\n * const refFn = (ref) => {....}\n *\n * assignRef(refObject, \"refValue\");\n * assignRef(refFn, \"refValue\");\n */\nexport function assignRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n }\n else if (ref) {\n ref.current = value;\n }\n return ref;\n}\n","import { useState } from 'react';\n/**\n * creates a MutableRef with ref change callback\n * @param initialValue - initial ref value\n * @param {Function} callback - a callback to run when value changes\n *\n * @example\n * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);\n * ref.current = 1;\n * // prints 0 -> 1\n *\n * @see https://reactjs.org/docs/hooks-reference.html#useref\n * @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref\n * @returns {MutableRefObject}\n */\nexport function useCallbackRef(initialValue, callback) {\n var ref = useState(function () { return ({\n // value\n value: initialValue,\n // last callback\n callback: callback,\n // \"memoized\" public interface\n facade: {\n get current() {\n return ref.value;\n },\n set current(value) {\n var last = ref.value;\n if (last !== value) {\n ref.value = value;\n ref.callback(value, last);\n }\n },\n },\n }); })[0];\n // update callback\n ref.callback = callback;\n return ref.facade;\n}\n","import { assignRef } from './assignRef';\nimport { useCallbackRef } from './useRef';\n/**\n * Merges two or more refs together providing a single interface to set their value\n * @param {RefObject|Ref} refs\n * @returns {MutableRefObject} - a new ref, which translates all changes to {refs}\n *\n * @see {@link mergeRefs} a version without buit-in memoization\n * @see https://github.com/theKashey/use-callback-ref#usemergerefs\n * @example\n * const Component = React.forwardRef((props, ref) => {\n * const ownRef = useRef();\n * const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together\n * return
...
\n * }\n */\nexport function useMergeRefs(refs, defaultValue) {\n return useCallbackRef(defaultValue || null, function (newValue) { return refs.forEach(function (ref) { return assignRef(ref, newValue); }); });\n}\n","import { __assign } from \"tslib\";\nfunction ItoI(a) {\n return a;\n}\nfunction innerCreateMedium(defaults, middleware) {\n if (middleware === void 0) { middleware = ItoI; }\n var buffer = [];\n var assigned = false;\n var medium = {\n read: function () {\n if (assigned) {\n throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');\n }\n if (buffer.length) {\n return buffer[buffer.length - 1];\n }\n return defaults;\n },\n useMedium: function (data) {\n var item = middleware(data, assigned);\n buffer.push(item);\n return function () {\n buffer = buffer.filter(function (x) { return x !== item; });\n };\n },\n assignSyncMedium: function (cb) {\n assigned = true;\n while (buffer.length) {\n var cbs = buffer;\n buffer = [];\n cbs.forEach(cb);\n }\n buffer = {\n push: function (x) { return cb(x); },\n filter: function () { return buffer; },\n };\n },\n assignMedium: function (cb) {\n assigned = true;\n var pendingQueue = [];\n if (buffer.length) {\n var cbs = buffer;\n buffer = [];\n cbs.forEach(cb);\n pendingQueue = buffer;\n }\n var executeQueue = function () {\n var cbs = pendingQueue;\n pendingQueue = [];\n cbs.forEach(cb);\n };\n var cycle = function () { return Promise.resolve().then(executeQueue); };\n cycle();\n buffer = {\n push: function (x) {\n pendingQueue.push(x);\n cycle();\n },\n filter: function (filter) {\n pendingQueue = pendingQueue.filter(filter);\n return buffer;\n },\n };\n },\n };\n return medium;\n}\nexport function createMedium(defaults, middleware) {\n if (middleware === void 0) { middleware = ItoI; }\n return innerCreateMedium(defaults, middleware);\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function createSidecarMedium(options) {\n if (options === void 0) { options = {}; }\n var medium = innerCreateMedium(null);\n medium.options = __assign({ async: true, ssr: false }, options);\n return medium;\n}\n","import { __assign, __rest } from \"tslib\";\nimport * as React from 'react';\nvar SideCar = function (_a) {\n var sideCar = _a.sideCar, rest = __rest(_a, [\"sideCar\"]);\n if (!sideCar) {\n throw new Error('Sidecar: please provide `sideCar` property to import the right car');\n }\n var Target = sideCar.read();\n if (!Target) {\n throw new Error('Sidecar medium not found');\n }\n return React.createElement(Target, __assign({}, rest));\n};\nSideCar.isSideCarExport = true;\nexport function exportSidecar(medium, exported) {\n medium.useMedium(exported);\n return SideCar;\n}\n","import { createSidecarMedium } from 'use-sidecar';\nexport var effectCar = createSidecarMedium();\n","import { __assign, __rest } from \"tslib\";\nimport * as React from 'react';\nimport { fullWidthClassName, zeroRightClassName } from 'react-remove-scroll-bar/constants';\nimport { useMergeRefs } from 'use-callback-ref';\nimport { effectCar } from './medium';\nvar nothing = function () {\n return;\n};\n/**\n * Removes scrollbar from the page and contain the scroll within the Lock\n */\nvar RemoveScroll = React.forwardRef(function (props, parentRef) {\n var ref = React.useRef(null);\n var _a = React.useState({\n onScrollCapture: nothing,\n onWheelCapture: nothing,\n onTouchMoveCapture: nothing,\n }), callbacks = _a[0], setCallbacks = _a[1];\n var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, rest = __rest(props, [\"forwardProps\", \"children\", \"className\", \"removeScrollBar\", \"enabled\", \"shards\", \"sideCar\", \"noIsolation\", \"inert\", \"allowPinchZoom\", \"as\"]);\n var SideCar = sideCar;\n var containerRef = useMergeRefs([ref, parentRef]);\n var containerProps = __assign(__assign({}, rest), callbacks);\n return (React.createElement(React.Fragment, null,\n enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),\n forwardProps ? (React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (React.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));\n});\nRemoveScroll.defaultProps = {\n enabled: true,\n removeScrollBar: true,\n inert: false,\n};\nRemoveScroll.classNames = {\n fullWidth: fullWidthClassName,\n zeroRight: zeroRightClassName,\n};\nexport { RemoveScroll };\n","var currentNonce;\nexport var setNonce = function (nonce) {\n currentNonce = nonce;\n};\nexport var getNonce = function () {\n if (currentNonce) {\n return currentNonce;\n }\n if (typeof __webpack_nonce__ !== 'undefined') {\n return __webpack_nonce__;\n }\n return undefined;\n};\n","import { getNonce } from 'get-nonce';\nfunction makeStyleTag() {\n if (!document)\n return null;\n var tag = document.createElement('style');\n tag.type = 'text/css';\n var nonce = getNonce();\n if (nonce) {\n tag.setAttribute('nonce', nonce);\n }\n return tag;\n}\nfunction injectStyles(tag, css) {\n // @ts-ignore\n if (tag.styleSheet) {\n // @ts-ignore\n tag.styleSheet.cssText = css;\n }\n else {\n tag.appendChild(document.createTextNode(css));\n }\n}\nfunction insertStyleTag(tag) {\n var head = document.head || document.getElementsByTagName('head')[0];\n head.appendChild(tag);\n}\nexport var stylesheetSingleton = function () {\n var counter = 0;\n var stylesheet = null;\n return {\n add: function (style) {\n if (counter == 0) {\n if ((stylesheet = makeStyleTag())) {\n injectStyles(stylesheet, style);\n insertStyleTag(stylesheet);\n }\n }\n counter++;\n },\n remove: function () {\n counter--;\n if (!counter && stylesheet) {\n stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);\n stylesheet = null;\n }\n },\n };\n};\n","import * as React from 'react';\nimport { stylesheetSingleton } from './singleton';\nexport var styleHookSingleton = function () {\n var sheet = stylesheetSingleton();\n return function (styles) {\n React.useEffect(function () {\n sheet.add(styles);\n return function () {\n sheet.remove();\n };\n }, [styles]);\n };\n};\n","import { styleHookSingleton } from './hook';\nexport var styleSingleton = function () {\n var useStyle = styleHookSingleton();\n var Sheet = function (_a) {\n var styles = _a.styles;\n useStyle(styles);\n return null;\n };\n return Sheet;\n};\n","export var zeroGap = {\n left: 0,\n top: 0,\n right: 0,\n gap: 0,\n};\nvar parse = function (x) { return parseInt(x || '', 10) || 0; };\nvar getOffset = function (gapMode) {\n var cs = window.getComputedStyle(document.body);\n var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];\n var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];\n var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];\n return [parse(left), parse(top), parse(right)];\n};\nexport var getGapWidth = function (gapMode) {\n if (gapMode === void 0) { gapMode = 'margin'; }\n if (typeof window === 'undefined') {\n return zeroGap;\n }\n var offsets = getOffset(gapMode);\n var documentWidth = document.documentElement.clientWidth;\n var windowWidth = window.innerWidth;\n return {\n left: offsets[0],\n top: offsets[1],\n right: offsets[2],\n gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),\n };\n};\n","import * as React from 'react';\nimport { styleSingleton } from 'react-style-singleton';\nimport { fullWidthClassName, zeroRightClassName, noScrollbarsClassName, removedBarSizeVariable } from './constants';\nimport { getGapWidth } from './utils';\nvar Style = styleSingleton();\n// important tip - once we measure scrollBar width and remove them\n// we could not repeat this operation\n// thus we are using style-singleton - only the first \"yet correct\" style will be applied.\nvar getStyles = function (_a, allowRelative, gapMode, important) {\n var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;\n if (gapMode === void 0) { gapMode = 'margin'; }\n return \"\\n .\".concat(noScrollbarsClassName, \" {\\n overflow: hidden \").concat(important, \";\\n padding-right: \").concat(gap, \"px \").concat(important, \";\\n }\\n body {\\n overflow: hidden \").concat(important, \";\\n \").concat([\n allowRelative && \"position: relative \".concat(important, \";\"),\n gapMode === 'margin' &&\n \"\\n padding-left: \".concat(left, \"px;\\n padding-top: \").concat(top, \"px;\\n padding-right: \").concat(right, \"px;\\n margin-left:0;\\n margin-top:0;\\n margin-right: \").concat(gap, \"px \").concat(important, \";\\n \"),\n gapMode === 'padding' && \"padding-right: \".concat(gap, \"px \").concat(important, \";\"),\n ]\n .filter(Boolean)\n .join(''), \"\\n }\\n \\n .\").concat(zeroRightClassName, \" {\\n right: \").concat(gap, \"px \").concat(important, \";\\n }\\n \\n .\").concat(fullWidthClassName, \" {\\n margin-right: \").concat(gap, \"px \").concat(important, \";\\n }\\n \\n .\").concat(zeroRightClassName, \" .\").concat(zeroRightClassName, \" {\\n right: 0 \").concat(important, \";\\n }\\n \\n .\").concat(fullWidthClassName, \" .\").concat(fullWidthClassName, \" {\\n margin-right: 0 \").concat(important, \";\\n }\\n \\n body {\\n \").concat(removedBarSizeVariable, \": \").concat(gap, \"px;\\n }\\n\");\n};\n/**\n * Removes page scrollbar and blocks page scroll when mounted\n */\nexport var RemoveScrollBar = function (props) {\n var _a = React.useState(getGapWidth(props.gapMode)), gap = _a[0], setGap = _a[1];\n React.useEffect(function () {\n setGap(getGapWidth(props.gapMode));\n }, [props.gapMode]);\n var noRelative = props.noRelative, noImportant = props.noImportant, _b = props.gapMode, gapMode = _b === void 0 ? 'margin' : _b;\n return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });\n};\n","var passiveSupported = false;\nif (typeof window !== 'undefined') {\n try {\n var options = Object.defineProperty({}, 'passive', {\n get: function () {\n passiveSupported = true;\n return true;\n },\n });\n // @ts-ignore\n window.addEventListener('test', options, options);\n // @ts-ignore\n window.removeEventListener('test', options, options);\n }\n catch (err) {\n passiveSupported = false;\n }\n}\nexport var nonPassive = passiveSupported ? { passive: false } : false;\n","var elementCouldBeVScrolled = function (node) {\n var styles = window.getComputedStyle(node);\n return (styles.overflowY !== 'hidden' && // not-not-scrollable\n !(styles.overflowY === styles.overflowX && styles.overflowY === 'visible') // scrollable\n );\n};\nvar elementCouldBeHScrolled = function (node) {\n var styles = window.getComputedStyle(node);\n return (styles.overflowX !== 'hidden' && // not-not-scrollable\n !(styles.overflowY === styles.overflowX && styles.overflowX === 'visible') // scrollable\n );\n};\nexport var locationCouldBeScrolled = function (axis, node) {\n var current = node;\n do {\n // Skip over shadow root\n if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {\n current = current.host;\n }\n var isScrollable = elementCouldBeScrolled(axis, current);\n if (isScrollable) {\n var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2];\n if (s > d) {\n return true;\n }\n }\n current = current.parentNode;\n } while (current && current !== document.body);\n return false;\n};\nvar getVScrollVariables = function (_a) {\n var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;\n return [\n scrollTop,\n scrollHeight,\n clientHeight,\n ];\n};\nvar getHScrollVariables = function (_a) {\n var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;\n return [\n scrollLeft,\n scrollWidth,\n clientWidth,\n ];\n};\nvar elementCouldBeScrolled = function (axis, node) {\n return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);\n};\nvar getScrollVariables = function (axis, node) {\n return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);\n};\nvar getDirectionFactor = function (axis, direction) {\n /**\n * If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,\n * and then increasingly negative as you scroll towards the end of the content.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft\n */\n return axis === 'h' && direction === 'rtl' ? -1 : 1;\n};\nexport var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {\n var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);\n var delta = directionFactor * sourceDelta;\n // find scrollable target\n var target = event.target;\n var targetInLock = endTarget.contains(target);\n var shouldCancelScroll = false;\n var isDeltaPositive = delta > 0;\n var availableScroll = 0;\n var availableScrollTop = 0;\n do {\n var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];\n var elementScroll = scroll_1 - capacity - directionFactor * position;\n if (position || elementScroll) {\n if (elementCouldBeScrolled(axis, target)) {\n availableScroll += elementScroll;\n availableScrollTop += position;\n }\n }\n target = target.parentNode;\n } while (\n // portaled content\n (!targetInLock && target !== document.body) ||\n // self content\n (targetInLock && (endTarget.contains(target) || endTarget === target)));\n if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {\n shouldCancelScroll = true;\n }\n else if (!isDeltaPositive &&\n ((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))) {\n shouldCancelScroll = true;\n }\n return shouldCancelScroll;\n};\n","import { __spreadArray } from \"tslib\";\nimport * as React from 'react';\nimport { RemoveScrollBar } from 'react-remove-scroll-bar';\nimport { styleSingleton } from 'react-style-singleton';\nimport { nonPassive } from './aggresiveCapture';\nimport { handleScroll, locationCouldBeScrolled } from './handleScroll';\nexport var getTouchXY = function (event) {\n return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];\n};\nexport var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };\nvar extractRef = function (ref) {\n return ref && 'current' in ref ? ref.current : ref;\n};\nvar deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };\nvar generateStyle = function (id) { return \"\\n .block-interactivity-\".concat(id, \" {pointer-events: none;}\\n .allow-interactivity-\").concat(id, \" {pointer-events: all;}\\n\"); };\nvar idCounter = 0;\nvar lockStack = [];\nexport function RemoveScrollSideCar(props) {\n var shouldPreventQueue = React.useRef([]);\n var touchStartRef = React.useRef([0, 0]);\n var activeAxis = React.useRef();\n var id = React.useState(idCounter++)[0];\n var Style = React.useState(function () { return styleSingleton(); })[0];\n var lastProps = React.useRef(props);\n React.useEffect(function () {\n lastProps.current = props;\n }, [props]);\n React.useEffect(function () {\n if (props.inert) {\n document.body.classList.add(\"block-interactivity-\".concat(id));\n var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);\n allow_1.forEach(function (el) { return el.classList.add(\"allow-interactivity-\".concat(id)); });\n return function () {\n document.body.classList.remove(\"block-interactivity-\".concat(id));\n allow_1.forEach(function (el) { return el.classList.remove(\"allow-interactivity-\".concat(id)); });\n };\n }\n return;\n }, [props.inert, props.lockRef.current, props.shards]);\n var shouldCancelEvent = React.useCallback(function (event, parent) {\n if ('touches' in event && event.touches.length === 2) {\n return !lastProps.current.allowPinchZoom;\n }\n var touch = getTouchXY(event);\n var touchStart = touchStartRef.current;\n var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];\n var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];\n var currentAxis;\n var target = event.target;\n var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';\n // allow horizontal touch move on Range inputs. They will not cause any scroll\n if ('touches' in event && moveDirection === 'h' && target.type === 'range') {\n return false;\n }\n var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);\n if (!canBeScrolledInMainDirection) {\n return true;\n }\n if (canBeScrolledInMainDirection) {\n currentAxis = moveDirection;\n }\n else {\n currentAxis = moveDirection === 'v' ? 'h' : 'v';\n canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);\n // other axis might be not scrollable\n }\n if (!canBeScrolledInMainDirection) {\n return false;\n }\n if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {\n activeAxis.current = currentAxis;\n }\n if (!currentAxis) {\n return true;\n }\n var cancelingAxis = activeAxis.current || currentAxis;\n return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);\n }, []);\n var shouldPrevent = React.useCallback(function (_event) {\n var event = _event;\n if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {\n // not the last active\n return;\n }\n var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);\n var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta); })[0];\n // self event, and should be canceled\n if (sourceEvent && sourceEvent.should) {\n event.preventDefault();\n return;\n }\n // outside or shard event\n if (!sourceEvent) {\n var shardNodes = (lastProps.current.shards || [])\n .map(extractRef)\n .filter(Boolean)\n .filter(function (node) { return node.contains(event.target); });\n var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;\n if (shouldStop) {\n event.preventDefault();\n }\n }\n }, []);\n var shouldCancel = React.useCallback(function (name, delta, target, should) {\n var event = { name: name, delta: delta, target: target, should: should };\n shouldPreventQueue.current.push(event);\n setTimeout(function () {\n shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });\n }, 1);\n }, []);\n var scrollTouchStart = React.useCallback(function (event) {\n touchStartRef.current = getTouchXY(event);\n activeAxis.current = undefined;\n }, []);\n var scrollWheel = React.useCallback(function (event) {\n shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));\n }, []);\n var scrollTouchMove = React.useCallback(function (event) {\n shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));\n }, []);\n React.useEffect(function () {\n lockStack.push(Style);\n props.setCallbacks({\n onScrollCapture: scrollWheel,\n onWheelCapture: scrollWheel,\n onTouchMoveCapture: scrollTouchMove,\n });\n document.addEventListener('wheel', shouldPrevent, nonPassive);\n document.addEventListener('touchmove', shouldPrevent, nonPassive);\n document.addEventListener('touchstart', scrollTouchStart, nonPassive);\n return function () {\n lockStack = lockStack.filter(function (inst) { return inst !== Style; });\n document.removeEventListener('wheel', shouldPrevent, nonPassive);\n document.removeEventListener('touchmove', shouldPrevent, nonPassive);\n document.removeEventListener('touchstart', scrollTouchStart, nonPassive);\n };\n }, []);\n var removeScrollBar = props.removeScrollBar, inert = props.inert;\n return (React.createElement(React.Fragment, null,\n inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,\n removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: \"margin\" }) : null));\n}\n","import { exportSidecar } from 'use-sidecar';\nimport { RemoveScrollSideCar } from './SideEffect';\nimport { effectCar } from './medium';\nexport default exportSidecar(effectCar, RemoveScrollSideCar);\n","import { __assign } from \"tslib\";\nimport * as React from 'react';\nimport { RemoveScroll } from './UI';\nimport SideCar from './sidecar';\nvar ReactRemoveScroll = React.forwardRef(function (props, ref) { return (React.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: SideCar }))); });\nReactRemoveScroll.classNames = RemoveScroll.classNames;\nexport default ReactRemoveScroll;\n","export const throttle = (func: (args: A) => void, timeout: any): (args: A) => void => {\n let ready = true;\n return (...args) => {\n if (!ready) {\n return;\n }\n\n ready = false;\n func(...args);\n setTimeout(() => {\n ready = true;\n }, timeout);\n };\n};\n\nexport const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\nexport const parseDate = (date: any) => {\n const newDate = new Date(date);\n let day;\n if (date) {\n day = date[8] && date[8] !== '0' ? date[8] + date[9] : date[9];\n }\n else {\n day = newDate.getDate();\n }\n\n const month = newDate.getMonth();\n const year = newDate.getFullYear();\n return `${day} ${monthNames[month]} ${year}`;\n};\n","import React, {\n FunctionComponent,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { BottomDrawerProps } from '../../types/bottomDrawer';\nimport { throttle } from '../../utils/utilFunctions';\nimport { Button } from '../button/Button';\nimport ChevronIcon from '../icons/ChevronIcon';\nimport XIcon from '../icons/XIcon';\nimport Typography from '../typography/Typography';\nimport './bottomDrawer.scss';\n\nconst BottomDrawer: FunctionComponent = ({\n isOpen,\n className = '',\n onClose,\n title,\n text,\n children,\n goBack,\n enableDesktopView,\n}) => {\n const [startOffset, setStartOffset] = useState(0);\n const [backdropOpacity, setBackdropOpacity] = useState(0);\n const [isDragging, setIsDragging] = useState(false);\n\n const [bottomPosition, setBottomPosition] = useState(0);\n\n const drawerRef = useRef(null);\n\n const onTouchStart = (e: React.TouchEvent) => {\n setIsDragging(true);\n\n if (!startOffset) {\n setStartOffset(drawerRef.current!.clientHeight - (window.innerHeight - e.touches[0].clientY));\n }\n };\n\n const onTouchMove = (e: React.TouchEvent) => {\n const clientY = e.changedTouches[0].clientY;\n const drawerHeight = drawerRef.current!.clientHeight;\n const newPosition = -(clientY - (window.innerHeight - drawerHeight + startOffset));\n\n const opacity = parseFloat(((drawerHeight - Math.abs(newPosition)) / drawerHeight).toFixed(2)) / 2;\n\n if (newPosition <= 0 && Math.abs(newPosition) < drawerHeight) {\n setBottomPosition(newPosition);\n setBackdropOpacity(opacity);\n }\n };\n\n const onTouchEnd = (e: React.TouchEvent) => {\n setIsDragging(false);\n\n const clientY = e.changedTouches[0].clientY;\n const drawerHeight = drawerRef.current!.clientHeight;\n if (window.innerHeight - clientY < drawerHeight / 2) {\n onClose!();\n setBackdropOpacity(0);\n }\n else {\n setBottomPosition(0);\n setBackdropOpacity(0.5);\n }\n };\n\n useEffect(() => {\n setBottomPosition(0);\n if (isOpen) {\n setBackdropOpacity(0.5);\n }\n else {\n setBackdropOpacity(0);\n }\n }, [isOpen]);\n\n const throttledOnTouchMove = useMemo(() => throttle(onTouchMove, 150), [onTouchMove]);\n\n return (\n \n \n\n e.stopPropagation()}\n style={{\n bottom: bottomPosition,\n transition: isDragging ? 'none' : 'all 0.2s ease-in-out',\n }}\n ref={drawerRef}\n >\n \n
\n
\n
\n
\n {goBack && (\n
\n }\n iconPosition=\"left\"\n textColor=\"asphalt6\"\n onClick={goBack}\n className=\"back-button\"\n />\n
\n )}\n \n
\n
\n
\n \n {title}\n \n
\n
\n \n {title}\n \n {text && (\n \n {text}\n \n )}\n {children}\n
\n
\n \n );\n};\n\nexport default BottomDrawer;\n","import React from 'react';\nimport './icon.scss';\nimport { IconProps } from '../../types/icons';\n\nconst NoResultsIcon: React.FC = ({\n fill,\n color,\n width = 24,\n height,\n onClick,\n className = '',\n}) => {\n const classBase = 'custom-icon';\n const classes = `${classBase} ${classBase}-color-${color} ${className}`;\n\n return (\n \n \n \n \n );\n};\n\nexport default NoResultsIcon;\n","import React, { useState, useEffect } from 'react';\nimport Typography from '../typography/Typography';\nimport './tabs.scss';\nimport { ITabs } from '../../types/tabs';\n\nconst Tabs = ({\n tabs, onChange,\n}: ITabs) => {\n const classBase = 'custom-tabs';\n const tabClass = 'custom-tab';\n const [isActive, setActive] = useState(tabs[0]?.tab);\n\n const handleClick = (tab:string) => {\n setActive(tab);\n };\n\n useEffect(() => onChange(isActive), [isActive]);\n\n const tabWidth = `${100 / tabs.length}%`;\n\n return (\n \n {tabs.length && tabs.map((tab, i) => (\n {\n handleClick(tab.tab);\n }}\n >\n
{tab.icon}
\n\n \n {tab.label}\n \n\n {isActive === tab.tab && (\n
\n )}\n
\n ))}\n \n );\n};\n\nexport default Tabs;\n","export default \"__VITE_ASSET__442fed38__\"","export default \"__VITE_ASSET__49776c8c__\"","export default \"__VITE_ASSET__95f6a22c__\"","export default \"__VITE_ASSET__efae1a19__\"","import React, { FunctionComponent, ReactElement } from 'react';\nimport { ClockIcon } from '../icons';\nimport Typography from '../typography/Typography';\nimport './timeStamp.scss';\n\ntype TimeStampProps = {\n timeInSeconds: number,\n icon?: ReactElement,\n className?: string,\n showSeconds?: boolean\n}\n\nconst TimeStamp: FunctionComponent = ({\n timeInSeconds,\n icon,\n className = '',\n showSeconds = false,\n}) => {\n function secondsToHm(seconds: number) {\n const h = Math.floor(seconds / 3600);\n const m = Math.floor((seconds % 3600) / 60);\n const s = Math.floor((seconds % 3600) % 60);\n\n const hDisplay = h > 0 ? `${h}h` : '';\n const mDisplay = m > 0 ? `${m}m` : '';\n const sDisplay = s > 0 ? `${s}s` : '';\n\n return `${hDisplay} ${mDisplay}${showSeconds ? ` ${sDisplay}` : ''}`;\n }\n\n return (\n
\n {icon || (\n \n )}\n \n {secondsToHm(timeInSeconds)}\n \n
\n );\n};\n\nexport default TimeStamp;\n","import React, { FunctionComponent } from 'react';\nimport TaxiImage from '../../shared/assets/images/video-cover-taxi.png';\nimport PhoneImage from '../../shared/assets/images/video-cover-phone.png';\nimport ProfileImage from '../../shared/assets/images/video-cover-profile.png';\nimport IssuesImage from '../../shared/assets/images/video-cover-issues.png';\nimport PlayIcon from '../icons/PlayIcon';\nimport Typography from '../typography/Typography';\nimport './videoCard.scss';\nimport TimeStamp from '../timeStamp/TimeStamp';\n\ntype VideoCardType = {\n title: string;\n duration: number;\n cover: 'taxi' | 'phone' | 'profile' | 'issues';\n onCardClick: () => void;\n className?: string;\n alt?: string;\n}\n\nconst VideoCard: FunctionComponent = ({\n title,\n duration,\n cover,\n onCardClick,\n alt = 'Video cover',\n className = '',\n}) => {\n const renderImage = () => {\n if (cover === 'taxi') return TaxiImage;\n if (cover === 'phone') return PhoneImage;\n if (cover === 'issues') return IssuesImage;\n return ProfileImage;\n };\n\n const image = renderImage();\n\n return (\n \n
\n
\n {alt}\n
\n \n \n
\n
\n \n {title}\n \n
\n \n );\n};\n\nexport default VideoCard;\n","import React, {\n FunctionComponent, useState,\n} from 'react';\nimport DateTimePicker from 'react-datepicker';\nimport './rangeDatePicker.scss';\nimport Input from '../input/Input';\nimport { CalendarNewIcon, CheckIcon, XIcon } from '../icons';\nimport Divider from '../divider/Divider';\nimport { Button } from '../button/Button';\n\ntype RangeDatePickerProps = {\n startDateValue: Date;\n endDateValue: Date;\n label: string;\n name?: string;\n className?: string;\n onRangeChange: (start: Date, end: Date) => void;\n clearButtonLabel?: string,\n confirmButtonLabel?: string,\n onConfirm: () => void,\n onClear: () => void,\n placeholderText?: string\n}\n\nconst RangeDatePicker: FunctionComponent = ({\n startDateValue,\n endDateValue,\n label,\n name,\n className = '',\n onRangeChange,\n clearButtonLabel,\n confirmButtonLabel,\n onConfirm,\n onClear,\n placeholderText,\n}) => {\n const [calendarOpened, setCalendarOpened] = useState(false);\n\n const onDateRangeChange = (value: [Date, Date]) => {\n const [startDate, endDate] = value;\n onRangeChange(startDate, endDate);\n };\n\n const confirmClick = () => {\n setCalendarOpened(false);\n onConfirm();\n };\n\n return (\n
\n setCalendarOpened(true)}\n selectsRange\n wrapperClassName=\"range-datepicker-wrapper\"\n className=\"custom-datepicker\"\n dateFormat=\"dd MMM yyyy\"\n placeholderText={placeholderText || 'Start date - End date'}\n customInput={(\n }\n onClick={() => setCalendarOpened(true)}\n data-testid=\"datepicker_placeholder\"\n />\n )}\n >\n \n
\n }\n priority=\"secondary\"\n textColor=\"red5\"\n variant=\"cancel\"\n className=\"m-r-16\"\n onClick={onClear}\n data-testid=\"datepicker_clear\"\n />\n\n }\n priority=\"secondary\"\n textColor=\"blue5\"\n variant=\"info\"\n onClick={confirmClick}\n data-testid=\"datepicker_confirm\"\n />\n
\n \n
\n );\n};\n\nexport default RangeDatePicker;\n","/**\n * @license\n * Lodash \n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n;(function() {\n\n /** Used as a safe reference for `undefined` in pre-ES5 environments. */\n var undefined;\n\n /** Used as the semantic version number. */\n var VERSION = '4.17.21';\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE = 200;\n\n /** Error message constants. */\n var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',\n FUNC_ERROR_TEXT = 'Expected a function',\n INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n /** Used as the maximum memoize cache size. */\n var MAX_MEMOIZE_SIZE = 500;\n\n /** Used as the internal argument placeholder. */\n var PLACEHOLDER = '__lodash_placeholder__';\n\n /** Used to compose bitmasks for cloning. */\n var CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n /** Used to compose bitmasks for function metadata. */\n var WRAP_BIND_FLAG = 1,\n WRAP_BIND_KEY_FLAG = 2,\n WRAP_CURRY_BOUND_FLAG = 4,\n WRAP_CURRY_FLAG = 8,\n WRAP_CURRY_RIGHT_FLAG = 16,\n WRAP_PARTIAL_FLAG = 32,\n WRAP_PARTIAL_RIGHT_FLAG = 64,\n WRAP_ARY_FLAG = 128,\n WRAP_REARG_FLAG = 256,\n WRAP_FLIP_FLAG = 512;\n\n /** Used as default options for `_.truncate`. */\n var DEFAULT_TRUNC_LENGTH = 30,\n DEFAULT_TRUNC_OMISSION = '...';\n\n /** Used to detect hot functions by number of calls within a span of milliseconds. */\n var HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n /** Used to indicate the type of lazy iteratees. */\n var LAZY_FILTER_FLAG = 1,\n LAZY_MAP_FLAG = 2,\n LAZY_WHILE_FLAG = 3;\n\n /** Used as references for various `Number` constants. */\n var INFINITY = 1 / 0,\n MAX_SAFE_INTEGER = 9007199254740991,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n /** Used as references for the maximum length and index of an array. */\n var MAX_ARRAY_LENGTH = 4294967295,\n MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,\n HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;\n\n /** Used to associate wrap methods with their bit flags. */\n var wrapFlags = [\n ['ary', WRAP_ARY_FLAG],\n ['bind', WRAP_BIND_FLAG],\n ['bindKey', WRAP_BIND_KEY_FLAG],\n ['curry', WRAP_CURRY_FLAG],\n ['curryRight', WRAP_CURRY_RIGHT_FLAG],\n ['flip', WRAP_FLIP_FLAG],\n ['partial', WRAP_PARTIAL_FLAG],\n ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],\n ['rearg', WRAP_REARG_FLAG]\n ];\n\n /** `Object#toString` result references. */\n var argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n domExcTag = '[object DOMException]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]',\n weakSetTag = '[object WeakSet]';\n\n var arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n /** Used to match empty string literals in compiled template source. */\n var reEmptyStringLeading = /\\b__p \\+= '';/g,\n reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n /** Used to match HTML entities and HTML characters. */\n var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,\n reUnescapedHtml = /[&<>\"']/g,\n reHasEscapedHtml = RegExp(reEscapedHtml.source),\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n /** Used to match template delimiters. */\n var reEscape = /<%-([\\s\\S]+?)%>/g,\n reEvaluate = /<%([\\s\\S]+?)%>/g,\n reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\n /** Used to match property names within property paths. */\n var reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/,\n rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n /**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\n var reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g,\n reHasRegExpChar = RegExp(reRegExpChar.source);\n\n /** Used to match leading whitespace. */\n var reTrimStart = /^\\s+/;\n\n /** Used to match a single whitespace character. */\n var reWhitespace = /\\s/;\n\n /** Used to match wrap detail comments. */\n var reWrapComment = /\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,\n reWrapDetails = /\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,\n reSplitDetails = /,? & /;\n\n /** Used to match words composed of alphanumeric characters. */\n var reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\n /**\n * Used to validate the `validate` option in `_.template` variable.\n *\n * Forbids characters which could potentially change the meaning of the function argument definition:\n * - \"(),\" (modification of function parameters)\n * - \"=\" (default value)\n * - \"[]{}\" (destructuring of function parameters)\n * - \"/\" (beginning of a comment)\n * - whitespace\n */\n var reForbiddenIdentifierChars = /[()=,{}\\[\\]\\/\\s]/;\n\n /** Used to match backslashes in property paths. */\n var reEscapeChar = /\\\\(\\\\)?/g;\n\n /**\n * Used to match\n * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).\n */\n var reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n /** Used to match `RegExp` flags from their coerced string values. */\n var reFlags = /\\w*$/;\n\n /** Used to detect bad signed hexadecimal string values. */\n var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n /** Used to detect binary string values. */\n var reIsBinary = /^0b[01]+$/i;\n\n /** Used to detect host constructors (Safari). */\n var reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n /** Used to detect octal string values. */\n var reIsOctal = /^0o[0-7]+$/i;\n\n /** Used to detect unsigned integer values. */\n var reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n /** Used to match Latin Unicode letters (excluding mathematical operators). */\n var reLatin = /[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g;\n\n /** Used to ensure capturing order of template delimiters. */\n var reNoMatch = /($^)/;\n\n /** Used to match unescaped characters in compiled string literals. */\n var reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n /** Used to compose unicode character classes. */\n var rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsDingbatRange = '\\\\u2700-\\\\u27bf',\n rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n rsPunctuationRange = '\\\\u2000-\\\\u206f',\n rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n rsVarRange = '\\\\ufe0e\\\\ufe0f',\n rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n /** Used to compose unicode capture groups. */\n var rsApos = \"['\\u2019]\",\n rsAstral = '[' + rsAstralRange + ']',\n rsBreak = '[' + rsBreakRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsDigits = '\\\\d+',\n rsDingbat = '[' + rsDingbatRange + ']',\n rsLower = '[' + rsLowerRange + ']',\n rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsUpper = '[' + rsUpperRange + ']',\n rsZWJ = '\\\\u200d';\n\n /** Used to compose unicode regexes. */\n var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',\n rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',\n rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\n rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\n reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsOrdLower = '\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])',\n rsOrdUpper = '\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n /** Used to match apostrophes. */\n var reApos = RegExp(rsApos, 'g');\n\n /**\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n */\n var reComboMark = RegExp(rsCombo, 'g');\n\n /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\n var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n /** Used to match complex or compound words. */\n var reUnicodeWord = RegExp([\n rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',\n rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,\n rsUpper + '+' + rsOptContrUpper,\n rsOrdUpper,\n rsOrdLower,\n rsDigits,\n rsEmoji\n ].join('|'), 'g');\n\n /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\n var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n /** Used to detect strings that need a more robust regexp to match words. */\n var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n /** Used to assign default `context` object properties. */\n var contextProps = [\n 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',\n 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',\n 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',\n 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',\n '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'\n ];\n\n /** Used to make template sourceURLs easier to identify. */\n var templateCounter = -1;\n\n /** Used to identify `toStringTag` values of typed arrays. */\n var typedArrayTags = {};\n typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\n typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\n typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\n typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\n typedArrayTags[uint32Tag] = true;\n typedArrayTags[argsTag] = typedArrayTags[arrayTag] =\n typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\n typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\n typedArrayTags[errorTag] = typedArrayTags[funcTag] =\n typedArrayTags[mapTag] = typedArrayTags[numberTag] =\n typedArrayTags[objectTag] = typedArrayTags[regexpTag] =\n typedArrayTags[setTag] = typedArrayTags[stringTag] =\n typedArrayTags[weakMapTag] = false;\n\n /** Used to identify `toStringTag` values supported by `_.clone`. */\n var cloneableTags = {};\n cloneableTags[argsTag] = cloneableTags[arrayTag] =\n cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\n cloneableTags[boolTag] = cloneableTags[dateTag] =\n cloneableTags[float32Tag] = cloneableTags[float64Tag] =\n cloneableTags[int8Tag] = cloneableTags[int16Tag] =\n cloneableTags[int32Tag] = cloneableTags[mapTag] =\n cloneableTags[numberTag] = cloneableTags[objectTag] =\n cloneableTags[regexpTag] = cloneableTags[setTag] =\n cloneableTags[stringTag] = cloneableTags[symbolTag] =\n cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\n cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\n cloneableTags[errorTag] = cloneableTags[funcTag] =\n cloneableTags[weakMapTag] = false;\n\n /** Used to map Latin Unicode letters to basic Latin letters. */\n var deburredLetters = {\n // Latin-1 Supplement block.\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcc': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xec': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss',\n // Latin Extended-A block.\n '\\u0100': 'A', '\\u0102': 'A', '\\u0104': 'A',\n '\\u0101': 'a', '\\u0103': 'a', '\\u0105': 'a',\n '\\u0106': 'C', '\\u0108': 'C', '\\u010a': 'C', '\\u010c': 'C',\n '\\u0107': 'c', '\\u0109': 'c', '\\u010b': 'c', '\\u010d': 'c',\n '\\u010e': 'D', '\\u0110': 'D', '\\u010f': 'd', '\\u0111': 'd',\n '\\u0112': 'E', '\\u0114': 'E', '\\u0116': 'E', '\\u0118': 'E', '\\u011a': 'E',\n '\\u0113': 'e', '\\u0115': 'e', '\\u0117': 'e', '\\u0119': 'e', '\\u011b': 'e',\n '\\u011c': 'G', '\\u011e': 'G', '\\u0120': 'G', '\\u0122': 'G',\n '\\u011d': 'g', '\\u011f': 'g', '\\u0121': 'g', '\\u0123': 'g',\n '\\u0124': 'H', '\\u0126': 'H', '\\u0125': 'h', '\\u0127': 'h',\n '\\u0128': 'I', '\\u012a': 'I', '\\u012c': 'I', '\\u012e': 'I', '\\u0130': 'I',\n '\\u0129': 'i', '\\u012b': 'i', '\\u012d': 'i', '\\u012f': 'i', '\\u0131': 'i',\n '\\u0134': 'J', '\\u0135': 'j',\n '\\u0136': 'K', '\\u0137': 'k', '\\u0138': 'k',\n '\\u0139': 'L', '\\u013b': 'L', '\\u013d': 'L', '\\u013f': 'L', '\\u0141': 'L',\n '\\u013a': 'l', '\\u013c': 'l', '\\u013e': 'l', '\\u0140': 'l', '\\u0142': 'l',\n '\\u0143': 'N', '\\u0145': 'N', '\\u0147': 'N', '\\u014a': 'N',\n '\\u0144': 'n', '\\u0146': 'n', '\\u0148': 'n', '\\u014b': 'n',\n '\\u014c': 'O', '\\u014e': 'O', '\\u0150': 'O',\n '\\u014d': 'o', '\\u014f': 'o', '\\u0151': 'o',\n '\\u0154': 'R', '\\u0156': 'R', '\\u0158': 'R',\n '\\u0155': 'r', '\\u0157': 'r', '\\u0159': 'r',\n '\\u015a': 'S', '\\u015c': 'S', '\\u015e': 'S', '\\u0160': 'S',\n '\\u015b': 's', '\\u015d': 's', '\\u015f': 's', '\\u0161': 's',\n '\\u0162': 'T', '\\u0164': 'T', '\\u0166': 'T',\n '\\u0163': 't', '\\u0165': 't', '\\u0167': 't',\n '\\u0168': 'U', '\\u016a': 'U', '\\u016c': 'U', '\\u016e': 'U', '\\u0170': 'U', '\\u0172': 'U',\n '\\u0169': 'u', '\\u016b': 'u', '\\u016d': 'u', '\\u016f': 'u', '\\u0171': 'u', '\\u0173': 'u',\n '\\u0174': 'W', '\\u0175': 'w',\n '\\u0176': 'Y', '\\u0177': 'y', '\\u0178': 'Y',\n '\\u0179': 'Z', '\\u017b': 'Z', '\\u017d': 'Z',\n '\\u017a': 'z', '\\u017c': 'z', '\\u017e': 'z',\n '\\u0132': 'IJ', '\\u0133': 'ij',\n '\\u0152': 'Oe', '\\u0153': 'oe',\n '\\u0149': \"'n\", '\\u017f': 's'\n };\n\n /** Used to map characters to HTML entities. */\n var htmlEscapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''\n };\n\n /** Used to map HTML entities to characters. */\n var htmlUnescapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\"\n };\n\n /** Used to escape characters for inclusion in compiled string literals. */\n var stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n };\n\n /** Built-in method references without a dependency on `root`. */\n var freeParseFloat = parseFloat,\n freeParseInt = parseInt;\n\n /** Detect free variable `global` from Node.js. */\n var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n /** Detect free variable `self`. */\n var freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n /** Used as a reference to the global object. */\n var root = freeGlobal || freeSelf || Function('return this')();\n\n /** Detect free variable `exports`. */\n var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n /** Detect free variable `module`. */\n var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports = freeModule && freeModule.exports === freeExports;\n\n /** Detect free variable `process` from Node.js. */\n var freeProcess = moduleExports && freeGlobal.process;\n\n /** Used to access faster Node.js helpers. */\n var nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n }());\n\n /* Node.js helper references. */\n var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,\n nodeIsDate = nodeUtil && nodeUtil.isDate,\n nodeIsMap = nodeUtil && nodeUtil.isMap,\n nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,\n nodeIsSet = nodeUtil && nodeUtil.isSet,\n nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\n function apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n }\n\n /**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.forEachRight` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEachRight(array, iteratee) {\n var length = array == null ? 0 : array.length;\n\n while (length--) {\n if (iteratee(array[length], length, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.every` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\n function arrayEvery(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n }\n\n /**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n }\n\n /**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\n function arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n }\n\n /**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.reduceRight` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the last element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduceRight(array, iteratee, accumulator, initAccum) {\n var length = array == null ? 0 : array.length;\n if (initAccum && length) {\n accumulator = array[--length];\n }\n while (length--) {\n accumulator = iteratee(accumulator, array[length], length, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Gets the size of an ASCII `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\n var asciiSize = baseProperty('length');\n\n /**\n * Converts an ASCII `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function asciiToArray(string) {\n return string.split('');\n }\n\n /**\n * Splits an ASCII `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\n function asciiWords(string) {\n return string.match(reAsciiWord) || [];\n }\n\n /**\n * The base implementation of methods like `_.findKey` and `_.findLastKey`,\n * without support for iteratee shorthands, which iterates over `collection`\n * using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the found element or its key, else `undefined`.\n */\n function baseFindKey(collection, predicate, eachFunc) {\n var result;\n eachFunc(collection, function(value, key, collection) {\n if (predicate(value, key, collection)) {\n result = key;\n return false;\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n }\n\n /**\n * This function is like `baseIndexOf` except that it accepts a comparator.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOfWith(array, value, fromIndex, comparator) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (comparator(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\n function baseIsNaN(value) {\n return value !== value;\n }\n\n /**\n * The base implementation of `_.mean` and `_.meanBy` without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the mean.\n */\n function baseMean(array, iteratee) {\n var length = array == null ? 0 : array.length;\n return length ? (baseSum(array, iteratee) / length) : NAN;\n }\n\n /**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n }\n\n /**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined : object[key];\n };\n }\n\n /**\n * The base implementation of `_.reduce` and `_.reduceRight`, without support\n * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initAccum Specify using the first or last element of\n * `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\n function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initAccum\n ? (initAccum = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.sortBy` which uses `comparer` to define the\n * sort order of `array` and replaces criteria objects with their corresponding\n * values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\n function baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.sum` and `_.sumBy` without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the sum.\n */\n function baseSum(array, iteratee) {\n var result,\n index = -1,\n length = array.length;\n\n while (++index < length) {\n var current = iteratee(array[index]);\n if (current !== undefined) {\n result = result === undefined ? current : (result + current);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\n function baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array\n * of key-value pairs for `object` corresponding to the property names of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the key-value pairs.\n */\n function baseToPairs(object, props) {\n return arrayMap(props, function(key) {\n return [key, object[key]];\n });\n }\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 */\n function baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n }\n\n /**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\n function baseUnary(func) {\n return function(value) {\n return func(value);\n };\n }\n\n /**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\n function baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n }\n\n /**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function cacheHas(cache, key) {\n return cache.has(key);\n }\n\n /**\n * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the first unmatched string symbol.\n */\n function charsStartIndex(strSymbols, chrSymbols) {\n var index = -1,\n length = strSymbols.length;\n\n while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n }\n\n /**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the last unmatched string symbol.\n */\n function charsEndIndex(strSymbols, chrSymbols) {\n var index = strSymbols.length;\n\n while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n }\n\n /**\n * Gets the number of `placeholder` occurrences in `array`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} placeholder The placeholder to search for.\n * @returns {number} Returns the placeholder count.\n */\n function countHolders(array, placeholder) {\n var length = array.length,\n result = 0;\n\n while (length--) {\n if (array[length] === placeholder) {\n ++result;\n }\n }\n return result;\n }\n\n /**\n * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A\n * letters to basic Latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\n var deburrLetter = basePropertyOf(deburredLetters);\n\n /**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n var escapeHtmlChar = basePropertyOf(htmlEscapes);\n\n /**\n * Used by `_.template` to escape characters for inclusion in compiled string literals.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeStringChar(chr) {\n return '\\\\' + stringEscapes[chr];\n }\n\n /**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function getValue(object, key) {\n return object == null ? undefined : object[key];\n }\n\n /**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\n function hasUnicode(string) {\n return reHasUnicode.test(string);\n }\n\n /**\n * Checks if `string` contains a word composed of Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a word is found, else `false`.\n */\n function hasUnicodeWord(string) {\n return reHasUnicodeWord.test(string);\n }\n\n /**\n * Converts `iterator` to an array.\n *\n * @private\n * @param {Object} iterator The iterator to convert.\n * @returns {Array} Returns the converted array.\n */\n function iteratorToArray(iterator) {\n var data,\n result = [];\n\n while (!(data = iterator.next()).done) {\n result.push(data.value);\n }\n return result;\n }\n\n /**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\n function mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n }\n\n /**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\n function overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n }\n\n /**\n * Replaces all `placeholder` elements in `array` with an internal placeholder\n * and returns an array of their indexes.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {*} placeholder The placeholder to replace.\n * @returns {Array} Returns the new array of placeholder indexes.\n */\n function replaceHolders(array, placeholder) {\n var index = -1,\n length = array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value === placeholder || value === PLACEHOLDER) {\n array[index] = PLACEHOLDER;\n result[resIndex++] = index;\n }\n }\n return result;\n }\n\n /**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\n function setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n }\n\n /**\n * Converts `set` to its value-value pairs.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the value-value pairs.\n */\n function setToPairs(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = [value, value];\n });\n return result;\n }\n\n /**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * A specialized version of `_.lastIndexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictLastIndexOf(array, value, fromIndex) {\n var index = fromIndex + 1;\n while (index--) {\n if (array[index] === value) {\n return index;\n }\n }\n return index;\n }\n\n /**\n * Gets the number of symbols in `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the string size.\n */\n function stringSize(string) {\n return hasUnicode(string)\n ? unicodeSize(string)\n : asciiSize(string);\n }\n\n /**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n }\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 */\n function trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n }\n\n /**\n * Used by `_.unescape` to convert HTML entities to characters.\n *\n * @private\n * @param {string} chr The matched character to unescape.\n * @returns {string} Returns the unescaped character.\n */\n var unescapeHtmlChar = basePropertyOf(htmlUnescapes);\n\n /**\n * Gets the size of a Unicode `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\n function unicodeSize(string) {\n var result = reUnicode.lastIndex = 0;\n while (reUnicode.test(string)) {\n ++result;\n }\n return result;\n }\n\n /**\n * Converts a Unicode `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function unicodeToArray(string) {\n return string.match(reUnicode) || [];\n }\n\n /**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\n function unicodeWords(string) {\n return string.match(reUnicodeWord) || [];\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Create a new pristine `lodash` function using the `context` object.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Util\n * @param {Object} [context=root] The context object.\n * @returns {Function} Returns a new `lodash` function.\n * @example\n *\n * _.mixin({ 'foo': _.constant('foo') });\n *\n * var lodash = _.runInContext();\n * lodash.mixin({ 'bar': lodash.constant('bar') });\n *\n * _.isFunction(_.foo);\n * // => true\n * _.isFunction(_.bar);\n * // => false\n *\n * lodash.isFunction(lodash.foo);\n * // => false\n * lodash.isFunction(lodash.bar);\n * // => true\n *\n * // Create a suped-up `defer` in Node.js.\n * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;\n */\n var runInContext = (function runInContext(context) {\n context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));\n\n /** Built-in constructor references. */\n var Array = context.Array,\n Date = context.Date,\n Error = context.Error,\n Function = context.Function,\n Math = context.Math,\n Object = context.Object,\n RegExp = context.RegExp,\n String = context.String,\n TypeError = context.TypeError;\n\n /** Used for built-in method references. */\n var arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n /** Used to detect overreaching core-js shims. */\n var coreJsData = context['__core-js_shared__'];\n\n /** Used to resolve the decompiled source of functions. */\n var funcToString = funcProto.toString;\n\n /** Used to check objects for own properties. */\n var hasOwnProperty = objectProto.hasOwnProperty;\n\n /** Used to generate unique IDs. */\n var idCounter = 0;\n\n /** Used to detect methods masquerading as native. */\n var maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n }());\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 */\n var nativeObjectToString = objectProto.toString;\n\n /** Used to infer the `Object` constructor. */\n var objectCtorString = funcToString.call(Object);\n\n /** Used to restore the original `_` reference in `_.noConflict`. */\n var oldDash = root._;\n\n /** Used to detect if a method is native. */\n var reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n );\n\n /** Built-in value references. */\n var Buffer = moduleExports ? context.Buffer : undefined,\n Symbol = context.Symbol,\n Uint8Array = context.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,\n symIterator = Symbol ? Symbol.iterator : undefined,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n var defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n }());\n\n /** Mocked built-ins. */\n var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,\n ctxNow = Date && Date.now !== root.Date.now && Date.now,\n ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeCeil = Math.ceil,\n nativeFloor = Math.floor,\n nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeIsFinite = context.isFinite,\n nativeJoin = arrayProto.join,\n nativeKeys = overArg(Object.keys, Object),\n nativeMax = Math.max,\n nativeMin = Math.min,\n nativeNow = Date.now,\n nativeParseInt = context.parseInt,\n nativeRandom = Math.random,\n nativeReverse = arrayProto.reverse;\n\n /* Built-in method references that are verified to be native. */\n var DataView = getNative(context, 'DataView'),\n Map = getNative(context, 'Map'),\n Promise = getNative(context, 'Promise'),\n Set = getNative(context, 'Set'),\n WeakMap = getNative(context, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n /** Used to store function metadata. */\n var metaMap = WeakMap && new WeakMap;\n\n /** Used to lookup unminified function names. */\n var realNames = {};\n\n /** Used to detect maps, sets, and weakmaps. */\n var dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` object which wraps `value` to enable implicit method\n * chain sequences. Methods that operate on and return arrays, collections,\n * and functions can be chained together. Methods that retrieve a single value\n * or may return a primitive value will automatically end the chain sequence\n * and return the unwrapped value. Otherwise, the value must be unwrapped\n * with `_#value`.\n *\n * Explicit chain sequences, which must be unwrapped with `_#value`, may be\n * enabled using `_.chain`.\n *\n * The execution of chained methods is lazy, that is, it's deferred until\n * `_#value` is implicitly or explicitly called.\n *\n * Lazy evaluation allows several methods to support shortcut fusion.\n * Shortcut fusion is an optimization to merge iteratee calls; this avoids\n * the creation of intermediate arrays and can greatly reduce the number of\n * iteratee executions. Sections of a chain sequence qualify for shortcut\n * fusion if the section is applied to an array and iteratees accept only\n * one argument. The heuristic for whether a section qualifies for shortcut\n * fusion is subject to change.\n *\n * Chaining is supported in custom builds as long as the `_#value` method is\n * directly or indirectly included in the build.\n *\n * In addition to lodash methods, wrappers have `Array` and `String` methods.\n *\n * The wrapper `Array` methods are:\n * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`\n *\n * The wrapper `String` methods are:\n * `replace` and `split`\n *\n * The wrapper methods that support shortcut fusion are:\n * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,\n * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,\n * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`\n *\n * The chainable wrapper methods are:\n * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,\n * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,\n * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,\n * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,\n * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,\n * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,\n * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,\n * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,\n * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,\n * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,\n * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,\n * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,\n * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,\n * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,\n * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,\n * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,\n * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,\n * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,\n * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,\n * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,\n * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,\n * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,\n * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,\n * `zipObject`, `zipObjectDeep`, and `zipWith`\n *\n * The wrapper methods that are **not** chainable by default are:\n * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,\n * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,\n * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,\n * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,\n * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,\n * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,\n * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,\n * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,\n * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,\n * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,\n * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,\n * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,\n * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,\n * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,\n * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,\n * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,\n * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,\n * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,\n * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,\n * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,\n * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,\n * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,\n * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,\n * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,\n * `upperFirst`, `value`, and `words`\n *\n * @name _\n * @constructor\n * @category Seq\n * @param {*} value The value to wrap in a `lodash` instance.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var wrapped = _([1, 2, 3]);\n *\n * // Returns an unwrapped value.\n * wrapped.reduce(_.add);\n * // => 6\n *\n * // Returns a wrapped value.\n * var squares = wrapped.map(square);\n *\n * _.isArray(squares);\n * // => false\n *\n * _.isArray(squares.value());\n * // => true\n */\n function lodash(value) {\n if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {\n if (value instanceof LodashWrapper) {\n return value;\n }\n if (hasOwnProperty.call(value, '__wrapped__')) {\n return wrapperClone(value);\n }\n }\n return new LodashWrapper(value);\n }\n\n /**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\n var baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n }());\n\n /**\n * The function whose prototype chain sequence wrappers inherit from.\n *\n * @private\n */\n function baseLodash() {\n // No operation performed.\n }\n\n /**\n * The base constructor for creating `lodash` wrapper objects.\n *\n * @private\n * @param {*} value The value to wrap.\n * @param {boolean} [chainAll] Enable explicit method chain sequences.\n */\n function LodashWrapper(value, chainAll) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__chain__ = !!chainAll;\n this.__index__ = 0;\n this.__values__ = undefined;\n }\n\n /**\n * By default, the template delimiters used by lodash are like those in\n * embedded Ruby (ERB) as well as ES2015 template strings. Change the\n * following template settings to use alternative delimiters.\n *\n * @static\n * @memberOf _\n * @type {Object}\n */\n lodash.templateSettings = {\n\n /**\n * Used to detect `data` property values to be HTML-escaped.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'escape': reEscape,\n\n /**\n * Used to detect code to be evaluated.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'evaluate': reEvaluate,\n\n /**\n * Used to detect `data` property values to inject.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'interpolate': reInterpolate,\n\n /**\n * Used to reference the data object in the template text.\n *\n * @memberOf _.templateSettings\n * @type {string}\n */\n 'variable': '',\n\n /**\n * Used to import variables into the compiled template.\n *\n * @memberOf _.templateSettings\n * @type {Object}\n */\n 'imports': {\n\n /**\n * A reference to the `lodash` function.\n *\n * @memberOf _.templateSettings.imports\n * @type {Function}\n */\n '_': lodash\n }\n };\n\n // Ensure wrappers are instances of `baseLodash`.\n lodash.prototype = baseLodash.prototype;\n lodash.prototype.constructor = lodash;\n\n LodashWrapper.prototype = baseCreate(baseLodash.prototype);\n LodashWrapper.prototype.constructor = LodashWrapper;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.\n *\n * @private\n * @constructor\n * @param {*} value The value to wrap.\n */\n function LazyWrapper(value) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__dir__ = 1;\n this.__filtered__ = false;\n this.__iteratees__ = [];\n this.__takeCount__ = MAX_ARRAY_LENGTH;\n this.__views__ = [];\n }\n\n /**\n * Creates a clone of the lazy wrapper object.\n *\n * @private\n * @name clone\n * @memberOf LazyWrapper\n * @returns {Object} Returns the cloned `LazyWrapper` object.\n */\n function lazyClone() {\n var result = new LazyWrapper(this.__wrapped__);\n result.__actions__ = copyArray(this.__actions__);\n result.__dir__ = this.__dir__;\n result.__filtered__ = this.__filtered__;\n result.__iteratees__ = copyArray(this.__iteratees__);\n result.__takeCount__ = this.__takeCount__;\n result.__views__ = copyArray(this.__views__);\n return result;\n }\n\n /**\n * Reverses the direction of lazy iteration.\n *\n * @private\n * @name reverse\n * @memberOf LazyWrapper\n * @returns {Object} Returns the new reversed `LazyWrapper` object.\n */\n function lazyReverse() {\n if (this.__filtered__) {\n var result = new LazyWrapper(this);\n result.__dir__ = -1;\n result.__filtered__ = true;\n } else {\n result = this.clone();\n result.__dir__ *= -1;\n }\n return result;\n }\n\n /**\n * Extracts the unwrapped value from its lazy wrapper.\n *\n * @private\n * @name value\n * @memberOf LazyWrapper\n * @returns {*} Returns the unwrapped value.\n */\n function lazyValue() {\n var array = this.__wrapped__.value(),\n dir = this.__dir__,\n isArr = isArray(array),\n isRight = dir < 0,\n arrLength = isArr ? array.length : 0,\n view = getView(0, arrLength, this.__views__),\n start = view.start,\n end = view.end,\n length = end - start,\n index = isRight ? end : (start - 1),\n iteratees = this.__iteratees__,\n iterLength = iteratees.length,\n resIndex = 0,\n takeCount = nativeMin(length, this.__takeCount__);\n\n if (!isArr || (!isRight && arrLength == length && takeCount == length)) {\n return baseWrapperValue(array, this.__actions__);\n }\n var result = [];\n\n outer:\n while (length-- && resIndex < takeCount) {\n index += dir;\n\n var iterIndex = -1,\n value = array[index];\n\n while (++iterIndex < iterLength) {\n var data = iteratees[iterIndex],\n iteratee = data.iteratee,\n type = data.type,\n computed = iteratee(value);\n\n if (type == LAZY_MAP_FLAG) {\n value = computed;\n } else if (!computed) {\n if (type == LAZY_FILTER_FLAG) {\n continue outer;\n } else {\n break outer;\n }\n }\n }\n result[resIndex++] = value;\n }\n return result;\n }\n\n // Ensure `LazyWrapper` is an instance of `baseLodash`.\n LazyWrapper.prototype = baseCreate(baseLodash.prototype);\n LazyWrapper.prototype.constructor = LazyWrapper;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\n function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n }\n\n /**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n }\n\n /**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n }\n\n /**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\n function hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n }\n\n // Add methods to `Hash`.\n Hash.prototype.clear = hashClear;\n Hash.prototype['delete'] = hashDelete;\n Hash.prototype.get = hashGet;\n Hash.prototype.has = hashHas;\n Hash.prototype.set = hashSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\n function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n }\n\n /**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n }\n\n /**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n }\n\n /**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\n function listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n }\n\n // Add methods to `ListCache`.\n ListCache.prototype.clear = listCacheClear;\n ListCache.prototype['delete'] = listCacheDelete;\n ListCache.prototype.get = listCacheGet;\n ListCache.prototype.has = listCacheHas;\n ListCache.prototype.set = listCacheSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\n function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n }\n\n /**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n }\n\n /**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function mapCacheGet(key) {\n return getMapData(this, key).get(key);\n }\n\n /**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function mapCacheHas(key) {\n return getMapData(this, key).has(key);\n }\n\n /**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\n function mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n }\n\n // Add methods to `MapCache`.\n MapCache.prototype.clear = mapCacheClear;\n MapCache.prototype['delete'] = mapCacheDelete;\n MapCache.prototype.get = mapCacheGet;\n MapCache.prototype.has = mapCacheHas;\n MapCache.prototype.set = mapCacheSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\n function SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n }\n\n /**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\n function setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n }\n\n /**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\n function setCacheHas(value) {\n return this.__data__.has(value);\n }\n\n // Add methods to `SetCache`.\n SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\n SetCache.prototype.has = setCacheHas;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n }\n\n /**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\n function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n }\n\n /**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function stackGet(key) {\n return this.__data__.get(key);\n }\n\n /**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function stackHas(key) {\n return this.__data__.has(key);\n }\n\n /**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\n function stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n }\n\n // Add methods to `Stack`.\n Stack.prototype.clear = stackClear;\n Stack.prototype['delete'] = stackDelete;\n Stack.prototype.get = stackGet;\n Stack.prototype.has = stackHas;\n Stack.prototype.set = stackSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\n function arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.sample` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @returns {*} Returns the random element.\n */\n function arraySample(array) {\n var length = array.length;\n return length ? array[baseRandom(0, length - 1)] : undefined;\n }\n\n /**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\n function arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n }\n\n /**\n * A specialized version of `_.shuffle` for arrays.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @returns {Array} Returns the new shuffled array.\n */\n function arrayShuffle(array) {\n return shuffleSelf(copyArray(array));\n }\n\n /**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n }\n\n /**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n }\n\n /**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n }\n\n /**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n }\n\n /**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n }\n\n /**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n }\n\n /**\n * The base implementation of `_.at` without support for individual paths.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {string[]} paths The property paths to pick.\n * @returns {Array} Returns the picked elements.\n */\n function baseAt(object, paths) {\n var index = -1,\n length = paths.length,\n result = Array(length),\n skip = object == null;\n\n while (++index < length) {\n result[index] = skip ? undefined : get(object, paths[index]);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\n function baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n }\n\n /**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\n function baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n }\n\n /**\n * The base implementation of `_.conforms` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property predicates to conform to.\n * @returns {Function} Returns the new spec function.\n */\n function baseConforms(source) {\n var props = keys(source);\n return function(object) {\n return baseConformsTo(object, source, props);\n };\n }\n\n /**\n * The base implementation of `_.conformsTo` which accepts `props` to check.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property predicates to conform to.\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\n */\n function baseConformsTo(object, source, props) {\n var length = props.length;\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (length--) {\n var key = props[length],\n predicate = source[key],\n value = object[key];\n\n if ((value === undefined && !(key in object)) || !predicate(value)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.delay` and `_.defer` which accepts `args`\n * to provide to `func`.\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {Array} args The arguments to provide to `func`.\n * @returns {number|Object} Returns the timer id or timeout object.\n */\n function baseDelay(func, wait, args) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return setTimeout(function() { func.apply(undefined, args); }, wait);\n }\n\n /**\n * The base implementation of methods like `_.difference` without support\n * for excluding multiple arrays or iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n */\n function baseDifference(array, values, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n isCommon = true,\n length = array.length,\n result = [],\n valuesLength = values.length;\n\n if (!length) {\n return result;\n }\n if (iteratee) {\n values = arrayMap(values, baseUnary(iteratee));\n }\n if (comparator) {\n includes = arrayIncludesWith;\n isCommon = false;\n }\n else if (values.length >= LARGE_ARRAY_SIZE) {\n includes = cacheHas;\n isCommon = false;\n values = new SetCache(values);\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee == null ? value : iteratee(value);\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var valuesIndex = valuesLength;\n while (valuesIndex--) {\n if (values[valuesIndex] === computed) {\n continue outer;\n }\n }\n result.push(value);\n }\n else if (!includes(values, computed, comparator)) {\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEach = createBaseEach(baseForOwn);\n\n /**\n * The base implementation of `_.forEachRight` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEachRight = createBaseEach(baseForOwnRight, true);\n\n /**\n * The base implementation of `_.every` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\n function baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n }\n\n /**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\n function baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.fill` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n */\n function baseFill(array, value, start, end) {\n var length = array.length;\n\n start = toInteger(start);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : toInteger(end);\n if (end < 0) {\n end += length;\n }\n end = start > end ? 0 : toLength(end);\n while (start < end) {\n array[start++] = value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.filter` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\n function baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseFor = createBaseFor();\n\n /**\n * This function is like `baseFor` except that it iterates over properties\n * in the opposite order.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseForRight = createBaseFor(true);\n\n /**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.forOwnRight` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwnRight(object, iteratee) {\n return object && baseForRight(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.functions` which creates an array of\n * `object` function property names filtered from `props`.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} props The property names to filter.\n * @returns {Array} Returns the function names.\n */\n function baseFunctions(object, props) {\n return arrayFilter(props, function(key) {\n return isFunction(object[key]);\n });\n }\n\n /**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\n function baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n }\n\n /**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n }\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 */\n function 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\n /**\n * The base implementation of `_.gt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n */\n function baseGt(value, other) {\n return value > other;\n }\n\n /**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHas(object, key) {\n return object != null && hasOwnProperty.call(object, key);\n }\n\n /**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHasIn(object, key) {\n return object != null && key in Object(object);\n }\n\n /**\n * The base implementation of `_.inRange` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to check.\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n */\n function baseInRange(number, start, end) {\n return number >= nativeMin(start, end) && number < nativeMax(start, end);\n }\n\n /**\n * The base implementation of methods like `_.intersection`, without support\n * for iteratee shorthands, that accepts an array of arrays to inspect.\n *\n * @private\n * @param {Array} arrays The arrays to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of shared values.\n */\n function baseIntersection(arrays, iteratee, comparator) {\n var includes = comparator ? arrayIncludesWith : arrayIncludes,\n length = arrays[0].length,\n othLength = arrays.length,\n othIndex = othLength,\n caches = Array(othLength),\n maxLength = Infinity,\n result = [];\n\n while (othIndex--) {\n var array = arrays[othIndex];\n if (othIndex && iteratee) {\n array = arrayMap(array, baseUnary(iteratee));\n }\n maxLength = nativeMin(array.length, maxLength);\n caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))\n ? new SetCache(othIndex && array)\n : undefined;\n }\n array = arrays[0];\n\n var index = -1,\n seen = caches[0];\n\n outer:\n while (++index < length && result.length < maxLength) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (!(seen\n ? cacheHas(seen, computed)\n : includes(result, computed, comparator)\n )) {\n othIndex = othLength;\n while (--othIndex) {\n var cache = caches[othIndex];\n if (!(cache\n ? cacheHas(cache, computed)\n : includes(arrays[othIndex], computed, comparator))\n ) {\n continue outer;\n }\n }\n if (seen) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.invert` and `_.invertBy` which inverts\n * `object` with values transformed by `iteratee` and set by `setter`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform values.\n * @param {Object} accumulator The initial inverted object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseInverter(object, setter, iteratee, accumulator) {\n baseForOwn(object, function(value, key, object) {\n setter(accumulator, iteratee(value), key, object);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.invoke` without support for individual\n * method arguments.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {Array} args The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n */\n function baseInvoke(object, path, args) {\n path = castPath(path, object);\n object = parent(object, path);\n var func = object == null ? object : object[toKey(last(path))];\n return func == null ? undefined : apply(func, object, args);\n }\n\n /**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\n function baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n }\n\n /**\n * The base implementation of `_.isArrayBuffer` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.\n */\n function baseIsArrayBuffer(value) {\n return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;\n }\n\n /**\n * The base implementation of `_.isDate` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n */\n function baseIsDate(value) {\n return isObjectLike(value) && baseGetTag(value) == dateTag;\n }\n\n /**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\n function baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n }\n\n /**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n }\n\n /**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\n function baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n }\n\n /**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\n function baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\n function baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n }\n\n /**\n * The base implementation of `_.isRegExp` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n */\n function baseIsRegExp(value) {\n return isObjectLike(value) && baseGetTag(value) == regexpTag;\n }\n\n /**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\n function baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n }\n\n /**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\n function baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n }\n\n /**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\n function baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n }\n\n /**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\n function baseLt(value, other) {\n return value < other;\n }\n\n /**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n }\n\n /**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n }\n\n /**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n }\n\n /**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\n function baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n }\n\n /**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\n function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n }\n\n /**\n * The base implementation of `_.nth` which doesn't coerce arguments.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {number} n The index of the element to return.\n * @returns {*} Returns the nth element of `array`.\n */\n function baseNth(array, n) {\n var length = array.length;\n if (!length) {\n return;\n }\n n += n < 0 ? length : 0;\n return isIndex(n, length) ? array[n] : undefined;\n }\n\n /**\n * The base implementation of `_.orderBy` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {string[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\n function baseOrderBy(collection, iteratees, orders) {\n if (iteratees.length) {\n iteratees = arrayMap(iteratees, function(iteratee) {\n if (isArray(iteratee)) {\n return function(value) {\n return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);\n }\n }\n return iteratee;\n });\n } else {\n iteratees = [identity];\n }\n\n var index = -1;\n iteratees = arrayMap(iteratees, baseUnary(getIteratee()));\n\n var result = baseMap(collection, function(value, key, collection) {\n var criteria = arrayMap(iteratees, function(iteratee) {\n return iteratee(value);\n });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n }\n\n /**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\n function basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n }\n\n /**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\n function basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n }\n\n /**\n * The base implementation of `_.pullAllBy` without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns `array`.\n */\n function basePullAll(array, values, iteratee, comparator) {\n var indexOf = comparator ? baseIndexOfWith : baseIndexOf,\n index = -1,\n length = values.length,\n seen = array;\n\n if (array === values) {\n values = copyArray(values);\n }\n if (iteratee) {\n seen = arrayMap(array, baseUnary(iteratee));\n }\n while (++index < length) {\n var fromIndex = 0,\n value = values[index],\n computed = iteratee ? iteratee(value) : value;\n\n while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {\n if (seen !== array) {\n splice.call(seen, fromIndex, 1);\n }\n splice.call(array, fromIndex, 1);\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.pullAt` without support for individual\n * indexes or capturing the removed elements.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {number[]} indexes The indexes of elements to remove.\n * @returns {Array} Returns `array`.\n */\n function basePullAt(array, indexes) {\n var length = array ? indexes.length : 0,\n lastIndex = length - 1;\n\n while (length--) {\n var index = indexes[length];\n if (length == lastIndex || index !== previous) {\n var previous = index;\n if (isIndex(index)) {\n splice.call(array, index, 1);\n } else {\n baseUnset(array, index);\n }\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\n function baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n }\n\n /**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\n function baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n }\n\n /**\n * The base implementation of `_.repeat` which doesn't coerce arguments.\n *\n * @private\n * @param {string} string The string to repeat.\n * @param {number} n The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n */\n function baseRepeat(string, n) {\n var result = '';\n if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\n return result;\n }\n // Leverage the exponentiation by squaring algorithm for a faster repeat.\n // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n do {\n if (n % 2) {\n result += string;\n }\n n = nativeFloor(n / 2);\n if (n) {\n string += string;\n }\n } while (n);\n\n return result;\n }\n\n /**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\n function baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n }\n\n /**\n * The base implementation of `_.sample`.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @returns {*} Returns the random element.\n */\n function baseSample(collection) {\n return arraySample(values(collection));\n }\n\n /**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\n function baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n }\n\n /**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object;\n }\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n }\n\n /**\n * The base implementation of `setData` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var baseSetData = !metaMap ? identity : function(func, data) {\n metaMap.set(func, data);\n return func;\n };\n\n /**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n };\n\n /**\n * The base implementation of `_.shuffle`.\n *\n * @private\n * @param {Array|Object} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n */\n function baseShuffle(collection) {\n return shuffleSelf(values(collection));\n }\n\n /**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n }\n\n /**\n * The base implementation of `_.some` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n }\n\n /**\n * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which\n * performs a binary search of `array` to determine the index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function baseSortedIndex(array, value, retHighest) {\n var low = 0,\n high = array == null ? low : array.length;\n\n if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {\n while (low < high) {\n var mid = (low + high) >>> 1,\n computed = array[mid];\n\n if (computed !== null && !isSymbol(computed) &&\n (retHighest ? (computed <= value) : (computed < value))) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n return baseSortedIndexBy(array, value, identity, retHighest);\n }\n\n /**\n * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`\n * which invokes `iteratee` for `value` and each element of `array` to compute\n * their sort ranking. The iteratee is invoked with one argument; (value).\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} iteratee The iteratee invoked per element.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function baseSortedIndexBy(array, value, iteratee, retHighest) {\n var low = 0,\n high = array == null ? 0 : array.length;\n if (high === 0) {\n return 0;\n }\n\n value = iteratee(value);\n var valIsNaN = value !== value,\n valIsNull = value === null,\n valIsSymbol = isSymbol(value),\n valIsUndefined = value === undefined;\n\n while (low < high) {\n var mid = nativeFloor((low + high) / 2),\n computed = iteratee(array[mid]),\n othIsDefined = computed !== undefined,\n othIsNull = computed === null,\n othIsReflexive = computed === computed,\n othIsSymbol = isSymbol(computed);\n\n if (valIsNaN) {\n var setLow = retHighest || othIsReflexive;\n } else if (valIsUndefined) {\n setLow = othIsReflexive && (retHighest || othIsDefined);\n } else if (valIsNull) {\n setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);\n } else if (valIsSymbol) {\n setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);\n } else if (othIsNull || othIsSymbol) {\n setLow = false;\n } else {\n setLow = retHighest ? (computed <= value) : (computed < value);\n }\n if (setLow) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return nativeMin(high, MAX_ARRAY_INDEX);\n }\n\n /**\n * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseSortedUniq(array, iteratee) {\n var index = -1,\n length = array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n if (!index || !eq(computed, seen)) {\n var seen = computed;\n result[resIndex++] = value === 0 ? 0 : value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.toNumber` which doesn't ensure correct\n * conversions of binary, hexadecimal, or octal string values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n */\n function baseToNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n return +value;\n }\n\n /**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\n function baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n }\n\n /**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.unset`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The property path to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n */\n function baseUnset(object, path) {\n path = castPath(path, object);\n object = parent(object, path);\n return object == null || delete object[toKey(last(path))];\n }\n\n /**\n * The base implementation of `_.update`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to update.\n * @param {Function} updater The function to produce the updated value.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseUpdate(object, path, updater, customizer) {\n return baseSet(object, path, updater(baseGet(object, path)), customizer);\n }\n\n /**\n * The base implementation of methods like `_.dropWhile` and `_.takeWhile`\n * without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [isDrop] Specify dropping elements instead of taking them.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseWhile(array, predicate, isDrop, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length) &&\n predicate(array[index], index, array)) {}\n\n return isDrop\n ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))\n : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));\n }\n\n /**\n * The base implementation of `wrapperValue` which returns the result of\n * performing a sequence of actions on the unwrapped `value`, where each\n * successive action is supplied the return value of the previous.\n *\n * @private\n * @param {*} value The unwrapped value.\n * @param {Array} actions Actions to perform to resolve the unwrapped value.\n * @returns {*} Returns the resolved value.\n */\n function baseWrapperValue(value, actions) {\n var result = value;\n if (result instanceof LazyWrapper) {\n result = result.value();\n }\n return arrayReduce(actions, function(result, action) {\n return action.func.apply(action.thisArg, arrayPush([result], action.args));\n }, result);\n }\n\n /**\n * The base implementation of methods like `_.xor`, without support for\n * iteratee shorthands, that accepts an array of arrays to inspect.\n *\n * @private\n * @param {Array} arrays The arrays to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of values.\n */\n function baseXor(arrays, iteratee, comparator) {\n var length = arrays.length;\n if (length < 2) {\n return length ? baseUniq(arrays[0]) : [];\n }\n var index = -1,\n result = Array(length);\n\n while (++index < length) {\n var array = arrays[index],\n othIndex = -1;\n\n while (++othIndex < length) {\n if (othIndex != index) {\n result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);\n }\n }\n }\n return baseUniq(baseFlatten(result, 1), iteratee, comparator);\n }\n\n /**\n * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\n *\n * @private\n * @param {Array} props The property identifiers.\n * @param {Array} values The property values.\n * @param {Function} assignFunc The function to assign values.\n * @returns {Object} Returns the new object.\n */\n function baseZipObject(props, values, assignFunc) {\n var index = -1,\n length = props.length,\n valsLength = values.length,\n result = {};\n\n while (++index < length) {\n var value = index < valsLength ? values[index] : undefined;\n assignFunc(result, props[index], value);\n }\n return result;\n }\n\n /**\n * Casts `value` to an empty array if it's not an array like object.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Array|Object} Returns the cast array-like object.\n */\n function castArrayLikeObject(value) {\n return isArrayLikeObject(value) ? value : [];\n }\n\n /**\n * Casts `value` to `identity` if it's not a function.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Function} Returns cast function.\n */\n function castFunction(value) {\n return typeof value == 'function' ? value : identity;\n }\n\n /**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\n function castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n }\n\n /**\n * A `baseRest` alias which can be replaced with `identity` by module\n * replacement plugins.\n *\n * @private\n * @type {Function}\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\n var castRest = baseRest;\n\n /**\n * Casts `array` to a slice if it's needed.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {number} start The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the cast slice.\n */\n function castSlice(array, start, end) {\n var length = array.length;\n end = end === undefined ? length : end;\n return (!start && end >= length) ? array : baseSlice(array, start, end);\n }\n\n /**\n * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).\n *\n * @private\n * @param {number|Object} id The timer id or timeout object of the timer to clear.\n */\n var clearTimeout = ctxClearTimeout || function(id) {\n return root.clearTimeout(id);\n };\n\n /**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\n function cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n }\n\n /**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\n function cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n }\n\n /**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\n function cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n }\n\n /**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\n function cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n }\n\n /**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\n function cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n }\n\n /**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\n function cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n }\n\n /**\n * Compares values to sort them in ascending order.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\n function compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined,\n valIsNull = value === null,\n valIsReflexive = value === value,\n valIsSymbol = isSymbol(value);\n\n var othIsDefined = other !== undefined,\n othIsNull = other === null,\n othIsReflexive = other === other,\n othIsSymbol = isSymbol(other);\n\n if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||\n (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||\n (valIsNull && othIsDefined && othIsReflexive) ||\n (!valIsDefined && othIsReflexive) ||\n !valIsReflexive) {\n return 1;\n }\n if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||\n (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||\n (othIsNull && valIsDefined && valIsReflexive) ||\n (!othIsDefined && valIsReflexive) ||\n !othIsReflexive) {\n return -1;\n }\n }\n return 0;\n }\n\n /**\n * Used by `_.orderBy` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n * specify an order of \"desc\" for descending or \"asc\" for ascending sort order\n * of corresponding values.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]|string[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\n function compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = compareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * (order == 'desc' ? -1 : 1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n }\n\n /**\n * Creates an array that is the composition of partially applied arguments,\n * placeholders, and provided arguments into a single array of arguments.\n *\n * @private\n * @param {Array} args The provided arguments.\n * @param {Array} partials The arguments to prepend to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @params {boolean} [isCurried] Specify composing for a curried function.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgs(args, partials, holders, isCurried) {\n var argsIndex = -1,\n argsLength = args.length,\n holdersLength = holders.length,\n leftIndex = -1,\n leftLength = partials.length,\n rangeLength = nativeMax(argsLength - holdersLength, 0),\n result = Array(leftLength + rangeLength),\n isUncurried = !isCurried;\n\n while (++leftIndex < leftLength) {\n result[leftIndex] = partials[leftIndex];\n }\n while (++argsIndex < holdersLength) {\n if (isUncurried || argsIndex < argsLength) {\n result[holders[argsIndex]] = args[argsIndex];\n }\n }\n while (rangeLength--) {\n result[leftIndex++] = args[argsIndex++];\n }\n return result;\n }\n\n /**\n * This function is like `composeArgs` except that the arguments composition\n * is tailored for `_.partialRight`.\n *\n * @private\n * @param {Array} args The provided arguments.\n * @param {Array} partials The arguments to append to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @params {boolean} [isCurried] Specify composing for a curried function.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgsRight(args, partials, holders, isCurried) {\n var argsIndex = -1,\n argsLength = args.length,\n holdersIndex = -1,\n holdersLength = holders.length,\n rightIndex = -1,\n rightLength = partials.length,\n rangeLength = nativeMax(argsLength - holdersLength, 0),\n result = Array(rangeLength + rightLength),\n isUncurried = !isCurried;\n\n while (++argsIndex < rangeLength) {\n result[argsIndex] = args[argsIndex];\n }\n var offset = argsIndex;\n while (++rightIndex < rightLength) {\n result[offset + rightIndex] = partials[rightIndex];\n }\n while (++holdersIndex < holdersLength) {\n if (isUncurried || argsIndex < argsLength) {\n result[offset + holders[holdersIndex]] = args[argsIndex++];\n }\n }\n return result;\n }\n\n /**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\n function copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n }\n\n /**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\n function copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n }\n\n /**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n }\n\n /**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n }\n\n /**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\n function createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, getIteratee(iteratee, 2), accumulator);\n };\n }\n\n /**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\n function createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n }\n\n /**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n }\n\n /**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with the optional `this`\n * binding of `thisArg`.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createBind(func, bitmask, thisArg) {\n var isBind = bitmask & WRAP_BIND_FLAG,\n Ctor = createCtor(func);\n\n function wrapper() {\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return fn.apply(isBind ? thisArg : this, arguments);\n }\n return wrapper;\n }\n\n /**\n * Creates a function like `_.lowerFirst`.\n *\n * @private\n * @param {string} methodName The name of the `String` case method to use.\n * @returns {Function} Returns the new case function.\n */\n function createCaseFirst(methodName) {\n return function(string) {\n string = toString(string);\n\n var strSymbols = hasUnicode(string)\n ? stringToArray(string)\n : undefined;\n\n var chr = strSymbols\n ? strSymbols[0]\n : string.charAt(0);\n\n var trailing = strSymbols\n ? castSlice(strSymbols, 1).join('')\n : string.slice(1);\n\n return chr[methodName]() + trailing;\n };\n }\n\n /**\n * Creates a function like `_.camelCase`.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\n function createCompounder(callback) {\n return function(string) {\n return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');\n };\n }\n\n /**\n * Creates a function that produces an instance of `Ctor` regardless of\n * whether it was invoked as part of a `new` expression or by `call` or `apply`.\n *\n * @private\n * @param {Function} Ctor The constructor to wrap.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCtor(Ctor) {\n return function() {\n // Use a `switch` statement to work with class constructors. See\n // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist\n // for more details.\n var args = arguments;\n switch (args.length) {\n case 0: return new Ctor;\n case 1: return new Ctor(args[0]);\n case 2: return new Ctor(args[0], args[1]);\n case 3: return new Ctor(args[0], args[1], args[2]);\n case 4: return new Ctor(args[0], args[1], args[2], args[3]);\n case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);\n case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);\n case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n }\n var thisBinding = baseCreate(Ctor.prototype),\n result = Ctor.apply(thisBinding, args);\n\n // Mimic the constructor's `return` behavior.\n // See https://es5.github.io/#x13.2.2 for more details.\n return isObject(result) ? result : thisBinding;\n };\n }\n\n /**\n * Creates a function that wraps `func` to enable currying.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {number} arity The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCurry(func, bitmask, arity) {\n var Ctor = createCtor(func);\n\n function wrapper() {\n var length = arguments.length,\n args = Array(length),\n index = length,\n placeholder = getHolder(wrapper);\n\n while (index--) {\n args[index] = arguments[index];\n }\n var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)\n ? []\n : replaceHolders(args, placeholder);\n\n length -= holders.length;\n if (length < arity) {\n return createRecurry(\n func, bitmask, createHybrid, wrapper.placeholder, undefined,\n args, holders, undefined, undefined, arity - length);\n }\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return apply(fn, this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\n function createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = getIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;\n };\n }\n\n /**\n * Creates a `_.flow` or `_.flowRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new flow function.\n */\n function createFlow(fromRight) {\n return flatRest(function(funcs) {\n var length = funcs.length,\n index = length,\n prereq = LodashWrapper.prototype.thru;\n\n if (fromRight) {\n funcs.reverse();\n }\n while (index--) {\n var func = funcs[index];\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (prereq && !wrapper && getFuncName(func) == 'wrapper') {\n var wrapper = new LodashWrapper([], true);\n }\n }\n index = wrapper ? index : length;\n while (++index < length) {\n func = funcs[index];\n\n var funcName = getFuncName(func),\n data = funcName == 'wrapper' ? getData(func) : undefined;\n\n if (data && isLaziable(data[0]) &&\n data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&\n !data[4].length && data[9] == 1\n ) {\n wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);\n } else {\n wrapper = (func.length == 1 && isLaziable(func))\n ? wrapper[funcName]()\n : wrapper.thru(func);\n }\n }\n return function() {\n var args = arguments,\n value = args[0];\n\n if (wrapper && args.length == 1 && isArray(value)) {\n return wrapper.plant(value).value();\n }\n var index = 0,\n result = length ? funcs[index].apply(this, args) : value;\n\n while (++index < length) {\n result = funcs[index].call(this, result);\n }\n return result;\n };\n });\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with optional `this`\n * binding of `thisArg`, partial application, and currying.\n *\n * @private\n * @param {Function|string} func The function or method name to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to\n * the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [partialsRight] The arguments to append to those provided\n * to the new function.\n * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {\n var isAry = bitmask & WRAP_ARY_FLAG,\n isBind = bitmask & WRAP_BIND_FLAG,\n isBindKey = bitmask & WRAP_BIND_KEY_FLAG,\n isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),\n isFlip = bitmask & WRAP_FLIP_FLAG,\n Ctor = isBindKey ? undefined : createCtor(func);\n\n function wrapper() {\n var length = arguments.length,\n args = Array(length),\n index = length;\n\n while (index--) {\n args[index] = arguments[index];\n }\n if (isCurried) {\n var placeholder = getHolder(wrapper),\n holdersCount = countHolders(args, placeholder);\n }\n if (partials) {\n args = composeArgs(args, partials, holders, isCurried);\n }\n if (partialsRight) {\n args = composeArgsRight(args, partialsRight, holdersRight, isCurried);\n }\n length -= holdersCount;\n if (isCurried && length < arity) {\n var newHolders = replaceHolders(args, placeholder);\n return createRecurry(\n func, bitmask, createHybrid, wrapper.placeholder, thisArg,\n args, newHolders, argPos, ary, arity - length\n );\n }\n var thisBinding = isBind ? thisArg : this,\n fn = isBindKey ? thisBinding[func] : func;\n\n length = args.length;\n if (argPos) {\n args = reorder(args, argPos);\n } else if (isFlip && length > 1) {\n args.reverse();\n }\n if (isAry && ary < length) {\n args.length = ary;\n }\n if (this && this !== root && this instanceof wrapper) {\n fn = Ctor || createCtor(fn);\n }\n return fn.apply(thisBinding, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a function like `_.invertBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} toIteratee The function to resolve iteratees.\n * @returns {Function} Returns the new inverter function.\n */\n function createInverter(setter, toIteratee) {\n return function(object, iteratee) {\n return baseInverter(object, setter, toIteratee(iteratee), {});\n };\n }\n\n /**\n * Creates a function that performs a mathematical operation on two values.\n *\n * @private\n * @param {Function} operator The function to perform the operation.\n * @param {number} [defaultValue] The value used for `undefined` arguments.\n * @returns {Function} Returns the new mathematical operation function.\n */\n function createMathOperation(operator, defaultValue) {\n return function(value, other) {\n var result;\n if (value === undefined && other === undefined) {\n return defaultValue;\n }\n if (value !== undefined) {\n result = value;\n }\n if (other !== undefined) {\n if (result === undefined) {\n return other;\n }\n if (typeof value == 'string' || typeof other == 'string') {\n value = baseToString(value);\n other = baseToString(other);\n } else {\n value = baseToNumber(value);\n other = baseToNumber(other);\n }\n result = operator(value, other);\n }\n return result;\n };\n }\n\n /**\n * Creates a function like `_.over`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over iteratees.\n * @returns {Function} Returns the new over function.\n */\n function createOver(arrayFunc) {\n return flatRest(function(iteratees) {\n iteratees = arrayMap(iteratees, baseUnary(getIteratee()));\n return baseRest(function(args) {\n var thisArg = this;\n return arrayFunc(iteratees, function(iteratee) {\n return apply(iteratee, thisArg, args);\n });\n });\n });\n }\n\n /**\n * Creates the padding for `string` based on `length`. The `chars` string\n * is truncated if the number of characters exceeds `length`.\n *\n * @private\n * @param {number} length The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padding for `string`.\n */\n function createPadding(length, chars) {\n chars = chars === undefined ? ' ' : baseToString(chars);\n\n var charsLength = chars.length;\n if (charsLength < 2) {\n return charsLength ? baseRepeat(chars, length) : chars;\n }\n var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));\n return hasUnicode(chars)\n ? castSlice(stringToArray(result), 0, length).join('')\n : result.slice(0, length);\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with the `this` binding\n * of `thisArg` and `partials` prepended to the arguments it receives.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} partials The arguments to prepend to those provided to\n * the new function.\n * @returns {Function} Returns the new wrapped function.\n */\n function createPartial(func, bitmask, thisArg, partials) {\n var isBind = bitmask & WRAP_BIND_FLAG,\n Ctor = createCtor(func);\n\n function wrapper() {\n var argsIndex = -1,\n argsLength = arguments.length,\n leftIndex = -1,\n leftLength = partials.length,\n args = Array(leftLength + argsLength),\n fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n\n while (++leftIndex < leftLength) {\n args[leftIndex] = partials[leftIndex];\n }\n while (argsLength--) {\n args[leftIndex++] = arguments[++argsIndex];\n }\n return apply(fn, isBind ? thisArg : this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.range` or `_.rangeRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new range function.\n */\n function createRange(fromRight) {\n return function(start, end, step) {\n if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\n end = step = undefined;\n }\n // Ensure the sign of `-0` is preserved.\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);\n return baseRange(start, end, step, fromRight);\n };\n }\n\n /**\n * Creates a function that performs a relational operation on two values.\n *\n * @private\n * @param {Function} operator The function to perform the operation.\n * @returns {Function} Returns the new relational operation function.\n */\n function createRelationalOperation(operator) {\n return function(value, other) {\n if (!(typeof value == 'string' && typeof other == 'string')) {\n value = toNumber(value);\n other = toNumber(other);\n }\n return operator(value, other);\n };\n }\n\n /**\n * Creates a function that wraps `func` to continue currying.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {Function} wrapFunc The function to create the `func` wrapper.\n * @param {*} placeholder The placeholder value.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to\n * the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {\n var isCurry = bitmask & WRAP_CURRY_FLAG,\n newHolders = isCurry ? holders : undefined,\n newHoldersRight = isCurry ? undefined : holders,\n newPartials = isCurry ? partials : undefined,\n newPartialsRight = isCurry ? undefined : partials;\n\n bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);\n bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);\n\n if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {\n bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);\n }\n var newData = [\n func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,\n newHoldersRight, argPos, ary, arity\n ];\n\n var result = wrapFunc.apply(undefined, newData);\n if (isLaziable(func)) {\n setData(result, newData);\n }\n result.placeholder = placeholder;\n return setWrapToString(result, func, bitmask);\n }\n\n /**\n * Creates a function like `_.round`.\n *\n * @private\n * @param {string} methodName The name of the `Math` method to use when rounding.\n * @returns {Function} Returns the new round function.\n */\n function createRound(methodName) {\n var func = Math[methodName];\n return function(number, precision) {\n number = toNumber(number);\n precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);\n if (precision && nativeIsFinite(number)) {\n // Shift with exponential notation to avoid floating-point issues.\n // See [MDN](https://mdn.io/round#Examples) for more details.\n var pair = (toString(number) + 'e').split('e'),\n value = func(pair[0] + 'e' + (+pair[1] + precision));\n\n pair = (toString(value) + 'e').split('e');\n return +(pair[0] + 'e' + (+pair[1] - precision));\n }\n return func(number);\n };\n }\n\n /**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\n var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n };\n\n /**\n * Creates a `_.toPairs` or `_.toPairsIn` function.\n *\n * @private\n * @param {Function} keysFunc The function to get the keys of a given object.\n * @returns {Function} Returns the new pairs function.\n */\n function createToPairs(keysFunc) {\n return function(object) {\n var tag = getTag(object);\n if (tag == mapTag) {\n return mapToArray(object);\n }\n if (tag == setTag) {\n return setToPairs(object);\n }\n return baseToPairs(object, keysFunc(object));\n };\n }\n\n /**\n * Creates a function that either curries or invokes `func` with optional\n * `this` binding and partially applied arguments.\n *\n * @private\n * @param {Function|string} func The function or method name to wrap.\n * @param {number} bitmask The bitmask flags.\n * 1 - `_.bind`\n * 2 - `_.bindKey`\n * 4 - `_.curry` or `_.curryRight` of a bound function\n * 8 - `_.curry`\n * 16 - `_.curryRight`\n * 32 - `_.partial`\n * 64 - `_.partialRight`\n * 128 - `_.rearg`\n * 256 - `_.ary`\n * 512 - `_.flip`\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to be partially applied.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {\n var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;\n if (!isBindKey && typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var length = partials ? partials.length : 0;\n if (!length) {\n bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);\n partials = holders = undefined;\n }\n ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);\n arity = arity === undefined ? arity : toInteger(arity);\n length -= holders ? holders.length : 0;\n\n if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {\n var partialsRight = partials,\n holdersRight = holders;\n\n partials = holders = undefined;\n }\n var data = isBindKey ? undefined : getData(func);\n\n var newData = [\n func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,\n argPos, ary, arity\n ];\n\n if (data) {\n mergeData(newData, data);\n }\n func = newData[0];\n bitmask = newData[1];\n thisArg = newData[2];\n partials = newData[3];\n holders = newData[4];\n arity = newData[9] = newData[9] === undefined\n ? (isBindKey ? 0 : func.length)\n : nativeMax(newData[9] - length, 0);\n\n if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {\n bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);\n }\n if (!bitmask || bitmask == WRAP_BIND_FLAG) {\n var result = createBind(func, bitmask, thisArg);\n } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {\n result = createCurry(func, bitmask, arity);\n } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {\n result = createPartial(func, bitmask, thisArg, partials);\n } else {\n result = createHybrid.apply(undefined, newData);\n }\n var setter = data ? baseSetData : setData;\n return setWrapToString(setter(result, newData), func, bitmask);\n }\n\n /**\n * Used by `_.defaults` to customize its `_.assignIn` use to assign properties\n * of source objects to the destination object for all destination properties\n * that resolve to `undefined`.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\n function customDefaultsAssignIn(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n }\n\n /**\n * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source\n * objects into destination objects that are passed thru.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to merge.\n * @param {Object} object The parent object of `objValue`.\n * @param {Object} source The parent object of `srcValue`.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n * @returns {*} Returns the value to assign.\n */\n function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {\n if (isObject(objValue) && isObject(srcValue)) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, objValue);\n baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);\n stack['delete'](srcValue);\n }\n return objValue;\n }\n\n /**\n * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain\n * objects.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {string} key The key of the property to inspect.\n * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.\n */\n function customOmitClone(value) {\n return isPlainObject(value) ? undefined : value;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\n function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n }\n\n /**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\n function flatRest(func) {\n return setToString(overRest(func, undefined, flatten), func + '');\n }\n\n /**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n }\n\n /**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n }\n\n /**\n * Gets metadata for `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {*} Returns the metadata for `func`.\n */\n var getData = !metaMap ? noop : function(func) {\n return metaMap.get(func);\n };\n\n /**\n * Gets the name of `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {string} Returns the function name.\n */\n function getFuncName(func) {\n var result = (func.name + ''),\n array = realNames[result],\n length = hasOwnProperty.call(realNames, result) ? array.length : 0;\n\n while (length--) {\n var data = array[length],\n otherFunc = data.func;\n if (otherFunc == null || otherFunc == func) {\n return data.name;\n }\n }\n return result;\n }\n\n /**\n * Gets the argument placeholder value for `func`.\n *\n * @private\n * @param {Function} func The function to inspect.\n * @returns {*} Returns the placeholder value.\n */\n function getHolder(func) {\n var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;\n return object.placeholder;\n }\n\n /**\n * Gets the appropriate \"iteratee\" function. If `_.iteratee` is customized,\n * this function returns the custom method, otherwise it returns `baseIteratee`.\n * If arguments are provided, the chosen function is invoked with them and\n * its result is returned.\n *\n * @private\n * @param {*} [value] The value to convert to an iteratee.\n * @param {number} [arity] The arity of the created iteratee.\n * @returns {Function} Returns the chosen function or its result.\n */\n function getIteratee() {\n var result = lodash.iteratee || iteratee;\n result = result === iteratee ? baseIteratee : result;\n return arguments.length ? result(arguments[0], arguments[1]) : result;\n }\n\n /**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\n function getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n }\n\n /**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\n function getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n }\n\n /**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\n function getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n }\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 */\n function 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\n /**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n };\n\n /**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n };\n\n /**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n var getTag = baseGetTag;\n\n // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\n if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n }\n\n /**\n * Gets the view, applying any `transforms` to the `start` and `end` positions.\n *\n * @private\n * @param {number} start The start of the view.\n * @param {number} end The end of the view.\n * @param {Array} transforms The transformations to apply to the view.\n * @returns {Object} Returns an object containing the `start` and `end`\n * positions of the view.\n */\n function getView(start, end, transforms) {\n var index = -1,\n length = transforms.length;\n\n while (++index < length) {\n var data = transforms[index],\n size = data.size;\n\n switch (data.type) {\n case 'drop': start += size; break;\n case 'dropRight': end -= size; break;\n case 'take': end = nativeMin(end, start + size); break;\n case 'takeRight': start = nativeMax(start, end - size); break;\n }\n }\n return { 'start': start, 'end': end };\n }\n\n /**\n * Extracts wrapper details from the `source` body comment.\n *\n * @private\n * @param {string} source The source to inspect.\n * @returns {Array} Returns the wrapper details.\n */\n function getWrapDetails(source) {\n var match = source.match(reWrapDetails);\n return match ? match[1].split(reSplitDetails) : [];\n }\n\n /**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\n function hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n }\n\n /**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\n function initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n }\n\n /**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n }\n\n /**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n }\n\n /**\n * Inserts wrapper `details` in a comment at the top of the `source` body.\n *\n * @private\n * @param {string} source The source to modify.\n * @returns {Array} details The details to insert.\n * @returns {string} Returns the modified source.\n */\n function insertWrapDetails(source, details) {\n var length = details.length;\n if (!length) {\n return source;\n }\n var lastIndex = length - 1;\n details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];\n details = details.join(length > 2 ? ', ' : ' ');\n return source.replace(reWrapComment, '{\\n/* [wrapped with ' + details + '] */\\n');\n }\n\n /**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\n function isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n }\n\n /**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\n function isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n }\n\n /**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\n function isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n }\n\n /**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\n function isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n }\n\n /**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\n function isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n }\n\n /**\n * Checks if `func` has a lazy counterpart.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` has a lazy counterpart,\n * else `false`.\n */\n function isLaziable(func) {\n var funcName = getFuncName(func),\n other = lodash[funcName];\n\n if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {\n return false;\n }\n if (func === other) {\n return true;\n }\n var data = getData(other);\n return !!data && func === data[0];\n }\n\n /**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\n function isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n }\n\n /**\n * Checks if `func` is capable of being masked.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `func` is maskable, else `false`.\n */\n var isMaskable = coreJsData ? isFunction : stubFalse;\n\n /**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\n function isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n }\n\n /**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\n function isStrictComparable(value) {\n return value === value && !isObject(value);\n }\n\n /**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n }\n\n /**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\n function memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n }\n\n /**\n * Merges the function metadata of `source` into `data`.\n *\n * Merging metadata reduces the number of wrappers used to invoke a function.\n * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`\n * may be applied regardless of execution order. Methods like `_.ary` and\n * `_.rearg` modify function arguments, making the order in which they are\n * executed important, preventing the merging of metadata. However, we make\n * an exception for a safe combined case where curried functions have `_.ary`\n * and or `_.rearg` applied.\n *\n * @private\n * @param {Array} data The destination metadata.\n * @param {Array} source The source metadata.\n * @returns {Array} Returns `data`.\n */\n function mergeData(data, source) {\n var bitmask = data[1],\n srcBitmask = source[1],\n newBitmask = bitmask | srcBitmask,\n isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);\n\n var isCombo =\n ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||\n ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||\n ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));\n\n // Exit early if metadata can't be merged.\n if (!(isCommon || isCombo)) {\n return data;\n }\n // Use source `thisArg` if available.\n if (srcBitmask & WRAP_BIND_FLAG) {\n data[2] = source[2];\n // Set when currying a bound function.\n newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;\n }\n // Compose partial arguments.\n var value = source[3];\n if (value) {\n var partials = data[3];\n data[3] = partials ? composeArgs(partials, value, source[4]) : value;\n data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];\n }\n // Compose partial right arguments.\n value = source[5];\n if (value) {\n partials = data[5];\n data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;\n data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];\n }\n // Use source `argPos` if available.\n value = source[7];\n if (value) {\n data[7] = value;\n }\n // Use source `ary` if it's smaller.\n if (srcBitmask & WRAP_ARY_FLAG) {\n data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);\n }\n // Use source `arity` if one is not provided.\n if (data[9] == null) {\n data[9] = source[9];\n }\n // Use source `func` and merge bitmasks.\n data[0] = source[0];\n data[1] = newBitmask;\n\n return data;\n }\n\n /**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n }\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 */\n function objectToString(value) {\n return nativeObjectToString.call(value);\n }\n\n /**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\n function overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n }\n\n /**\n * Gets the parent value at `path` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path to get the parent value of.\n * @returns {*} Returns the parent value.\n */\n function parent(object, path) {\n return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));\n }\n\n /**\n * Reorder `array` according to the specified indexes where the element at\n * the first index is assigned as the first element, the element at\n * the second index is assigned as the second element, and so on.\n *\n * @private\n * @param {Array} array The array to reorder.\n * @param {Array} indexes The arranged array indexes.\n * @returns {Array} Returns `array`.\n */\n function reorder(array, indexes) {\n var arrLength = array.length,\n length = nativeMin(indexes.length, arrLength),\n oldArray = copyArray(array);\n\n while (length--) {\n var index = indexes[length];\n array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;\n }\n return array;\n }\n\n /**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n }\n\n /**\n * Sets metadata for `func`.\n *\n * **Note:** If this function becomes hot, i.e. is invoked a lot in a short\n * period of time, it will trip its breaker and transition to an identity\n * function to avoid garbage collection pauses in V8. See\n * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)\n * for more details.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var setData = shortOut(baseSetData);\n\n /**\n * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @returns {number|Object} Returns the timer id or timeout object.\n */\n var setTimeout = ctxSetTimeout || function(func, wait) {\n return root.setTimeout(func, wait);\n };\n\n /**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var setToString = shortOut(baseSetToString);\n\n /**\n * Sets the `toString` method of `wrapper` to mimic the source of `reference`\n * with wrapper details in a comment at the top of the source body.\n *\n * @private\n * @param {Function} wrapper The function to modify.\n * @param {Function} reference The reference function.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @returns {Function} Returns `wrapper`.\n */\n function setWrapToString(wrapper, reference, bitmask) {\n var source = (reference + '');\n return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));\n }\n\n /**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\n function shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n }\n\n /**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\n function shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n }\n\n /**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\n var stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n });\n\n /**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\n function toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n }\n\n /**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\n function toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n }\n\n /**\n * Updates wrapper `details` based on `bitmask` flags.\n *\n * @private\n * @returns {Array} details The details to modify.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @returns {Array} Returns `details`.\n */\n function updateWrapDetails(details, bitmask) {\n arrayEach(wrapFlags, function(pair) {\n var value = '_.' + pair[0];\n if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {\n details.push(value);\n }\n });\n return details.sort();\n }\n\n /**\n * Creates a clone of `wrapper`.\n *\n * @private\n * @param {Object} wrapper The wrapper to clone.\n * @returns {Object} Returns the cloned wrapper.\n */\n function wrapperClone(wrapper) {\n if (wrapper instanceof LazyWrapper) {\n return wrapper.clone();\n }\n var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);\n result.__actions__ = copyArray(wrapper.__actions__);\n result.__index__ = wrapper.__index__;\n result.__values__ = wrapper.__values__;\n return result;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of elements split into groups the length of `size`.\n * If `array` can't be split evenly, the final chunk will be the remaining\n * elements.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to process.\n * @param {number} [size=1] The length of each chunk\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the new array of chunks.\n * @example\n *\n * _.chunk(['a', 'b', 'c', 'd'], 2);\n * // => [['a', 'b'], ['c', 'd']]\n *\n * _.chunk(['a', 'b', 'c', 'd'], 3);\n * // => [['a', 'b', 'c'], ['d']]\n */\n function chunk(array, size, guard) {\n if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {\n size = 1;\n } else {\n size = nativeMax(toInteger(size), 0);\n }\n var length = array == null ? 0 : array.length;\n if (!length || size < 1) {\n return [];\n }\n var index = 0,\n resIndex = 0,\n result = Array(nativeCeil(length / size));\n\n while (index < length) {\n result[resIndex++] = baseSlice(array, index, (index += size));\n }\n return result;\n }\n\n /**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\n function compact(array) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n }\n\n /**\n * Creates a new array concatenating `array` with any additional arrays\n * and/or values.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to concatenate.\n * @param {...*} [values] The values to concatenate.\n * @returns {Array} Returns the new concatenated array.\n * @example\n *\n * var array = [1];\n * var other = _.concat(array, 2, [3], [[4]]);\n *\n * console.log(other);\n * // => [1, 2, 3, [4]]\n *\n * console.log(array);\n * // => [1]\n */\n function concat() {\n var length = arguments.length;\n if (!length) {\n return [];\n }\n var args = Array(length - 1),\n array = arguments[0],\n index = length;\n\n while (index--) {\n args[index - 1] = arguments[index];\n }\n return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));\n }\n\n /**\n * Creates an array of `array` values not included in the other given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * **Note:** Unlike `_.pullAll`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.without, _.xor\n * @example\n *\n * _.difference([2, 1], [2, 3]);\n * // => [1]\n */\n var difference = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))\n : [];\n });\n\n /**\n * This method is like `_.difference` except that it accepts `iteratee` which\n * is invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * **Note:** Unlike `_.pullAllBy`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');\n * // => [{ 'x': 2 }]\n */\n var differenceBy = baseRest(function(array, values) {\n var iteratee = last(values);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))\n : [];\n });\n\n /**\n * This method is like `_.difference` except that it accepts `comparator`\n * which is invoked to compare elements of `array` to `values`. The order and\n * references of result values are determined by the first array. The comparator\n * is invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `_.pullAllWith`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n *\n * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);\n * // => [{ 'x': 2, 'y': 1 }]\n */\n var differenceWith = baseRest(function(array, values) {\n var comparator = last(values);\n if (isArrayLikeObject(comparator)) {\n comparator = undefined;\n }\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)\n : [];\n });\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function drop(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n return baseSlice(array, n < 0 ? 0 : n, length);\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function dropRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the end.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.dropRightWhile(users, function(o) { return !o.active; });\n * // => objects for ['barney']\n *\n * // The `_.matches` iteratee shorthand.\n * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });\n * // => objects for ['barney', 'fred']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.dropRightWhile(users, ['active', false]);\n * // => objects for ['barney']\n *\n * // The `_.property` iteratee shorthand.\n * _.dropRightWhile(users, 'active');\n * // => objects for ['barney', 'fred', 'pebbles']\n */\n function dropRightWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), true, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the beginning.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.dropWhile(users, function(o) { return !o.active; });\n * // => objects for ['pebbles']\n *\n * // The `_.matches` iteratee shorthand.\n * _.dropWhile(users, { 'user': 'barney', 'active': false });\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.dropWhile(users, ['active', false]);\n * // => objects for ['pebbles']\n *\n * // The `_.property` iteratee shorthand.\n * _.dropWhile(users, 'active');\n * // => objects for ['barney', 'fred', 'pebbles']\n */\n function dropWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), true)\n : [];\n }\n\n /**\n * Fills elements of `array` with `value` from `start` up to, but not\n * including, `end`.\n *\n * **Note:** This method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Array\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.fill(array, 'a');\n * console.log(array);\n * // => ['a', 'a', 'a']\n *\n * _.fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * _.fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n */\n function fill(array, value, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\n start = 0;\n end = length;\n }\n return baseFill(array, value, start, end);\n }\n\n /**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\n function findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseFindIndex(array, getIteratee(predicate, 3), index);\n }\n\n /**\n * This method is like `_.findIndex` except that it iterates over elements\n * of `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });\n * // => 2\n *\n * // The `_.matches` iteratee shorthand.\n * _.findLastIndex(users, { 'user': 'barney', 'active': true });\n * // => 0\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findLastIndex(users, ['active', false]);\n * // => 2\n *\n * // The `_.property` iteratee shorthand.\n * _.findLastIndex(users, 'active');\n * // => 0\n */\n function findLastIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = length - 1;\n if (fromIndex !== undefined) {\n index = toInteger(fromIndex);\n index = fromIndex < 0\n ? nativeMax(length + index, 0)\n : nativeMin(index, length - 1);\n }\n return baseFindIndex(array, getIteratee(predicate, 3), index, true);\n }\n\n /**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\n function flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n }\n\n /**\n * Recursively flattens `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flattenDeep([1, [2, [3, [4]], 5]]);\n * // => [1, 2, 3, 4, 5]\n */\n function flattenDeep(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, INFINITY) : [];\n }\n\n /**\n * Recursively flatten `array` up to `depth` times.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @param {number} [depth=1] The maximum recursion depth.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * var array = [1, [2, [3, [4]], 5]];\n *\n * _.flattenDepth(array, 1);\n * // => [1, 2, [3, [4]], 5]\n *\n * _.flattenDepth(array, 2);\n * // => [1, 2, 3, [4], 5]\n */\n function flattenDepth(array, depth) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n depth = depth === undefined ? 1 : toInteger(depth);\n return baseFlatten(array, depth);\n }\n\n /**\n * The inverse of `_.toPairs`; this method returns an object composed\n * from key-value `pairs`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} pairs The key-value pairs.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.fromPairs([['a', 1], ['b', 2]]);\n * // => { 'a': 1, 'b': 2 }\n */\n function fromPairs(pairs) {\n var index = -1,\n length = pairs == null ? 0 : pairs.length,\n result = {};\n\n while (++index < length) {\n var pair = pairs[index];\n result[pair[0]] = pair[1];\n }\n return result;\n }\n\n /**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias first\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.head([1, 2, 3]);\n * // => 1\n *\n * _.head([]);\n * // => undefined\n */\n function head(array) {\n return (array && array.length) ? array[0] : undefined;\n }\n\n /**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it's used as the\n * offset from the end of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // Search from the `fromIndex`.\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n */\n function indexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseIndexOf(array, value, index);\n }\n\n /**\n * Gets all but the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.initial([1, 2, 3]);\n * // => [1, 2]\n */\n function initial(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 0, -1) : [];\n }\n\n /**\n * Creates an array of unique values that are included in all given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * _.intersection([2, 1], [2, 3]);\n * // => [2]\n */\n var intersection = baseRest(function(arrays) {\n var mapped = arrayMap(arrays, castArrayLikeObject);\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped)\n : [];\n });\n\n /**\n * This method is like `_.intersection` except that it accepts `iteratee`\n * which is invoked for each element of each `arrays` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [2.1]\n *\n * // The `_.property` iteratee shorthand.\n * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }]\n */\n var intersectionBy = baseRest(function(arrays) {\n var iteratee = last(arrays),\n mapped = arrayMap(arrays, castArrayLikeObject);\n\n if (iteratee === last(mapped)) {\n iteratee = undefined;\n } else {\n mapped.pop();\n }\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped, getIteratee(iteratee, 2))\n : [];\n });\n\n /**\n * This method is like `_.intersection` except that it accepts `comparator`\n * which is invoked to compare elements of `arrays`. The order and references\n * of result values are determined by the first array. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.intersectionWith(objects, others, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }]\n */\n var intersectionWith = baseRest(function(arrays) {\n var comparator = last(arrays),\n mapped = arrayMap(arrays, castArrayLikeObject);\n\n comparator = typeof comparator == 'function' ? comparator : undefined;\n if (comparator) {\n mapped.pop();\n }\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped, undefined, comparator)\n : [];\n });\n\n /**\n * Converts all elements in `array` into a string separated by `separator`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to convert.\n * @param {string} [separator=','] The element separator.\n * @returns {string} Returns the joined string.\n * @example\n *\n * _.join(['a', 'b', 'c'], '~');\n * // => 'a~b~c'\n */\n function join(array, separator) {\n return array == null ? '' : nativeJoin.call(array, separator);\n }\n\n /**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\n function last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n }\n\n /**\n * This method is like `_.indexOf` except that it iterates over elements of\n * `array` from right to left.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.lastIndexOf([1, 2, 1, 2], 2);\n * // => 3\n *\n * // Search from the `fromIndex`.\n * _.lastIndexOf([1, 2, 1, 2], 2, 2);\n * // => 1\n */\n function lastIndexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = length;\n if (fromIndex !== undefined) {\n index = toInteger(fromIndex);\n index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);\n }\n return value === value\n ? strictLastIndexOf(array, value, index)\n : baseFindIndex(array, baseIsNaN, index, true);\n }\n\n /**\n * Gets the element at index `n` of `array`. If `n` is negative, the nth\n * element from the end is returned.\n *\n * @static\n * @memberOf _\n * @since 4.11.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=0] The index of the element to return.\n * @returns {*} Returns the nth element of `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'd'];\n *\n * _.nth(array, 1);\n * // => 'b'\n *\n * _.nth(array, -2);\n * // => 'c';\n */\n function nth(array, n) {\n return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;\n }\n\n /**\n * Removes all given values from `array` using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`\n * to remove elements from an array by predicate.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...*} [values] The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'a', 'b', 'c'];\n *\n * _.pull(array, 'a', 'c');\n * console.log(array);\n * // => ['b', 'b']\n */\n var pull = baseRest(pullAll);\n\n /**\n * This method is like `_.pull` except that it accepts an array of values to remove.\n *\n * **Note:** Unlike `_.difference`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'a', 'b', 'c'];\n *\n * _.pullAll(array, ['a', 'c']);\n * console.log(array);\n * // => ['b', 'b']\n */\n function pullAll(array, values) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values)\n : array;\n }\n\n /**\n * This method is like `_.pullAll` except that it accepts `iteratee` which is\n * invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The iteratee is invoked with one argument: (value).\n *\n * **Note:** Unlike `_.differenceBy`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];\n *\n * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');\n * console.log(array);\n * // => [{ 'x': 2 }]\n */\n function pullAllBy(array, values, iteratee) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values, getIteratee(iteratee, 2))\n : array;\n }\n\n /**\n * This method is like `_.pullAll` except that it accepts `comparator` which\n * is invoked to compare elements of `array` to `values`. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `_.differenceWith`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];\n *\n * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);\n * console.log(array);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]\n */\n function pullAllWith(array, values, comparator) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values, undefined, comparator)\n : array;\n }\n\n /**\n * Removes elements from `array` corresponding to `indexes` and returns an\n * array of removed elements.\n *\n * **Note:** Unlike `_.at`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...(number|number[])} [indexes] The indexes of elements to remove.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = ['a', 'b', 'c', 'd'];\n * var pulled = _.pullAt(array, [1, 3]);\n *\n * console.log(array);\n * // => ['a', 'c']\n *\n * console.log(pulled);\n * // => ['b', 'd']\n */\n var pullAt = flatRest(function(array, indexes) {\n var length = array == null ? 0 : array.length,\n result = baseAt(array, indexes);\n\n basePullAt(array, arrayMap(indexes, function(index) {\n return isIndex(index, length) ? +index : index;\n }).sort(compareAscending));\n\n return result;\n });\n\n /**\n * Removes all elements from `array` that `predicate` returns truthy for\n * and returns an array of the removed elements. The predicate is invoked\n * with three arguments: (value, index, array).\n *\n * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`\n * to pull elements from an array by value.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = [1, 2, 3, 4];\n * var evens = _.remove(array, function(n) {\n * return n % 2 == 0;\n * });\n *\n * console.log(array);\n * // => [1, 3]\n *\n * console.log(evens);\n * // => [2, 4]\n */\n function remove(array, predicate) {\n var result = [];\n if (!(array && array.length)) {\n return result;\n }\n var index = -1,\n indexes = [],\n length = array.length;\n\n predicate = getIteratee(predicate, 3);\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result.push(value);\n indexes.push(index);\n }\n }\n basePullAt(array, indexes);\n return result;\n }\n\n /**\n * Reverses `array` so that the first element becomes the last, the second\n * element becomes the second to last, and so on.\n *\n * **Note:** This method mutates `array` and is based on\n * [`Array#reverse`](https://mdn.io/Array/reverse).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.reverse(array);\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function reverse(array) {\n return array == null ? array : nativeReverse.call(array);\n }\n\n /**\n * Creates a slice of `array` from `start` up to, but not including, `end`.\n *\n * **Note:** This method is used instead of\n * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are\n * returned.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function slice(array, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {\n start = 0;\n end = length;\n }\n else {\n start = start == null ? 0 : toInteger(start);\n end = end === undefined ? length : toInteger(end);\n }\n return baseSlice(array, start, end);\n }\n\n /**\n * Uses a binary search to determine the lowest index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedIndex([30, 50], 40);\n * // => 1\n */\n function sortedIndex(array, value) {\n return baseSortedIndex(array, value);\n }\n\n /**\n * This method is like `_.sortedIndex` except that it accepts `iteratee`\n * which is invoked for `value` and each element of `array` to compute their\n * sort ranking. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * var objects = [{ 'x': 4 }, { 'x': 5 }];\n *\n * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.sortedIndexBy(objects, { 'x': 4 }, 'x');\n * // => 0\n */\n function sortedIndexBy(array, value, iteratee) {\n return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));\n }\n\n /**\n * This method is like `_.indexOf` except that it performs a binary\n * search on a sorted `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.sortedIndexOf([4, 5, 5, 5, 6], 5);\n * // => 1\n */\n function sortedIndexOf(array, value) {\n var length = array == null ? 0 : array.length;\n if (length) {\n var index = baseSortedIndex(array, value);\n if (index < length && eq(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * This method is like `_.sortedIndex` except that it returns the highest\n * index at which `value` should be inserted into `array` in order to\n * maintain its sort order.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedLastIndex([4, 5, 5, 5, 6], 5);\n * // => 4\n */\n function sortedLastIndex(array, value) {\n return baseSortedIndex(array, value, true);\n }\n\n /**\n * This method is like `_.sortedLastIndex` except that it accepts `iteratee`\n * which is invoked for `value` and each element of `array` to compute their\n * sort ranking. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * var objects = [{ 'x': 4 }, { 'x': 5 }];\n *\n * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });\n * // => 1\n *\n * // The `_.property` iteratee shorthand.\n * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');\n * // => 1\n */\n function sortedLastIndexBy(array, value, iteratee) {\n return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);\n }\n\n /**\n * This method is like `_.lastIndexOf` except that it performs a binary\n * search on a sorted `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);\n * // => 3\n */\n function sortedLastIndexOf(array, value) {\n var length = array == null ? 0 : array.length;\n if (length) {\n var index = baseSortedIndex(array, value, true) - 1;\n if (eq(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * This method is like `_.uniq` except that it's designed and optimized\n * for sorted arrays.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.sortedUniq([1, 1, 2]);\n * // => [1, 2]\n */\n function sortedUniq(array) {\n return (array && array.length)\n ? baseSortedUniq(array)\n : [];\n }\n\n /**\n * This method is like `_.uniqBy` except that it's designed and optimized\n * for sorted arrays.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);\n * // => [1.1, 2.3]\n */\n function sortedUniqBy(array, iteratee) {\n return (array && array.length)\n ? baseSortedUniq(array, getIteratee(iteratee, 2))\n : [];\n }\n\n /**\n * Gets all but the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.tail([1, 2, 3]);\n * // => [2, 3]\n */\n function tail(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 1, length) : [];\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.take([1, 2, 3]);\n * // => [1]\n *\n * _.take([1, 2, 3], 2);\n * // => [1, 2]\n *\n * _.take([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.take([1, 2, 3], 0);\n * // => []\n */\n function take(array, n, guard) {\n if (!(array && array.length)) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeRight([1, 2, 3]);\n * // => [3]\n *\n * _.takeRight([1, 2, 3], 2);\n * // => [2, 3]\n *\n * _.takeRight([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.takeRight([1, 2, 3], 0);\n * // => []\n */\n function takeRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, n < 0 ? 0 : n, length);\n }\n\n /**\n * Creates a slice of `array` with elements taken from the end. Elements are\n * taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.takeRightWhile(users, function(o) { return !o.active; });\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.matches` iteratee shorthand.\n * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });\n * // => objects for ['pebbles']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.takeRightWhile(users, ['active', false]);\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.property` iteratee shorthand.\n * _.takeRightWhile(users, 'active');\n * // => []\n */\n function takeRightWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), false, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` with elements taken from the beginning. Elements\n * are taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.takeWhile(users, function(o) { return !o.active; });\n * // => objects for ['barney', 'fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.takeWhile(users, { 'user': 'barney', 'active': false });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.takeWhile(users, ['active', false]);\n * // => objects for ['barney', 'fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.takeWhile(users, 'active');\n * // => []\n */\n function takeWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3))\n : [];\n }\n\n /**\n * Creates an array of unique values, in order, from all given arrays using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([2], [1, 2]);\n * // => [2, 1]\n */\n var union = baseRest(function(arrays) {\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\n });\n\n /**\n * This method is like `_.union` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which uniqueness is computed. Result values are chosen from the first\n * array in which the value occurs. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.unionBy([2.1], [1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n var unionBy = baseRest(function(arrays) {\n var iteratee = last(arrays);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));\n });\n\n /**\n * This method is like `_.union` except that it accepts `comparator` which\n * is invoked to compare elements of `arrays`. Result values are chosen from\n * the first array in which the value occurs. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.unionWith(objects, others, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n var unionWith = baseRest(function(arrays) {\n var comparator = last(arrays);\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);\n });\n\n /**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\n function uniq(array) {\n return (array && array.length) ? baseUniq(array) : [];\n }\n\n /**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n function uniqBy(array, iteratee) {\n return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];\n }\n\n /**\n * This method is like `_.uniq` except that it accepts `comparator` which\n * is invoked to compare elements of `array`. The order of result values is\n * determined by the order they occur in the array.The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.uniqWith(objects, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n */\n function uniqWith(array, comparator) {\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return (array && array.length) ? baseUniq(array, undefined, comparator) : [];\n }\n\n /**\n * This method is like `_.zip` except that it accepts an array of grouped\n * elements and creates an array regrouping the elements to their pre-zip\n * configuration.\n *\n * @static\n * @memberOf _\n * @since 1.2.0\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);\n * // => [['a', 1, true], ['b', 2, false]]\n *\n * _.unzip(zipped);\n * // => [['a', 'b'], [1, 2], [true, false]]\n */\n function unzip(array) {\n if (!(array && array.length)) {\n return [];\n }\n var length = 0;\n array = arrayFilter(array, function(group) {\n if (isArrayLikeObject(group)) {\n length = nativeMax(group.length, length);\n return true;\n }\n });\n return baseTimes(length, function(index) {\n return arrayMap(array, baseProperty(index));\n });\n }\n\n /**\n * This method is like `_.unzip` except that it accepts `iteratee` to specify\n * how regrouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @param {Function} [iteratee=_.identity] The function to combine\n * regrouped values.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip([1, 2], [10, 20], [100, 200]);\n * // => [[1, 10, 100], [2, 20, 200]]\n *\n * _.unzipWith(zipped, _.add);\n * // => [3, 30, 300]\n */\n function unzipWith(array, iteratee) {\n if (!(array && array.length)) {\n return [];\n }\n var result = unzip(array);\n if (iteratee == null) {\n return result;\n }\n return arrayMap(result, function(group) {\n return apply(iteratee, undefined, group);\n });\n }\n\n /**\n * Creates an array excluding all given values using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.pull`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...*} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.difference, _.xor\n * @example\n *\n * _.without([2, 1, 2, 3], 1, 2);\n * // => [3]\n */\n var without = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, values)\n : [];\n });\n\n /**\n * Creates an array of unique values that is the\n * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)\n * of the given arrays. The order of result values is determined by the order\n * they occur in the arrays.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.difference, _.without\n * @example\n *\n * _.xor([2, 1], [2, 3]);\n * // => [1, 3]\n */\n var xor = baseRest(function(arrays) {\n return baseXor(arrayFilter(arrays, isArrayLikeObject));\n });\n\n /**\n * This method is like `_.xor` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which by which they're compared. The order of result values is determined\n * by the order they occur in the arrays. The iteratee is invoked with one\n * argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [1.2, 3.4]\n *\n * // The `_.property` iteratee shorthand.\n * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 2 }]\n */\n var xorBy = baseRest(function(arrays) {\n var iteratee = last(arrays);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));\n });\n\n /**\n * This method is like `_.xor` except that it accepts `comparator` which is\n * invoked to compare elements of `arrays`. The order of result values is\n * determined by the order they occur in the arrays. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.xorWith(objects, others, _.isEqual);\n * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n var xorWith = baseRest(function(arrays) {\n var comparator = last(arrays);\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);\n });\n\n /**\n * Creates an array of grouped elements, the first of which contains the\n * first elements of the given arrays, the second of which contains the\n * second elements of the given arrays, and so on.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zip(['a', 'b'], [1, 2], [true, false]);\n * // => [['a', 1, true], ['b', 2, false]]\n */\n var zip = baseRest(unzip);\n\n /**\n * This method is like `_.fromPairs` except that it accepts two arrays,\n * one of property identifiers and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 0.4.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject(['a', 'b'], [1, 2]);\n * // => { 'a': 1, 'b': 2 }\n */\n function zipObject(props, values) {\n return baseZipObject(props || [], values || [], assignValue);\n }\n\n /**\n * This method is like `_.zipObject` except that it supports property paths.\n *\n * @static\n * @memberOf _\n * @since 4.1.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);\n * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\n function zipObjectDeep(props, values) {\n return baseZipObject(props || [], values || [], baseSet);\n }\n\n /**\n * This method is like `_.zip` except that it accepts `iteratee` to specify\n * how grouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @param {Function} [iteratee=_.identity] The function to combine\n * grouped values.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {\n * return a + b + c;\n * });\n * // => [111, 222]\n */\n var zipWith = baseRest(function(arrays) {\n var length = arrays.length,\n iteratee = length > 1 ? arrays[length - 1] : undefined;\n\n iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;\n return unzipWith(arrays, iteratee);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` wrapper instance that wraps `value` with explicit method\n * chain sequences enabled. The result of such sequences must be unwrapped\n * with `_#value`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Seq\n * @param {*} value The value to wrap.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'pebbles', 'age': 1 }\n * ];\n *\n * var youngest = _\n * .chain(users)\n * .sortBy('age')\n * .map(function(o) {\n * return o.user + ' is ' + o.age;\n * })\n * .head()\n * .value();\n * // => 'pebbles is 1'\n */\n function chain(value) {\n var result = lodash(value);\n result.__chain__ = true;\n return result;\n }\n\n /**\n * This method invokes `interceptor` and returns `value`. The interceptor\n * is invoked with one argument; (value). The purpose of this method is to\n * \"tap into\" a method chain sequence in order to modify intermediate results.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @returns {*} Returns `value`.\n * @example\n *\n * _([1, 2, 3])\n * .tap(function(array) {\n * // Mutate input array.\n * array.pop();\n * })\n * .reverse()\n * .value();\n * // => [2, 1]\n */\n function tap(value, interceptor) {\n interceptor(value);\n return value;\n }\n\n /**\n * This method is like `_.tap` except that it returns the result of `interceptor`.\n * The purpose of this method is to \"pass thru\" values replacing intermediate\n * results in a method chain sequence.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Seq\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @returns {*} Returns the result of `interceptor`.\n * @example\n *\n * _(' abc ')\n * .chain()\n * .trim()\n * .thru(function(value) {\n * return [value];\n * })\n * .value();\n * // => ['abc']\n */\n function thru(value, interceptor) {\n return interceptor(value);\n }\n\n /**\n * This method is the wrapper version of `_.at`.\n *\n * @name at\n * @memberOf _\n * @since 1.0.0\n * @category Seq\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n *\n * _(object).at(['a[0].b.c', 'a[1]']).value();\n * // => [3, 4]\n */\n var wrapperAt = flatRest(function(paths) {\n var length = paths.length,\n start = length ? paths[0] : 0,\n value = this.__wrapped__,\n interceptor = function(object) { return baseAt(object, paths); };\n\n if (length > 1 || this.__actions__.length ||\n !(value instanceof LazyWrapper) || !isIndex(start)) {\n return this.thru(interceptor);\n }\n value = value.slice(start, +start + (length ? 1 : 0));\n value.__actions__.push({\n 'func': thru,\n 'args': [interceptor],\n 'thisArg': undefined\n });\n return new LodashWrapper(value, this.__chain__).thru(function(array) {\n if (length && !array.length) {\n array.push(undefined);\n }\n return array;\n });\n });\n\n /**\n * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.\n *\n * @name chain\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 }\n * ];\n *\n * // A sequence without explicit chaining.\n * _(users).head();\n * // => { 'user': 'barney', 'age': 36 }\n *\n * // A sequence with explicit chaining.\n * _(users)\n * .chain()\n * .head()\n * .pick('user')\n * .value();\n * // => { 'user': 'barney' }\n */\n function wrapperChain() {\n return chain(this);\n }\n\n /**\n * Executes the chain sequence and returns the wrapped result.\n *\n * @name commit\n * @memberOf _\n * @since 3.2.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2];\n * var wrapped = _(array).push(3);\n *\n * console.log(array);\n * // => [1, 2]\n *\n * wrapped = wrapped.commit();\n * console.log(array);\n * // => [1, 2, 3]\n *\n * wrapped.last();\n * // => 3\n *\n * console.log(array);\n * // => [1, 2, 3]\n */\n function wrapperCommit() {\n return new LodashWrapper(this.value(), this.__chain__);\n }\n\n /**\n * Gets the next value on a wrapped object following the\n * [iterator protocol](https://mdn.io/iteration_protocols#iterator).\n *\n * @name next\n * @memberOf _\n * @since 4.0.0\n * @category Seq\n * @returns {Object} Returns the next iterator value.\n * @example\n *\n * var wrapped = _([1, 2]);\n *\n * wrapped.next();\n * // => { 'done': false, 'value': 1 }\n *\n * wrapped.next();\n * // => { 'done': false, 'value': 2 }\n *\n * wrapped.next();\n * // => { 'done': true, 'value': undefined }\n */\n function wrapperNext() {\n if (this.__values__ === undefined) {\n this.__values__ = toArray(this.value());\n }\n var done = this.__index__ >= this.__values__.length,\n value = done ? undefined : this.__values__[this.__index__++];\n\n return { 'done': done, 'value': value };\n }\n\n /**\n * Enables the wrapper to be iterable.\n *\n * @name Symbol.iterator\n * @memberOf _\n * @since 4.0.0\n * @category Seq\n * @returns {Object} Returns the wrapper object.\n * @example\n *\n * var wrapped = _([1, 2]);\n *\n * wrapped[Symbol.iterator]() === wrapped;\n * // => true\n *\n * Array.from(wrapped);\n * // => [1, 2]\n */\n function wrapperToIterator() {\n return this;\n }\n\n /**\n * Creates a clone of the chain sequence planting `value` as the wrapped value.\n *\n * @name plant\n * @memberOf _\n * @since 3.2.0\n * @category Seq\n * @param {*} value The value to plant.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var wrapped = _([1, 2]).map(square);\n * var other = wrapped.plant([3, 4]);\n *\n * other.value();\n * // => [9, 16]\n *\n * wrapped.value();\n * // => [1, 4]\n */\n function wrapperPlant(value) {\n var result,\n parent = this;\n\n while (parent instanceof baseLodash) {\n var clone = wrapperClone(parent);\n clone.__index__ = 0;\n clone.__values__ = undefined;\n if (result) {\n previous.__wrapped__ = clone;\n } else {\n result = clone;\n }\n var previous = clone;\n parent = parent.__wrapped__;\n }\n previous.__wrapped__ = value;\n return result;\n }\n\n /**\n * This method is the wrapper version of `_.reverse`.\n *\n * **Note:** This method mutates the wrapped array.\n *\n * @name reverse\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _(array).reverse().value()\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function wrapperReverse() {\n var value = this.__wrapped__;\n if (value instanceof LazyWrapper) {\n var wrapped = value;\n if (this.__actions__.length) {\n wrapped = new LazyWrapper(this);\n }\n wrapped = wrapped.reverse();\n wrapped.__actions__.push({\n 'func': thru,\n 'args': [reverse],\n 'thisArg': undefined\n });\n return new LodashWrapper(wrapped, this.__chain__);\n }\n return this.thru(reverse);\n }\n\n /**\n * Executes the chain sequence to resolve the unwrapped value.\n *\n * @name value\n * @memberOf _\n * @since 0.1.0\n * @alias toJSON, valueOf\n * @category Seq\n * @returns {*} Returns the resolved unwrapped value.\n * @example\n *\n * _([1, 2, 3]).value();\n * // => [1, 2, 3]\n */\n function wrapperValue() {\n return baseWrapperValue(this.__wrapped__, this.__actions__);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the number of times the key was returned by `iteratee`. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.countBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': 1, '6': 2 }\n *\n * // The `_.property` iteratee shorthand.\n * _.countBy(['one', 'two', 'three'], 'length');\n * // => { '3': 2, '5': 1 }\n */\n var countBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n ++result[key];\n } else {\n baseAssignValue(result, key, 1);\n }\n });\n\n /**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * Iteration is stopped once `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * **Note:** This method returns `true` for\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\n * elements of empty collections.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.every(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.every(users, 'active');\n * // => false\n */\n function every(collection, predicate, guard) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * **Note:** Unlike `_.remove`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.reject\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.filter(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, { 'age': 36, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.filter(users, 'active');\n * // => objects for ['barney']\n *\n * // Combining several predicates using `_.overEvery` or `_.overSome`.\n * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));\n * // => objects for ['fred', 'barney']\n */\n function filter(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\n var find = createFind(findIndex);\n\n /**\n * This method is like `_.find` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=collection.length-1] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * _.findLast([1, 2, 3, 4], function(n) {\n * return n % 2 == 1;\n * });\n * // => 3\n */\n var findLast = createFind(findLastIndex);\n\n /**\n * Creates a flattened array of values by running each element in `collection`\n * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n * with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [n, n];\n * }\n *\n * _.flatMap([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMap(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), 1);\n }\n\n /**\n * This method is like `_.flatMap` except that it recursively flattens the\n * mapped results.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [[[n, n]]];\n * }\n *\n * _.flatMapDeep([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMapDeep(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), INFINITY);\n }\n\n /**\n * This method is like `_.flatMap` except that it recursively flattens the\n * mapped results up to `depth` times.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {number} [depth=1] The maximum recursion depth.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [[[n, n]]];\n * }\n *\n * _.flatMapDepth([1, 2], duplicate, 2);\n * // => [[1, 1], [2, 2]]\n */\n function flatMapDepth(collection, iteratee, depth) {\n depth = depth === undefined ? 1 : toInteger(depth);\n return baseFlatten(map(collection, iteratee), depth);\n }\n\n /**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forEach(collection, iteratee) {\n var func = isArray(collection) ? arrayEach : baseEach;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.forEach` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @alias eachRight\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEach\n * @example\n *\n * _.forEachRight([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `2` then `1`.\n */\n function forEachRight(collection, iteratee) {\n var func = isArray(collection) ? arrayEachRight : baseEachRight;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n *\n * // The `_.property` iteratee shorthand.\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\n var groupBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n baseAssignValue(result, key, [value]);\n }\n });\n\n /**\n * Checks if `value` is in `collection`. If `collection` is a string, it's\n * checked for a substring of `value`, otherwise\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * is used for equality comparisons. If `fromIndex` is negative, it's used as\n * the offset from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {boolean} Returns `true` if `value` is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'a': 1, 'b': 2 }, 1);\n * // => true\n *\n * _.includes('abcd', 'bc');\n * // => true\n */\n function includes(collection, value, fromIndex, guard) {\n collection = isArrayLike(collection) ? collection : values(collection);\n fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;\n\n var length = collection.length;\n if (fromIndex < 0) {\n fromIndex = nativeMax(length + fromIndex, 0);\n }\n return isString(collection)\n ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)\n : (!!length && baseIndexOf(collection, value, fromIndex) > -1);\n }\n\n /**\n * Invokes the method at `path` of each element in `collection`, returning\n * an array of the results of each invoked method. Any additional arguments\n * are provided to each invoked method. If `path` is a function, it's invoked\n * for, and `this` bound to, each element in `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Array|Function|string} path The path of the method to invoke or\n * the function invoked per iteration.\n * @param {...*} [args] The arguments to invoke each method with.\n * @returns {Array} Returns the array of results.\n * @example\n *\n * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');\n * // => [[1, 5, 7], [1, 2, 3]]\n *\n * _.invokeMap([123, 456], String.prototype.split, '');\n * // => [['1', '2', '3'], ['4', '5', '6']]\n */\n var invokeMap = baseRest(function(collection, path, args) {\n var index = -1,\n isFunc = typeof path == 'function',\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value) {\n result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);\n });\n return result;\n });\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the last element responsible for generating the key. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * var array = [\n * { 'dir': 'left', 'code': 97 },\n * { 'dir': 'right', 'code': 100 }\n * ];\n *\n * _.keyBy(array, function(o) {\n * return String.fromCharCode(o.code);\n * });\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n *\n * _.keyBy(array, 'dir');\n * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n */\n var keyBy = createAggregator(function(result, value, key) {\n baseAssignValue(result, key, value);\n });\n\n /**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\n function map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.sortBy` except that it allows specifying the sort\n * orders of the iteratees to sort by. If `orders` is unspecified, all values\n * are sorted in ascending order. Otherwise, specify an order of \"desc\" for\n * descending or \"asc\" for ascending sort order of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @param {string[]} [orders] The sort orders of `iteratees`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 34 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'barney', 'age': 36 }\n * ];\n *\n * // Sort by `user` in ascending order and by `age` in descending order.\n * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n */\n function orderBy(collection, iteratees, orders, guard) {\n if (collection == null) {\n return [];\n }\n if (!isArray(iteratees)) {\n iteratees = iteratees == null ? [] : [iteratees];\n }\n orders = guard ? undefined : orders;\n if (!isArray(orders)) {\n orders = orders == null ? [] : [orders];\n }\n return baseOrderBy(collection, iteratees, orders);\n }\n\n /**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, the second of which\n * contains elements `predicate` returns falsey for. The predicate is\n * invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * _.partition(users, function(o) { return o.active; });\n * // => objects for [['fred'], ['barney', 'pebbles']]\n *\n * // The `_.matches` iteratee shorthand.\n * _.partition(users, { 'age': 1, 'active': false });\n * // => objects for [['pebbles'], ['barney', 'fred']]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.partition(users, ['active', false]);\n * // => objects for [['barney', 'pebbles'], ['fred']]\n *\n * // The `_.property` iteratee shorthand.\n * _.partition(users, 'active');\n * // => objects for [['fred'], ['barney', 'pebbles']]\n */\n var partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n }, function() { return [[], []]; });\n\n /**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` thru `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not given, the first element of `collection` is used as the initial\n * value. The iteratee is invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n * and `sortBy`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduceRight\n * @example\n *\n * _.reduce([1, 2], function(sum, n) {\n * return sum + n;\n * }, 0);\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * return result;\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n */\n function reduce(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduce : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);\n }\n\n /**\n * This method is like `_.reduce` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduce\n * @example\n *\n * var array = [[0, 1], [2, 3], [4, 5]];\n *\n * _.reduceRight(array, function(flattened, other) {\n * return flattened.concat(other);\n * }, []);\n * // => [4, 5, 2, 3, 0, 1]\n */\n function reduceRight(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduceRight : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);\n }\n\n /**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.filter\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * _.reject(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.reject(users, { 'age': 40, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.reject(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.reject(users, 'active');\n * // => objects for ['barney']\n */\n function reject(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, negate(getIteratee(predicate, 3)));\n }\n\n /**\n * Gets a random element from `collection`.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @returns {*} Returns the random element.\n * @example\n *\n * _.sample([1, 2, 3, 4]);\n * // => 2\n */\n function sample(collection) {\n var func = isArray(collection) ? arraySample : baseSample;\n return func(collection);\n }\n\n /**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\n function sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n }\n\n /**\n * Creates an array of shuffled values, using a version of the\n * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n * @example\n *\n * _.shuffle([1, 2, 3, 4]);\n * // => [4, 1, 3, 2]\n */\n function shuffle(collection) {\n var func = isArray(collection) ? arrayShuffle : baseShuffle;\n return func(collection);\n }\n\n /**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable string keyed properties for objects.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the collection size.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\n function size(collection) {\n if (collection == null) {\n return 0;\n }\n if (isArrayLike(collection)) {\n return isString(collection) ? stringSize(collection) : collection.length;\n }\n var tag = getTag(collection);\n if (tag == mapTag || tag == setTag) {\n return collection.size;\n }\n return baseKeys(collection).length;\n }\n\n /**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * Iteration is stopped once `predicate` returns truthy. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.some(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.some(users, 'active');\n * // => true\n */\n function some(collection, predicate, guard) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection thru each iteratee. This method\n * performs a stable sort, that is, it preserves the original sort order of\n * equal elements. The iteratees are invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 30 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.sortBy(users, [function(o) { return o.user; }]);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]\n *\n * _.sortBy(users, ['user', 'age']);\n * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]\n */\n var sortBy = baseRest(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var length = iteratees.length;\n if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n iteratees = [];\n } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n iteratees = [iteratees[0]];\n }\n return baseOrderBy(collection, baseFlatten(iteratees, 1), []);\n });\n\n /*------------------------------------------------------------------------*/\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 */\n var now = ctxNow || function() {\n return root.Date.now();\n };\n\n /*------------------------------------------------------------------------*/\n\n /**\n * The opposite of `_.before`; this method creates a function that invokes\n * `func` once it's called `n` or more times.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {number} n The number of calls before `func` is invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var saves = ['profile', 'settings'];\n *\n * var done = _.after(saves.length, function() {\n * console.log('done saving!');\n * });\n *\n * _.forEach(saves, function(type) {\n * asyncSave({ 'type': type, 'complete': done });\n * });\n * // => Logs 'done saving!' after the two async saves have completed.\n */\n function after(n, func) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n n = toInteger(n);\n return function() {\n if (--n < 1) {\n return func.apply(this, arguments);\n }\n };\n }\n\n /**\n * Creates a function that invokes `func`, with up to `n` arguments,\n * ignoring any additional arguments.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @param {number} [n=func.length] The arity cap.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new capped function.\n * @example\n *\n * _.map(['6', '8', '10'], _.ary(parseInt, 1));\n * // => [6, 8, 10]\n */\n function ary(func, n, guard) {\n n = guard ? undefined : n;\n n = (func && n == null) ? func.length : n;\n return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);\n }\n\n /**\n * Creates a function that invokes `func`, with the `this` binding and arguments\n * of the created function, while it's called less than `n` times. Subsequent\n * calls to the created function return the result of the last `func` invocation.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {number} n The number of calls at which `func` is no longer invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * jQuery(element).on('click', _.before(5, addContactToList));\n * // => Allows adding up to 4 contacts to the list.\n */\n function before(n, func) {\n var result;\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n n = toInteger(n);\n return function() {\n if (--n > 0) {\n result = func.apply(this, arguments);\n }\n if (n <= 1) {\n func = undefined;\n }\n return result;\n };\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of `thisArg`\n * and `partials` prepended to the arguments it receives.\n *\n * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for partially applied arguments.\n *\n * **Note:** Unlike native `Function#bind`, this method doesn't set the \"length\"\n * property of bound functions.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * function greet(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n *\n * var object = { 'user': 'fred' };\n *\n * var bound = _.bind(greet, object, 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * // Bound with placeholders.\n * var bound = _.bind(greet, object, _, '!');\n * bound('hi');\n * // => 'hi fred!'\n */\n var bind = baseRest(function(func, thisArg, partials) {\n var bitmask = WRAP_BIND_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, getHolder(bind));\n bitmask |= WRAP_PARTIAL_FLAG;\n }\n return createWrap(func, bitmask, thisArg, partials, holders);\n });\n\n /**\n * Creates a function that invokes the method at `object[key]` with `partials`\n * prepended to the arguments it receives.\n *\n * This method differs from `_.bind` by allowing bound functions to reference\n * methods that may be redefined or don't yet exist. See\n * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)\n * for more details.\n *\n * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Function\n * @param {Object} object The object to invoke the method on.\n * @param {string} key The key of the method.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var object = {\n * 'user': 'fred',\n * 'greet': function(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n * };\n *\n * var bound = _.bindKey(object, 'greet', 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * object.greet = function(greeting, punctuation) {\n * return greeting + 'ya ' + this.user + punctuation;\n * };\n *\n * bound('!');\n * // => 'hiya fred!'\n *\n * // Bound with placeholders.\n * var bound = _.bindKey(object, 'greet', _, '!');\n * bound('hi');\n * // => 'hiya fred!'\n */\n var bindKey = baseRest(function(object, key, partials) {\n var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, getHolder(bindKey));\n bitmask |= WRAP_PARTIAL_FLAG;\n }\n return createWrap(key, bitmask, object, partials, holders);\n });\n\n /**\n * Creates a function that accepts arguments of `func` and either invokes\n * `func` returning its result, if at least `arity` number of arguments have\n * been provided, or returns a function that accepts the remaining `func`\n * arguments, and so on. The arity of `func` may be specified if `func.length`\n * is not sufficient.\n *\n * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for provided arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curry(abc);\n *\n * curried(1)(2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // Curried with placeholders.\n * curried(1)(_, 3)(2);\n * // => [1, 2, 3]\n */\n function curry(func, arity, guard) {\n arity = guard ? undefined : arity;\n var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\n result.placeholder = curry.placeholder;\n return result;\n }\n\n /**\n * This method is like `_.curry` except that arguments are applied to `func`\n * in the manner of `_.partialRight` instead of `_.partial`.\n *\n * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for provided arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curryRight(abc);\n *\n * curried(3)(2)(1);\n * // => [1, 2, 3]\n *\n * curried(2, 3)(1);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // Curried with placeholders.\n * curried(3)(1, _)(2);\n * // => [1, 2, 3]\n */\n function curryRight(func, arity, guard) {\n arity = guard ? undefined : arity;\n var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\n result.placeholder = curryRight.placeholder;\n return result;\n }\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 */\n function 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\n /**\n * Defers invoking the `func` until the current call stack has cleared. Any\n * additional arguments are provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to defer.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.defer(function(text) {\n * console.log(text);\n * }, 'deferred');\n * // => Logs 'deferred' after one millisecond.\n */\n var defer = baseRest(function(func, args) {\n return baseDelay(func, 1, args);\n });\n\n /**\n * Invokes `func` after `wait` milliseconds. Any additional arguments are\n * provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.delay(function(text) {\n * console.log(text);\n * }, 1000, 'later');\n * // => Logs 'later' after one second.\n */\n var delay = baseRest(function(func, wait, args) {\n return baseDelay(func, toNumber(wait) || 0, args);\n });\n\n /**\n * Creates a function that invokes `func` with arguments reversed.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to flip arguments for.\n * @returns {Function} Returns the new flipped function.\n * @example\n *\n * var flipped = _.flip(function() {\n * return _.toArray(arguments);\n * });\n *\n * flipped('a', 'b', 'c', 'd');\n * // => ['d', 'c', 'b', 'a']\n */\n function flip(func) {\n return createWrap(func, WRAP_FLIP_FLAG);\n }\n\n /**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\n function memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n }\n\n // Expose `MapCache`.\n memoize.Cache = MapCache;\n\n /**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new negated function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\n function negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function() {\n var args = arguments;\n switch (args.length) {\n case 0: return !predicate.call(this);\n case 1: return !predicate.call(this, args[0]);\n case 2: return !predicate.call(this, args[0], args[1]);\n case 3: return !predicate.call(this, args[0], args[1], args[2]);\n }\n return !predicate.apply(this, args);\n };\n }\n\n /**\n * Creates a function that is restricted to invoking `func` once. Repeat calls\n * to the function return the value of the first invocation. The `func` is\n * invoked with the `this` binding and arguments of the created function.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var initialize = _.once(createApplication);\n * initialize();\n * initialize();\n * // => `createApplication` is invoked once\n */\n function once(func) {\n return before(2, func);\n }\n\n /**\n * Creates a function that invokes `func` with its arguments transformed.\n *\n * @static\n * @since 4.0.0\n * @memberOf _\n * @category Function\n * @param {Function} func The function to wrap.\n * @param {...(Function|Function[])} [transforms=[_.identity]]\n * The argument transforms.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function doubled(n) {\n * return n * 2;\n * }\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var func = _.overArgs(function(x, y) {\n * return [x, y];\n * }, [square, doubled]);\n *\n * func(9, 3);\n * // => [81, 6]\n *\n * func(10, 5);\n * // => [100, 10]\n */\n var overArgs = castRest(function(func, transforms) {\n transforms = (transforms.length == 1 && isArray(transforms[0]))\n ? arrayMap(transforms[0], baseUnary(getIteratee()))\n : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));\n\n var funcsLength = transforms.length;\n return baseRest(function(args) {\n var index = -1,\n length = nativeMin(args.length, funcsLength);\n\n while (++index < length) {\n args[index] = transforms[index].call(this, args[index]);\n }\n return apply(func, this, args);\n });\n });\n\n /**\n * Creates a function that invokes `func` with `partials` prepended to the\n * arguments it receives. This method is like `_.bind` except it does **not**\n * alter the `this` binding.\n *\n * The `_.partial.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @since 0.2.0\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * function greet(greeting, name) {\n * return greeting + ' ' + name;\n * }\n *\n * var sayHelloTo = _.partial(greet, 'hello');\n * sayHelloTo('fred');\n * // => 'hello fred'\n *\n * // Partially applied with placeholders.\n * var greetFred = _.partial(greet, _, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n */\n var partial = baseRest(function(func, partials) {\n var holders = replaceHolders(partials, getHolder(partial));\n return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);\n });\n\n /**\n * This method is like `_.partial` except that partially applied arguments\n * are appended to the arguments it receives.\n *\n * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * function greet(greeting, name) {\n * return greeting + ' ' + name;\n * }\n *\n * var greetFred = _.partialRight(greet, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n *\n * // Partially applied with placeholders.\n * var sayHelloTo = _.partialRight(greet, 'hello', _);\n * sayHelloTo('fred');\n * // => 'hello fred'\n */\n var partialRight = baseRest(function(func, partials) {\n var holders = replaceHolders(partials, getHolder(partialRight));\n return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);\n });\n\n /**\n * Creates a function that invokes `func` with arguments arranged according\n * to the specified `indexes` where the argument value at the first index is\n * provided as the first argument, the argument value at the second index is\n * provided as the second argument, and so on.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to rearrange arguments for.\n * @param {...(number|number[])} indexes The arranged argument indexes.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var rearged = _.rearg(function(a, b, c) {\n * return [a, b, c];\n * }, [2, 0, 1]);\n *\n * rearged('b', 'c', 'a')\n * // => ['a', 'b', 'c']\n */\n var rearg = flatRest(function(func, indexes) {\n return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);\n });\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as\n * an array.\n *\n * **Note:** This method is based on the\n * [rest parameter](https://mdn.io/rest_parameters).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.rest(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\n function rest(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = start === undefined ? start : toInteger(start);\n return baseRest(func, start);\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * create function and an array of arguments much like\n * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).\n *\n * **Note:** This method is based on the\n * [spread operator](https://mdn.io/spread_operator).\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Function\n * @param {Function} func The function to spread arguments over.\n * @param {number} [start=0] The start position of the spread.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.spread(function(who, what) {\n * return who + ' says ' + what;\n * });\n *\n * say(['fred', 'hello']);\n * // => 'fred says hello'\n *\n * var numbers = Promise.all([\n * Promise.resolve(40),\n * Promise.resolve(36)\n * ]);\n *\n * numbers.then(_.spread(function(x, y) {\n * return x + y;\n * }));\n * // => a Promise of 76\n */\n function spread(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = start == null ? 0 : nativeMax(toInteger(start), 0);\n return baseRest(function(args) {\n var array = args[start],\n otherArgs = castSlice(args, 0, start);\n\n if (array) {\n arrayPush(otherArgs, array);\n }\n return apply(func, this, otherArgs);\n });\n }\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 */\n function 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\n /**\n * Creates a function that accepts up to one argument, ignoring any\n * additional arguments.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n * @example\n *\n * _.map(['6', '8', '10'], _.unary(parseInt));\n * // => [6, 8, 10]\n */\n function unary(func) {\n return ary(func, 1);\n }\n\n /**\n * Creates a function that provides `value` to `wrapper` as its first\n * argument. Any additional arguments provided to the function are appended\n * to those provided to the `wrapper`. The wrapper is invoked with the `this`\n * binding of the created function.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {*} value The value to wrap.\n * @param {Function} [wrapper=identity] The wrapper function.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var p = _.wrap(_.escape, function(func, text) {\n * return '

' + func(text) + '

';\n * });\n *\n * p('fred, barney, & pebbles');\n * // => '

fred, barney, & pebbles

'\n */\n function wrap(value, wrapper) {\n return partial(castFunction(wrapper), value);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Casts `value` as an array if it's not one.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Lang\n * @param {*} value The value to inspect.\n * @returns {Array} Returns the cast array.\n * @example\n *\n * _.castArray(1);\n * // => [1]\n *\n * _.castArray({ 'a': 1 });\n * // => [{ 'a': 1 }]\n *\n * _.castArray('abc');\n * // => ['abc']\n *\n * _.castArray(null);\n * // => [null]\n *\n * _.castArray(undefined);\n * // => [undefined]\n *\n * _.castArray();\n * // => []\n *\n * var array = [1, 2, 3];\n * console.log(_.castArray(array) === array);\n * // => true\n */\n function castArray() {\n if (!arguments.length) {\n return [];\n }\n var value = arguments[0];\n return isArray(value) ? value : [value];\n }\n\n /**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\n function clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG);\n }\n\n /**\n * This method is like `_.clone` except that it accepts `customizer` which\n * is invoked to produce the cloned value. If `customizer` returns `undefined`,\n * cloning is handled by the method instead. The `customizer` is invoked with\n * up to four arguments; (value [, index|key, object, stack]).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to clone.\n * @param {Function} [customizer] The function to customize cloning.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeepWith\n * @example\n *\n * function customizer(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(false);\n * }\n * }\n *\n * var el = _.cloneWith(document.body, customizer);\n *\n * console.log(el === document.body);\n * // => false\n * console.log(el.nodeName);\n * // => 'BODY'\n * console.log(el.childNodes.length);\n * // => 0\n */\n function cloneWith(value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);\n }\n\n /**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\n function cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n }\n\n /**\n * This method is like `_.cloneWith` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @param {Function} [customizer] The function to customize cloning.\n * @returns {*} Returns the deep cloned value.\n * @see _.cloneWith\n * @example\n *\n * function customizer(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(true);\n * }\n * }\n *\n * var el = _.cloneDeepWith(document.body, customizer);\n *\n * console.log(el === document.body);\n * // => false\n * console.log(el.nodeName);\n * // => 'BODY'\n * console.log(el.childNodes.length);\n * // => 20\n */\n function cloneDeepWith(value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);\n }\n\n /**\n * Checks if `object` conforms to `source` by invoking the predicate\n * properties of `source` with the corresponding property values of `object`.\n *\n * **Note:** This method is equivalent to `_.conforms` when `source` is\n * partially applied.\n *\n * @static\n * @memberOf _\n * @since 4.14.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property predicates to conform to.\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n *\n * _.conformsTo(object, { 'b': function(n) { return n > 1; } });\n * // => true\n *\n * _.conformsTo(object, { 'b': function(n) { return n > 2; } });\n * // => false\n */\n function conformsTo(object, source) {\n return source == null || baseConformsTo(object, source, keys(source));\n }\n\n /**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\n function eq(value, other) {\n return value === other || (value !== value && other !== other);\n }\n\n /**\n * Checks if `value` is greater than `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n * @see _.lt\n * @example\n *\n * _.gt(3, 1);\n * // => true\n *\n * _.gt(3, 3);\n * // => false\n *\n * _.gt(1, 3);\n * // => false\n */\n var gt = createRelationalOperation(baseGt);\n\n /**\n * Checks if `value` is greater than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than or equal to\n * `other`, else `false`.\n * @see _.lte\n * @example\n *\n * _.gte(3, 1);\n * // => true\n *\n * _.gte(3, 3);\n * // => true\n *\n * _.gte(1, 3);\n * // => false\n */\n var gte = createRelationalOperation(function(value, other) {\n return value >= other;\n });\n\n /**\n * Checks if `value` is likely an `arguments` object.\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 `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\n var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n };\n\n /**\n * Checks if `value` is classified as an `Array` object.\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 array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\n var isArray = Array.isArray;\n\n /**\n * Checks if `value` is classified as an `ArrayBuffer` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.\n * @example\n *\n * _.isArrayBuffer(new ArrayBuffer(2));\n * // => true\n *\n * _.isArrayBuffer(new Array(2));\n * // => false\n */\n var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;\n\n /**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\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 array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\n function isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n }\n\n /**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an 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 an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\n function isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n }\n\n /**\n * Checks if `value` is classified as a boolean primitive or object.\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 a boolean, else `false`.\n * @example\n *\n * _.isBoolean(false);\n * // => true\n *\n * _.isBoolean(null);\n * // => false\n */\n function isBoolean(value) {\n return value === true || value === false ||\n (isObjectLike(value) && baseGetTag(value) == boolTag);\n }\n\n /**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\n var isBuffer = nativeIsBuffer || stubFalse;\n\n /**\n * Checks if `value` is classified as a `Date` object.\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 a date object, else `false`.\n * @example\n *\n * _.isDate(new Date);\n * // => true\n *\n * _.isDate('Mon April 23 2012');\n * // => false\n */\n var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;\n\n /**\n * Checks if `value` is likely a DOM element.\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 a DOM element, else `false`.\n * @example\n *\n * _.isElement(document.body);\n * // => true\n *\n * _.isElement('');\n * // => false\n */\n function isElement(value) {\n return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);\n }\n\n /**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\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 empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\n function isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) &&\n (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n return !value.length;\n }\n var tag = getTag(value);\n if (tag == mapTag || tag == setTag) {\n return !value.size;\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\n function isEqual(value, other) {\n return baseIsEqual(value, other);\n }\n\n /**\n * This method is like `_.isEqual` except that it accepts `customizer` which\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n * are handled by the method instead. The `customizer` is invoked with up to\n * six arguments: (objValue, othValue [, index|key, object, other, stack]).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * function isGreeting(value) {\n * return /^h(?:i|ello)$/.test(value);\n * }\n *\n * function customizer(objValue, othValue) {\n * if (isGreeting(objValue) && isGreeting(othValue)) {\n * return true;\n * }\n * }\n *\n * var array = ['hello', 'goodbye'];\n * var other = ['hi', 'goodbye'];\n *\n * _.isEqualWith(array, other, customizer);\n * // => true\n */\n function isEqualWith(value, other, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n var result = customizer ? customizer(value, other) : undefined;\n return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;\n }\n\n /**\n * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an error object, else `false`.\n * @example\n *\n * _.isError(new Error);\n * // => true\n *\n * _.isError(Error);\n * // => false\n */\n function isError(value) {\n if (!isObjectLike(value)) {\n return false;\n }\n var tag = baseGetTag(value);\n return tag == errorTag || tag == domExcTag ||\n (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));\n }\n\n /**\n * Checks if `value` is a finite primitive number.\n *\n * **Note:** This method is based on\n * [`Number.isFinite`](https://mdn.io/Number/isFinite).\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 a finite number, else `false`.\n * @example\n *\n * _.isFinite(3);\n * // => true\n *\n * _.isFinite(Number.MIN_VALUE);\n * // => true\n *\n * _.isFinite(Infinity);\n * // => false\n *\n * _.isFinite('3');\n * // => false\n */\n function isFinite(value) {\n return typeof value == 'number' && nativeIsFinite(value);\n }\n\n /**\n * Checks if `value` is classified as a `Function` object.\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 a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\n function isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n }\n\n /**\n * Checks if `value` is an integer.\n *\n * **Note:** This method is based on\n * [`Number.isInteger`](https://mdn.io/Number/isInteger).\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 an integer, else `false`.\n * @example\n *\n * _.isInteger(3);\n * // => true\n *\n * _.isInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isInteger(Infinity);\n * // => false\n *\n * _.isInteger('3');\n * // => false\n */\n function isInteger(value) {\n return typeof value == 'number' && value == toInteger(value);\n }\n\n /**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\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 valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\n function isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n }\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 */\n function isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n }\n\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 */\n function isObjectLike(value) {\n return value != null && typeof value == 'object';\n }\n\n /**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\n var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\n /**\n * Performs a partial deep comparison between `object` and `source` to\n * determine if `object` contains equivalent property values.\n *\n * **Note:** This method is equivalent to `_.matches` when `source` is\n * partially applied.\n *\n * Partial comparisons will match empty array and empty object `source`\n * values against any array or object value, respectively. See `_.isEqual`\n * for a list of supported value comparisons.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n *\n * _.isMatch(object, { 'b': 2 });\n * // => true\n *\n * _.isMatch(object, { 'b': 1 });\n * // => false\n */\n function isMatch(object, source) {\n return object === source || baseIsMatch(object, source, getMatchData(source));\n }\n\n /**\n * This method is like `_.isMatch` except that it accepts `customizer` which\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n * are handled by the method instead. The `customizer` is invoked with five\n * arguments: (objValue, srcValue, index|key, object, source).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * function isGreeting(value) {\n * return /^h(?:i|ello)$/.test(value);\n * }\n *\n * function customizer(objValue, srcValue) {\n * if (isGreeting(objValue) && isGreeting(srcValue)) {\n * return true;\n * }\n * }\n *\n * var object = { 'greeting': 'hello' };\n * var source = { 'greeting': 'hi' };\n *\n * _.isMatchWith(object, source, customizer);\n * // => true\n */\n function isMatchWith(object, source, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseIsMatch(object, source, getMatchData(source), customizer);\n }\n\n /**\n * Checks if `value` is `NaN`.\n *\n * **Note:** This method is based on\n * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as\n * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for\n * `undefined` and other non-number values.\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 `NaN`, else `false`.\n * @example\n *\n * _.isNaN(NaN);\n * // => true\n *\n * _.isNaN(new Number(NaN));\n * // => true\n *\n * isNaN(undefined);\n * // => true\n *\n * _.isNaN(undefined);\n * // => false\n */\n function isNaN(value) {\n // An `NaN` primitive is the only value that is not equal to itself.\n // Perform the `toStringTag` check first to avoid errors with some\n // ActiveX objects in IE.\n return isNumber(value) && value != +value;\n }\n\n /**\n * Checks if `value` is a pristine native function.\n *\n * **Note:** This method can't reliably detect native functions in the presence\n * of the core-js package because core-js circumvents this kind of detection.\n * Despite multiple requests, the core-js maintainer has made it clear: any\n * attempt to fix the detection will be obstructed. As a result, we're left\n * with little choice but to throw an error. Unfortunately, this also affects\n * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),\n * which rely on core-js.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\n function isNative(value) {\n if (isMaskable(value)) {\n throw new Error(CORE_ERROR_TEXT);\n }\n return baseIsNative(value);\n }\n\n /**\n * Checks if `value` is `null`.\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 `null`, else `false`.\n * @example\n *\n * _.isNull(null);\n * // => true\n *\n * _.isNull(void 0);\n * // => false\n */\n function isNull(value) {\n return value === null;\n }\n\n /**\n * Checks if `value` is `null` or `undefined`.\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 nullish, else `false`.\n * @example\n *\n * _.isNil(null);\n * // => true\n *\n * _.isNil(void 0);\n * // => true\n *\n * _.isNil(NaN);\n * // => false\n */\n function isNil(value) {\n return value == null;\n }\n\n /**\n * Checks if `value` is classified as a `Number` primitive or object.\n *\n * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are\n * classified as numbers, use the `_.isFinite` method.\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 a number, else `false`.\n * @example\n *\n * _.isNumber(3);\n * // => true\n *\n * _.isNumber(Number.MIN_VALUE);\n * // => true\n *\n * _.isNumber(Infinity);\n * // => true\n *\n * _.isNumber('3');\n * // => false\n */\n function isNumber(value) {\n return typeof value == 'number' ||\n (isObjectLike(value) && baseGetTag(value) == numberTag);\n }\n\n /**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\n function isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n }\n\n /**\n * Checks if `value` is classified as a `RegExp` object.\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 a regexp, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\n var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;\n\n /**\n * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754\n * double precision number which isn't the result of a rounded unsafe integer.\n *\n * **Note:** This method is based on\n * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).\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 safe integer, else `false`.\n * @example\n *\n * _.isSafeInteger(3);\n * // => true\n *\n * _.isSafeInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isSafeInteger(Infinity);\n * // => false\n *\n * _.isSafeInteger('3');\n * // => false\n */\n function isSafeInteger(value) {\n return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\n var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\n /**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\n function isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n }\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 */\n function isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n }\n\n /**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\n var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n /**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\n function isUndefined(value) {\n return value === undefined;\n }\n\n /**\n * Checks if `value` is classified as a `WeakMap` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.\n * @example\n *\n * _.isWeakMap(new WeakMap);\n * // => true\n *\n * _.isWeakMap(new Map);\n * // => false\n */\n function isWeakMap(value) {\n return isObjectLike(value) && getTag(value) == weakMapTag;\n }\n\n /**\n * Checks if `value` is classified as a `WeakSet` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.\n * @example\n *\n * _.isWeakSet(new WeakSet);\n * // => true\n *\n * _.isWeakSet(new Set);\n * // => false\n */\n function isWeakSet(value) {\n return isObjectLike(value) && baseGetTag(value) == weakSetTag;\n }\n\n /**\n * Checks if `value` is less than `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n * @see _.gt\n * @example\n *\n * _.lt(1, 3);\n * // => true\n *\n * _.lt(3, 3);\n * // => false\n *\n * _.lt(3, 1);\n * // => false\n */\n var lt = createRelationalOperation(baseLt);\n\n /**\n * Checks if `value` is less than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than or equal to\n * `other`, else `false`.\n * @see _.gte\n * @example\n *\n * _.lte(1, 3);\n * // => true\n *\n * _.lte(3, 3);\n * // => true\n *\n * _.lte(3, 1);\n * // => false\n */\n var lte = createRelationalOperation(function(value, other) {\n return value <= other;\n });\n\n /**\n * Converts `value` to an array.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Array} Returns the converted array.\n * @example\n *\n * _.toArray({ 'a': 1, 'b': 2 });\n * // => [1, 2]\n *\n * _.toArray('abc');\n * // => ['a', 'b', 'c']\n *\n * _.toArray(1);\n * // => []\n *\n * _.toArray(null);\n * // => []\n */\n function toArray(value) {\n if (!value) {\n return [];\n }\n if (isArrayLike(value)) {\n return isString(value) ? stringToArray(value) : copyArray(value);\n }\n if (symIterator && value[symIterator]) {\n return iteratorToArray(value[symIterator]());\n }\n var tag = getTag(value),\n func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);\n\n return func(value);\n }\n\n /**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\n function toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n }\n\n /**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\n function toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n }\n\n /**\n * Converts `value` to an integer suitable for use as the length of an\n * array-like object.\n *\n * **Note:** This method is based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toLength(3.2);\n * // => 3\n *\n * _.toLength(Number.MIN_VALUE);\n * // => 0\n *\n * _.toLength(Infinity);\n * // => 4294967295\n *\n * _.toLength('3.2');\n * // => 3\n */\n function toLength(value) {\n return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;\n }\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 */\n function 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\n /**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\n function toPlainObject(value) {\n return copyObject(value, keysIn(value));\n }\n\n /**\n * Converts `value` to a safe integer. A safe integer can be compared and\n * represented correctly.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toSafeInteger(3.2);\n * // => 3\n *\n * _.toSafeInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toSafeInteger(Infinity);\n * // => 9007199254740991\n *\n * _.toSafeInteger('3.2');\n * // => 3\n */\n function toSafeInteger(value) {\n return value\n ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)\n : (value === 0 ? value : 0);\n }\n\n /**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\n function toString(value) {\n return value == null ? '' : baseToString(value);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\n var assign = createAssigner(function(object, source) {\n if (isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object);\n return;\n }\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n assignValue(object, key, source[key]);\n }\n }\n });\n\n /**\n * This method is like `_.assign` except that it iterates over own and\n * inherited source properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extend\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assign\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assignIn({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }\n */\n var assignIn = createAssigner(function(object, source) {\n copyObject(source, keysIn(source), object);\n });\n\n /**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n });\n\n /**\n * This method is like `_.assign` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignInWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var assignWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keys(source), object, customizer);\n });\n\n /**\n * Creates an array of values corresponding to `paths` of `object`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Array} Returns the picked values.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n *\n * _.at(object, ['a[0].b.c', 'a[1]']);\n * // => [3, 4]\n */\n var at = flatRest(baseAt);\n\n /**\n * Creates an object that inherits from the `prototype` object. If a\n * `properties` object is given, its own enumerable string keyed properties\n * are assigned to the created object.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Object\n * @param {Object} prototype The object to inherit from.\n * @param {Object} [properties] The properties to assign to the object.\n * @returns {Object} Returns the new object.\n * @example\n *\n * function Shape() {\n * this.x = 0;\n * this.y = 0;\n * }\n *\n * function Circle() {\n * Shape.call(this);\n * }\n *\n * Circle.prototype = _.create(Shape.prototype, {\n * 'constructor': Circle\n * });\n *\n * var circle = new Circle;\n * circle instanceof Circle;\n * // => true\n *\n * circle instanceof Shape;\n * // => true\n */\n function create(prototype, properties) {\n var result = baseCreate(prototype);\n return properties == null ? result : baseAssign(result, properties);\n }\n\n /**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var defaults = baseRest(function(object, sources) {\n object = Object(object);\n\n var index = -1;\n var length = sources.length;\n var guard = length > 2 ? sources[2] : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n length = 1;\n }\n\n while (++index < length) {\n var source = sources[index];\n var props = keysIn(source);\n var propsIndex = -1;\n var propsLength = props.length;\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex];\n var value = object[key];\n\n if (value === undefined ||\n (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n object[key] = source[key];\n }\n }\n }\n\n return object;\n });\n\n /**\n * This method is like `_.defaults` except that it recursively assigns\n * default properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaults\n * @example\n *\n * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });\n * // => { 'a': { 'b': 2, 'c': 3 } }\n */\n var defaultsDeep = baseRest(function(args) {\n args.push(undefined, customDefaultsMerge);\n return apply(mergeWith, undefined, args);\n });\n\n /**\n * This method is like `_.find` except that it returns the key of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {string|undefined} Returns the key of the matched element,\n * else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findKey(users, function(o) { return o.age < 40; });\n * // => 'barney' (iteration order is not guaranteed)\n *\n * // The `_.matches` iteratee shorthand.\n * _.findKey(users, { 'age': 1, 'active': true });\n * // => 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findKey(users, ['active', false]);\n * // => 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.findKey(users, 'active');\n * // => 'barney'\n */\n function findKey(object, predicate) {\n return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);\n }\n\n /**\n * This method is like `_.findKey` except that it iterates over elements of\n * a collection in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {string|undefined} Returns the key of the matched element,\n * else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findLastKey(users, function(o) { return o.age < 40; });\n * // => returns 'pebbles' assuming `_.findKey` returns 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.findLastKey(users, { 'age': 36, 'active': true });\n * // => 'barney'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findLastKey(users, ['active', false]);\n * // => 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.findLastKey(users, 'active');\n * // => 'pebbles'\n */\n function findLastKey(object, predicate) {\n return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);\n }\n\n /**\n * Iterates over own and inherited enumerable string keyed properties of an\n * object and invokes `iteratee` for each property. The iteratee is invoked\n * with three arguments: (value, key, object). Iteratee functions may exit\n * iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forInRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forIn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).\n */\n function forIn(object, iteratee) {\n return object == null\n ? object\n : baseFor(object, getIteratee(iteratee, 3), keysIn);\n }\n\n /**\n * This method is like `_.forIn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forInRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.\n */\n function forInRight(object, iteratee) {\n return object == null\n ? object\n : baseForRight(object, getIteratee(iteratee, 3), keysIn);\n }\n\n /**\n * Iterates over own enumerable string keyed properties of an object and\n * invokes `iteratee` for each property. The iteratee is invoked with three\n * arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwnRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forOwn(object, iteratee) {\n return object && baseForOwn(object, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.forOwn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwnRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.\n */\n function forOwnRight(object, iteratee) {\n return object && baseForOwnRight(object, getIteratee(iteratee, 3));\n }\n\n /**\n * Creates an array of function property names from own enumerable properties\n * of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the function names.\n * @see _.functionsIn\n * @example\n *\n * function Foo() {\n * this.a = _.constant('a');\n * this.b = _.constant('b');\n * }\n *\n * Foo.prototype.c = _.constant('c');\n *\n * _.functions(new Foo);\n * // => ['a', 'b']\n */\n function functions(object) {\n return object == null ? [] : baseFunctions(object, keys(object));\n }\n\n /**\n * Creates an array of function property names from own and inherited\n * enumerable properties of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the function names.\n * @see _.functions\n * @example\n *\n * function Foo() {\n * this.a = _.constant('a');\n * this.b = _.constant('b');\n * }\n *\n * Foo.prototype.c = _.constant('c');\n *\n * _.functionsIn(new Foo);\n * // => ['a', 'b', 'c']\n */\n function functionsIn(object) {\n return object == null ? [] : baseFunctions(object, keysIn(object));\n }\n\n /**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\n function get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n }\n\n /**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\n function has(object, path) {\n return object != null && hasPath(object, path, baseHas);\n }\n\n /**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\n function hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n }\n\n /**\n * Creates an object composed of the inverted keys and values of `object`.\n * If `object` contains duplicate values, subsequent values overwrite\n * property assignments of previous values.\n *\n * @static\n * @memberOf _\n * @since 0.7.0\n * @category Object\n * @param {Object} object The object to invert.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invert(object);\n * // => { '1': 'c', '2': 'b' }\n */\n var invert = createInverter(function(result, value, key) {\n if (value != null &&\n typeof value.toString != 'function') {\n value = nativeObjectToString.call(value);\n }\n\n result[value] = key;\n }, constant(identity));\n\n /**\n * This method is like `_.invert` except that the inverted object is generated\n * from the results of running each element of `object` thru `iteratee`. The\n * corresponding inverted value of each inverted key is an array of keys\n * responsible for generating the inverted value. The iteratee is invoked\n * with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.1.0\n * @category Object\n * @param {Object} object The object to invert.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invertBy(object);\n * // => { '1': ['a', 'c'], '2': ['b'] }\n *\n * _.invertBy(object, function(value) {\n * return 'group' + value;\n * });\n * // => { 'group1': ['a', 'c'], 'group2': ['b'] }\n */\n var invertBy = createInverter(function(result, value, key) {\n if (value != null &&\n typeof value.toString != 'function') {\n value = nativeObjectToString.call(value);\n }\n\n if (hasOwnProperty.call(result, value)) {\n result[value].push(key);\n } else {\n result[value] = [key];\n }\n }, getIteratee);\n\n /**\n * Invokes the method at `path` of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };\n *\n * _.invoke(object, 'a[0].b.c.slice', 1, 3);\n * // => [2, 3]\n */\n var invoke = baseRest(baseInvoke);\n\n /**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\n function keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n }\n\n /**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\n function keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n }\n\n /**\n * The opposite of `_.mapValues`; this method creates an object with the\n * same values as `object` and keys generated by running each own enumerable\n * string keyed property of `object` thru `iteratee`. The iteratee is invoked\n * with three arguments: (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapValues\n * @example\n *\n * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\n * return key + value;\n * });\n * // => { 'a1': 1, 'b2': 2 }\n */\n function mapKeys(object, iteratee) {\n var result = {};\n iteratee = getIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, iteratee(value, key, object), value);\n });\n return result;\n }\n\n /**\n * Creates an object with the same keys as `object` and values generated\n * by running each own enumerable string keyed property of `object` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapKeys\n * @example\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * _.mapValues(users, function(o) { return o.age; });\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n *\n * // The `_.property` iteratee shorthand.\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\n function mapValues(object, iteratee) {\n var result = {};\n iteratee = getIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, key, iteratee(value, key, object));\n });\n return result;\n }\n\n /**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\n var merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n });\n\n /**\n * This method is like `_.merge` except that it accepts `customizer` which\n * is invoked to produce the merged values of the destination and source\n * properties. If `customizer` returns `undefined`, merging is handled by the\n * method instead. The `customizer` is invoked with six arguments:\n * (objValue, srcValue, key, object, source, stack).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function customizer(objValue, srcValue) {\n * if (_.isArray(objValue)) {\n * return objValue.concat(srcValue);\n * }\n * }\n *\n * var object = { 'a': [1], 'b': [2] };\n * var other = { 'a': [3], 'b': [4] };\n *\n * _.mergeWith(object, other, customizer);\n * // => { 'a': [1, 3], 'b': [2, 4] }\n */\n var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {\n baseMerge(object, source, srcIndex, customizer);\n });\n\n /**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable property paths of `object` that are not omitted.\n *\n * **Note:** This method is considerably slower than `_.pick`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to omit.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omit(object, ['a', 'c']);\n * // => { 'b': '2' }\n */\n var omit = flatRest(function(object, paths) {\n var result = {};\n if (object == null) {\n return result;\n }\n var isDeep = false;\n paths = arrayMap(paths, function(path) {\n path = castPath(path, object);\n isDeep || (isDeep = path.length > 1);\n return path;\n });\n copyObject(object, getAllKeysIn(object), result);\n if (isDeep) {\n result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);\n }\n var length = paths.length;\n while (length--) {\n baseUnset(result, paths[length]);\n }\n return result;\n });\n\n /**\n * The opposite of `_.pickBy`; this method creates an object composed of\n * the own and inherited enumerable string keyed properties of `object` that\n * `predicate` doesn't return truthy for. The predicate is invoked with two\n * arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omitBy(object, _.isNumber);\n * // => { 'b': '2' }\n */\n function omitBy(object, predicate) {\n return pickBy(object, negate(getIteratee(predicate)));\n }\n\n /**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\n var pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n });\n\n /**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pickBy(object, _.isNumber);\n * // => { 'a': 1, 'c': 3 }\n */\n function pickBy(object, predicate) {\n if (object == null) {\n return {};\n }\n var props = arrayMap(getAllKeysIn(object), function(prop) {\n return [prop];\n });\n predicate = getIteratee(predicate);\n return basePickBy(object, props, function(value, path) {\n return predicate(value, path[0]);\n });\n }\n\n /**\n * This method is like `_.get` except that if the resolved value is a\n * function it's invoked with the `this` binding of its parent object and\n * its result is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to resolve.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\n *\n * _.result(object, 'a[0].b.c1');\n * // => 3\n *\n * _.result(object, 'a[0].b.c2');\n * // => 4\n *\n * _.result(object, 'a[0].b.c3', 'default');\n * // => 'default'\n *\n * _.result(object, 'a[0].b.c3', _.constant('default'));\n * // => 'default'\n */\n function result(object, path, defaultValue) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length;\n\n // Ensure the loop is entered when path is empty.\n if (!length) {\n length = 1;\n object = undefined;\n }\n while (++index < length) {\n var value = object == null ? undefined : object[toKey(path[index])];\n if (value === undefined) {\n index = length;\n value = defaultValue;\n }\n object = isFunction(value) ? value.call(object) : value;\n }\n return object;\n }\n\n /**\n * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,\n * it's created. Arrays are created for missing index properties while objects\n * are created for all other missing properties. Use `_.setWith` to customize\n * `path` creation.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.set(object, 'a[0].b.c', 4);\n * console.log(object.a[0].b.c);\n * // => 4\n *\n * _.set(object, ['x', '0', 'y', 'z'], 5);\n * console.log(object.x[0].y.z);\n * // => 5\n */\n function set(object, path, value) {\n return object == null ? object : baseSet(object, path, value);\n }\n\n /**\n * This method is like `_.set` except that it accepts `customizer` which is\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\n * path creation is handled by the method instead. The `customizer` is invoked\n * with three arguments: (nsValue, key, nsObject).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {};\n *\n * _.setWith(object, '[0][1]', 'a', Object);\n * // => { '0': { '1': 'a' } }\n */\n function setWith(object, path, value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return object == null ? object : baseSet(object, path, value, customizer);\n }\n\n /**\n * Creates an array of own enumerable string keyed-value pairs for `object`\n * which can be consumed by `_.fromPairs`. If `object` is a map or set, its\n * entries are returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias entries\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the key-value pairs.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.toPairs(new Foo);\n * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)\n */\n var toPairs = createToPairs(keys);\n\n /**\n * Creates an array of own and inherited enumerable string keyed-value pairs\n * for `object` which can be consumed by `_.fromPairs`. If `object` is a map\n * or set, its entries are returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias entriesIn\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the key-value pairs.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.toPairsIn(new Foo);\n * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)\n */\n var toPairsIn = createToPairs(keysIn);\n\n /**\n * An alternative to `_.reduce`; this method transforms `object` to a new\n * `accumulator` object which is the result of running each of its own\n * enumerable string keyed properties thru `iteratee`, with each invocation\n * potentially mutating the `accumulator` object. If `accumulator` is not\n * provided, a new object with the same `[[Prototype]]` will be used. The\n * iteratee is invoked with four arguments: (accumulator, value, key, object).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The custom accumulator value.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.transform([2, 3, 4], function(result, n) {\n * result.push(n *= n);\n * return n % 2 == 0;\n * }, []);\n * // => [4, 9]\n *\n * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] }\n */\n function transform(object, iteratee, accumulator) {\n var isArr = isArray(object),\n isArrLike = isArr || isBuffer(object) || isTypedArray(object);\n\n iteratee = getIteratee(iteratee, 4);\n if (accumulator == null) {\n var Ctor = object && object.constructor;\n if (isArrLike) {\n accumulator = isArr ? new Ctor : [];\n }\n else if (isObject(object)) {\n accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};\n }\n else {\n accumulator = {};\n }\n }\n (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {\n return iteratee(accumulator, value, index, object);\n });\n return accumulator;\n }\n\n /**\n * Removes the property at `path` of `object`.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 7 } }] };\n * _.unset(object, 'a[0].b.c');\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n *\n * _.unset(object, ['a', '0', 'b', 'c']);\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n */\n function unset(object, path) {\n return object == null ? true : baseUnset(object, path);\n }\n\n /**\n * This method is like `_.set` except that accepts `updater` to produce the\n * value to set. Use `_.updateWith` to customize `path` creation. The `updater`\n * is invoked with one argument: (value).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {Function} updater The function to produce the updated value.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.update(object, 'a[0].b.c', function(n) { return n * n; });\n * console.log(object.a[0].b.c);\n * // => 9\n *\n * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });\n * console.log(object.x[0].y.z);\n * // => 0\n */\n function update(object, path, updater) {\n return object == null ? object : baseUpdate(object, path, castFunction(updater));\n }\n\n /**\n * This method is like `_.update` except that it accepts `customizer` which is\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\n * path creation is handled by the method instead. The `customizer` is invoked\n * with three arguments: (nsValue, key, nsObject).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {Function} updater The function to produce the updated value.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {};\n *\n * _.updateWith(object, '[0][1]', _.constant('a'), Object);\n * // => { '0': { '1': 'a' } }\n */\n function updateWith(object, path, updater, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);\n }\n\n /**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\n function values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n }\n\n /**\n * Creates an array of the own and inherited enumerable string keyed property\n * values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.valuesIn(new Foo);\n * // => [1, 2, 3] (iteration order is not guaranteed)\n */\n function valuesIn(object) {\n return object == null ? [] : baseValues(object, keysIn(object));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Clamps `number` within the inclusive `lower` and `upper` bounds.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Number\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n * @example\n *\n * _.clamp(-10, -5, 5);\n * // => -5\n *\n * _.clamp(10, -5, 5);\n * // => 5\n */\n function clamp(number, lower, upper) {\n if (upper === undefined) {\n upper = lower;\n lower = undefined;\n }\n if (upper !== undefined) {\n upper = toNumber(upper);\n upper = upper === upper ? upper : 0;\n }\n if (lower !== undefined) {\n lower = toNumber(lower);\n lower = lower === lower ? lower : 0;\n }\n return baseClamp(toNumber(number), lower, upper);\n }\n\n /**\n * Checks if `n` is between `start` and up to, but not including, `end`. If\n * `end` is not specified, it's set to `start` with `start` then set to `0`.\n * If `start` is greater than `end` the params are swapped to support\n * negative ranges.\n *\n * @static\n * @memberOf _\n * @since 3.3.0\n * @category Number\n * @param {number} number The number to check.\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n * @see _.range, _.rangeRight\n * @example\n *\n * _.inRange(3, 2, 4);\n * // => true\n *\n * _.inRange(4, 8);\n * // => true\n *\n * _.inRange(4, 2);\n * // => false\n *\n * _.inRange(2, 2);\n * // => false\n *\n * _.inRange(1.2, 2);\n * // => true\n *\n * _.inRange(5.2, 4);\n * // => false\n *\n * _.inRange(-3, -2, -6);\n * // => true\n */\n function inRange(number, start, end) {\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n number = toNumber(number);\n return baseInRange(number, start, end);\n }\n\n /**\n * Produces a random number between the inclusive `lower` and `upper` bounds.\n * If only one argument is provided a number between `0` and the given number\n * is returned. If `floating` is `true`, or either `lower` or `upper` are\n * floats, a floating-point number is returned instead of an integer.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @memberOf _\n * @since 0.7.0\n * @category Number\n * @param {number} [lower=0] The lower bound.\n * @param {number} [upper=1] The upper bound.\n * @param {boolean} [floating] Specify returning a floating-point number.\n * @returns {number} Returns the random number.\n * @example\n *\n * _.random(0, 5);\n * // => an integer between 0 and 5\n *\n * _.random(5);\n * // => also an integer between 0 and 5\n *\n * _.random(5, true);\n * // => a floating-point number between 0 and 5\n *\n * _.random(1.2, 5.2);\n * // => a floating-point number between 1.2 and 5.2\n */\n function random(lower, upper, floating) {\n if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {\n upper = floating = undefined;\n }\n if (floating === undefined) {\n if (typeof upper == 'boolean') {\n floating = upper;\n upper = undefined;\n }\n else if (typeof lower == 'boolean') {\n floating = lower;\n lower = undefined;\n }\n }\n if (lower === undefined && upper === undefined) {\n lower = 0;\n upper = 1;\n }\n else {\n lower = toFinite(lower);\n if (upper === undefined) {\n upper = lower;\n lower = 0;\n } else {\n upper = toFinite(upper);\n }\n }\n if (lower > upper) {\n var temp = lower;\n lower = upper;\n upper = temp;\n }\n if (floating || lower % 1 || upper % 1) {\n var rand = nativeRandom();\n return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);\n }\n return baseRandom(lower, upper);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the camel cased string.\n * @example\n *\n * _.camelCase('Foo Bar');\n * // => 'fooBar'\n *\n * _.camelCase('--foo-bar--');\n * // => 'fooBar'\n *\n * _.camelCase('__FOO_BAR__');\n * // => 'fooBar'\n */\n var camelCase = createCompounder(function(result, word, index) {\n word = word.toLowerCase();\n return result + (index ? capitalize(word) : word);\n });\n\n /**\n * Converts the first character of `string` to upper case and the remaining\n * to lower case.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to capitalize.\n * @returns {string} Returns the capitalized string.\n * @example\n *\n * _.capitalize('FRED');\n * // => 'Fred'\n */\n function capitalize(string) {\n return upperFirst(toString(string).toLowerCase());\n }\n\n /**\n * Deburrs `string` by converting\n * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)\n * letters to basic Latin letters and removing\n * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\n function deburr(string) {\n string = toString(string);\n return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');\n }\n\n /**\n * Checks if `string` ends with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=string.length] The position to search up to.\n * @returns {boolean} Returns `true` if `string` ends with `target`,\n * else `false`.\n * @example\n *\n * _.endsWith('abc', 'c');\n * // => true\n *\n * _.endsWith('abc', 'b');\n * // => false\n *\n * _.endsWith('abc', 'b', 2);\n * // => true\n */\n function endsWith(string, target, position) {\n string = toString(string);\n target = baseToString(target);\n\n var length = string.length;\n position = position === undefined\n ? length\n : baseClamp(toInteger(position), 0, length);\n\n var end = position;\n position -= target.length;\n return position >= 0 && string.slice(position, end) == target;\n }\n\n /**\n * Converts the characters \"&\", \"<\", \">\", '\"', and \"'\" in `string` to their\n * corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional\n * characters use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value. See\n * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * When working with HTML you should always\n * [quote attribute values](http://wonko.com/post/html-escaping) to reduce\n * XSS vectors.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, & pebbles'\n */\n function escape(string) {\n string = toString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n }\n\n /**\n * Escapes the `RegExp` special characters \"^\", \"$\", \"\\\", \".\", \"*\", \"+\",\n * \"?\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\", and \"|\" in `string`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escapeRegExp('[lodash](https://lodash.com/)');\n * // => '\\[lodash\\]\\(https://lodash\\.com/\\)'\n */\n function escapeRegExp(string) {\n string = toString(string);\n return (string && reHasRegExpChar.test(string))\n ? string.replace(reRegExpChar, '\\\\$&')\n : string;\n }\n\n /**\n * Converts `string` to\n * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the kebab cased string.\n * @example\n *\n * _.kebabCase('Foo Bar');\n * // => 'foo-bar'\n *\n * _.kebabCase('fooBar');\n * // => 'foo-bar'\n *\n * _.kebabCase('__FOO_BAR__');\n * // => 'foo-bar'\n */\n var kebabCase = createCompounder(function(result, word, index) {\n return result + (index ? '-' : '') + word.toLowerCase();\n });\n\n /**\n * Converts `string`, as space separated words, to lower case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the lower cased string.\n * @example\n *\n * _.lowerCase('--Foo-Bar--');\n * // => 'foo bar'\n *\n * _.lowerCase('fooBar');\n * // => 'foo bar'\n *\n * _.lowerCase('__FOO_BAR__');\n * // => 'foo bar'\n */\n var lowerCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + word.toLowerCase();\n });\n\n /**\n * Converts the first character of `string` to lower case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.lowerFirst('Fred');\n * // => 'fred'\n *\n * _.lowerFirst('FRED');\n * // => 'fRED'\n */\n var lowerFirst = createCaseFirst('toLowerCase');\n\n /**\n * Pads `string` on the left and right sides if it's shorter than `length`.\n * Padding characters are truncated if they can't be evenly divided by `length`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.pad('abc', 8);\n * // => ' abc '\n *\n * _.pad('abc', 8, '_-');\n * // => '_-abc_-_'\n *\n * _.pad('abc', 3);\n * // => 'abc'\n */\n function pad(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n if (!length || strLength >= length) {\n return string;\n }\n var mid = (length - strLength) / 2;\n return (\n createPadding(nativeFloor(mid), chars) +\n string +\n createPadding(nativeCeil(mid), chars)\n );\n }\n\n /**\n * Pads `string` on the right side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padEnd('abc', 6);\n * // => 'abc '\n *\n * _.padEnd('abc', 6, '_-');\n * // => 'abc_-_'\n *\n * _.padEnd('abc', 3);\n * // => 'abc'\n */\n function padEnd(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (string + createPadding(length - strLength, chars))\n : string;\n }\n\n /**\n * Pads `string` on the left side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padStart('abc', 6);\n * // => ' abc'\n *\n * _.padStart('abc', 6, '_-');\n * // => '_-_abc'\n *\n * _.padStart('abc', 3);\n * // => 'abc'\n */\n function padStart(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (createPadding(length - strLength, chars) + string)\n : string;\n }\n\n /**\n * Converts `string` to an integer of the specified radix. If `radix` is\n * `undefined` or `0`, a `radix` of `10` is used unless `value` is a\n * hexadecimal, in which case a `radix` of `16` is used.\n *\n * **Note:** This method aligns with the\n * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category String\n * @param {string} string The string to convert.\n * @param {number} [radix=10] The radix to interpret `value` by.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.parseInt('08');\n * // => 8\n *\n * _.map(['6', '08', '10'], _.parseInt);\n * // => [6, 8, 10]\n */\n function parseInt(string, radix, guard) {\n if (guard || radix == null) {\n radix = 0;\n } else if (radix) {\n radix = +radix;\n }\n return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);\n }\n\n /**\n * Repeats the given string `n` times.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to repeat.\n * @param {number} [n=1] The number of times to repeat the string.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the repeated string.\n * @example\n *\n * _.repeat('*', 3);\n * // => '***'\n *\n * _.repeat('abc', 2);\n * // => 'abcabc'\n *\n * _.repeat('abc', 0);\n * // => ''\n */\n function repeat(string, n, guard) {\n if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n return baseRepeat(toString(string), n);\n }\n\n /**\n * Replaces matches for `pattern` in `string` with `replacement`.\n *\n * **Note:** This method is based on\n * [`String#replace`](https://mdn.io/String/replace).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to modify.\n * @param {RegExp|string} pattern The pattern to replace.\n * @param {Function|string} replacement The match replacement.\n * @returns {string} Returns the modified string.\n * @example\n *\n * _.replace('Hi Fred', 'Fred', 'Barney');\n * // => 'Hi Barney'\n */\n function replace() {\n var args = arguments,\n string = toString(args[0]);\n\n return args.length < 3 ? string : string.replace(args[1], args[2]);\n }\n\n /**\n * Converts `string` to\n * [snake case](https://en.wikipedia.org/wiki/Snake_case).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the snake cased string.\n * @example\n *\n * _.snakeCase('Foo Bar');\n * // => 'foo_bar'\n *\n * _.snakeCase('fooBar');\n * // => 'foo_bar'\n *\n * _.snakeCase('--FOO-BAR--');\n * // => 'foo_bar'\n */\n var snakeCase = createCompounder(function(result, word, index) {\n return result + (index ? '_' : '') + word.toLowerCase();\n });\n\n /**\n * Splits `string` by `separator`.\n *\n * **Note:** This method is based on\n * [`String#split`](https://mdn.io/String/split).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to split.\n * @param {RegExp|string} separator The separator pattern to split by.\n * @param {number} [limit] The length to truncate results to.\n * @returns {Array} Returns the string segments.\n * @example\n *\n * _.split('a-b-c', '-', 2);\n * // => ['a', 'b']\n */\n function split(string, separator, limit) {\n if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {\n separator = limit = undefined;\n }\n limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;\n if (!limit) {\n return [];\n }\n string = toString(string);\n if (string && (\n typeof separator == 'string' ||\n (separator != null && !isRegExp(separator))\n )) {\n separator = baseToString(separator);\n if (!separator && hasUnicode(string)) {\n return castSlice(stringToArray(string), 0, limit);\n }\n }\n return string.split(separator, limit);\n }\n\n /**\n * Converts `string` to\n * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).\n *\n * @static\n * @memberOf _\n * @since 3.1.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the start cased string.\n * @example\n *\n * _.startCase('--foo-bar--');\n * // => 'Foo Bar'\n *\n * _.startCase('fooBar');\n * // => 'Foo Bar'\n *\n * _.startCase('__FOO_BAR__');\n * // => 'FOO BAR'\n */\n var startCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + upperFirst(word);\n });\n\n /**\n * Checks if `string` starts with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=0] The position to search from.\n * @returns {boolean} Returns `true` if `string` starts with `target`,\n * else `false`.\n * @example\n *\n * _.startsWith('abc', 'a');\n * // => true\n *\n * _.startsWith('abc', 'b');\n * // => false\n *\n * _.startsWith('abc', 'b', 1);\n * // => true\n */\n function startsWith(string, target, position) {\n string = toString(string);\n position = position == null\n ? 0\n : baseClamp(toInteger(position), 0, string.length);\n\n target = baseToString(target);\n return string.slice(position, position + target.length) == target;\n }\n\n /**\n * Creates a compiled template function that can interpolate data properties\n * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n * properties may be accessed as free variables in the template. If a setting\n * object is given, it takes precedence over `_.templateSettings` values.\n *\n * **Note:** In the development build `_.template` utilizes\n * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n * for easier debugging.\n *\n * For more information on precompiling templates see\n * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n *\n * For more information on Chrome extension sandboxes see\n * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The template string.\n * @param {Object} [options={}] The options object.\n * @param {RegExp} [options.escape=_.templateSettings.escape]\n * The HTML \"escape\" delimiter.\n * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]\n * The \"evaluate\" delimiter.\n * @param {Object} [options.imports=_.templateSettings.imports]\n * An object to import into the template as free variables.\n * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]\n * The \"interpolate\" delimiter.\n * @param {string} [options.sourceURL='lodash.templateSources[n]']\n * The sourceURL of the compiled template.\n * @param {string} [options.variable='obj']\n * The data object variable name.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the compiled template function.\n * @example\n *\n * // Use the \"interpolate\" delimiter to create a compiled template.\n * var compiled = _.template('hello <%= user %>!');\n * compiled({ 'user': 'fred' });\n * // => 'hello fred!'\n *\n * // Use the HTML \"escape\" delimiter to escape data property values.\n * var compiled = _.template('<%- value %>');\n * compiled({ 'value': '