{"version":3,"sources":["node_modules/flat/index.js","node_modules/oidc-client/lib/oidc-client.min.js","node_modules/lottie-web/build/player/lottie.js","node_modules/@angular/core/fesm2022/primitives/signals.mjs","node_modules/rxjs/dist/esm/internal/util/isFunction.js","node_modules/rxjs/dist/esm/internal/util/createErrorClass.js","node_modules/rxjs/dist/esm/internal/util/UnsubscriptionError.js","node_modules/rxjs/dist/esm/internal/util/arrRemove.js","node_modules/rxjs/dist/esm/internal/Subscription.js","node_modules/rxjs/dist/esm/internal/config.js","node_modules/rxjs/dist/esm/internal/scheduler/timeoutProvider.js","node_modules/rxjs/dist/esm/internal/util/reportUnhandledError.js","node_modules/rxjs/dist/esm/internal/util/noop.js","node_modules/rxjs/dist/esm/internal/NotificationFactories.js","node_modules/rxjs/dist/esm/internal/util/errorContext.js","node_modules/rxjs/dist/esm/internal/Subscriber.js","node_modules/rxjs/dist/esm/internal/symbol/observable.js","node_modules/rxjs/dist/esm/internal/util/identity.js","node_modules/rxjs/dist/esm/internal/util/pipe.js","node_modules/rxjs/dist/esm/internal/Observable.js","node_modules/rxjs/dist/esm/internal/util/lift.js","node_modules/rxjs/dist/esm/internal/operators/OperatorSubscriber.js","node_modules/rxjs/dist/esm/internal/operators/refCount.js","node_modules/rxjs/dist/esm/internal/observable/ConnectableObservable.js","node_modules/rxjs/dist/esm/internal/scheduler/animationFrameProvider.js","node_modules/rxjs/dist/esm/internal/util/ObjectUnsubscribedError.js","node_modules/rxjs/dist/esm/internal/Subject.js","node_modules/rxjs/dist/esm/internal/BehaviorSubject.js","node_modules/rxjs/dist/esm/internal/scheduler/dateTimestampProvider.js","node_modules/rxjs/dist/esm/internal/ReplaySubject.js","node_modules/rxjs/dist/esm/internal/scheduler/Action.js","node_modules/rxjs/dist/esm/internal/scheduler/intervalProvider.js","node_modules/rxjs/dist/esm/internal/scheduler/AsyncAction.js","node_modules/rxjs/dist/esm/internal/util/Immediate.js","node_modules/rxjs/dist/esm/internal/scheduler/immediateProvider.js","node_modules/rxjs/dist/esm/internal/scheduler/AsapAction.js","node_modules/rxjs/dist/esm/internal/Scheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/AsyncScheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/AsapScheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/asap.js","node_modules/rxjs/dist/esm/internal/scheduler/async.js","node_modules/rxjs/dist/esm/internal/scheduler/QueueAction.js","node_modules/rxjs/dist/esm/internal/scheduler/QueueScheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/queue.js","node_modules/rxjs/dist/esm/internal/scheduler/AnimationFrameAction.js","node_modules/rxjs/dist/esm/internal/scheduler/AnimationFrameScheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/animationFrame.js","node_modules/rxjs/dist/esm/internal/observable/empty.js","node_modules/rxjs/dist/esm/internal/util/isScheduler.js","node_modules/rxjs/dist/esm/internal/util/args.js","node_modules/tslib/tslib.es6.mjs","node_modules/rxjs/dist/esm/internal/util/isArrayLike.js","node_modules/rxjs/dist/esm/internal/util/isPromise.js","node_modules/rxjs/dist/esm/internal/util/isInteropObservable.js","node_modules/rxjs/dist/esm/internal/util/isAsyncIterable.js","node_modules/rxjs/dist/esm/internal/util/throwUnobservableError.js","node_modules/rxjs/dist/esm/internal/symbol/iterator.js","node_modules/rxjs/dist/esm/internal/util/isIterable.js","node_modules/rxjs/dist/esm/internal/util/isReadableStreamLike.js","node_modules/rxjs/dist/esm/internal/observable/innerFrom.js","node_modules/rxjs/dist/esm/internal/util/executeSchedule.js","node_modules/rxjs/dist/esm/internal/operators/observeOn.js","node_modules/rxjs/dist/esm/internal/operators/subscribeOn.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleObservable.js","node_modules/rxjs/dist/esm/internal/scheduled/schedulePromise.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleArray.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleIterable.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleAsyncIterable.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleReadableStreamLike.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduled.js","node_modules/rxjs/dist/esm/internal/observable/from.js","node_modules/rxjs/dist/esm/internal/observable/of.js","node_modules/rxjs/dist/esm/internal/observable/throwError.js","node_modules/rxjs/dist/esm/internal/Notification.js","node_modules/rxjs/dist/esm/internal/util/isObservable.js","node_modules/rxjs/dist/esm/internal/util/EmptyError.js","node_modules/rxjs/dist/esm/internal/lastValueFrom.js","node_modules/rxjs/dist/esm/internal/firstValueFrom.js","node_modules/rxjs/dist/esm/internal/util/isDate.js","node_modules/rxjs/dist/esm/internal/operators/timeout.js","node_modules/rxjs/dist/esm/internal/operators/map.js","node_modules/rxjs/dist/esm/internal/util/mapOneOrManyArgs.js","node_modules/rxjs/dist/esm/internal/util/argsArgArrayOrObject.js","node_modules/rxjs/dist/esm/internal/util/createObject.js","node_modules/rxjs/dist/esm/internal/observable/combineLatest.js","node_modules/rxjs/dist/esm/internal/operators/mergeInternals.js","node_modules/rxjs/dist/esm/internal/operators/mergeMap.js","node_modules/rxjs/dist/esm/internal/operators/mergeAll.js","node_modules/rxjs/dist/esm/internal/operators/concatAll.js","node_modules/rxjs/dist/esm/internal/observable/concat.js","node_modules/rxjs/dist/esm/internal/observable/defer.js","node_modules/rxjs/dist/esm/internal/observable/forkJoin.js","node_modules/rxjs/dist/esm/internal/observable/fromEvent.js","node_modules/rxjs/dist/esm/internal/observable/iif.js","node_modules/rxjs/dist/esm/internal/observable/timer.js","node_modules/rxjs/dist/esm/internal/observable/interval.js","node_modules/rxjs/dist/esm/internal/observable/merge.js","node_modules/rxjs/dist/esm/internal/util/argsOrArgArray.js","node_modules/rxjs/dist/esm/internal/operators/filter.js","node_modules/rxjs/dist/esm/internal/observable/race.js","node_modules/rxjs/dist/esm/internal/observable/zip.js","node_modules/rxjs/dist/esm/internal/operators/audit.js","node_modules/rxjs/dist/esm/internal/operators/auditTime.js","node_modules/rxjs/dist/esm/internal/operators/catchError.js","node_modules/rxjs/dist/esm/internal/operators/scanInternals.js","node_modules/rxjs/dist/esm/internal/operators/combineLatest.js","node_modules/rxjs/dist/esm/internal/operators/combineLatestWith.js","node_modules/rxjs/dist/esm/internal/operators/concatMap.js","node_modules/rxjs/dist/esm/internal/observable/fromSubscribable.js","node_modules/rxjs/dist/esm/internal/operators/connect.js","node_modules/rxjs/dist/esm/internal/operators/debounce.js","node_modules/rxjs/dist/esm/internal/operators/debounceTime.js","node_modules/rxjs/dist/esm/internal/operators/defaultIfEmpty.js","node_modules/rxjs/dist/esm/internal/operators/take.js","node_modules/rxjs/dist/esm/internal/operators/ignoreElements.js","node_modules/rxjs/dist/esm/internal/operators/mapTo.js","node_modules/rxjs/dist/esm/internal/operators/delayWhen.js","node_modules/rxjs/dist/esm/internal/operators/delay.js","node_modules/rxjs/dist/esm/internal/operators/dematerialize.js","node_modules/rxjs/dist/esm/internal/operators/distinctUntilChanged.js","node_modules/rxjs/dist/esm/internal/operators/throwIfEmpty.js","node_modules/rxjs/dist/esm/internal/operators/exhaustMap.js","node_modules/rxjs/dist/esm/internal/operators/expand.js","node_modules/rxjs/dist/esm/internal/operators/finalize.js","node_modules/rxjs/dist/esm/internal/operators/first.js","node_modules/rxjs/dist/esm/internal/operators/groupBy.js","node_modules/rxjs/dist/esm/internal/operators/takeLast.js","node_modules/rxjs/dist/esm/internal/operators/last.js","node_modules/rxjs/dist/esm/internal/operators/materialize.js","node_modules/rxjs/dist/esm/internal/operators/multicast.js","node_modules/rxjs/dist/esm/internal/operators/pairwise.js","node_modules/rxjs/dist/esm/internal/operators/pluck.js","node_modules/rxjs/dist/esm/internal/operators/publishReplay.js","node_modules/rxjs/dist/esm/internal/operators/retry.js","node_modules/rxjs/dist/esm/internal/operators/scan.js","node_modules/rxjs/dist/esm/internal/operators/share.js","node_modules/rxjs/dist/esm/internal/operators/shareReplay.js","node_modules/rxjs/dist/esm/internal/operators/skip.js","node_modules/rxjs/dist/esm/internal/operators/skipLast.js","node_modules/rxjs/dist/esm/internal/operators/skipWhile.js","node_modules/rxjs/dist/esm/internal/operators/startWith.js","node_modules/rxjs/dist/esm/internal/operators/switchMap.js","node_modules/rxjs/dist/esm/internal/operators/takeUntil.js","node_modules/rxjs/dist/esm/internal/operators/takeWhile.js","node_modules/rxjs/dist/esm/internal/operators/tap.js","node_modules/rxjs/dist/esm/internal/operators/throttle.js","node_modules/rxjs/dist/esm/internal/operators/throttleTime.js","node_modules/rxjs/dist/esm/internal/operators/withLatestFrom.js","node_modules/@angular/core/fesm2022/core.mjs","node_modules/@angular/common/fesm2022/common.mjs","node_modules/@angular/common/fesm2022/http.mjs","node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs","node_modules/@angular/cdk/fesm2022/coercion.mjs","node_modules/@angular/cdk/fesm2022/platform.mjs","node_modules/@angular/cdk/fesm2022/bidi.mjs","node_modules/@angular/cdk/fesm2022/collections.mjs","node_modules/@angular/cdk/fesm2022/scrolling.mjs","node_modules/@angular/cdk/fesm2022/portal.mjs","node_modules/@angular/cdk/fesm2022/keycodes.mjs","node_modules/@angular/cdk/fesm2022/overlay.mjs","node_modules/@angular/forms/fesm2022/forms.mjs","node_modules/@angular/router/fesm2022/router.mjs","projects/insight/src/app/shared/models/company/company.model.ts","projects/insight/src/app/shared/models/condition/selection.model.ts","projects/insight/src/app/shared/models/content/content.model.ts","projects/insight/src/app/shared/models/content/edit-content.model.ts","projects/insight/src/app/shared/models/email.model.ts","projects/insight/src/app/shared/models/event-log.model.ts","projects/insight/src/app/shared/models/generate-answer-settings.model.ts","projects/insight/src/app/shared/models/group/group.model.ts","projects/insight/src/app/shared/models/integrations.model.ts","projects/insight/src/app/shared/models/menu/report-page.model.ts","projects/insight/src/app/shared/models/menu/menu-item.model.ts","projects/insight/src/app/shared/models/module.model.ts","projects/insight/src/app/shared/models/organization/import-map.model.ts","projects/insight/src/app/shared/models/organization/organization-rule.model.ts","projects/insight/src/app/shared/models/organization/group-categories-hierarchy.model.ts","projects/insight/src/app/shared/models/product-definition.model.ts","projects/insight/src/app/shared/models/product-wizard.model.ts","projects/insight/src/app/shared/models/result-pages/action-plan.model.ts","projects/insight/src/app/shared/models/result-pages/question-results.model.ts","projects/insight/src/app/shared/models/route.model.ts","projects/insight/src/app/shared/models/sensitivity-level.model.ts","projects/insight/src/app/shared/models/snapshot.model.ts","projects/insight/src/app/shared/models/survey/field.model.ts","projects/insight/src/app/shared/models/survey/rule-target.model.ts","projects/insight/src/app/shared/models/survey/survey-list.model.ts","projects/insight/src/app/shared/models/survey-ui-state.model.ts","projects/insight/src/app/shared/models/user/user-session.model.ts","projects/insight/src/app/shared/models/user/user-info.model.ts","projects/insight/src/app/shared/models/user/create-user.model.ts","projects/insight/src/app/shared/models/wordpress.model.ts","node_modules/@ngneat/transloco/fesm2020/ngneat-transloco.mjs","node_modules/@angular/core/fesm2022/rxjs-interop.mjs","node_modules/@ngrx/store/fesm2022/ngrx-store.mjs","projects/insight/src/app/shared/services/configuration.service.ts","projects/insight/src/app/shared/services/act.service.ts","projects/insight/src/app/shared/services/attribute-type.service.ts","projects/insight/src/app/state/selectors/company-context.selectors.ts","projects/insight/src/app/shared/services/attribute.service.ts","projects/insight/src/app/shared/services/auth-credentials.service.ts","projects/insight/src/app/shared/services/authentication.service.ts","projects/insight/src/app/shared/services/clear-answers.service.ts","projects/insight/src/app/shared/services/company-index.service.ts","projects/insight/src/app/shared/services/company-product-definition.service.ts","projects/insight/src/app/shared/services/company.service.ts","projects/insight/src/app/shared/auth/authentication.interceptor.ts","projects/insight/src/app/shared/auth/admin.guard.ts","projects/insight/src/app/shared/core/needs-to-unsubscribe.ts","projects/insight/src/app/shared/core/has-permission.directive.ts","projects/insight/src/app/shared/core/pipes/removePtag.pipe.ts","projects/insight/src/app/shared/core/pipes/safe.pipe.ts","projects/insight/src/app/shared/core/pipes/filter.pipe.ts","node_modules/@angular/cdk/fesm2022/observers.mjs","node_modules/@angular/cdk/fesm2022/layout.mjs","node_modules/@angular/cdk/fesm2022/a11y.mjs","node_modules/@angular/material/fesm2022/core.mjs","node_modules/@angular/material/fesm2022/progress-bar.mjs","projects/insight/src/app/shared/auth/forgotten-password/forgotten-password.component.ts","projects/insight/src/app/shared/auth/forgotten-password/forgotten-password.component.html","projects/insight/src/app/shared/auth/link-logon/link-logon.component.ts","projects/insight/src/app/shared/auth/link-logon/link-logon.component.html","projects/insight/src/app/shared/auth/impersonate-logon/impersonate-logon.component.ts","projects/insight/src/app/shared/auth/impersonate-logon/impersonate-logon.component.html","projects/insight/src/app/state/actions/navigation.actions.ts","projects/insight/src/app/shared/ui-kit/form-field/error.ts","node_modules/@angular/animations/fesm2022/animations.mjs","projects/insight/src/app/shared/ui-kit/button/button.ts","projects/insight/src/app/shared/ui-kit/button/button.html","projects/insight/src/assets/animations/button_completed_state.json","projects/insight/src/assets/animations/button_failed_state.json","projects/insight/src/assets/animations/button_loading_state.json","projects/insight/src/app/shared/ui-kit/icon/icon.component.ts","projects/insight/src/app/shared/ui-kit/icon/icon.component.html","projects/insight/src/app/shared/auth/pin-code-logon/pin-code-logon.component.ts","projects/insight/src/app/shared/auth/pin-code-logon/pin-code-logon.component.html","projects/insight/src/app/shared/auth/signin-callback/signin-callback.component.ts","projects/insight/src/app/shared/auth/signin-callback/signin-callback.component.html","projects/insight/src/app/shared/auth/signout-callback/signout-callback.component.ts","projects/insight/src/app/shared/auth/signout-callback/signout-callback.component.html","projects/insight/src/app/shared/auth/context-header-interceptor.service.ts","node_modules/@microsoft/dynamicproto-js/lib/dist/esm/dynamicproto-js.js","node_modules/@microsoft/applicationinsights-shims/dist-esm/Constants.js","node_modules/@microsoft/applicationinsights-shims/dist-esm/Helpers.js","node_modules/@microsoft/applicationinsights-shims/dist-esm/TsLibShims.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/__DynamicConstants.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/InternalConstants.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/HelperFuncs.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/EnvUtils.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DbgExtensionUtils.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DiagnosticLogger.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/PerfManager.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/RandomHelper.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DataCacheHelper.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CookieMgr.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/EventHelpers.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CoreUtils.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/W3cTraceParent.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/TelemetryHelpers.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/ChannelController.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/BaseCore.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/NotificationManager.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/AppInsightsCore.js","node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/InstrumentHooks.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Constants.js","node_modules/@microsoft/applicationinsights-common/dist-esm/DomHelperFuncs.js","node_modules/@microsoft/applicationinsights-common/dist-esm/__DynamicConstants.js","node_modules/@microsoft/applicationinsights-common/dist-esm/HelperFuncs.js","node_modules/@microsoft/applicationinsights-common/dist-esm/RequestResponseHeaders.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Enums.js","node_modules/@microsoft/applicationinsights-common/dist-esm/StorageHelperFuncs.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/DataSanitizer.js","node_modules/@microsoft/applicationinsights-common/dist-esm/UrlHelperFuncs.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Util.js","node_modules/@microsoft/applicationinsights-common/dist-esm/ConnectionStringParser.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/Envelope.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Event.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Exception.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/DataPoint.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Metric.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/PageView.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/RemoteDependencyData.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Trace.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/PageViewPerformance.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/Data.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/ContextTagKeys.js","node_modules/@microsoft/applicationinsights-common/dist-esm/TelemetryItemCreator.js","node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/PartAExtensions.js","node_modules/@microsoft/applicationinsights-common/dist-esm/applicationinsights-common.js","node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/__DynamicConstants.js","node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js","node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js","node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js","node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Timing.js","node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/AnalyticsPlugin.js","node_modules/@microsoft/applicationinsights-channel-js/dist-esm/InternalConstants.js","node_modules/@microsoft/applicationinsights-channel-js/dist-esm/__DynamicConstants.js","node_modules/@microsoft/applicationinsights-channel-js/dist-esm/EnvelopeCreator.js","node_modules/@microsoft/applicationinsights-channel-js/dist-esm/Offline.js","node_modules/@microsoft/applicationinsights-channel-js/dist-esm/SendBuffer.js","node_modules/@microsoft/applicationinsights-channel-js/dist-esm/Serializer.js","node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js","node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js","node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryProcessors/Sample.js","node_modules/@microsoft/applicationinsights-channel-js/dist-esm/Sender.js","node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/InternalConstants.js","node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/__DynamicConstants.js","node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/ajaxRecord.js","node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/ajax.js","node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Application.js","node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Device.js","node_modules/@microsoft/applicationinsights-properties-js/dist-esm/__DynamicConstants.js","node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Internal.js","node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Location.js","node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Session.js","node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/TelemetryTrace.js","node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/User.js","node_modules/@microsoft/applicationinsights-properties-js/dist-esm/TelemetryContext.js","node_modules/@microsoft/applicationinsights-properties-js/dist-esm/PropertiesPlugin.js","node_modules/@microsoft/applicationinsights-web/dist-esm/InternalConstants.js","node_modules/@microsoft/applicationinsights-web/dist-esm/__DynamicConstants.js","node_modules/@microsoft/applicationinsights-web/dist-esm/Initialization.js","node_modules/@microsoft/applicationinsights-angularplugin-js/fesm2020/microsoft-applicationinsights-angularplugin-js.mjs","projects/insight/src/appsettings.json","projects/insight/src/app/shared/errors/application-insights.service.ts","projects/insight/src/app/shared/errors/errors.handler.ts","projects/insight/src/app/shared/services/condition.service.ts","projects/insight/src/app/shared/services/content.service.ts","projects/insight/src/app/shared/services/data-source.service.ts","projects/insight/src/app/shared/services/default-entities.service.ts","projects/insight/src/app/shared/services/email.service.ts","node_modules/@angular/material/fesm2022/button.mjs","node_modules/@angular/material/fesm2022/snack-bar.mjs","projects/insight/src/app/shared/services/errors.service.ts","projects/insight/src/app/shared/services/favorite-company.service.ts","projects/insight/src/app/shared/services/group-category.service.ts","projects/insight/src/app/shared/services/group.service.ts","projects/insight/src/app/admin-tpl/company-overview/reports/templates/default/index-report-page.ts","projects/insight/src/app/shared/services/index.service.ts","projects/insight/src/app/shared/services/integrations.service.ts","projects/insight/src/app/shared/services/language.service.ts","projects/insight/src/app/shared/services/library.service.ts","projects/insight/src/app/shared/services/mapping-definition.service.ts","projects/insight/src/app/shared/services/menu.service.ts","projects/insight/src/app/shared/services/meta.service.ts","projects/insight/src/app/shared/services/module-category.service.ts","projects/insight/src/app/shared/services/module.service.ts","projects/insight/src/app/shared/services/organization-rule.service.ts","projects/insight/src/app/shared/services/parameter.service.ts","projects/insight/src/app/shared/services/permission.service.ts","projects/insight/src/app/shared/services/pin-code.service.ts","projects/insight/src/app/shared/services/product-definition.service.ts","projects/insight/src/app/shared/services/product.service.ts","projects/insight/src/app/shared/services/question-content.service.ts","projects/insight/src/app/shared/services/question.service.ts","projects/insight/src/app/admin-tpl/company-overview/reports/templates/default/index.ts","projects/insight/src/app/admin-tpl/company-overview/reports/templates/default/structure.json","projects/insight/src/app/admin-tpl/company-overview/reports/templates/default/parameters.json","projects/insight/src/app/admin-tpl/company-overview/reports/templates/default/data-sources.json","projects/insight/src/app/shared/services/report-page.service.ts","projects/insight/src/app/shared/services/result.service.ts","projects/insight/src/app/shared/services/role.service.ts","projects/insight/src/app/shared/services/session.service.ts","projects/insight/src/app/shared/services/sms.service.ts","projects/insight/src/app/shared/services/snapshot.service.ts","projects/insight/src/app/shared/services/survey.service.ts","projects/insight/src/app/shared/services/tree.service.ts","projects/insight/src/app/shared/services/user-parameter.service.ts","projects/insight/src/app/shared/services/user-relation.service.ts","projects/insight/src/app/shared/services/user.service.ts","projects/insight/src/app/shared/services/utils.service.ts","projects/insight/src/app/shared/services/variable.service.ts","projects/insight/src/app/shared/auth/authentication.guard.ts","projects/insight/src/app/shared/ui-kit/icon/icon.module.ts","projects/insight/src/app/shared/ui-kit/button/button.module.ts","projects/insight/src/app/shared/ui-kit/color-scheme.ts"],"sourcesContent":["module.exports = flatten;\nflatten.flatten = flatten;\nflatten.unflatten = unflatten;\nfunction isBuffer(obj) {\n return obj && obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);\n}\nfunction keyIdentity(key) {\n return key;\n}\nfunction flatten(target, opts) {\n opts = opts || {};\n const delimiter = opts.delimiter || '.';\n const maxDepth = opts.maxDepth;\n const transformKey = opts.transformKey || keyIdentity;\n const output = {};\n function step(object, prev, currentDepth) {\n currentDepth = currentDepth || 1;\n Object.keys(object).forEach(function (key) {\n const value = object[key];\n const isarray = opts.safe && Array.isArray(value);\n const type = Object.prototype.toString.call(value);\n const isbuffer = isBuffer(value);\n const isobject = type === '[object Object]' || type === '[object Array]';\n const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);\n if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) {\n return step(value, newKey, currentDepth + 1);\n }\n output[newKey] = value;\n });\n }\n step(target);\n return output;\n}\nfunction unflatten(target, opts) {\n opts = opts || {};\n const delimiter = opts.delimiter || '.';\n const overwrite = opts.overwrite || false;\n const transformKey = opts.transformKey || keyIdentity;\n const result = {};\n const isbuffer = isBuffer(target);\n if (isbuffer || Object.prototype.toString.call(target) !== '[object Object]') {\n return target;\n }\n\n // safely ensure that the key is\n // an integer.\n function getkey(key) {\n const parsedKey = Number(key);\n return isNaN(parsedKey) || key.indexOf('.') !== -1 || opts.object ? key : parsedKey;\n }\n function addKeys(keyPrefix, recipient, target) {\n return Object.keys(target).reduce(function (result, key) {\n result[keyPrefix + delimiter + key] = target[key];\n return result;\n }, recipient);\n }\n function isEmpty(val) {\n const type = Object.prototype.toString.call(val);\n const isArray = type === '[object Array]';\n const isObject = type === '[object Object]';\n if (!val) {\n return true;\n } else if (isArray) {\n return !val.length;\n } else if (isObject) {\n return !Object.keys(val).length;\n }\n }\n target = Object.keys(target).reduce(function (result, key) {\n const type = Object.prototype.toString.call(target[key]);\n const isObject = type === '[object Object]' || type === '[object Array]';\n if (!isObject || isEmpty(target[key])) {\n result[key] = target[key];\n return result;\n } else {\n return addKeys(key, result, flatten(target[key], opts));\n }\n }, {});\n Object.keys(target).forEach(function (key) {\n const split = key.split(delimiter).map(transformKey);\n let key1 = getkey(split.shift());\n let key2 = getkey(split[0]);\n let recipient = result;\n while (key2 !== undefined) {\n if (key1 === '__proto__') {\n return;\n }\n const type = Object.prototype.toString.call(recipient[key1]);\n const isobject = type === '[object Object]' || type === '[object Array]';\n\n // do not write over falsey, non-undefined values if overwrite is false\n if (!overwrite && !isobject && typeof recipient[key1] !== 'undefined') {\n return;\n }\n if (overwrite && !isobject || !overwrite && recipient[key1] == null) {\n recipient[key1] = typeof key2 === 'number' && !opts.object ? [] : {};\n }\n recipient = recipient[key1];\n if (split.length > 0) {\n key1 = getkey(split.shift());\n key2 = getkey(split[0]);\n }\n }\n\n // unflatten again for 'messy objects'\n recipient[key1] = unflatten(target[key], opts);\n });\n return result;\n}","!function t(e, r) {\n if (\"object\" == typeof exports && \"object\" == typeof module) module.exports = r();else if (\"function\" == typeof define && define.amd) define([], r);else {\n var n = r();\n for (var i in n) (\"object\" == typeof exports ? exports : e)[i] = n[i];\n }\n}(this, function () {\n return function (t) {\n var e = {};\n function r(n) {\n if (e[n]) return e[n].exports;\n var i = e[n] = {\n i: n,\n l: !1,\n exports: {}\n };\n return t[n].call(i.exports, i, i.exports, r), i.l = !0, i.exports;\n }\n return r.m = t, r.c = e, r.d = function (t, e, n) {\n r.o(t, e) || Object.defineProperty(t, e, {\n enumerable: !0,\n get: n\n });\n }, r.r = function (t) {\n \"undefined\" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {\n value: \"Module\"\n }), Object.defineProperty(t, \"__esModule\", {\n value: !0\n });\n }, r.t = function (t, e) {\n if (1 & e && (t = r(t)), 8 & e) return t;\n if (4 & e && \"object\" == typeof t && t && t.__esModule) return t;\n var n = Object.create(null);\n if (r.r(n), Object.defineProperty(n, \"default\", {\n enumerable: !0,\n value: t\n }), 2 & e && \"string\" != typeof t) for (var i in t) r.d(n, i, function (e) {\n return t[e];\n }.bind(null, i));\n return n;\n }, r.n = function (t) {\n var e = t && t.__esModule ? function e() {\n return t.default;\n } : function e() {\n return t;\n };\n return r.d(e, \"a\", e), e;\n }, r.o = function (t, e) {\n return Object.prototype.hasOwnProperty.call(t, e);\n }, r.p = \"\", r(r.s = 22);\n }([function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }();\n var i = {\n debug: function t() {},\n info: function t() {},\n warn: function t() {},\n error: function t() {}\n },\n o = void 0,\n s = void 0;\n (e.Log = function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n }\n return t.reset = function t() {\n s = 3, o = i;\n }, t.debug = function t() {\n if (s >= 4) {\n for (var e = arguments.length, r = Array(e), n = 0; n < e; n++) r[n] = arguments[n];\n o.debug.apply(o, Array.from(r));\n }\n }, t.info = function t() {\n if (s >= 3) {\n for (var e = arguments.length, r = Array(e), n = 0; n < e; n++) r[n] = arguments[n];\n o.info.apply(o, Array.from(r));\n }\n }, t.warn = function t() {\n if (s >= 2) {\n for (var e = arguments.length, r = Array(e), n = 0; n < e; n++) r[n] = arguments[n];\n o.warn.apply(o, Array.from(r));\n }\n }, t.error = function t() {\n if (s >= 1) {\n for (var e = arguments.length, r = Array(e), n = 0; n < e; n++) r[n] = arguments[n];\n o.error.apply(o, Array.from(r));\n }\n }, n(t, null, [{\n key: \"NONE\",\n get: function t() {\n return 0;\n }\n }, {\n key: \"ERROR\",\n get: function t() {\n return 1;\n }\n }, {\n key: \"WARN\",\n get: function t() {\n return 2;\n }\n }, {\n key: \"INFO\",\n get: function t() {\n return 3;\n }\n }, {\n key: \"DEBUG\",\n get: function t() {\n return 4;\n }\n }, {\n key: \"level\",\n get: function t() {\n return s;\n },\n set: function t(e) {\n if (!(0 <= e && e <= 4)) throw new Error(\"Invalid log level\");\n s = e;\n }\n }, {\n key: \"logger\",\n get: function t() {\n return o;\n },\n set: function t(e) {\n if (!e.debug && e.info && (e.debug = e.info), !(e.debug && e.info && e.warn && e.error)) throw new Error(\"Invalid logger\");\n o = e;\n }\n }]), t;\n }()).reset();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }();\n var i = {\n setInterval: function (t) {\n function e(e, r) {\n return t.apply(this, arguments);\n }\n return e.toString = function () {\n return t.toString();\n }, e;\n }(function (t, e) {\n return setInterval(t, e);\n }),\n clearInterval: function (t) {\n function e(e) {\n return t.apply(this, arguments);\n }\n return e.toString = function () {\n return t.toString();\n }, e;\n }(function (t) {\n return clearInterval(t);\n })\n },\n o = !1,\n s = null;\n e.Global = function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n }\n return t._testing = function t() {\n o = !0;\n }, t.setXMLHttpRequest = function t(e) {\n s = e;\n }, n(t, null, [{\n key: \"location\",\n get: function t() {\n if (!o) return location;\n }\n }, {\n key: \"localStorage\",\n get: function t() {\n if (!o && \"undefined\" != typeof window) return localStorage;\n }\n }, {\n key: \"sessionStorage\",\n get: function t() {\n if (!o && \"undefined\" != typeof window) return sessionStorage;\n }\n }, {\n key: \"XMLHttpRequest\",\n get: function t() {\n if (!o && \"undefined\" != typeof window) return s || XMLHttpRequest;\n }\n }, {\n key: \"timer\",\n get: function t() {\n if (!o) return i;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.MetadataService = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0),\n o = r(7);\n function s(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n var a = \".well-known/openid-configuration\";\n e.MetadataService = function () {\n function t(e) {\n var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : o.JsonService;\n if (s(this, t), !e) throw i.Log.error(\"MetadataService: No settings passed to MetadataService\"), new Error(\"settings\");\n this._settings = e, this._jsonService = new r([\"application/jwk-set+json\"]);\n }\n return t.prototype.resetSigningKeys = function t() {\n this._settings = this._settings || {}, this._settings.signingKeys = void 0;\n }, t.prototype.getMetadata = function t() {\n var e = this;\n return this._settings.metadata ? (i.Log.debug(\"MetadataService.getMetadata: Returning metadata from settings\"), Promise.resolve(this._settings.metadata)) : this.metadataUrl ? (i.Log.debug(\"MetadataService.getMetadata: getting metadata from\", this.metadataUrl), this._jsonService.getJson(this.metadataUrl).then(function (t) {\n i.Log.debug(\"MetadataService.getMetadata: json received\");\n var r = e._settings.metadataSeed || {};\n return e._settings.metadata = Object.assign({}, r, t), e._settings.metadata;\n })) : (i.Log.error(\"MetadataService.getMetadata: No authority or metadataUrl configured on settings\"), Promise.reject(new Error(\"No authority or metadataUrl configured on settings\")));\n }, t.prototype.getIssuer = function t() {\n return this._getMetadataProperty(\"issuer\");\n }, t.prototype.getAuthorizationEndpoint = function t() {\n return this._getMetadataProperty(\"authorization_endpoint\");\n }, t.prototype.getUserInfoEndpoint = function t() {\n return this._getMetadataProperty(\"userinfo_endpoint\");\n }, t.prototype.getTokenEndpoint = function t() {\n var e = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];\n return this._getMetadataProperty(\"token_endpoint\", e);\n }, t.prototype.getCheckSessionIframe = function t() {\n return this._getMetadataProperty(\"check_session_iframe\", !0);\n }, t.prototype.getEndSessionEndpoint = function t() {\n return this._getMetadataProperty(\"end_session_endpoint\", !0);\n }, t.prototype.getRevocationEndpoint = function t() {\n return this._getMetadataProperty(\"revocation_endpoint\", !0);\n }, t.prototype.getKeysEndpoint = function t() {\n return this._getMetadataProperty(\"jwks_uri\", !0);\n }, t.prototype._getMetadataProperty = function t(e) {\n var r = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];\n return i.Log.debug(\"MetadataService.getMetadataProperty for: \" + e), this.getMetadata().then(function (t) {\n if (i.Log.debug(\"MetadataService.getMetadataProperty: metadata recieved\"), void 0 === t[e]) {\n if (!0 === r) return void i.Log.warn(\"MetadataService.getMetadataProperty: Metadata does not contain optional property \" + e);\n throw i.Log.error(\"MetadataService.getMetadataProperty: Metadata does not contain property \" + e), new Error(\"Metadata does not contain property \" + e);\n }\n return t[e];\n });\n }, t.prototype.getSigningKeys = function t() {\n var e = this;\n return this._settings.signingKeys ? (i.Log.debug(\"MetadataService.getSigningKeys: Returning signingKeys from settings\"), Promise.resolve(this._settings.signingKeys)) : this._getMetadataProperty(\"jwks_uri\").then(function (t) {\n return i.Log.debug(\"MetadataService.getSigningKeys: jwks_uri received\", t), e._jsonService.getJson(t).then(function (t) {\n if (i.Log.debug(\"MetadataService.getSigningKeys: key set received\", t), !t.keys) throw i.Log.error(\"MetadataService.getSigningKeys: Missing keys on keyset\"), new Error(\"Missing keys on keyset\");\n return e._settings.signingKeys = t.keys, e._settings.signingKeys;\n });\n });\n }, n(t, [{\n key: \"metadataUrl\",\n get: function t() {\n return this._metadataUrl || (this._settings.metadataUrl ? this._metadataUrl = this._settings.metadataUrl : (this._metadataUrl = this._settings.authority, this._metadataUrl && this._metadataUrl.indexOf(a) < 0 && (\"/\" !== this._metadataUrl[this._metadataUrl.length - 1] && (this._metadataUrl += \"/\"), this._metadataUrl += a))), this._metadataUrl;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.UrlUtility = void 0;\n var n = r(0),\n i = r(1);\n e.UrlUtility = function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n }\n return t.addQueryParam = function t(e, r, n) {\n return e.indexOf(\"?\") < 0 && (e += \"?\"), \"?\" !== e[e.length - 1] && (e += \"&\"), e += encodeURIComponent(r), e += \"=\", e += encodeURIComponent(n);\n }, t.parseUrlFragment = function t(e) {\n var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : \"#\",\n o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : i.Global;\n \"string\" != typeof e && (e = o.location.href);\n var s = e.lastIndexOf(r);\n s >= 0 && (e = e.substr(s + 1)), \"?\" === r && (s = e.indexOf(\"#\")) >= 0 && (e = e.substr(0, s));\n for (var a, u = {}, c = /([^&=]+)=([^&]*)/g, h = 0; a = c.exec(e);) if (u[decodeURIComponent(a[1])] = decodeURIComponent(a[2].replace(/\\+/g, \" \")), h++ > 50) return n.Log.error(\"UrlUtility.parseUrlFragment: response exceeded expected number of parameters\", e), {\n error: \"Response exceeded expected number of parameters\"\n };\n for (var l in u) return u;\n return {};\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.JoseUtil = void 0;\n var n = r(26),\n i = function o(t) {\n return t && t.__esModule ? t : {\n default: t\n };\n }(r(33));\n e.JoseUtil = (0, i.default)({\n jws: n.jws,\n KeyUtil: n.KeyUtil,\n X509: n.X509,\n crypto: n.crypto,\n hextob64u: n.hextob64u,\n b64tohex: n.b64tohex,\n AllowedSigningAlgs: n.AllowedSigningAlgs\n });\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.OidcClientSettings = void 0;\n var n = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (t) {\n return typeof t;\n } : function (t) {\n return t && \"function\" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? \"symbol\" : typeof t;\n },\n i = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n o = r(0),\n s = r(23),\n a = r(6),\n u = r(24),\n c = r(2);\n function h(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n var l = \".well-known/openid-configuration\",\n f = \"id_token\",\n g = \"openid\",\n d = \"client_secret_post\";\n e.OidcClientSettings = function () {\n function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n r = e.authority,\n i = e.metadataUrl,\n o = e.metadata,\n l = e.signingKeys,\n p = e.metadataSeed,\n v = e.client_id,\n y = e.client_secret,\n m = e.response_type,\n _ = void 0 === m ? f : m,\n S = e.scope,\n b = void 0 === S ? g : S,\n w = e.redirect_uri,\n F = e.post_logout_redirect_uri,\n E = e.client_authentication,\n x = void 0 === E ? d : E,\n A = e.prompt,\n k = e.display,\n P = e.max_age,\n C = e.ui_locales,\n T = e.acr_values,\n R = e.resource,\n I = e.response_mode,\n D = e.filterProtocolClaims,\n L = void 0 === D || D,\n N = e.loadUserInfo,\n U = void 0 === N || N,\n B = e.staleStateAge,\n O = void 0 === B ? 900 : B,\n j = e.clockSkew,\n M = void 0 === j ? 300 : j,\n H = e.clockService,\n V = void 0 === H ? new s.ClockService() : H,\n K = e.userInfoJwtIssuer,\n q = void 0 === K ? \"OP\" : K,\n J = e.mergeClaims,\n W = void 0 !== J && J,\n z = e.stateStore,\n Y = void 0 === z ? new a.WebStorageStateStore() : z,\n G = e.ResponseValidatorCtor,\n X = void 0 === G ? u.ResponseValidator : G,\n $ = e.MetadataServiceCtor,\n Q = void 0 === $ ? c.MetadataService : $,\n Z = e.extraQueryParams,\n tt = void 0 === Z ? {} : Z,\n et = e.extraTokenParams,\n rt = void 0 === et ? {} : et;\n h(this, t), this._authority = r, this._metadataUrl = i, this._metadata = o, this._metadataSeed = p, this._signingKeys = l, this._client_id = v, this._client_secret = y, this._response_type = _, this._scope = b, this._redirect_uri = w, this._post_logout_redirect_uri = F, this._client_authentication = x, this._prompt = A, this._display = k, this._max_age = P, this._ui_locales = C, this._acr_values = T, this._resource = R, this._response_mode = I, this._filterProtocolClaims = !!L, this._loadUserInfo = !!U, this._staleStateAge = O, this._clockSkew = M, this._clockService = V, this._userInfoJwtIssuer = q, this._mergeClaims = !!W, this._stateStore = Y, this._validator = new X(this), this._metadataService = new Q(this), this._extraQueryParams = \"object\" === (void 0 === tt ? \"undefined\" : n(tt)) ? tt : {}, this._extraTokenParams = \"object\" === (void 0 === rt ? \"undefined\" : n(rt)) ? rt : {};\n }\n return t.prototype.getEpochTime = function t() {\n return this._clockService.getEpochTime();\n }, i(t, [{\n key: \"client_id\",\n get: function t() {\n return this._client_id;\n },\n set: function t(e) {\n if (this._client_id) throw o.Log.error(\"OidcClientSettings.set_client_id: client_id has already been assigned.\"), new Error(\"client_id has already been assigned.\");\n this._client_id = e;\n }\n }, {\n key: \"client_secret\",\n get: function t() {\n return this._client_secret;\n }\n }, {\n key: \"response_type\",\n get: function t() {\n return this._response_type;\n }\n }, {\n key: \"scope\",\n get: function t() {\n return this._scope;\n }\n }, {\n key: \"redirect_uri\",\n get: function t() {\n return this._redirect_uri;\n }\n }, {\n key: \"post_logout_redirect_uri\",\n get: function t() {\n return this._post_logout_redirect_uri;\n }\n }, {\n key: \"client_authentication\",\n get: function t() {\n return this._client_authentication;\n }\n }, {\n key: \"prompt\",\n get: function t() {\n return this._prompt;\n }\n }, {\n key: \"display\",\n get: function t() {\n return this._display;\n }\n }, {\n key: \"max_age\",\n get: function t() {\n return this._max_age;\n }\n }, {\n key: \"ui_locales\",\n get: function t() {\n return this._ui_locales;\n }\n }, {\n key: \"acr_values\",\n get: function t() {\n return this._acr_values;\n }\n }, {\n key: \"resource\",\n get: function t() {\n return this._resource;\n }\n }, {\n key: \"response_mode\",\n get: function t() {\n return this._response_mode;\n }\n }, {\n key: \"authority\",\n get: function t() {\n return this._authority;\n },\n set: function t(e) {\n if (this._authority) throw o.Log.error(\"OidcClientSettings.set_authority: authority has already been assigned.\"), new Error(\"authority has already been assigned.\");\n this._authority = e;\n }\n }, {\n key: \"metadataUrl\",\n get: function t() {\n return this._metadataUrl || (this._metadataUrl = this.authority, this._metadataUrl && this._metadataUrl.indexOf(l) < 0 && (\"/\" !== this._metadataUrl[this._metadataUrl.length - 1] && (this._metadataUrl += \"/\"), this._metadataUrl += l)), this._metadataUrl;\n }\n }, {\n key: \"metadata\",\n get: function t() {\n return this._metadata;\n },\n set: function t(e) {\n this._metadata = e;\n }\n }, {\n key: \"metadataSeed\",\n get: function t() {\n return this._metadataSeed;\n },\n set: function t(e) {\n this._metadataSeed = e;\n }\n }, {\n key: \"signingKeys\",\n get: function t() {\n return this._signingKeys;\n },\n set: function t(e) {\n this._signingKeys = e;\n }\n }, {\n key: \"filterProtocolClaims\",\n get: function t() {\n return this._filterProtocolClaims;\n }\n }, {\n key: \"loadUserInfo\",\n get: function t() {\n return this._loadUserInfo;\n }\n }, {\n key: \"staleStateAge\",\n get: function t() {\n return this._staleStateAge;\n }\n }, {\n key: \"clockSkew\",\n get: function t() {\n return this._clockSkew;\n }\n }, {\n key: \"userInfoJwtIssuer\",\n get: function t() {\n return this._userInfoJwtIssuer;\n }\n }, {\n key: \"mergeClaims\",\n get: function t() {\n return this._mergeClaims;\n }\n }, {\n key: \"stateStore\",\n get: function t() {\n return this._stateStore;\n }\n }, {\n key: \"validator\",\n get: function t() {\n return this._validator;\n }\n }, {\n key: \"metadataService\",\n get: function t() {\n return this._metadataService;\n }\n }, {\n key: \"extraQueryParams\",\n get: function t() {\n return this._extraQueryParams;\n },\n set: function t(e) {\n \"object\" === (void 0 === e ? \"undefined\" : n(e)) ? this._extraQueryParams = e : this._extraQueryParams = {};\n }\n }, {\n key: \"extraTokenParams\",\n get: function t() {\n return this._extraTokenParams;\n },\n set: function t(e) {\n \"object\" === (void 0 === e ? \"undefined\" : n(e)) ? this._extraTokenParams = e : this._extraTokenParams = {};\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.WebStorageStateStore = void 0;\n var n = r(0),\n i = r(1);\n function o(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n e.WebStorageStateStore = function () {\n function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n r = e.prefix,\n n = void 0 === r ? \"oidc.\" : r,\n s = e.store,\n a = void 0 === s ? i.Global.localStorage : s;\n o(this, t), this._store = a, this._prefix = n;\n }\n return t.prototype.set = function t(e, r) {\n return n.Log.debug(\"WebStorageStateStore.set\", e), e = this._prefix + e, this._store.setItem(e, r), Promise.resolve();\n }, t.prototype.get = function t(e) {\n n.Log.debug(\"WebStorageStateStore.get\", e), e = this._prefix + e;\n var r = this._store.getItem(e);\n return Promise.resolve(r);\n }, t.prototype.remove = function t(e) {\n n.Log.debug(\"WebStorageStateStore.remove\", e), e = this._prefix + e;\n var r = this._store.getItem(e);\n return this._store.removeItem(e), Promise.resolve(r);\n }, t.prototype.getAllKeys = function t() {\n n.Log.debug(\"WebStorageStateStore.getAllKeys\");\n for (var e = [], r = 0; r < this._store.length; r++) {\n var i = this._store.key(r);\n 0 === i.indexOf(this._prefix) && e.push(i.substr(this._prefix.length));\n }\n return Promise.resolve(e);\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.JsonService = void 0;\n var n = r(0),\n i = r(1);\n function o(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n e.JsonService = function () {\n function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null,\n r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : i.Global.XMLHttpRequest,\n n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;\n o(this, t), e && Array.isArray(e) ? this._contentTypes = e.slice() : this._contentTypes = [], this._contentTypes.push(\"application/json\"), n && this._contentTypes.push(\"application/jwt\"), this._XMLHttpRequest = r, this._jwtHandler = n;\n }\n return t.prototype.getJson = function t(e, r) {\n var i = this;\n if (!e) throw n.Log.error(\"JsonService.getJson: No url passed\"), new Error(\"url\");\n return n.Log.debug(\"JsonService.getJson, url: \", e), new Promise(function (t, o) {\n var s = new i._XMLHttpRequest();\n s.open(\"GET\", e);\n var a = i._contentTypes,\n u = i._jwtHandler;\n s.onload = function () {\n if (n.Log.debug(\"JsonService.getJson: HTTP response received, status\", s.status), 200 === s.status) {\n var r = s.getResponseHeader(\"Content-Type\");\n if (r) {\n var i = a.find(function (t) {\n if (r.startsWith(t)) return !0;\n });\n if (\"application/jwt\" == i) return void u(s).then(t, o);\n if (i) try {\n return void t(JSON.parse(s.responseText));\n } catch (t) {\n return n.Log.error(\"JsonService.getJson: Error parsing JSON response\", t.message), void o(t);\n }\n }\n o(Error(\"Invalid response Content-Type: \" + r + \", from URL: \" + e));\n } else o(Error(s.statusText + \" (\" + s.status + \")\"));\n }, s.onerror = function () {\n n.Log.error(\"JsonService.getJson: network error\"), o(Error(\"Network Error\"));\n }, r && (n.Log.debug(\"JsonService.getJson: token passed, setting Authorization header\"), s.setRequestHeader(\"Authorization\", \"Bearer \" + r)), s.send();\n });\n }, t.prototype.postForm = function t(e, r, i) {\n var o = this;\n if (!e) throw n.Log.error(\"JsonService.postForm: No url passed\"), new Error(\"url\");\n return n.Log.debug(\"JsonService.postForm, url: \", e), new Promise(function (t, s) {\n var a = new o._XMLHttpRequest();\n a.open(\"POST\", e);\n var u = o._contentTypes;\n a.onload = function () {\n if (n.Log.debug(\"JsonService.postForm: HTTP response received, status\", a.status), 200 !== a.status) {\n if (400 === a.status) if (i = a.getResponseHeader(\"Content-Type\")) if (u.find(function (t) {\n if (i.startsWith(t)) return !0;\n })) try {\n var r = JSON.parse(a.responseText);\n if (r && r.error) return n.Log.error(\"JsonService.postForm: Error from server: \", r.error), void s(new Error(r.error));\n } catch (t) {\n return n.Log.error(\"JsonService.postForm: Error parsing JSON response\", t.message), void s(t);\n }\n s(Error(a.statusText + \" (\" + a.status + \")\"));\n } else {\n var i;\n if ((i = a.getResponseHeader(\"Content-Type\")) && u.find(function (t) {\n if (i.startsWith(t)) return !0;\n })) try {\n return void t(JSON.parse(a.responseText));\n } catch (t) {\n return n.Log.error(\"JsonService.postForm: Error parsing JSON response\", t.message), void s(t);\n }\n s(Error(\"Invalid response Content-Type: \" + i + \", from URL: \" + e));\n }\n }, a.onerror = function () {\n n.Log.error(\"JsonService.postForm: network error\"), s(Error(\"Network Error\"));\n };\n var c = \"\";\n for (var h in r) {\n var l = r[h];\n l && (c.length > 0 && (c += \"&\"), c += encodeURIComponent(h), c += \"=\", c += encodeURIComponent(l));\n }\n a.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\"), void 0 !== i && a.setRequestHeader(\"Authorization\", \"Basic \" + btoa(i)), a.send(c);\n });\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.SigninRequest = void 0;\n var n = r(0),\n i = r(3),\n o = r(13);\n e.SigninRequest = function () {\n function t(e) {\n var r = e.url,\n s = e.client_id,\n a = e.redirect_uri,\n u = e.response_type,\n c = e.scope,\n h = e.authority,\n l = e.data,\n f = e.prompt,\n g = e.display,\n d = e.max_age,\n p = e.ui_locales,\n v = e.id_token_hint,\n y = e.login_hint,\n m = e.acr_values,\n _ = e.resource,\n S = e.response_mode,\n b = e.request,\n w = e.request_uri,\n F = e.extraQueryParams,\n E = e.request_type,\n x = e.client_secret,\n A = e.extraTokenParams,\n k = e.skipUserInfo;\n if (function P(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t), !r) throw n.Log.error(\"SigninRequest.ctor: No url passed\"), new Error(\"url\");\n if (!s) throw n.Log.error(\"SigninRequest.ctor: No client_id passed\"), new Error(\"client_id\");\n if (!a) throw n.Log.error(\"SigninRequest.ctor: No redirect_uri passed\"), new Error(\"redirect_uri\");\n if (!u) throw n.Log.error(\"SigninRequest.ctor: No response_type passed\"), new Error(\"response_type\");\n if (!c) throw n.Log.error(\"SigninRequest.ctor: No scope passed\"), new Error(\"scope\");\n if (!h) throw n.Log.error(\"SigninRequest.ctor: No authority passed\"), new Error(\"authority\");\n var C = t.isOidc(u),\n T = t.isCode(u);\n S || (S = t.isCode(u) ? \"query\" : null), this.state = new o.SigninState({\n nonce: C,\n data: l,\n client_id: s,\n authority: h,\n redirect_uri: a,\n code_verifier: T,\n request_type: E,\n response_mode: S,\n client_secret: x,\n scope: c,\n extraTokenParams: A,\n skipUserInfo: k\n }), r = i.UrlUtility.addQueryParam(r, \"client_id\", s), r = i.UrlUtility.addQueryParam(r, \"redirect_uri\", a), r = i.UrlUtility.addQueryParam(r, \"response_type\", u), r = i.UrlUtility.addQueryParam(r, \"scope\", c), r = i.UrlUtility.addQueryParam(r, \"state\", this.state.id), C && (r = i.UrlUtility.addQueryParam(r, \"nonce\", this.state.nonce)), T && (r = i.UrlUtility.addQueryParam(r, \"code_challenge\", this.state.code_challenge), r = i.UrlUtility.addQueryParam(r, \"code_challenge_method\", \"S256\"));\n var R = {\n prompt: f,\n display: g,\n max_age: d,\n ui_locales: p,\n id_token_hint: v,\n login_hint: y,\n acr_values: m,\n resource: _,\n request: b,\n request_uri: w,\n response_mode: S\n };\n for (var I in R) R[I] && (r = i.UrlUtility.addQueryParam(r, I, R[I]));\n for (var D in F) r = i.UrlUtility.addQueryParam(r, D, F[D]);\n this.url = r;\n }\n return t.isOidc = function t(e) {\n return !!e.split(/\\s+/g).filter(function (t) {\n return \"id_token\" === t;\n })[0];\n }, t.isOAuth = function t(e) {\n return !!e.split(/\\s+/g).filter(function (t) {\n return \"token\" === t;\n })[0];\n }, t.isCode = function t(e) {\n return !!e.split(/\\s+/g).filter(function (t) {\n return \"code\" === t;\n })[0];\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.State = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0),\n o = function s(t) {\n return t && t.__esModule ? t : {\n default: t\n };\n }(r(14));\n function a(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n e.State = function () {\n function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n r = e.id,\n n = e.data,\n i = e.created,\n s = e.request_type;\n a(this, t), this._id = r || (0, o.default)(), this._data = n, this._created = \"number\" == typeof i && i > 0 ? i : parseInt(Date.now() / 1e3), this._request_type = s;\n }\n return t.prototype.toStorageString = function t() {\n return i.Log.debug(\"State.toStorageString\"), JSON.stringify({\n id: this.id,\n data: this.data,\n created: this.created,\n request_type: this.request_type\n });\n }, t.fromStorageString = function e(r) {\n return i.Log.debug(\"State.fromStorageString\"), new t(JSON.parse(r));\n }, t.clearStaleState = function e(r, n) {\n var o = Date.now() / 1e3 - n;\n return r.getAllKeys().then(function (e) {\n i.Log.debug(\"State.clearStaleState: got keys\", e);\n for (var n = [], s = function s(a) {\n var c = e[a];\n u = r.get(c).then(function (e) {\n var n = !1;\n if (e) try {\n var s = t.fromStorageString(e);\n i.Log.debug(\"State.clearStaleState: got item from key: \", c, s.created), s.created <= o && (n = !0);\n } catch (t) {\n i.Log.error(\"State.clearStaleState: Error parsing state for key\", c, t.message), n = !0;\n } else i.Log.debug(\"State.clearStaleState: no item in storage for key: \", c), n = !0;\n if (n) return i.Log.debug(\"State.clearStaleState: removed item for key: \", c), r.remove(c);\n }), n.push(u);\n }, a = 0; a < e.length; a++) {\n var u;\n s(a);\n }\n return i.Log.debug(\"State.clearStaleState: waiting on promise count:\", n.length), Promise.all(n);\n });\n }, n(t, [{\n key: \"id\",\n get: function t() {\n return this._id;\n }\n }, {\n key: \"data\",\n get: function t() {\n return this._data;\n }\n }, {\n key: \"created\",\n get: function t() {\n return this._created;\n }\n }, {\n key: \"request_type\",\n get: function t() {\n return this._request_type;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.OidcClient = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0),\n o = r(5),\n s = r(12),\n a = r(8),\n u = r(34),\n c = r(35),\n h = r(36),\n l = r(13),\n f = r(9);\n function g(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n e.OidcClient = function () {\n function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};\n g(this, t), e instanceof o.OidcClientSettings ? this._settings = e : this._settings = new o.OidcClientSettings(e);\n }\n return t.prototype.createSigninRequest = function t() {\n var e = this,\n r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n n = r.response_type,\n o = r.scope,\n s = r.redirect_uri,\n u = r.data,\n c = r.state,\n h = r.prompt,\n l = r.display,\n f = r.max_age,\n g = r.ui_locales,\n d = r.id_token_hint,\n p = r.login_hint,\n v = r.acr_values,\n y = r.resource,\n m = r.request,\n _ = r.request_uri,\n S = r.response_mode,\n b = r.extraQueryParams,\n w = r.extraTokenParams,\n F = r.request_type,\n E = r.skipUserInfo,\n x = arguments[1];\n i.Log.debug(\"OidcClient.createSigninRequest\");\n var A = this._settings.client_id;\n n = n || this._settings.response_type, o = o || this._settings.scope, s = s || this._settings.redirect_uri, h = h || this._settings.prompt, l = l || this._settings.display, f = f || this._settings.max_age, g = g || this._settings.ui_locales, v = v || this._settings.acr_values, y = y || this._settings.resource, S = S || this._settings.response_mode, b = b || this._settings.extraQueryParams, w = w || this._settings.extraTokenParams;\n var k = this._settings.authority;\n return a.SigninRequest.isCode(n) && \"code\" !== n ? Promise.reject(new Error(\"OpenID Connect hybrid flow is not supported\")) : this._metadataService.getAuthorizationEndpoint().then(function (t) {\n i.Log.debug(\"OidcClient.createSigninRequest: Received authorization endpoint\", t);\n var r = new a.SigninRequest({\n url: t,\n client_id: A,\n redirect_uri: s,\n response_type: n,\n scope: o,\n data: u || c,\n authority: k,\n prompt: h,\n display: l,\n max_age: f,\n ui_locales: g,\n id_token_hint: d,\n login_hint: p,\n acr_values: v,\n resource: y,\n request: m,\n request_uri: _,\n extraQueryParams: b,\n extraTokenParams: w,\n request_type: F,\n response_mode: S,\n client_secret: e._settings.client_secret,\n skipUserInfo: E\n }),\n P = r.state;\n return (x = x || e._stateStore).set(P.id, P.toStorageString()).then(function () {\n return r;\n });\n });\n }, t.prototype.readSigninResponseState = function t(e, r) {\n var n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];\n i.Log.debug(\"OidcClient.readSigninResponseState\");\n var o = \"query\" === this._settings.response_mode || !this._settings.response_mode && a.SigninRequest.isCode(this._settings.response_type),\n s = o ? \"?\" : \"#\",\n c = new u.SigninResponse(e, s);\n if (!c.state) return i.Log.error(\"OidcClient.readSigninResponseState: No state in response\"), Promise.reject(new Error(\"No state in response\"));\n r = r || this._stateStore;\n var h = n ? r.remove.bind(r) : r.get.bind(r);\n return h(c.state).then(function (t) {\n if (!t) throw i.Log.error(\"OidcClient.readSigninResponseState: No matching state found in storage\"), new Error(\"No matching state found in storage\");\n return {\n state: l.SigninState.fromStorageString(t),\n response: c\n };\n });\n }, t.prototype.processSigninResponse = function t(e, r) {\n var n = this;\n return i.Log.debug(\"OidcClient.processSigninResponse\"), this.readSigninResponseState(e, r, !0).then(function (t) {\n var e = t.state,\n r = t.response;\n return i.Log.debug(\"OidcClient.processSigninResponse: Received state from storage; validating response\"), n._validator.validateSigninResponse(e, r);\n });\n }, t.prototype.createSignoutRequest = function t() {\n var e = this,\n r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n n = r.id_token_hint,\n o = r.data,\n s = r.state,\n a = r.post_logout_redirect_uri,\n u = r.extraQueryParams,\n h = r.request_type,\n l = arguments[1];\n return i.Log.debug(\"OidcClient.createSignoutRequest\"), a = a || this._settings.post_logout_redirect_uri, u = u || this._settings.extraQueryParams, this._metadataService.getEndSessionEndpoint().then(function (t) {\n if (!t) throw i.Log.error(\"OidcClient.createSignoutRequest: No end session endpoint url returned\"), new Error(\"no end session endpoint\");\n i.Log.debug(\"OidcClient.createSignoutRequest: Received end session endpoint\", t);\n var r = new c.SignoutRequest({\n url: t,\n id_token_hint: n,\n post_logout_redirect_uri: a,\n data: o || s,\n extraQueryParams: u,\n request_type: h\n }),\n f = r.state;\n return f && (i.Log.debug(\"OidcClient.createSignoutRequest: Signout request has state to persist\"), (l = l || e._stateStore).set(f.id, f.toStorageString())), r;\n });\n }, t.prototype.readSignoutResponseState = function t(e, r) {\n var n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];\n i.Log.debug(\"OidcClient.readSignoutResponseState\");\n var o = new h.SignoutResponse(e);\n if (!o.state) return i.Log.debug(\"OidcClient.readSignoutResponseState: No state in response\"), o.error ? (i.Log.warn(\"OidcClient.readSignoutResponseState: Response was error: \", o.error), Promise.reject(new s.ErrorResponse(o))) : Promise.resolve({\n state: void 0,\n response: o\n });\n var a = o.state;\n r = r || this._stateStore;\n var u = n ? r.remove.bind(r) : r.get.bind(r);\n return u(a).then(function (t) {\n if (!t) throw i.Log.error(\"OidcClient.readSignoutResponseState: No matching state found in storage\"), new Error(\"No matching state found in storage\");\n return {\n state: f.State.fromStorageString(t),\n response: o\n };\n });\n }, t.prototype.processSignoutResponse = function t(e, r) {\n var n = this;\n return i.Log.debug(\"OidcClient.processSignoutResponse\"), this.readSignoutResponseState(e, r, !0).then(function (t) {\n var e = t.state,\n r = t.response;\n return e ? (i.Log.debug(\"OidcClient.processSignoutResponse: Received state from storage; validating response\"), n._validator.validateSignoutResponse(e, r)) : (i.Log.debug(\"OidcClient.processSignoutResponse: No state from storage; skipping validating response\"), r);\n });\n }, t.prototype.clearStaleState = function t(e) {\n return i.Log.debug(\"OidcClient.clearStaleState\"), e = e || this._stateStore, f.State.clearStaleState(e, this.settings.staleStateAge);\n }, n(t, [{\n key: \"_stateStore\",\n get: function t() {\n return this.settings.stateStore;\n }\n }, {\n key: \"_validator\",\n get: function t() {\n return this.settings.validator;\n }\n }, {\n key: \"_metadataService\",\n get: function t() {\n return this.settings.metadataService;\n }\n }, {\n key: \"settings\",\n get: function t() {\n return this._settings;\n }\n }, {\n key: \"metadataService\",\n get: function t() {\n return this._metadataService;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.TokenClient = void 0;\n var n = r(7),\n i = r(2),\n o = r(0);\n function s(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n e.TokenClient = function () {\n function t(e) {\n var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : n.JsonService,\n a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : i.MetadataService;\n if (s(this, t), !e) throw o.Log.error(\"TokenClient.ctor: No settings passed\"), new Error(\"settings\");\n this._settings = e, this._jsonService = new r(), this._metadataService = new a(this._settings);\n }\n return t.prototype.exchangeCode = function t() {\n var e = this,\n r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};\n (r = Object.assign({}, r)).grant_type = r.grant_type || \"authorization_code\", r.client_id = r.client_id || this._settings.client_id, r.client_secret = r.client_secret || this._settings.client_secret, r.redirect_uri = r.redirect_uri || this._settings.redirect_uri;\n var n = void 0,\n i = r._client_authentication || this._settings._client_authentication;\n return delete r._client_authentication, r.code ? r.redirect_uri ? r.code_verifier ? r.client_id ? r.client_secret || \"client_secret_basic\" != i ? (\"client_secret_basic\" == i && (n = r.client_id + \":\" + r.client_secret, delete r.client_id, delete r.client_secret), this._metadataService.getTokenEndpoint(!1).then(function (t) {\n return o.Log.debug(\"TokenClient.exchangeCode: Received token endpoint\"), e._jsonService.postForm(t, r, n).then(function (t) {\n return o.Log.debug(\"TokenClient.exchangeCode: response received\"), t;\n });\n })) : (o.Log.error(\"TokenClient.exchangeCode: No client_secret passed\"), Promise.reject(new Error(\"A client_secret is required\"))) : (o.Log.error(\"TokenClient.exchangeCode: No client_id passed\"), Promise.reject(new Error(\"A client_id is required\"))) : (o.Log.error(\"TokenClient.exchangeCode: No code_verifier passed\"), Promise.reject(new Error(\"A code_verifier is required\"))) : (o.Log.error(\"TokenClient.exchangeCode: No redirect_uri passed\"), Promise.reject(new Error(\"A redirect_uri is required\"))) : (o.Log.error(\"TokenClient.exchangeCode: No code passed\"), Promise.reject(new Error(\"A code is required\")));\n }, t.prototype.exchangeRefreshToken = function t() {\n var e = this,\n r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};\n (r = Object.assign({}, r)).grant_type = r.grant_type || \"refresh_token\", r.client_id = r.client_id || this._settings.client_id, r.client_secret = r.client_secret || this._settings.client_secret;\n var n = void 0,\n i = r._client_authentication || this._settings._client_authentication;\n return delete r._client_authentication, r.refresh_token ? r.client_id ? (\"client_secret_basic\" == i && (n = r.client_id + \":\" + r.client_secret, delete r.client_id, delete r.client_secret), this._metadataService.getTokenEndpoint(!1).then(function (t) {\n return o.Log.debug(\"TokenClient.exchangeRefreshToken: Received token endpoint\"), e._jsonService.postForm(t, r, n).then(function (t) {\n return o.Log.debug(\"TokenClient.exchangeRefreshToken: response received\"), t;\n });\n })) : (o.Log.error(\"TokenClient.exchangeRefreshToken: No client_id passed\"), Promise.reject(new Error(\"A client_id is required\"))) : (o.Log.error(\"TokenClient.exchangeRefreshToken: No refresh_token passed\"), Promise.reject(new Error(\"A refresh_token is required\")));\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.ErrorResponse = void 0;\n var n = r(0);\n function i(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n function o(t, e) {\n if (!t) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return !e || \"object\" != typeof e && \"function\" != typeof e ? t : e;\n }\n e.ErrorResponse = function (t) {\n function e() {\n var r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n s = r.error,\n a = r.error_description,\n u = r.error_uri,\n c = r.state,\n h = r.session_state;\n if (i(this, e), !s) throw n.Log.error(\"No error passed to ErrorResponse\"), new Error(\"error\");\n var l = o(this, t.call(this, a || s));\n return l.name = \"ErrorResponse\", l.error = s, l.error_description = a, l.error_uri = u, l.state = c, l.session_state = h, l;\n }\n return function r(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function, not \" + typeof e);\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);\n }(e, t), e;\n }(Error);\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.SigninState = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0),\n o = r(9),\n s = r(4),\n a = function u(t) {\n return t && t.__esModule ? t : {\n default: t\n };\n }(r(14));\n function c(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n function h(t, e) {\n if (!t) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return !e || \"object\" != typeof e && \"function\" != typeof e ? t : e;\n }\n e.SigninState = function (t) {\n function e() {\n var r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n n = r.nonce,\n i = r.authority,\n o = r.client_id,\n u = r.redirect_uri,\n l = r.code_verifier,\n f = r.response_mode,\n g = r.client_secret,\n d = r.scope,\n p = r.extraTokenParams,\n v = r.skipUserInfo;\n c(this, e);\n var y = h(this, t.call(this, arguments[0]));\n if (!0 === n ? y._nonce = (0, a.default)() : n && (y._nonce = n), !0 === l ? y._code_verifier = (0, a.default)() + (0, a.default)() + (0, a.default)() : l && (y._code_verifier = l), y.code_verifier) {\n var m = s.JoseUtil.hashString(y.code_verifier, \"SHA256\");\n y._code_challenge = s.JoseUtil.hexToBase64Url(m);\n }\n return y._redirect_uri = u, y._authority = i, y._client_id = o, y._response_mode = f, y._client_secret = g, y._scope = d, y._extraTokenParams = p, y._skipUserInfo = v, y;\n }\n return function r(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function, not \" + typeof e);\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);\n }(e, t), e.prototype.toStorageString = function t() {\n return i.Log.debug(\"SigninState.toStorageString\"), JSON.stringify({\n id: this.id,\n data: this.data,\n created: this.created,\n request_type: this.request_type,\n nonce: this.nonce,\n code_verifier: this.code_verifier,\n redirect_uri: this.redirect_uri,\n authority: this.authority,\n client_id: this.client_id,\n response_mode: this.response_mode,\n client_secret: this.client_secret,\n scope: this.scope,\n extraTokenParams: this.extraTokenParams,\n skipUserInfo: this.skipUserInfo\n });\n }, e.fromStorageString = function t(r) {\n return i.Log.debug(\"SigninState.fromStorageString\"), new e(JSON.parse(r));\n }, n(e, [{\n key: \"nonce\",\n get: function t() {\n return this._nonce;\n }\n }, {\n key: \"authority\",\n get: function t() {\n return this._authority;\n }\n }, {\n key: \"client_id\",\n get: function t() {\n return this._client_id;\n }\n }, {\n key: \"redirect_uri\",\n get: function t() {\n return this._redirect_uri;\n }\n }, {\n key: \"code_verifier\",\n get: function t() {\n return this._code_verifier;\n }\n }, {\n key: \"code_challenge\",\n get: function t() {\n return this._code_challenge;\n }\n }, {\n key: \"response_mode\",\n get: function t() {\n return this._response_mode;\n }\n }, {\n key: \"client_secret\",\n get: function t() {\n return this._client_secret;\n }\n }, {\n key: \"scope\",\n get: function t() {\n return this._scope;\n }\n }, {\n key: \"extraTokenParams\",\n get: function t() {\n return this._extraTokenParams;\n }\n }, {\n key: \"skipUserInfo\",\n get: function t() {\n return this._skipUserInfo;\n }\n }]), e;\n }(o.State);\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.default = function n() {\n return (\"undefined\" != i && null !== i && void 0 !== i.getRandomValues ? o : s)().replace(/-/g, \"\");\n };\n var i = \"undefined\" != typeof window ? window.crypto || window.msCrypto : null;\n function o() {\n return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (t) {\n return (t ^ i.getRandomValues(new Uint8Array(1))[0] & 15 >> t / 4).toString(16);\n });\n }\n function s() {\n return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (t) {\n return (t ^ 16 * Math.random() >> t / 4).toString(16);\n });\n }\n t.exports = e.default;\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.User = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0);\n e.User = function () {\n function t(e) {\n var r = e.id_token,\n n = e.session_state,\n i = e.access_token,\n o = e.refresh_token,\n s = e.token_type,\n a = e.scope,\n u = e.profile,\n c = e.expires_at,\n h = e.state;\n !function l(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t), this.id_token = r, this.session_state = n, this.access_token = i, this.refresh_token = o, this.token_type = s, this.scope = a, this.profile = u, this.expires_at = c, this.state = h;\n }\n return t.prototype.toStorageString = function t() {\n return i.Log.debug(\"User.toStorageString\"), JSON.stringify({\n id_token: this.id_token,\n session_state: this.session_state,\n access_token: this.access_token,\n refresh_token: this.refresh_token,\n token_type: this.token_type,\n scope: this.scope,\n profile: this.profile,\n expires_at: this.expires_at\n });\n }, t.fromStorageString = function e(r) {\n return i.Log.debug(\"User.fromStorageString\"), new t(JSON.parse(r));\n }, n(t, [{\n key: \"expires_in\",\n get: function t() {\n if (this.expires_at) {\n var e = parseInt(Date.now() / 1e3);\n return this.expires_at - e;\n }\n },\n set: function t(e) {\n var r = parseInt(e);\n if (\"number\" == typeof r && r > 0) {\n var n = parseInt(Date.now() / 1e3);\n this.expires_at = n + r;\n }\n }\n }, {\n key: \"expired\",\n get: function t() {\n var e = this.expires_in;\n if (void 0 !== e) return e <= 0;\n }\n }, {\n key: \"scopes\",\n get: function t() {\n return (this.scope || \"\").split(\" \");\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.AccessTokenEvents = void 0;\n var n = r(0),\n i = r(46);\n function o(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n e.AccessTokenEvents = function () {\n function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n r = e.accessTokenExpiringNotificationTime,\n n = void 0 === r ? 60 : r,\n s = e.accessTokenExpiringTimer,\n a = void 0 === s ? new i.Timer(\"Access token expiring\") : s,\n u = e.accessTokenExpiredTimer,\n c = void 0 === u ? new i.Timer(\"Access token expired\") : u;\n o(this, t), this._accessTokenExpiringNotificationTime = n, this._accessTokenExpiring = a, this._accessTokenExpired = c;\n }\n return t.prototype.load = function t(e) {\n if (e.access_token && void 0 !== e.expires_in) {\n var r = e.expires_in;\n if (n.Log.debug(\"AccessTokenEvents.load: access token present, remaining duration:\", r), r > 0) {\n var i = r - this._accessTokenExpiringNotificationTime;\n i <= 0 && (i = 1), n.Log.debug(\"AccessTokenEvents.load: registering expiring timer in:\", i), this._accessTokenExpiring.init(i);\n } else n.Log.debug(\"AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration.\"), this._accessTokenExpiring.cancel();\n var o = r + 1;\n n.Log.debug(\"AccessTokenEvents.load: registering expired timer in:\", o), this._accessTokenExpired.init(o);\n } else this._accessTokenExpiring.cancel(), this._accessTokenExpired.cancel();\n }, t.prototype.unload = function t() {\n n.Log.debug(\"AccessTokenEvents.unload: canceling existing access token timers\"), this._accessTokenExpiring.cancel(), this._accessTokenExpired.cancel();\n }, t.prototype.addAccessTokenExpiring = function t(e) {\n this._accessTokenExpiring.addHandler(e);\n }, t.prototype.removeAccessTokenExpiring = function t(e) {\n this._accessTokenExpiring.removeHandler(e);\n }, t.prototype.addAccessTokenExpired = function t(e) {\n this._accessTokenExpired.addHandler(e);\n }, t.prototype.removeAccessTokenExpired = function t(e) {\n this._accessTokenExpired.removeHandler(e);\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.Event = void 0;\n var n = r(0);\n e.Event = function () {\n function t(e) {\n !function r(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t), this._name = e, this._callbacks = [];\n }\n return t.prototype.addHandler = function t(e) {\n this._callbacks.push(e);\n }, t.prototype.removeHandler = function t(e) {\n var r = this._callbacks.findIndex(function (t) {\n return t === e;\n });\n r >= 0 && this._callbacks.splice(r, 1);\n }, t.prototype.raise = function t() {\n n.Log.debug(\"Event: Raising event: \" + this._name);\n for (var e = 0; e < this._callbacks.length; e++) {\n var r;\n (r = this._callbacks)[e].apply(r, arguments);\n }\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.SessionMonitor = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0),\n o = r(19),\n s = r(1);\n function a(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n e.SessionMonitor = function () {\n function t(e) {\n var r = this,\n n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : o.CheckSessionIFrame,\n u = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : s.Global.timer;\n if (a(this, t), !e) throw i.Log.error(\"SessionMonitor.ctor: No user manager passed to SessionMonitor\"), new Error(\"userManager\");\n this._userManager = e, this._CheckSessionIFrameCtor = n, this._timer = u, this._userManager.events.addUserLoaded(this._start.bind(this)), this._userManager.events.addUserUnloaded(this._stop.bind(this)), Promise.resolve(this._userManager.getUser().then(function (t) {\n t ? r._start(t) : r._settings.monitorAnonymousSession && r._userManager.querySessionStatus().then(function (t) {\n var e = {\n session_state: t.session_state\n };\n t.sub && t.sid && (e.profile = {\n sub: t.sub,\n sid: t.sid\n }), r._start(e);\n }).catch(function (t) {\n i.Log.error(\"SessionMonitor ctor: error from querySessionStatus:\", t.message);\n });\n }).catch(function (t) {\n i.Log.error(\"SessionMonitor ctor: error from getUser:\", t.message);\n }));\n }\n return t.prototype._start = function t(e) {\n var r = this,\n n = e.session_state;\n n && (e.profile ? (this._sub = e.profile.sub, this._sid = e.profile.sid, i.Log.debug(\"SessionMonitor._start: session_state:\", n, \", sub:\", this._sub)) : (this._sub = void 0, this._sid = void 0, i.Log.debug(\"SessionMonitor._start: session_state:\", n, \", anonymous user\")), this._checkSessionIFrame ? this._checkSessionIFrame.start(n) : this._metadataService.getCheckSessionIframe().then(function (t) {\n if (t) {\n i.Log.debug(\"SessionMonitor._start: Initializing check session iframe\");\n var e = r._client_id,\n o = r._checkSessionInterval,\n s = r._stopCheckSessionOnError;\n r._checkSessionIFrame = new r._CheckSessionIFrameCtor(r._callback.bind(r), e, t, o, s), r._checkSessionIFrame.load().then(function () {\n r._checkSessionIFrame.start(n);\n });\n } else i.Log.warn(\"SessionMonitor._start: No check session iframe found in the metadata\");\n }).catch(function (t) {\n i.Log.error(\"SessionMonitor._start: Error from getCheckSessionIframe:\", t.message);\n }));\n }, t.prototype._stop = function t() {\n var e = this;\n if (this._sub = void 0, this._sid = void 0, this._checkSessionIFrame && (i.Log.debug(\"SessionMonitor._stop\"), this._checkSessionIFrame.stop()), this._settings.monitorAnonymousSession) var r = this._timer.setInterval(function () {\n e._timer.clearInterval(r), e._userManager.querySessionStatus().then(function (t) {\n var r = {\n session_state: t.session_state\n };\n t.sub && t.sid && (r.profile = {\n sub: t.sub,\n sid: t.sid\n }), e._start(r);\n }).catch(function (t) {\n i.Log.error(\"SessionMonitor: error from querySessionStatus:\", t.message);\n });\n }, 1e3);\n }, t.prototype._callback = function t() {\n var e = this;\n this._userManager.querySessionStatus().then(function (t) {\n var r = !0;\n t ? t.sub === e._sub ? (r = !1, e._checkSessionIFrame.start(t.session_state), t.sid === e._sid ? i.Log.debug(\"SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:\", t.session_state) : (i.Log.debug(\"SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:\", t.session_state), e._userManager.events._raiseUserSessionChanged())) : i.Log.debug(\"SessionMonitor._callback: Different subject signed into OP:\", t.sub) : i.Log.debug(\"SessionMonitor._callback: Subject no longer signed into OP\"), r && (e._sub ? (i.Log.debug(\"SessionMonitor._callback: SessionMonitor._callback; raising signed out event\"), e._userManager.events._raiseUserSignedOut()) : (i.Log.debug(\"SessionMonitor._callback: SessionMonitor._callback; raising signed in event\"), e._userManager.events._raiseUserSignedIn()));\n }).catch(function (t) {\n e._sub && (i.Log.debug(\"SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event\", t.message), e._userManager.events._raiseUserSignedOut());\n });\n }, n(t, [{\n key: \"_settings\",\n get: function t() {\n return this._userManager.settings;\n }\n }, {\n key: \"_metadataService\",\n get: function t() {\n return this._userManager.metadataService;\n }\n }, {\n key: \"_client_id\",\n get: function t() {\n return this._settings.client_id;\n }\n }, {\n key: \"_checkSessionInterval\",\n get: function t() {\n return this._settings.checkSessionInterval;\n }\n }, {\n key: \"_stopCheckSessionOnError\",\n get: function t() {\n return this._settings.stopCheckSessionOnError;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.CheckSessionIFrame = void 0;\n var n = r(0);\n function i(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n e.CheckSessionIFrame = function () {\n function t(e, r, n, o) {\n var s = !(arguments.length > 4 && void 0 !== arguments[4]) || arguments[4];\n i(this, t), this._callback = e, this._client_id = r, this._url = n, this._interval = o || 2e3, this._stopOnError = s;\n var a = n.indexOf(\"/\", n.indexOf(\"//\") + 2);\n this._frame_origin = n.substr(0, a), this._frame = window.document.createElement(\"iframe\"), this._frame.style.visibility = \"hidden\", this._frame.style.position = \"absolute\", this._frame.style.display = \"none\", this._frame.width = 0, this._frame.height = 0, this._frame.src = n;\n }\n return t.prototype.load = function t() {\n var e = this;\n return new Promise(function (t) {\n e._frame.onload = function () {\n t();\n }, window.document.body.appendChild(e._frame), e._boundMessageEvent = e._message.bind(e), window.addEventListener(\"message\", e._boundMessageEvent, !1);\n });\n }, t.prototype._message = function t(e) {\n e.origin === this._frame_origin && e.source === this._frame.contentWindow && (\"error\" === e.data ? (n.Log.error(\"CheckSessionIFrame: error message from check session op iframe\"), this._stopOnError && this.stop()) : \"changed\" === e.data ? (n.Log.debug(\"CheckSessionIFrame: changed message from check session op iframe\"), this.stop(), this._callback()) : n.Log.debug(\"CheckSessionIFrame: \" + e.data + \" message from check session op iframe\"));\n }, t.prototype.start = function t(e) {\n var r = this;\n if (this._session_state !== e) {\n n.Log.debug(\"CheckSessionIFrame.start\"), this.stop(), this._session_state = e;\n var i = function t() {\n r._frame.contentWindow.postMessage(r._client_id + \" \" + r._session_state, r._frame_origin);\n };\n i(), this._timer = window.setInterval(i, this._interval);\n }\n }, t.prototype.stop = function t() {\n this._session_state = null, this._timer && (n.Log.debug(\"CheckSessionIFrame.stop\"), window.clearInterval(this._timer), this._timer = null);\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.TokenRevocationClient = void 0;\n var n = r(0),\n i = r(2),\n o = r(1);\n function s(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n var a = \"access_token\",\n u = \"refresh_token\";\n e.TokenRevocationClient = function () {\n function t(e) {\n var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : o.Global.XMLHttpRequest,\n a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : i.MetadataService;\n if (s(this, t), !e) throw n.Log.error(\"TokenRevocationClient.ctor: No settings provided\"), new Error(\"No settings provided.\");\n this._settings = e, this._XMLHttpRequestCtor = r, this._metadataService = new a(this._settings);\n }\n return t.prototype.revoke = function t(e, r) {\n var i = this,\n o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : \"access_token\";\n if (!e) throw n.Log.error(\"TokenRevocationClient.revoke: No token provided\"), new Error(\"No token provided.\");\n if (o !== a && o != u) throw n.Log.error(\"TokenRevocationClient.revoke: Invalid token type\"), new Error(\"Invalid token type.\");\n return this._metadataService.getRevocationEndpoint().then(function (t) {\n if (t) {\n n.Log.debug(\"TokenRevocationClient.revoke: Revoking \" + o);\n var s = i._settings.client_id,\n a = i._settings.client_secret;\n return i._revoke(t, s, a, e, o);\n }\n if (r) throw n.Log.error(\"TokenRevocationClient.revoke: Revocation not supported\"), new Error(\"Revocation not supported\");\n });\n }, t.prototype._revoke = function t(e, r, i, o, s) {\n var a = this;\n return new Promise(function (t, u) {\n var c = new a._XMLHttpRequestCtor();\n c.open(\"POST\", e), c.onload = function () {\n n.Log.debug(\"TokenRevocationClient.revoke: HTTP response received, status\", c.status), 200 === c.status ? t() : u(Error(c.statusText + \" (\" + c.status + \")\"));\n }, c.onerror = function () {\n n.Log.debug(\"TokenRevocationClient.revoke: Network Error.\"), u(\"Network Error\");\n };\n var h = \"client_id=\" + encodeURIComponent(r);\n i && (h += \"&client_secret=\" + encodeURIComponent(i)), h += \"&token_type_hint=\" + encodeURIComponent(s), h += \"&token=\" + encodeURIComponent(o), c.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\"), c.send(h);\n });\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.CordovaPopupWindow = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0);\n e.CordovaPopupWindow = function () {\n function t(e) {\n var r = this;\n !function n(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t), this._promise = new Promise(function (t, e) {\n r._resolve = t, r._reject = e;\n }), this.features = e.popupWindowFeatures || \"location=no,toolbar=no,zoom=no\", this.target = e.popupWindowTarget || \"_blank\", this.redirect_uri = e.startUrl, i.Log.debug(\"CordovaPopupWindow.ctor: redirect_uri: \" + this.redirect_uri);\n }\n return t.prototype._isInAppBrowserInstalled = function t(e) {\n return [\"cordova-plugin-inappbrowser\", \"cordova-plugin-inappbrowser.inappbrowser\", \"org.apache.cordova.inappbrowser\"].some(function (t) {\n return e.hasOwnProperty(t);\n });\n }, t.prototype.navigate = function t(e) {\n if (e && e.url) {\n if (!window.cordova) return this._error(\"cordova is undefined\");\n var r = window.cordova.require(\"cordova/plugin_list\").metadata;\n if (!1 === this._isInAppBrowserInstalled(r)) return this._error(\"InAppBrowser plugin not found\");\n this._popup = cordova.InAppBrowser.open(e.url, this.target, this.features), this._popup ? (i.Log.debug(\"CordovaPopupWindow.navigate: popup successfully created\"), this._exitCallbackEvent = this._exitCallback.bind(this), this._loadStartCallbackEvent = this._loadStartCallback.bind(this), this._popup.addEventListener(\"exit\", this._exitCallbackEvent, !1), this._popup.addEventListener(\"loadstart\", this._loadStartCallbackEvent, !1)) : this._error(\"Error opening popup window\");\n } else this._error(\"No url provided\");\n return this.promise;\n }, t.prototype._loadStartCallback = function t(e) {\n 0 === e.url.indexOf(this.redirect_uri) && this._success({\n url: e.url\n });\n }, t.prototype._exitCallback = function t(e) {\n this._error(e);\n }, t.prototype._success = function t(e) {\n this._cleanup(), i.Log.debug(\"CordovaPopupWindow: Successful response from cordova popup window\"), this._resolve(e);\n }, t.prototype._error = function t(e) {\n this._cleanup(), i.Log.error(e), this._reject(new Error(e));\n }, t.prototype.close = function t() {\n this._cleanup();\n }, t.prototype._cleanup = function t() {\n this._popup && (i.Log.debug(\"CordovaPopupWindow: cleaning up popup\"), this._popup.removeEventListener(\"exit\", this._exitCallbackEvent, !1), this._popup.removeEventListener(\"loadstart\", this._loadStartCallbackEvent, !1), this._popup.close()), this._popup = null;\n }, n(t, [{\n key: \"promise\",\n get: function t() {\n return this._promise;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n var n = r(0),\n i = r(10),\n o = r(5),\n s = r(6),\n a = r(37),\n u = r(38),\n c = r(16),\n h = r(2),\n l = r(48),\n f = r(49),\n g = r(19),\n d = r(20),\n p = r(18),\n v = r(1),\n y = r(15),\n m = r(50);\n e.default = {\n Version: m.Version,\n Log: n.Log,\n OidcClient: i.OidcClient,\n OidcClientSettings: o.OidcClientSettings,\n WebStorageStateStore: s.WebStorageStateStore,\n InMemoryWebStorage: a.InMemoryWebStorage,\n UserManager: u.UserManager,\n AccessTokenEvents: c.AccessTokenEvents,\n MetadataService: h.MetadataService,\n CordovaPopupNavigator: l.CordovaPopupNavigator,\n CordovaIFrameNavigator: f.CordovaIFrameNavigator,\n CheckSessionIFrame: g.CheckSessionIFrame,\n TokenRevocationClient: d.TokenRevocationClient,\n SessionMonitor: p.SessionMonitor,\n Global: v.Global,\n User: y.User\n }, t.exports = e.default;\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n e.ClockService = function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n }\n return t.prototype.getEpochTime = function t() {\n return Promise.resolve(Date.now() / 1e3 | 0);\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.ResponseValidator = void 0;\n var n = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (t) {\n return typeof t;\n } : function (t) {\n return t && \"function\" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? \"symbol\" : typeof t;\n },\n i = r(0),\n o = r(2),\n s = r(25),\n a = r(11),\n u = r(12),\n c = r(4);\n function h(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n var l = [\"nonce\", \"at_hash\", \"iat\", \"nbf\", \"exp\", \"aud\", \"iss\", \"c_hash\"];\n e.ResponseValidator = function () {\n function t(e) {\n var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : o.MetadataService,\n n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : s.UserInfoService,\n u = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : c.JoseUtil,\n l = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : a.TokenClient;\n if (h(this, t), !e) throw i.Log.error(\"ResponseValidator.ctor: No settings passed to ResponseValidator\"), new Error(\"settings\");\n this._settings = e, this._metadataService = new r(this._settings), this._userInfoService = new n(this._settings), this._joseUtil = u, this._tokenClient = new l(this._settings);\n }\n return t.prototype.validateSigninResponse = function t(e, r) {\n var n = this;\n return i.Log.debug(\"ResponseValidator.validateSigninResponse\"), this._processSigninParams(e, r).then(function (t) {\n return i.Log.debug(\"ResponseValidator.validateSigninResponse: state processed\"), n._validateTokens(e, t).then(function (t) {\n return i.Log.debug(\"ResponseValidator.validateSigninResponse: tokens validated\"), n._processClaims(e, t).then(function (t) {\n return i.Log.debug(\"ResponseValidator.validateSigninResponse: claims processed\"), t;\n });\n });\n });\n }, t.prototype.validateSignoutResponse = function t(e, r) {\n return e.id !== r.state ? (i.Log.error(\"ResponseValidator.validateSignoutResponse: State does not match\"), Promise.reject(new Error(\"State does not match\"))) : (i.Log.debug(\"ResponseValidator.validateSignoutResponse: state validated\"), r.state = e.data, r.error ? (i.Log.warn(\"ResponseValidator.validateSignoutResponse: Response was error\", r.error), Promise.reject(new u.ErrorResponse(r))) : Promise.resolve(r));\n }, t.prototype._processSigninParams = function t(e, r) {\n if (e.id !== r.state) return i.Log.error(\"ResponseValidator._processSigninParams: State does not match\"), Promise.reject(new Error(\"State does not match\"));\n if (!e.client_id) return i.Log.error(\"ResponseValidator._processSigninParams: No client_id on state\"), Promise.reject(new Error(\"No client_id on state\"));\n if (!e.authority) return i.Log.error(\"ResponseValidator._processSigninParams: No authority on state\"), Promise.reject(new Error(\"No authority on state\"));\n if (this._settings.authority) {\n if (this._settings.authority && this._settings.authority !== e.authority) return i.Log.error(\"ResponseValidator._processSigninParams: authority mismatch on settings vs. signin state\"), Promise.reject(new Error(\"authority mismatch on settings vs. signin state\"));\n } else this._settings.authority = e.authority;\n if (this._settings.client_id) {\n if (this._settings.client_id && this._settings.client_id !== e.client_id) return i.Log.error(\"ResponseValidator._processSigninParams: client_id mismatch on settings vs. signin state\"), Promise.reject(new Error(\"client_id mismatch on settings vs. signin state\"));\n } else this._settings.client_id = e.client_id;\n return i.Log.debug(\"ResponseValidator._processSigninParams: state validated\"), r.state = e.data, r.error ? (i.Log.warn(\"ResponseValidator._processSigninParams: Response was error\", r.error), Promise.reject(new u.ErrorResponse(r))) : e.nonce && !r.id_token ? (i.Log.error(\"ResponseValidator._processSigninParams: Expecting id_token in response\"), Promise.reject(new Error(\"No id_token in response\"))) : !e.nonce && r.id_token ? (i.Log.error(\"ResponseValidator._processSigninParams: Not expecting id_token in response\"), Promise.reject(new Error(\"Unexpected id_token in response\"))) : e.code_verifier && !r.code ? (i.Log.error(\"ResponseValidator._processSigninParams: Expecting code in response\"), Promise.reject(new Error(\"No code in response\"))) : !e.code_verifier && r.code ? (i.Log.error(\"ResponseValidator._processSigninParams: Not expecting code in response\"), Promise.reject(new Error(\"Unexpected code in response\"))) : (r.scope || (r.scope = e.scope), Promise.resolve(r));\n }, t.prototype._processClaims = function t(e, r) {\n var n = this;\n if (r.isOpenIdConnect) {\n if (i.Log.debug(\"ResponseValidator._processClaims: response is OIDC, processing claims\"), r.profile = this._filterProtocolClaims(r.profile), !0 !== e.skipUserInfo && this._settings.loadUserInfo && r.access_token) return i.Log.debug(\"ResponseValidator._processClaims: loading user info\"), this._userInfoService.getClaims(r.access_token).then(function (t) {\n return i.Log.debug(\"ResponseValidator._processClaims: user info claims received from user info endpoint\"), t.sub !== r.profile.sub ? (i.Log.error(\"ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token\"), Promise.reject(new Error(\"sub from user info endpoint does not match sub in id_token\"))) : (r.profile = n._mergeClaims(r.profile, t), i.Log.debug(\"ResponseValidator._processClaims: user info claims received, updated profile:\", r.profile), r);\n });\n i.Log.debug(\"ResponseValidator._processClaims: not loading user info\");\n } else i.Log.debug(\"ResponseValidator._processClaims: response is not OIDC, not processing claims\");\n return Promise.resolve(r);\n }, t.prototype._mergeClaims = function t(e, r) {\n var i = Object.assign({}, e);\n for (var o in r) {\n var s = r[o];\n Array.isArray(s) || (s = [s]);\n for (var a = 0; a < s.length; a++) {\n var u = s[a];\n i[o] ? Array.isArray(i[o]) ? i[o].indexOf(u) < 0 && i[o].push(u) : i[o] !== u && (\"object\" === (void 0 === u ? \"undefined\" : n(u)) && this._settings.mergeClaims ? i[o] = this._mergeClaims(i[o], u) : i[o] = [i[o], u]) : i[o] = u;\n }\n }\n return i;\n }, t.prototype._filterProtocolClaims = function t(e) {\n i.Log.debug(\"ResponseValidator._filterProtocolClaims, incoming claims:\", e);\n var r = Object.assign({}, e);\n return this._settings._filterProtocolClaims ? (l.forEach(function (t) {\n delete r[t];\n }), i.Log.debug(\"ResponseValidator._filterProtocolClaims: protocol claims filtered\", r)) : i.Log.debug(\"ResponseValidator._filterProtocolClaims: protocol claims not filtered\"), r;\n }, t.prototype._validateTokens = function t(e, r) {\n return r.code ? (i.Log.debug(\"ResponseValidator._validateTokens: Validating code\"), this._processCode(e, r)) : r.id_token ? r.access_token ? (i.Log.debug(\"ResponseValidator._validateTokens: Validating id_token and access_token\"), this._validateIdTokenAndAccessToken(e, r)) : (i.Log.debug(\"ResponseValidator._validateTokens: Validating id_token\"), this._validateIdToken(e, r)) : (i.Log.debug(\"ResponseValidator._validateTokens: No code to process or id_token to validate\"), Promise.resolve(r));\n }, t.prototype._processCode = function t(e, r) {\n var o = this,\n s = {\n client_id: e.client_id,\n client_secret: e.client_secret,\n code: r.code,\n redirect_uri: e.redirect_uri,\n code_verifier: e.code_verifier\n };\n return e.extraTokenParams && \"object\" === n(e.extraTokenParams) && Object.assign(s, e.extraTokenParams), this._tokenClient.exchangeCode(s).then(function (t) {\n for (var n in t) r[n] = t[n];\n return r.id_token ? (i.Log.debug(\"ResponseValidator._processCode: token response successful, processing id_token\"), o._validateIdTokenAttributes(e, r)) : (i.Log.debug(\"ResponseValidator._processCode: token response successful, returning response\"), r);\n });\n }, t.prototype._validateIdTokenAttributes = function t(e, r) {\n var n = this;\n return this._metadataService.getIssuer().then(function (t) {\n var o = e.client_id,\n s = n._settings.clockSkew;\n return i.Log.debug(\"ResponseValidator._validateIdTokenAttributes: Validaing JWT attributes; using clock skew (in seconds) of: \", s), n._settings.getEpochTime().then(function (a) {\n return n._joseUtil.validateJwtAttributes(r.id_token, t, o, s, a).then(function (t) {\n return e.nonce && e.nonce !== t.nonce ? (i.Log.error(\"ResponseValidator._validateIdTokenAttributes: Invalid nonce in id_token\"), Promise.reject(new Error(\"Invalid nonce in id_token\"))) : t.sub ? (r.profile = t, r) : (i.Log.error(\"ResponseValidator._validateIdTokenAttributes: No sub present in id_token\"), Promise.reject(new Error(\"No sub present in id_token\")));\n });\n });\n });\n }, t.prototype._validateIdTokenAndAccessToken = function t(e, r) {\n var n = this;\n return this._validateIdToken(e, r).then(function (t) {\n return n._validateAccessToken(t);\n });\n }, t.prototype._getSigningKeyForJwt = function t(e) {\n var r = this;\n return this._metadataService.getSigningKeys().then(function (t) {\n var n = e.header.kid;\n if (!t) return i.Log.error(\"ResponseValidator._validateIdToken: No signing keys from metadata\"), Promise.reject(new Error(\"No signing keys from metadata\"));\n i.Log.debug(\"ResponseValidator._validateIdToken: Received signing keys\");\n var o = void 0;\n if (n) o = t.filter(function (t) {\n return t.kid === n;\n })[0];else {\n if ((t = r._filterByAlg(t, e.header.alg)).length > 1) return i.Log.error(\"ResponseValidator._validateIdToken: No kid found in id_token and more than one key found in metadata\"), Promise.reject(new Error(\"No kid found in id_token and more than one key found in metadata\"));\n o = t[0];\n }\n return Promise.resolve(o);\n });\n }, t.prototype._getSigningKeyForJwtWithSingleRetry = function t(e) {\n var r = this;\n return this._getSigningKeyForJwt(e).then(function (t) {\n return t ? Promise.resolve(t) : (r._metadataService.resetSigningKeys(), r._getSigningKeyForJwt(e));\n });\n }, t.prototype._validateIdToken = function t(e, r) {\n var n = this;\n if (!e.nonce) return i.Log.error(\"ResponseValidator._validateIdToken: No nonce on state\"), Promise.reject(new Error(\"No nonce on state\"));\n var o = this._joseUtil.parseJwt(r.id_token);\n return o && o.header && o.payload ? e.nonce !== o.payload.nonce ? (i.Log.error(\"ResponseValidator._validateIdToken: Invalid nonce in id_token\"), Promise.reject(new Error(\"Invalid nonce in id_token\"))) : this._metadataService.getIssuer().then(function (t) {\n return i.Log.debug(\"ResponseValidator._validateIdToken: Received issuer\"), n._getSigningKeyForJwtWithSingleRetry(o).then(function (s) {\n if (!s) return i.Log.error(\"ResponseValidator._validateIdToken: No key matching kid or alg found in signing keys\"), Promise.reject(new Error(\"No key matching kid or alg found in signing keys\"));\n var a = e.client_id,\n u = n._settings.clockSkew;\n return i.Log.debug(\"ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: \", u), n._joseUtil.validateJwt(r.id_token, s, t, a, u).then(function () {\n return i.Log.debug(\"ResponseValidator._validateIdToken: JWT validation successful\"), o.payload.sub ? (r.profile = o.payload, r) : (i.Log.error(\"ResponseValidator._validateIdToken: No sub present in id_token\"), Promise.reject(new Error(\"No sub present in id_token\")));\n });\n });\n }) : (i.Log.error(\"ResponseValidator._validateIdToken: Failed to parse id_token\", o), Promise.reject(new Error(\"Failed to parse id_token\")));\n }, t.prototype._filterByAlg = function t(e, r) {\n var n = null;\n if (r.startsWith(\"RS\")) n = \"RSA\";else if (r.startsWith(\"PS\")) n = \"PS\";else {\n if (!r.startsWith(\"ES\")) return i.Log.debug(\"ResponseValidator._filterByAlg: alg not supported: \", r), [];\n n = \"EC\";\n }\n return i.Log.debug(\"ResponseValidator._filterByAlg: Looking for keys that match kty: \", n), e = e.filter(function (t) {\n return t.kty === n;\n }), i.Log.debug(\"ResponseValidator._filterByAlg: Number of keys that match kty: \", n, e.length), e;\n }, t.prototype._validateAccessToken = function t(e) {\n if (!e.profile) return i.Log.error(\"ResponseValidator._validateAccessToken: No profile loaded from id_token\"), Promise.reject(new Error(\"No profile loaded from id_token\"));\n if (!e.profile.at_hash) return i.Log.error(\"ResponseValidator._validateAccessToken: No at_hash in id_token\"), Promise.reject(new Error(\"No at_hash in id_token\"));\n if (!e.id_token) return i.Log.error(\"ResponseValidator._validateAccessToken: No id_token\"), Promise.reject(new Error(\"No id_token\"));\n var r = this._joseUtil.parseJwt(e.id_token);\n if (!r || !r.header) return i.Log.error(\"ResponseValidator._validateAccessToken: Failed to parse id_token\", r), Promise.reject(new Error(\"Failed to parse id_token\"));\n var n = r.header.alg;\n if (!n || 5 !== n.length) return i.Log.error(\"ResponseValidator._validateAccessToken: Unsupported alg:\", n), Promise.reject(new Error(\"Unsupported alg: \" + n));\n var o = n.substr(2, 3);\n if (!o) return i.Log.error(\"ResponseValidator._validateAccessToken: Unsupported alg:\", n, o), Promise.reject(new Error(\"Unsupported alg: \" + n));\n if (256 !== (o = parseInt(o)) && 384 !== o && 512 !== o) return i.Log.error(\"ResponseValidator._validateAccessToken: Unsupported alg:\", n, o), Promise.reject(new Error(\"Unsupported alg: \" + n));\n var s = \"sha\" + o,\n a = this._joseUtil.hashString(e.access_token, s);\n if (!a) return i.Log.error(\"ResponseValidator._validateAccessToken: access_token hash failed:\", s), Promise.reject(new Error(\"Failed to validate at_hash\"));\n var u = a.substr(0, a.length / 2),\n c = this._joseUtil.hexToBase64Url(u);\n return c !== e.profile.at_hash ? (i.Log.error(\"ResponseValidator._validateAccessToken: Failed to validate at_hash\", c, e.profile.at_hash), Promise.reject(new Error(\"Failed to validate at_hash\"))) : (i.Log.debug(\"ResponseValidator._validateAccessToken: success\"), Promise.resolve(e));\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.UserInfoService = void 0;\n var n = r(7),\n i = r(2),\n o = r(0),\n s = r(4);\n function a(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n e.UserInfoService = function () {\n function t(e) {\n var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : n.JsonService,\n u = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : i.MetadataService,\n c = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : s.JoseUtil;\n if (a(this, t), !e) throw o.Log.error(\"UserInfoService.ctor: No settings passed\"), new Error(\"settings\");\n this._settings = e, this._jsonService = new r(void 0, void 0, this._getClaimsFromJwt.bind(this)), this._metadataService = new u(this._settings), this._joseUtil = c;\n }\n return t.prototype.getClaims = function t(e) {\n var r = this;\n return e ? this._metadataService.getUserInfoEndpoint().then(function (t) {\n return o.Log.debug(\"UserInfoService.getClaims: received userinfo url\", t), r._jsonService.getJson(t, e).then(function (t) {\n return o.Log.debug(\"UserInfoService.getClaims: claims received\", t), t;\n });\n }) : (o.Log.error(\"UserInfoService.getClaims: No token passed\"), Promise.reject(new Error(\"A token is required\")));\n }, t.prototype._getClaimsFromJwt = function t(e) {\n var r = this;\n try {\n var n = this._joseUtil.parseJwt(e.responseText);\n if (!n || !n.header || !n.payload) return o.Log.error(\"UserInfoService._getClaimsFromJwt: Failed to parse JWT\", n), Promise.reject(new Error(\"Failed to parse id_token\"));\n var i = n.header.kid,\n s = void 0;\n switch (this._settings.userInfoJwtIssuer) {\n case \"OP\":\n s = this._metadataService.getIssuer();\n break;\n case \"ANY\":\n s = Promise.resolve(n.payload.iss);\n break;\n default:\n s = Promise.resolve(this._settings.userInfoJwtIssuer);\n }\n return s.then(function (t) {\n return o.Log.debug(\"UserInfoService._getClaimsFromJwt: Received issuer:\" + t), r._metadataService.getSigningKeys().then(function (s) {\n if (!s) return o.Log.error(\"UserInfoService._getClaimsFromJwt: No signing keys from metadata\"), Promise.reject(new Error(\"No signing keys from metadata\"));\n o.Log.debug(\"UserInfoService._getClaimsFromJwt: Received signing keys\");\n var a = void 0;\n if (i) a = s.filter(function (t) {\n return t.kid === i;\n })[0];else {\n if ((s = r._filterByAlg(s, n.header.alg)).length > 1) return o.Log.error(\"UserInfoService._getClaimsFromJwt: No kid found in id_token and more than one key found in metadata\"), Promise.reject(new Error(\"No kid found in id_token and more than one key found in metadata\"));\n a = s[0];\n }\n if (!a) return o.Log.error(\"UserInfoService._getClaimsFromJwt: No key matching kid or alg found in signing keys\"), Promise.reject(new Error(\"No key matching kid or alg found in signing keys\"));\n var u = r._settings.client_id,\n c = r._settings.clockSkew;\n return o.Log.debug(\"UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: \", c), r._joseUtil.validateJwt(e.responseText, a, t, u, c, void 0, !0).then(function () {\n return o.Log.debug(\"UserInfoService._getClaimsFromJwt: JWT validation successful\"), n.payload;\n });\n });\n });\n } catch (t) {\n return o.Log.error(\"UserInfoService._getClaimsFromJwt: Error parsing JWT response\", t.message), void reject(t);\n }\n }, t.prototype._filterByAlg = function t(e, r) {\n var n = null;\n if (r.startsWith(\"RS\")) n = \"RSA\";else if (r.startsWith(\"PS\")) n = \"PS\";else {\n if (!r.startsWith(\"ES\")) return o.Log.debug(\"UserInfoService._filterByAlg: alg not supported: \", r), [];\n n = \"EC\";\n }\n return o.Log.debug(\"UserInfoService._filterByAlg: Looking for keys that match kty: \", n), e = e.filter(function (t) {\n return t.kty === n;\n }), o.Log.debug(\"UserInfoService._filterByAlg: Number of keys that match kty: \", n, e.length), e;\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.AllowedSigningAlgs = e.b64tohex = e.hextob64u = e.crypto = e.X509 = e.KeyUtil = e.jws = void 0;\n var n = r(27);\n e.jws = n.jws, e.KeyUtil = n.KEYUTIL, e.X509 = n.X509, e.crypto = n.crypto, e.hextob64u = n.hextob64u, e.b64tohex = n.b64tohex, e.AllowedSigningAlgs = [\"RS256\", \"RS384\", \"RS512\", \"PS256\", \"PS384\", \"PS512\", \"ES256\", \"ES384\", \"ES512\"];\n }, function (t, e, r) {\n \"use strict\";\n\n (function (t) {\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n var r = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (t) {\n return typeof t;\n } : function (t) {\n return t && \"function\" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? \"symbol\" : typeof t;\n },\n n = {\n userAgent: !1\n },\n i = {};\n /*!\n Copyright (c) 2011, Yahoo! Inc. All rights reserved.\n Code licensed under the BSD License:\n http://developer.yahoo.com/yui/license.html\n version: 2.9.0\n */\n if (void 0 === o) var o = {};\n o.lang = {\n extend: function t(e, r, i) {\n if (!r || !e) throw new Error(\"YAHOO.lang.extend failed, please check that all dependencies are included.\");\n var o = function t() {};\n if (o.prototype = r.prototype, e.prototype = new o(), e.prototype.constructor = e, e.superclass = r.prototype, r.prototype.constructor == Object.prototype.constructor && (r.prototype.constructor = r), i) {\n var s;\n for (s in i) e.prototype[s] = i[s];\n var a = function t() {},\n u = [\"toString\", \"valueOf\"];\n try {\n /MSIE/.test(n.userAgent) && (a = function t(e, r) {\n for (s = 0; s < u.length; s += 1) {\n var n = u[s],\n i = r[n];\n \"function\" == typeof i && i != Object.prototype[n] && (e[n] = i);\n }\n });\n } catch (t) {}\n a(e.prototype, i);\n }\n }\n };\n /*! CryptoJS v3.1.2 core-fix.js\n * code.google.com/p/crypto-js\n * (c) 2009-2013 by Jeff Mott. All rights reserved.\n * code.google.com/p/crypto-js/wiki/License\n * THIS IS FIX of 'core.js' to fix Hmac issue.\n * https://code.google.com/p/crypto-js/issues/detail?id=84\n * https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js\n */\n var s,\n a,\n u,\n c,\n h,\n l,\n f,\n g,\n d,\n p,\n v,\n y = y || (s = Math, u = (a = {}).lib = {}, c = u.Base = function () {\n function t() {}\n return {\n extend: function e(r) {\n t.prototype = this;\n var n = new t();\n return r && n.mixIn(r), n.hasOwnProperty(\"init\") || (n.init = function () {\n n.$super.init.apply(this, arguments);\n }), n.init.prototype = n, n.$super = this, n;\n },\n create: function t() {\n var e = this.extend();\n return e.init.apply(e, arguments), e;\n },\n init: function t() {},\n mixIn: function t(e) {\n for (var r in e) e.hasOwnProperty(r) && (this[r] = e[r]);\n e.hasOwnProperty(\"toString\") && (this.toString = e.toString);\n },\n clone: function t() {\n return this.init.prototype.extend(this);\n }\n };\n }(), h = u.WordArray = c.extend({\n init: function t(e, r) {\n e = this.words = e || [], this.sigBytes = null != r ? r : 4 * e.length;\n },\n toString: function t(e) {\n return (e || f).stringify(this);\n },\n concat: function t(e) {\n var r = this.words,\n n = e.words,\n i = this.sigBytes,\n o = e.sigBytes;\n if (this.clamp(), i % 4) for (var s = 0; s < o; s++) {\n var a = n[s >>> 2] >>> 24 - s % 4 * 8 & 255;\n r[i + s >>> 2] |= a << 24 - (i + s) % 4 * 8;\n } else for (s = 0; s < o; s += 4) r[i + s >>> 2] = n[s >>> 2];\n return this.sigBytes += o, this;\n },\n clamp: function t() {\n var e = this.words,\n r = this.sigBytes;\n e[r >>> 2] &= 4294967295 << 32 - r % 4 * 8, e.length = s.ceil(r / 4);\n },\n clone: function t() {\n var e = c.clone.call(this);\n return e.words = this.words.slice(0), e;\n },\n random: function t(e) {\n for (var r = [], n = 0; n < e; n += 4) r.push(4294967296 * s.random() | 0);\n return new h.init(r, e);\n }\n }), l = a.enc = {}, f = l.Hex = {\n stringify: function t(e) {\n for (var r = e.words, n = e.sigBytes, i = [], o = 0; o < n; o++) {\n var s = r[o >>> 2] >>> 24 - o % 4 * 8 & 255;\n i.push((s >>> 4).toString(16)), i.push((15 & s).toString(16));\n }\n return i.join(\"\");\n },\n parse: function t(e) {\n for (var r = e.length, n = [], i = 0; i < r; i += 2) n[i >>> 3] |= parseInt(e.substr(i, 2), 16) << 24 - i % 8 * 4;\n return new h.init(n, r / 2);\n }\n }, g = l.Latin1 = {\n stringify: function t(e) {\n for (var r = e.words, n = e.sigBytes, i = [], o = 0; o < n; o++) {\n var s = r[o >>> 2] >>> 24 - o % 4 * 8 & 255;\n i.push(String.fromCharCode(s));\n }\n return i.join(\"\");\n },\n parse: function t(e) {\n for (var r = e.length, n = [], i = 0; i < r; i++) n[i >>> 2] |= (255 & e.charCodeAt(i)) << 24 - i % 4 * 8;\n return new h.init(n, r);\n }\n }, d = l.Utf8 = {\n stringify: function t(e) {\n try {\n return decodeURIComponent(escape(g.stringify(e)));\n } catch (t) {\n throw new Error(\"Malformed UTF-8 data\");\n }\n },\n parse: function t(e) {\n return g.parse(unescape(encodeURIComponent(e)));\n }\n }, p = u.BufferedBlockAlgorithm = c.extend({\n reset: function t() {\n this._data = new h.init(), this._nDataBytes = 0;\n },\n _append: function t(e) {\n \"string\" == typeof e && (e = d.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes;\n },\n _process: function t(e) {\n var r = this._data,\n n = r.words,\n i = r.sigBytes,\n o = this.blockSize,\n a = i / (4 * o),\n u = (a = e ? s.ceil(a) : s.max((0 | a) - this._minBufferSize, 0)) * o,\n c = s.min(4 * u, i);\n if (u) {\n for (var l = 0; l < u; l += o) this._doProcessBlock(n, l);\n var f = n.splice(0, u);\n r.sigBytes -= c;\n }\n return new h.init(f, c);\n },\n clone: function t() {\n var e = c.clone.call(this);\n return e._data = this._data.clone(), e;\n },\n _minBufferSize: 0\n }), u.Hasher = p.extend({\n cfg: c.extend(),\n init: function t(e) {\n this.cfg = this.cfg.extend(e), this.reset();\n },\n reset: function t() {\n p.reset.call(this), this._doReset();\n },\n update: function t(e) {\n return this._append(e), this._process(), this;\n },\n finalize: function t(e) {\n return e && this._append(e), this._doFinalize();\n },\n blockSize: 16,\n _createHelper: function t(e) {\n return function (t, r) {\n return new e.init(r).finalize(t);\n };\n },\n _createHmacHelper: function t(e) {\n return function (t, r) {\n return new v.HMAC.init(e, r).finalize(t);\n };\n }\n }), v = a.algo = {}, a);\n !function (t) {\n var e,\n r = (e = y).lib,\n n = r.Base,\n i = r.WordArray;\n (e = e.x64 = {}).Word = n.extend({\n init: function t(e, r) {\n this.high = e, this.low = r;\n }\n }), e.WordArray = n.extend({\n init: function t(e, r) {\n e = this.words = e || [], this.sigBytes = null != r ? r : 8 * e.length;\n },\n toX32: function t() {\n for (var e = this.words, r = e.length, n = [], o = 0; o < r; o++) {\n var s = e[o];\n n.push(s.high), n.push(s.low);\n }\n return i.create(n, this.sigBytes);\n },\n clone: function t() {\n for (var e = n.clone.call(this), r = e.words = this.words.slice(0), i = r.length, o = 0; o < i; o++) r[o] = r[o].clone();\n return e;\n }\n });\n }(), function () {\n var t = y,\n e = t.lib.WordArray;\n t.enc.Base64 = {\n stringify: function t(e) {\n var r = e.words,\n n = e.sigBytes,\n i = this._map;\n e.clamp(), e = [];\n for (var o = 0; o < n; o += 3) for (var s = (r[o >>> 2] >>> 24 - o % 4 * 8 & 255) << 16 | (r[o + 1 >>> 2] >>> 24 - (o + 1) % 4 * 8 & 255) << 8 | r[o + 2 >>> 2] >>> 24 - (o + 2) % 4 * 8 & 255, a = 0; 4 > a && o + .75 * a < n; a++) e.push(i.charAt(s >>> 6 * (3 - a) & 63));\n if (r = i.charAt(64)) for (; e.length % 4;) e.push(r);\n return e.join(\"\");\n },\n parse: function t(r) {\n var n = r.length,\n i = this._map;\n (o = i.charAt(64)) && -1 != (o = r.indexOf(o)) && (n = o);\n for (var o = [], s = 0, a = 0; a < n; a++) if (a % 4) {\n var u = i.indexOf(r.charAt(a - 1)) << a % 4 * 2,\n c = i.indexOf(r.charAt(a)) >>> 6 - a % 4 * 2;\n o[s >>> 2] |= (u | c) << 24 - s % 4 * 8, s++;\n }\n return e.create(o, s);\n },\n _map: \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"\n };\n }(), function (t) {\n for (var e = y, r = (i = e.lib).WordArray, n = i.Hasher, i = e.algo, o = [], s = [], a = function t(e) {\n return 4294967296 * (e - (0 | e)) | 0;\n }, u = 2, c = 0; 64 > c;) {\n var h;\n t: {\n h = u;\n for (var l = t.sqrt(h), f = 2; f <= l; f++) if (!(h % f)) {\n h = !1;\n break t;\n }\n h = !0;\n }\n h && (8 > c && (o[c] = a(t.pow(u, .5))), s[c] = a(t.pow(u, 1 / 3)), c++), u++;\n }\n var g = [];\n i = i.SHA256 = n.extend({\n _doReset: function t() {\n this._hash = new r.init(o.slice(0));\n },\n _doProcessBlock: function t(e, r) {\n for (var n = this._hash.words, i = n[0], o = n[1], a = n[2], u = n[3], c = n[4], h = n[5], l = n[6], f = n[7], d = 0; 64 > d; d++) {\n if (16 > d) g[d] = 0 | e[r + d];else {\n var p = g[d - 15],\n v = g[d - 2];\n g[d] = ((p << 25 | p >>> 7) ^ (p << 14 | p >>> 18) ^ p >>> 3) + g[d - 7] + ((v << 15 | v >>> 17) ^ (v << 13 | v >>> 19) ^ v >>> 10) + g[d - 16];\n }\n p = f + ((c << 26 | c >>> 6) ^ (c << 21 | c >>> 11) ^ (c << 7 | c >>> 25)) + (c & h ^ ~c & l) + s[d] + g[d], v = ((i << 30 | i >>> 2) ^ (i << 19 | i >>> 13) ^ (i << 10 | i >>> 22)) + (i & o ^ i & a ^ o & a), f = l, l = h, h = c, c = u + p | 0, u = a, a = o, o = i, i = p + v | 0;\n }\n n[0] = n[0] + i | 0, n[1] = n[1] + o | 0, n[2] = n[2] + a | 0, n[3] = n[3] + u | 0, n[4] = n[4] + c | 0, n[5] = n[5] + h | 0, n[6] = n[6] + l | 0, n[7] = n[7] + f | 0;\n },\n _doFinalize: function e() {\n var r = this._data,\n n = r.words,\n i = 8 * this._nDataBytes,\n o = 8 * r.sigBytes;\n return n[o >>> 5] |= 128 << 24 - o % 32, n[14 + (o + 64 >>> 9 << 4)] = t.floor(i / 4294967296), n[15 + (o + 64 >>> 9 << 4)] = i, r.sigBytes = 4 * n.length, this._process(), this._hash;\n },\n clone: function t() {\n var e = n.clone.call(this);\n return e._hash = this._hash.clone(), e;\n }\n });\n e.SHA256 = n._createHelper(i), e.HmacSHA256 = n._createHmacHelper(i);\n }(Math), function () {\n function t() {\n return n.create.apply(n, arguments);\n }\n for (var e = y, r = e.lib.Hasher, n = (o = e.x64).Word, i = o.WordArray, o = e.algo, s = [t(1116352408, 3609767458), t(1899447441, 602891725), t(3049323471, 3964484399), t(3921009573, 2173295548), t(961987163, 4081628472), t(1508970993, 3053834265), t(2453635748, 2937671579), t(2870763221, 3664609560), t(3624381080, 2734883394), t(310598401, 1164996542), t(607225278, 1323610764), t(1426881987, 3590304994), t(1925078388, 4068182383), t(2162078206, 991336113), t(2614888103, 633803317), t(3248222580, 3479774868), t(3835390401, 2666613458), t(4022224774, 944711139), t(264347078, 2341262773), t(604807628, 2007800933), t(770255983, 1495990901), t(1249150122, 1856431235), t(1555081692, 3175218132), t(1996064986, 2198950837), t(2554220882, 3999719339), t(2821834349, 766784016), t(2952996808, 2566594879), t(3210313671, 3203337956), t(3336571891, 1034457026), t(3584528711, 2466948901), t(113926993, 3758326383), t(338241895, 168717936), t(666307205, 1188179964), t(773529912, 1546045734), t(1294757372, 1522805485), t(1396182291, 2643833823), t(1695183700, 2343527390), t(1986661051, 1014477480), t(2177026350, 1206759142), t(2456956037, 344077627), t(2730485921, 1290863460), t(2820302411, 3158454273), t(3259730800, 3505952657), t(3345764771, 106217008), t(3516065817, 3606008344), t(3600352804, 1432725776), t(4094571909, 1467031594), t(275423344, 851169720), t(430227734, 3100823752), t(506948616, 1363258195), t(659060556, 3750685593), t(883997877, 3785050280), t(958139571, 3318307427), t(1322822218, 3812723403), t(1537002063, 2003034995), t(1747873779, 3602036899), t(1955562222, 1575990012), t(2024104815, 1125592928), t(2227730452, 2716904306), t(2361852424, 442776044), t(2428436474, 593698344), t(2756734187, 3733110249), t(3204031479, 2999351573), t(3329325298, 3815920427), t(3391569614, 3928383900), t(3515267271, 566280711), t(3940187606, 3454069534), t(4118630271, 4000239992), t(116418474, 1914138554), t(174292421, 2731055270), t(289380356, 3203993006), t(460393269, 320620315), t(685471733, 587496836), t(852142971, 1086792851), t(1017036298, 365543100), t(1126000580, 2618297676), t(1288033470, 3409855158), t(1501505948, 4234509866), t(1607167915, 987167468), t(1816402316, 1246189591)], a = [], u = 0; 80 > u; u++) a[u] = t();\n o = o.SHA512 = r.extend({\n _doReset: function t() {\n this._hash = new i.init([new n.init(1779033703, 4089235720), new n.init(3144134277, 2227873595), new n.init(1013904242, 4271175723), new n.init(2773480762, 1595750129), new n.init(1359893119, 2917565137), new n.init(2600822924, 725511199), new n.init(528734635, 4215389547), new n.init(1541459225, 327033209)]);\n },\n _doProcessBlock: function t(e, r) {\n for (var n = (f = this._hash.words)[0], i = f[1], o = f[2], u = f[3], c = f[4], h = f[5], l = f[6], f = f[7], g = n.high, d = n.low, p = i.high, v = i.low, y = o.high, m = o.low, _ = u.high, S = u.low, b = c.high, w = c.low, F = h.high, E = h.low, x = l.high, A = l.low, k = f.high, P = f.low, C = g, T = d, R = p, I = v, D = y, L = m, N = _, U = S, B = b, O = w, j = F, M = E, H = x, V = A, K = k, q = P, J = 0; 80 > J; J++) {\n var W = a[J];\n if (16 > J) var z = W.high = 0 | e[r + 2 * J],\n Y = W.low = 0 | e[r + 2 * J + 1];else {\n z = ((Y = (z = a[J - 15]).high) >>> 1 | (G = z.low) << 31) ^ (Y >>> 8 | G << 24) ^ Y >>> 7;\n var G = (G >>> 1 | Y << 31) ^ (G >>> 8 | Y << 24) ^ (G >>> 7 | Y << 25),\n X = ((Y = (X = a[J - 2]).high) >>> 19 | ($ = X.low) << 13) ^ (Y << 3 | $ >>> 29) ^ Y >>> 6,\n $ = ($ >>> 19 | Y << 13) ^ ($ << 3 | Y >>> 29) ^ ($ >>> 6 | Y << 26),\n Q = (Y = a[J - 7]).high,\n Z = (tt = a[J - 16]).high,\n tt = tt.low;\n z = (z = (z = z + Q + ((Y = G + Y.low) >>> 0 < G >>> 0 ? 1 : 0)) + X + ((Y = Y + $) >>> 0 < $ >>> 0 ? 1 : 0)) + Z + ((Y = Y + tt) >>> 0 < tt >>> 0 ? 1 : 0);\n W.high = z, W.low = Y;\n }\n Q = B & j ^ ~B & H, tt = O & M ^ ~O & V, W = C & R ^ C & D ^ R & D;\n var et = T & I ^ T & L ^ I & L,\n rt = (G = (C >>> 28 | T << 4) ^ (C << 30 | T >>> 2) ^ (C << 25 | T >>> 7), X = (T >>> 28 | C << 4) ^ (T << 30 | C >>> 2) ^ (T << 25 | C >>> 7), ($ = s[J]).high),\n nt = $.low;\n Z = K + ((B >>> 14 | O << 18) ^ (B >>> 18 | O << 14) ^ (B << 23 | O >>> 9)) + (($ = q + ((O >>> 14 | B << 18) ^ (O >>> 18 | B << 14) ^ (O << 23 | B >>> 9))) >>> 0 < q >>> 0 ? 1 : 0), K = H, q = V, H = j, V = M, j = B, M = O, B = N + (Z = (Z = (Z = Z + Q + (($ = $ + tt) >>> 0 < tt >>> 0 ? 1 : 0)) + rt + (($ = $ + nt) >>> 0 < nt >>> 0 ? 1 : 0)) + z + (($ = $ + Y) >>> 0 < Y >>> 0 ? 1 : 0)) + ((O = U + $ | 0) >>> 0 < U >>> 0 ? 1 : 0) | 0, N = D, U = L, D = R, L = I, R = C, I = T, C = Z + (W = G + W + ((Y = X + et) >>> 0 < X >>> 0 ? 1 : 0)) + ((T = $ + Y | 0) >>> 0 < $ >>> 0 ? 1 : 0) | 0;\n }\n d = n.low = d + T, n.high = g + C + (d >>> 0 < T >>> 0 ? 1 : 0), v = i.low = v + I, i.high = p + R + (v >>> 0 < I >>> 0 ? 1 : 0), m = o.low = m + L, o.high = y + D + (m >>> 0 < L >>> 0 ? 1 : 0), S = u.low = S + U, u.high = _ + N + (S >>> 0 < U >>> 0 ? 1 : 0), w = c.low = w + O, c.high = b + B + (w >>> 0 < O >>> 0 ? 1 : 0), E = h.low = E + M, h.high = F + j + (E >>> 0 < M >>> 0 ? 1 : 0), A = l.low = A + V, l.high = x + H + (A >>> 0 < V >>> 0 ? 1 : 0), P = f.low = P + q, f.high = k + K + (P >>> 0 < q >>> 0 ? 1 : 0);\n },\n _doFinalize: function t() {\n var e = this._data,\n r = e.words,\n n = 8 * this._nDataBytes,\n i = 8 * e.sigBytes;\n return r[i >>> 5] |= 128 << 24 - i % 32, r[30 + (i + 128 >>> 10 << 5)] = Math.floor(n / 4294967296), r[31 + (i + 128 >>> 10 << 5)] = n, e.sigBytes = 4 * r.length, this._process(), this._hash.toX32();\n },\n clone: function t() {\n var e = r.clone.call(this);\n return e._hash = this._hash.clone(), e;\n },\n blockSize: 32\n }), e.SHA512 = r._createHelper(o), e.HmacSHA512 = r._createHmacHelper(o);\n }(), function () {\n var t = y,\n e = (i = t.x64).Word,\n r = i.WordArray,\n n = (i = t.algo).SHA512,\n i = i.SHA384 = n.extend({\n _doReset: function t() {\n this._hash = new r.init([new e.init(3418070365, 3238371032), new e.init(1654270250, 914150663), new e.init(2438529370, 812702999), new e.init(355462360, 4144912697), new e.init(1731405415, 4290775857), new e.init(2394180231, 1750603025), new e.init(3675008525, 1694076839), new e.init(1203062813, 3204075428)]);\n },\n _doFinalize: function t() {\n var e = n._doFinalize.call(this);\n return e.sigBytes -= 16, e;\n }\n });\n t.SHA384 = n._createHelper(i), t.HmacSHA384 = n._createHmacHelper(i);\n }();\n /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\n var m,\n _ = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n function S(t) {\n var e,\n r,\n n = \"\";\n for (e = 0; e + 3 <= t.length; e += 3) r = parseInt(t.substring(e, e + 3), 16), n += _.charAt(r >> 6) + _.charAt(63 & r);\n for (e + 1 == t.length ? (r = parseInt(t.substring(e, e + 1), 16), n += _.charAt(r << 2)) : e + 2 == t.length && (r = parseInt(t.substring(e, e + 2), 16), n += _.charAt(r >> 2) + _.charAt((3 & r) << 4)), \"=\"; (3 & n.length) > 0;) n += \"=\";\n return n;\n }\n function b(t) {\n var e,\n r,\n n,\n i = \"\",\n o = 0;\n for (e = 0; e < t.length && \"=\" != t.charAt(e); ++e) (n = _.indexOf(t.charAt(e))) < 0 || (0 == o ? (i += R(n >> 2), r = 3 & n, o = 1) : 1 == o ? (i += R(r << 2 | n >> 4), r = 15 & n, o = 2) : 2 == o ? (i += R(r), i += R(n >> 2), r = 3 & n, o = 3) : (i += R(r << 2 | n >> 4), i += R(15 & n), o = 0));\n return 1 == o && (i += R(r << 2)), i;\n }\n function w(t) {\n var e,\n r = b(t),\n n = new Array();\n for (e = 0; 2 * e < r.length; ++e) n[e] = parseInt(r.substring(2 * e, 2 * e + 2), 16);\n return n;\n }\n function F(t, e, r) {\n null != t && (\"number\" == typeof t ? this.fromNumber(t, e, r) : null == e && \"string\" != typeof t ? this.fromString(t, 256) : this.fromString(t, e));\n }\n function E() {\n return new F(null);\n }\n \"Microsoft Internet Explorer\" == n.appName ? (F.prototype.am = function x(t, e, r, n, i, o) {\n for (var s = 32767 & e, a = e >> 15; --o >= 0;) {\n var u = 32767 & this[t],\n c = this[t++] >> 15,\n h = a * u + c * s;\n i = ((u = s * u + ((32767 & h) << 15) + r[n] + (1073741823 & i)) >>> 30) + (h >>> 15) + a * c + (i >>> 30), r[n++] = 1073741823 & u;\n }\n return i;\n }, m = 30) : \"Netscape\" != n.appName ? (F.prototype.am = function A(t, e, r, n, i, o) {\n for (; --o >= 0;) {\n var s = e * this[t++] + r[n] + i;\n i = Math.floor(s / 67108864), r[n++] = 67108863 & s;\n }\n return i;\n }, m = 26) : (F.prototype.am = function k(t, e, r, n, i, o) {\n for (var s = 16383 & e, a = e >> 14; --o >= 0;) {\n var u = 16383 & this[t],\n c = this[t++] >> 14,\n h = a * u + c * s;\n i = ((u = s * u + ((16383 & h) << 14) + r[n] + i) >> 28) + (h >> 14) + a * c, r[n++] = 268435455 & u;\n }\n return i;\n }, m = 28), F.prototype.DB = m, F.prototype.DM = (1 << m) - 1, F.prototype.DV = 1 << m;\n F.prototype.FV = Math.pow(2, 52), F.prototype.F1 = 52 - m, F.prototype.F2 = 2 * m - 52;\n var P,\n C,\n T = new Array();\n for (P = \"0\".charCodeAt(0), C = 0; C <= 9; ++C) T[P++] = C;\n for (P = \"a\".charCodeAt(0), C = 10; C < 36; ++C) T[P++] = C;\n for (P = \"A\".charCodeAt(0), C = 10; C < 36; ++C) T[P++] = C;\n function R(t) {\n return \"0123456789abcdefghijklmnopqrstuvwxyz\".charAt(t);\n }\n function I(t, e) {\n var r = T[t.charCodeAt(e)];\n return null == r ? -1 : r;\n }\n function D(t) {\n var e = E();\n return e.fromInt(t), e;\n }\n function L(t) {\n var e,\n r = 1;\n return 0 != (e = t >>> 16) && (t = e, r += 16), 0 != (e = t >> 8) && (t = e, r += 8), 0 != (e = t >> 4) && (t = e, r += 4), 0 != (e = t >> 2) && (t = e, r += 2), 0 != (e = t >> 1) && (t = e, r += 1), r;\n }\n function N(t) {\n this.m = t;\n }\n function U(t) {\n this.m = t, this.mp = t.invDigit(), this.mpl = 32767 & this.mp, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t;\n }\n function B(t, e) {\n return t & e;\n }\n function O(t, e) {\n return t | e;\n }\n function j(t, e) {\n return t ^ e;\n }\n function M(t, e) {\n return t & ~e;\n }\n function H(t) {\n if (0 == t) return -1;\n var e = 0;\n return 0 == (65535 & t) && (t >>= 16, e += 16), 0 == (255 & t) && (t >>= 8, e += 8), 0 == (15 & t) && (t >>= 4, e += 4), 0 == (3 & t) && (t >>= 2, e += 2), 0 == (1 & t) && ++e, e;\n }\n function V(t) {\n for (var e = 0; 0 != t;) t &= t - 1, ++e;\n return e;\n }\n function K() {}\n function q(t) {\n return t;\n }\n function J(t) {\n this.r2 = E(), this.q3 = E(), F.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t), this.m = t;\n }\n N.prototype.convert = function W(t) {\n return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t;\n }, N.prototype.revert = function z(t) {\n return t;\n }, N.prototype.reduce = function Y(t) {\n t.divRemTo(this.m, null, t);\n }, N.prototype.mulTo = function G(t, e, r) {\n t.multiplyTo(e, r), this.reduce(r);\n }, N.prototype.sqrTo = function X(t, e) {\n t.squareTo(e), this.reduce(e);\n }, U.prototype.convert = function $(t) {\n var e = E();\n return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(F.ZERO) > 0 && this.m.subTo(e, e), e;\n }, U.prototype.revert = function Q(t) {\n var e = E();\n return t.copyTo(e), this.reduce(e), e;\n }, U.prototype.reduce = function Z(t) {\n for (; t.t <= this.mt2;) t[t.t++] = 0;\n for (var e = 0; e < this.m.t; ++e) {\n var r = 32767 & t[e],\n n = r * this.mpl + ((r * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;\n for (t[r = e + this.m.t] += this.m.am(0, n, t, e, 0, this.m.t); t[r] >= t.DV;) t[r] -= t.DV, t[++r]++;\n }\n t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t);\n }, U.prototype.mulTo = function tt(t, e, r) {\n t.multiplyTo(e, r), this.reduce(r);\n }, U.prototype.sqrTo = function et(t, e) {\n t.squareTo(e), this.reduce(e);\n }, F.prototype.copyTo = function rt(t) {\n for (var e = this.t - 1; e >= 0; --e) t[e] = this[e];\n t.t = this.t, t.s = this.s;\n }, F.prototype.fromInt = function nt(t) {\n this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0;\n }, F.prototype.fromString = function it(t, e) {\n var r;\n if (16 == e) r = 4;else if (8 == e) r = 3;else if (256 == e) r = 8;else if (2 == e) r = 1;else if (32 == e) r = 5;else {\n if (4 != e) return void this.fromRadix(t, e);\n r = 2;\n }\n this.t = 0, this.s = 0;\n for (var n = t.length, i = !1, o = 0; --n >= 0;) {\n var s = 8 == r ? 255 & t[n] : I(t, n);\n s < 0 ? \"-\" == t.charAt(n) && (i = !0) : (i = !1, 0 == o ? this[this.t++] = s : o + r > this.DB ? (this[this.t - 1] |= (s & (1 << this.DB - o) - 1) << o, this[this.t++] = s >> this.DB - o) : this[this.t - 1] |= s << o, (o += r) >= this.DB && (o -= this.DB));\n }\n 8 == r && 0 != (128 & t[0]) && (this.s = -1, o > 0 && (this[this.t - 1] |= (1 << this.DB - o) - 1 << o)), this.clamp(), i && F.ZERO.subTo(this, this);\n }, F.prototype.clamp = function ot() {\n for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t;) --this.t;\n }, F.prototype.dlShiftTo = function st(t, e) {\n var r;\n for (r = this.t - 1; r >= 0; --r) e[r + t] = this[r];\n for (r = t - 1; r >= 0; --r) e[r] = 0;\n e.t = this.t + t, e.s = this.s;\n }, F.prototype.drShiftTo = function at(t, e) {\n for (var r = t; r < this.t; ++r) e[r - t] = this[r];\n e.t = Math.max(this.t - t, 0), e.s = this.s;\n }, F.prototype.lShiftTo = function ut(t, e) {\n var r,\n n = t % this.DB,\n i = this.DB - n,\n o = (1 << i) - 1,\n s = Math.floor(t / this.DB),\n a = this.s << n & this.DM;\n for (r = this.t - 1; r >= 0; --r) e[r + s + 1] = this[r] >> i | a, a = (this[r] & o) << n;\n for (r = s - 1; r >= 0; --r) e[r] = 0;\n e[s] = a, e.t = this.t + s + 1, e.s = this.s, e.clamp();\n }, F.prototype.rShiftTo = function ct(t, e) {\n e.s = this.s;\n var r = Math.floor(t / this.DB);\n if (r >= this.t) e.t = 0;else {\n var n = t % this.DB,\n i = this.DB - n,\n o = (1 << n) - 1;\n e[0] = this[r] >> n;\n for (var s = r + 1; s < this.t; ++s) e[s - r - 1] |= (this[s] & o) << i, e[s - r] = this[s] >> n;\n n > 0 && (e[this.t - r - 1] |= (this.s & o) << i), e.t = this.t - r, e.clamp();\n }\n }, F.prototype.subTo = function ht(t, e) {\n for (var r = 0, n = 0, i = Math.min(t.t, this.t); r < i;) n += this[r] - t[r], e[r++] = n & this.DM, n >>= this.DB;\n if (t.t < this.t) {\n for (n -= t.s; r < this.t;) n += this[r], e[r++] = n & this.DM, n >>= this.DB;\n n += this.s;\n } else {\n for (n += this.s; r < t.t;) n -= t[r], e[r++] = n & this.DM, n >>= this.DB;\n n -= t.s;\n }\n e.s = n < 0 ? -1 : 0, n < -1 ? e[r++] = this.DV + n : n > 0 && (e[r++] = n), e.t = r, e.clamp();\n }, F.prototype.multiplyTo = function lt(t, e) {\n var r = this.abs(),\n n = t.abs(),\n i = r.t;\n for (e.t = i + n.t; --i >= 0;) e[i] = 0;\n for (i = 0; i < n.t; ++i) e[i + r.t] = r.am(0, n[i], e, i, 0, r.t);\n e.s = 0, e.clamp(), this.s != t.s && F.ZERO.subTo(e, e);\n }, F.prototype.squareTo = function ft(t) {\n for (var e = this.abs(), r = t.t = 2 * e.t; --r >= 0;) t[r] = 0;\n for (r = 0; r < e.t - 1; ++r) {\n var n = e.am(r, e[r], t, 2 * r, 0, 1);\n (t[r + e.t] += e.am(r + 1, 2 * e[r], t, 2 * r + 1, n, e.t - r - 1)) >= e.DV && (t[r + e.t] -= e.DV, t[r + e.t + 1] = 1);\n }\n t.t > 0 && (t[t.t - 1] += e.am(r, e[r], t, 2 * r, 0, 1)), t.s = 0, t.clamp();\n }, F.prototype.divRemTo = function gt(t, e, r) {\n var n = t.abs();\n if (!(n.t <= 0)) {\n var i = this.abs();\n if (i.t < n.t) return null != e && e.fromInt(0), void (null != r && this.copyTo(r));\n null == r && (r = E());\n var o = E(),\n s = this.s,\n a = t.s,\n u = this.DB - L(n[n.t - 1]);\n u > 0 ? (n.lShiftTo(u, o), i.lShiftTo(u, r)) : (n.copyTo(o), i.copyTo(r));\n var c = o.t,\n h = o[c - 1];\n if (0 != h) {\n var l = h * (1 << this.F1) + (c > 1 ? o[c - 2] >> this.F2 : 0),\n f = this.FV / l,\n g = (1 << this.F1) / l,\n d = 1 << this.F2,\n p = r.t,\n v = p - c,\n y = null == e ? E() : e;\n for (o.dlShiftTo(v, y), r.compareTo(y) >= 0 && (r[r.t++] = 1, r.subTo(y, r)), F.ONE.dlShiftTo(c, y), y.subTo(o, o); o.t < c;) o[o.t++] = 0;\n for (; --v >= 0;) {\n var m = r[--p] == h ? this.DM : Math.floor(r[p] * f + (r[p - 1] + d) * g);\n if ((r[p] += o.am(0, m, r, v, 0, c)) < m) for (o.dlShiftTo(v, y), r.subTo(y, r); r[p] < --m;) r.subTo(y, r);\n }\n null != e && (r.drShiftTo(c, e), s != a && F.ZERO.subTo(e, e)), r.t = c, r.clamp(), u > 0 && r.rShiftTo(u, r), s < 0 && F.ZERO.subTo(r, r);\n }\n }\n }, F.prototype.invDigit = function dt() {\n if (this.t < 1) return 0;\n var t = this[0];\n if (0 == (1 & t)) return 0;\n var e = 3 & t;\n return (e = (e = (e = (e = e * (2 - (15 & t) * e) & 15) * (2 - (255 & t) * e) & 255) * (2 - ((65535 & t) * e & 65535)) & 65535) * (2 - t * e % this.DV) % this.DV) > 0 ? this.DV - e : -e;\n }, F.prototype.isEven = function pt() {\n return 0 == (this.t > 0 ? 1 & this[0] : this.s);\n }, F.prototype.exp = function vt(t, e) {\n if (t > 4294967295 || t < 1) return F.ONE;\n var r = E(),\n n = E(),\n i = e.convert(this),\n o = L(t) - 1;\n for (i.copyTo(r); --o >= 0;) if (e.sqrTo(r, n), (t & 1 << o) > 0) e.mulTo(n, i, r);else {\n var s = r;\n r = n, n = s;\n }\n return e.revert(r);\n }, F.prototype.toString = function yt(t) {\n if (this.s < 0) return \"-\" + this.negate().toString(t);\n var e;\n if (16 == t) e = 4;else if (8 == t) e = 3;else if (2 == t) e = 1;else if (32 == t) e = 5;else {\n if (4 != t) return this.toRadix(t);\n e = 2;\n }\n var r,\n n = (1 << e) - 1,\n i = !1,\n o = \"\",\n s = this.t,\n a = this.DB - s * this.DB % e;\n if (s-- > 0) for (a < this.DB && (r = this[s] >> a) > 0 && (i = !0, o = R(r)); s >= 0;) a < e ? (r = (this[s] & (1 << a) - 1) << e - a, r |= this[--s] >> (a += this.DB - e)) : (r = this[s] >> (a -= e) & n, a <= 0 && (a += this.DB, --s)), r > 0 && (i = !0), i && (o += R(r));\n return i ? o : \"0\";\n }, F.prototype.negate = function mt() {\n var t = E();\n return F.ZERO.subTo(this, t), t;\n }, F.prototype.abs = function _t() {\n return this.s < 0 ? this.negate() : this;\n }, F.prototype.compareTo = function St(t) {\n var e = this.s - t.s;\n if (0 != e) return e;\n var r = this.t;\n if (0 != (e = r - t.t)) return this.s < 0 ? -e : e;\n for (; --r >= 0;) if (0 != (e = this[r] - t[r])) return e;\n return 0;\n }, F.prototype.bitLength = function bt() {\n return this.t <= 0 ? 0 : this.DB * (this.t - 1) + L(this[this.t - 1] ^ this.s & this.DM);\n }, F.prototype.mod = function wt(t) {\n var e = E();\n return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(F.ZERO) > 0 && t.subTo(e, e), e;\n }, F.prototype.modPowInt = function Ft(t, e) {\n var r;\n return r = t < 256 || e.isEven() ? new N(e) : new U(e), this.exp(t, r);\n }, F.ZERO = D(0), F.ONE = D(1), K.prototype.convert = q, K.prototype.revert = q, K.prototype.mulTo = function Et(t, e, r) {\n t.multiplyTo(e, r);\n }, K.prototype.sqrTo = function xt(t, e) {\n t.squareTo(e);\n }, J.prototype.convert = function At(t) {\n if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m);\n if (t.compareTo(this.m) < 0) return t;\n var e = E();\n return t.copyTo(e), this.reduce(e), e;\n }, J.prototype.revert = function kt(t) {\n return t;\n }, J.prototype.reduce = function Pt(t) {\n for (t.drShiftTo(this.m.t - 1, this.r2), t.t > this.m.t + 1 && (t.t = this.m.t + 1, t.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0;) t.dAddOffset(1, this.m.t + 1);\n for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0;) t.subTo(this.m, t);\n }, J.prototype.mulTo = function Ct(t, e, r) {\n t.multiplyTo(e, r), this.reduce(r);\n }, J.prototype.sqrTo = function Tt(t, e) {\n t.squareTo(e), this.reduce(e);\n };\n var Rt = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997],\n It = (1 << 26) / Rt[Rt.length - 1];\n /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\n function Dt() {\n this.i = 0, this.j = 0, this.S = new Array();\n }\n F.prototype.chunkSize = function Lt(t) {\n return Math.floor(Math.LN2 * this.DB / Math.log(t));\n }, F.prototype.toRadix = function Nt(t) {\n if (null == t && (t = 10), 0 == this.signum() || t < 2 || t > 36) return \"0\";\n var e = this.chunkSize(t),\n r = Math.pow(t, e),\n n = D(r),\n i = E(),\n o = E(),\n s = \"\";\n for (this.divRemTo(n, i, o); i.signum() > 0;) s = (r + o.intValue()).toString(t).substr(1) + s, i.divRemTo(n, i, o);\n return o.intValue().toString(t) + s;\n }, F.prototype.fromRadix = function Ut(t, e) {\n this.fromInt(0), null == e && (e = 10);\n for (var r = this.chunkSize(e), n = Math.pow(e, r), i = !1, o = 0, s = 0, a = 0; a < t.length; ++a) {\n var u = I(t, a);\n u < 0 ? \"-\" == t.charAt(a) && 0 == this.signum() && (i = !0) : (s = e * s + u, ++o >= r && (this.dMultiply(n), this.dAddOffset(s, 0), o = 0, s = 0));\n }\n o > 0 && (this.dMultiply(Math.pow(e, o)), this.dAddOffset(s, 0)), i && F.ZERO.subTo(this, this);\n }, F.prototype.fromNumber = function Bt(t, e, r) {\n if (\"number\" == typeof e) {\n if (t < 2) this.fromInt(1);else for (this.fromNumber(t, r), this.testBit(t - 1) || this.bitwiseTo(F.ONE.shiftLeft(t - 1), O, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e);) this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(F.ONE.shiftLeft(t - 1), this);\n } else {\n var n = new Array(),\n i = 7 & t;\n n.length = 1 + (t >> 3), e.nextBytes(n), i > 0 ? n[0] &= (1 << i) - 1 : n[0] = 0, this.fromString(n, 256);\n }\n }, F.prototype.bitwiseTo = function Ot(t, e, r) {\n var n,\n i,\n o = Math.min(t.t, this.t);\n for (n = 0; n < o; ++n) r[n] = e(this[n], t[n]);\n if (t.t < this.t) {\n for (i = t.s & this.DM, n = o; n < this.t; ++n) r[n] = e(this[n], i);\n r.t = this.t;\n } else {\n for (i = this.s & this.DM, n = o; n < t.t; ++n) r[n] = e(i, t[n]);\n r.t = t.t;\n }\n r.s = e(this.s, t.s), r.clamp();\n }, F.prototype.changeBit = function jt(t, e) {\n var r = F.ONE.shiftLeft(t);\n return this.bitwiseTo(r, e, r), r;\n }, F.prototype.addTo = function Mt(t, e) {\n for (var r = 0, n = 0, i = Math.min(t.t, this.t); r < i;) n += this[r] + t[r], e[r++] = n & this.DM, n >>= this.DB;\n if (t.t < this.t) {\n for (n += t.s; r < this.t;) n += this[r], e[r++] = n & this.DM, n >>= this.DB;\n n += this.s;\n } else {\n for (n += this.s; r < t.t;) n += t[r], e[r++] = n & this.DM, n >>= this.DB;\n n += t.s;\n }\n e.s = n < 0 ? -1 : 0, n > 0 ? e[r++] = n : n < -1 && (e[r++] = this.DV + n), e.t = r, e.clamp();\n }, F.prototype.dMultiply = function Ht(t) {\n this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp();\n }, F.prototype.dAddOffset = function Vt(t, e) {\n if (0 != t) {\n for (; this.t <= e;) this[this.t++] = 0;\n for (this[e] += t; this[e] >= this.DV;) this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e];\n }\n }, F.prototype.multiplyLowerTo = function Kt(t, e, r) {\n var n,\n i = Math.min(this.t + t.t, e);\n for (r.s = 0, r.t = i; i > 0;) r[--i] = 0;\n for (n = r.t - this.t; i < n; ++i) r[i + this.t] = this.am(0, t[i], r, i, 0, this.t);\n for (n = Math.min(t.t, e); i < n; ++i) this.am(0, t[i], r, i, 0, e - i);\n r.clamp();\n }, F.prototype.multiplyUpperTo = function qt(t, e, r) {\n --e;\n var n = r.t = this.t + t.t - e;\n for (r.s = 0; --n >= 0;) r[n] = 0;\n for (n = Math.max(e - this.t, 0); n < t.t; ++n) r[this.t + n - e] = this.am(e - n, t[n], r, 0, 0, this.t + n - e);\n r.clamp(), r.drShiftTo(1, r);\n }, F.prototype.modInt = function Jt(t) {\n if (t <= 0) return 0;\n var e = this.DV % t,\n r = this.s < 0 ? t - 1 : 0;\n if (this.t > 0) if (0 == e) r = this[0] % t;else for (var n = this.t - 1; n >= 0; --n) r = (e * r + this[n]) % t;\n return r;\n }, F.prototype.millerRabin = function Wt(t) {\n var e = this.subtract(F.ONE),\n r = e.getLowestSetBit();\n if (r <= 0) return !1;\n var n = e.shiftRight(r);\n (t = t + 1 >> 1) > Rt.length && (t = Rt.length);\n for (var i = E(), o = 0; o < t; ++o) {\n i.fromInt(Rt[Math.floor(Math.random() * Rt.length)]);\n var s = i.modPow(n, this);\n if (0 != s.compareTo(F.ONE) && 0 != s.compareTo(e)) {\n for (var a = 1; a++ < r && 0 != s.compareTo(e);) if (0 == (s = s.modPowInt(2, this)).compareTo(F.ONE)) return !1;\n if (0 != s.compareTo(e)) return !1;\n }\n }\n return !0;\n }, F.prototype.clone =\n /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\n function zt() {\n var t = E();\n return this.copyTo(t), t;\n }, F.prototype.intValue = function Yt() {\n if (this.s < 0) {\n if (1 == this.t) return this[0] - this.DV;\n if (0 == this.t) return -1;\n } else {\n if (1 == this.t) return this[0];\n if (0 == this.t) return 0;\n }\n return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];\n }, F.prototype.byteValue = function Gt() {\n return 0 == this.t ? this.s : this[0] << 24 >> 24;\n }, F.prototype.shortValue = function Xt() {\n return 0 == this.t ? this.s : this[0] << 16 >> 16;\n }, F.prototype.signum = function $t() {\n return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1;\n }, F.prototype.toByteArray = function Qt() {\n var t = this.t,\n e = new Array();\n e[0] = this.s;\n var r,\n n = this.DB - t * this.DB % 8,\n i = 0;\n if (t-- > 0) for (n < this.DB && (r = this[t] >> n) != (this.s & this.DM) >> n && (e[i++] = r | this.s << this.DB - n); t >= 0;) n < 8 ? (r = (this[t] & (1 << n) - 1) << 8 - n, r |= this[--t] >> (n += this.DB - 8)) : (r = this[t] >> (n -= 8) & 255, n <= 0 && (n += this.DB, --t)), 0 != (128 & r) && (r |= -256), 0 == i && (128 & this.s) != (128 & r) && ++i, (i > 0 || r != this.s) && (e[i++] = r);\n return e;\n }, F.prototype.equals = function Zt(t) {\n return 0 == this.compareTo(t);\n }, F.prototype.min = function te(t) {\n return this.compareTo(t) < 0 ? this : t;\n }, F.prototype.max = function ee(t) {\n return this.compareTo(t) > 0 ? this : t;\n }, F.prototype.and = function re(t) {\n var e = E();\n return this.bitwiseTo(t, B, e), e;\n }, F.prototype.or = function ne(t) {\n var e = E();\n return this.bitwiseTo(t, O, e), e;\n }, F.prototype.xor = function ie(t) {\n var e = E();\n return this.bitwiseTo(t, j, e), e;\n }, F.prototype.andNot = function oe(t) {\n var e = E();\n return this.bitwiseTo(t, M, e), e;\n }, F.prototype.not = function se() {\n for (var t = E(), e = 0; e < this.t; ++e) t[e] = this.DM & ~this[e];\n return t.t = this.t, t.s = ~this.s, t;\n }, F.prototype.shiftLeft = function ae(t) {\n var e = E();\n return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e;\n }, F.prototype.shiftRight = function ue(t) {\n var e = E();\n return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e;\n }, F.prototype.getLowestSetBit = function ce() {\n for (var t = 0; t < this.t; ++t) if (0 != this[t]) return t * this.DB + H(this[t]);\n return this.s < 0 ? this.t * this.DB : -1;\n }, F.prototype.bitCount = function he() {\n for (var t = 0, e = this.s & this.DM, r = 0; r < this.t; ++r) t += V(this[r] ^ e);\n return t;\n }, F.prototype.testBit = function le(t) {\n var e = Math.floor(t / this.DB);\n return e >= this.t ? 0 != this.s : 0 != (this[e] & 1 << t % this.DB);\n }, F.prototype.setBit = function fe(t) {\n return this.changeBit(t, O);\n }, F.prototype.clearBit = function ge(t) {\n return this.changeBit(t, M);\n }, F.prototype.flipBit = function de(t) {\n return this.changeBit(t, j);\n }, F.prototype.add = function pe(t) {\n var e = E();\n return this.addTo(t, e), e;\n }, F.prototype.subtract = function ve(t) {\n var e = E();\n return this.subTo(t, e), e;\n }, F.prototype.multiply = function ye(t) {\n var e = E();\n return this.multiplyTo(t, e), e;\n }, F.prototype.divide = function me(t) {\n var e = E();\n return this.divRemTo(t, e, null), e;\n }, F.prototype.remainder = function _e(t) {\n var e = E();\n return this.divRemTo(t, null, e), e;\n }, F.prototype.divideAndRemainder = function Se(t) {\n var e = E(),\n r = E();\n return this.divRemTo(t, e, r), new Array(e, r);\n }, F.prototype.modPow = function be(t, e) {\n var r,\n n,\n i = t.bitLength(),\n o = D(1);\n if (i <= 0) return o;\n r = i < 18 ? 1 : i < 48 ? 3 : i < 144 ? 4 : i < 768 ? 5 : 6, n = i < 8 ? new N(e) : e.isEven() ? new J(e) : new U(e);\n var s = new Array(),\n a = 3,\n u = r - 1,\n c = (1 << r) - 1;\n if (s[1] = n.convert(this), r > 1) {\n var h = E();\n for (n.sqrTo(s[1], h); a <= c;) s[a] = E(), n.mulTo(h, s[a - 2], s[a]), a += 2;\n }\n var l,\n f,\n g = t.t - 1,\n d = !0,\n p = E();\n for (i = L(t[g]) - 1; g >= 0;) {\n for (i >= u ? l = t[g] >> i - u & c : (l = (t[g] & (1 << i + 1) - 1) << u - i, g > 0 && (l |= t[g - 1] >> this.DB + i - u)), a = r; 0 == (1 & l);) l >>= 1, --a;\n if ((i -= a) < 0 && (i += this.DB, --g), d) s[l].copyTo(o), d = !1;else {\n for (; a > 1;) n.sqrTo(o, p), n.sqrTo(p, o), a -= 2;\n a > 0 ? n.sqrTo(o, p) : (f = o, o = p, p = f), n.mulTo(p, s[l], o);\n }\n for (; g >= 0 && 0 == (t[g] & 1 << i);) n.sqrTo(o, p), f = o, o = p, p = f, --i < 0 && (i = this.DB - 1, --g);\n }\n return n.revert(o);\n }, F.prototype.modInverse = function we(t) {\n var e = t.isEven();\n if (this.isEven() && e || 0 == t.signum()) return F.ZERO;\n for (var r = t.clone(), n = this.clone(), i = D(1), o = D(0), s = D(0), a = D(1); 0 != r.signum();) {\n for (; r.isEven();) r.rShiftTo(1, r), e ? (i.isEven() && o.isEven() || (i.addTo(this, i), o.subTo(t, o)), i.rShiftTo(1, i)) : o.isEven() || o.subTo(t, o), o.rShiftTo(1, o);\n for (; n.isEven();) n.rShiftTo(1, n), e ? (s.isEven() && a.isEven() || (s.addTo(this, s), a.subTo(t, a)), s.rShiftTo(1, s)) : a.isEven() || a.subTo(t, a), a.rShiftTo(1, a);\n r.compareTo(n) >= 0 ? (r.subTo(n, r), e && i.subTo(s, i), o.subTo(a, o)) : (n.subTo(r, n), e && s.subTo(i, s), a.subTo(o, a));\n }\n return 0 != n.compareTo(F.ONE) ? F.ZERO : a.compareTo(t) >= 0 ? a.subtract(t) : a.signum() < 0 ? (a.addTo(t, a), a.signum() < 0 ? a.add(t) : a) : a;\n }, F.prototype.pow = function Fe(t) {\n return this.exp(t, new K());\n }, F.prototype.gcd = function Ee(t) {\n var e = this.s < 0 ? this.negate() : this.clone(),\n r = t.s < 0 ? t.negate() : t.clone();\n if (e.compareTo(r) < 0) {\n var n = e;\n e = r, r = n;\n }\n var i = e.getLowestSetBit(),\n o = r.getLowestSetBit();\n if (o < 0) return e;\n for (i < o && (o = i), o > 0 && (e.rShiftTo(o, e), r.rShiftTo(o, r)); e.signum() > 0;) (i = e.getLowestSetBit()) > 0 && e.rShiftTo(i, e), (i = r.getLowestSetBit()) > 0 && r.rShiftTo(i, r), e.compareTo(r) >= 0 ? (e.subTo(r, e), e.rShiftTo(1, e)) : (r.subTo(e, r), r.rShiftTo(1, r));\n return o > 0 && r.lShiftTo(o, r), r;\n }, F.prototype.isProbablePrime = function xe(t) {\n var e,\n r = this.abs();\n if (1 == r.t && r[0] <= Rt[Rt.length - 1]) {\n for (e = 0; e < Rt.length; ++e) if (r[0] == Rt[e]) return !0;\n return !1;\n }\n if (r.isEven()) return !1;\n for (e = 1; e < Rt.length;) {\n for (var n = Rt[e], i = e + 1; i < Rt.length && n < It;) n *= Rt[i++];\n for (n = r.modInt(n); e < i;) if (n % Rt[e++] == 0) return !1;\n }\n return r.millerRabin(t);\n }, F.prototype.square = function Ae() {\n var t = E();\n return this.squareTo(t), t;\n }, Dt.prototype.init = function ke(t) {\n var e, r, n;\n for (e = 0; e < 256; ++e) this.S[e] = e;\n for (r = 0, e = 0; e < 256; ++e) r = r + this.S[e] + t[e % t.length] & 255, n = this.S[e], this.S[e] = this.S[r], this.S[r] = n;\n this.i = 0, this.j = 0;\n }, Dt.prototype.next = function Pe() {\n var t;\n return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, t = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = t, this.S[t + this.S[this.i] & 255];\n };\n var Ce, Te, Re;\n /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\n function Ie() {\n !function t(e) {\n Te[Re++] ^= 255 & e, Te[Re++] ^= e >> 8 & 255, Te[Re++] ^= e >> 16 & 255, Te[Re++] ^= e >> 24 & 255, Re >= 256 && (Re -= 256);\n }(new Date().getTime());\n }\n if (null == Te) {\n var De;\n if (Te = new Array(), Re = 0, void 0 !== i && (void 0 !== i.crypto || void 0 !== i.msCrypto)) {\n var Le = i.crypto || i.msCrypto;\n if (Le.getRandomValues) {\n var Ne = new Uint8Array(32);\n for (Le.getRandomValues(Ne), De = 0; De < 32; ++De) Te[Re++] = Ne[De];\n } else if (\"Netscape\" == n.appName && n.appVersion < \"5\") {\n var Ue = i.crypto.random(32);\n for (De = 0; De < Ue.length; ++De) Te[Re++] = 255 & Ue.charCodeAt(De);\n }\n }\n for (; Re < 256;) De = Math.floor(65536 * Math.random()), Te[Re++] = De >>> 8, Te[Re++] = 255 & De;\n Re = 0, Ie();\n }\n function Be() {\n if (null == Ce) {\n for (Ie(), (Ce = function t() {\n return new Dt();\n }()).init(Te), Re = 0; Re < Te.length; ++Re) Te[Re] = 0;\n Re = 0;\n }\n return Ce.next();\n }\n function Oe() {}\n /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\n function je(t, e) {\n return new F(t, e);\n }\n function Me(t, e, r) {\n for (var n = \"\", i = 0; n.length < e;) n += r(String.fromCharCode.apply(String, t.concat([(4278190080 & i) >> 24, (16711680 & i) >> 16, (65280 & i) >> 8, 255 & i]))), i += 1;\n return n;\n }\n function He() {\n this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;\n }\n /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\n function Ve(t, e) {\n this.x = e, this.q = t;\n }\n function Ke(t, e, r, n) {\n this.curve = t, this.x = e, this.y = r, this.z = null == n ? F.ONE : n, this.zinv = null;\n }\n function qe(t, e, r) {\n this.q = t, this.a = this.fromBigInteger(e), this.b = this.fromBigInteger(r), this.infinity = new Ke(this, null, null);\n }\n Oe.prototype.nextBytes = function Je(t) {\n var e;\n for (e = 0; e < t.length; ++e) t[e] = Be();\n }, He.prototype.doPublic = function We(t) {\n return t.modPowInt(this.e, this.n);\n }, He.prototype.setPublic = function ze(t, e) {\n if (this.isPublic = !0, this.isPrivate = !1, \"string\" != typeof t) this.n = t, this.e = e;else {\n if (!(null != t && null != e && t.length > 0 && e.length > 0)) throw \"Invalid RSA public key\";\n this.n = je(t, 16), this.e = parseInt(e, 16);\n }\n }, He.prototype.encrypt = function Ye(t) {\n var e = function r(t, e) {\n if (e < t.length + 11) throw \"Message too long for RSA\";\n for (var r = new Array(), n = t.length - 1; n >= 0 && e > 0;) {\n var i = t.charCodeAt(n--);\n i < 128 ? r[--e] = i : i > 127 && i < 2048 ? (r[--e] = 63 & i | 128, r[--e] = i >> 6 | 192) : (r[--e] = 63 & i | 128, r[--e] = i >> 6 & 63 | 128, r[--e] = i >> 12 | 224);\n }\n r[--e] = 0;\n for (var o = new Oe(), s = new Array(); e > 2;) {\n for (s[0] = 0; 0 == s[0];) o.nextBytes(s);\n r[--e] = s[0];\n }\n return r[--e] = 2, r[--e] = 0, new F(r);\n }(t, this.n.bitLength() + 7 >> 3);\n if (null == e) return null;\n var n = this.doPublic(e);\n if (null == n) return null;\n var i = n.toString(16);\n return 0 == (1 & i.length) ? i : \"0\" + i;\n }, He.prototype.encryptOAEP = function Ge(t, e, r) {\n var n = function i(t, e, r, n) {\n var i = br.crypto.MessageDigest,\n o = br.crypto.Util,\n s = null;\n if (r || (r = \"sha1\"), \"string\" == typeof r && (s = i.getCanonicalAlgName(r), n = i.getHashLength(s), r = function t(e) {\n return Nr(o.hashHex(Ur(e), s));\n }), t.length + 2 * n + 2 > e) throw \"Message too long for RSA\";\n var a,\n u = \"\";\n for (a = 0; a < e - t.length - 2 * n - 2; a += 1) u += \"\\0\";\n var c = r(\"\") + u + \"\u0001\" + t,\n h = new Array(n);\n new Oe().nextBytes(h);\n var l = Me(h, c.length, r),\n f = [];\n for (a = 0; a < c.length; a += 1) f[a] = c.charCodeAt(a) ^ l.charCodeAt(a);\n var g = Me(f, h.length, r),\n d = [0];\n for (a = 0; a < h.length; a += 1) d[a + 1] = h[a] ^ g.charCodeAt(a);\n return new F(d.concat(f));\n }(t, this.n.bitLength() + 7 >> 3, e, r);\n if (null == n) return null;\n var o = this.doPublic(n);\n if (null == o) return null;\n var s = o.toString(16);\n return 0 == (1 & s.length) ? s : \"0\" + s;\n }, He.prototype.type = \"RSA\", Ve.prototype.equals = function Xe(t) {\n return t == this || this.q.equals(t.q) && this.x.equals(t.x);\n }, Ve.prototype.toBigInteger = function $e() {\n return this.x;\n }, Ve.prototype.negate = function Qe() {\n return new Ve(this.q, this.x.negate().mod(this.q));\n }, Ve.prototype.add = function Ze(t) {\n return new Ve(this.q, this.x.add(t.toBigInteger()).mod(this.q));\n }, Ve.prototype.subtract = function tr(t) {\n return new Ve(this.q, this.x.subtract(t.toBigInteger()).mod(this.q));\n }, Ve.prototype.multiply = function er(t) {\n return new Ve(this.q, this.x.multiply(t.toBigInteger()).mod(this.q));\n }, Ve.prototype.square = function rr() {\n return new Ve(this.q, this.x.square().mod(this.q));\n }, Ve.prototype.divide = function nr(t) {\n return new Ve(this.q, this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q));\n }, Ke.prototype.getX = function ir() {\n return null == this.zinv && (this.zinv = this.z.modInverse(this.curve.q)), this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q));\n }, Ke.prototype.getY = function or() {\n return null == this.zinv && (this.zinv = this.z.modInverse(this.curve.q)), this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q));\n }, Ke.prototype.equals = function sr(t) {\n return t == this || (this.isInfinity() ? t.isInfinity() : t.isInfinity() ? this.isInfinity() : !!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(F.ZERO) && t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(F.ZERO));\n }, Ke.prototype.isInfinity = function ar() {\n return null == this.x && null == this.y || this.z.equals(F.ZERO) && !this.y.toBigInteger().equals(F.ZERO);\n }, Ke.prototype.negate = function ur() {\n return new Ke(this.curve, this.x, this.y.negate(), this.z);\n }, Ke.prototype.add = function cr(t) {\n if (this.isInfinity()) return t;\n if (t.isInfinity()) return this;\n var e = t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),\n r = t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);\n if (F.ZERO.equals(r)) return F.ZERO.equals(e) ? this.twice() : this.curve.getInfinity();\n var n = new F(\"3\"),\n i = this.x.toBigInteger(),\n o = this.y.toBigInteger(),\n s = (t.x.toBigInteger(), t.y.toBigInteger(), r.square()),\n a = s.multiply(r),\n u = i.multiply(s),\n c = e.square().multiply(this.z),\n h = c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(a).multiply(r).mod(this.curve.q),\n l = u.multiply(n).multiply(e).subtract(o.multiply(a)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(a)).mod(this.curve.q),\n f = a.multiply(this.z).multiply(t.z).mod(this.curve.q);\n return new Ke(this.curve, this.curve.fromBigInteger(h), this.curve.fromBigInteger(l), f);\n }, Ke.prototype.twice = function hr() {\n if (this.isInfinity()) return this;\n if (0 == this.y.toBigInteger().signum()) return this.curve.getInfinity();\n var t = new F(\"3\"),\n e = this.x.toBigInteger(),\n r = this.y.toBigInteger(),\n n = r.multiply(this.z),\n i = n.multiply(r).mod(this.curve.q),\n o = this.curve.a.toBigInteger(),\n s = e.square().multiply(t);\n F.ZERO.equals(o) || (s = s.add(this.z.square().multiply(o)));\n var a = (s = s.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),\n u = s.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),\n c = n.square().multiply(n).shiftLeft(3).mod(this.curve.q);\n return new Ke(this.curve, this.curve.fromBigInteger(a), this.curve.fromBigInteger(u), c);\n }, Ke.prototype.multiply = function lr(t) {\n if (this.isInfinity()) return this;\n if (0 == t.signum()) return this.curve.getInfinity();\n var e,\n r = t,\n n = r.multiply(new F(\"3\")),\n i = this.negate(),\n o = this,\n s = this.curve.q.subtract(t),\n a = s.multiply(new F(\"3\")),\n u = new Ke(this.curve, this.x, this.y),\n c = u.negate();\n for (e = n.bitLength() - 2; e > 0; --e) {\n o = o.twice();\n var h = n.testBit(e);\n h != r.testBit(e) && (o = o.add(h ? this : i));\n }\n for (e = a.bitLength() - 2; e > 0; --e) {\n u = u.twice();\n var l = a.testBit(e);\n l != s.testBit(e) && (u = u.add(l ? u : c));\n }\n return o;\n }, Ke.prototype.multiplyTwo = function fr(t, e, r) {\n var n;\n n = t.bitLength() > r.bitLength() ? t.bitLength() - 1 : r.bitLength() - 1;\n for (var i = this.curve.getInfinity(), o = this.add(e); n >= 0;) i = i.twice(), t.testBit(n) ? i = r.testBit(n) ? i.add(o) : i.add(this) : r.testBit(n) && (i = i.add(e)), --n;\n return i;\n }, qe.prototype.getQ = function gr() {\n return this.q;\n }, qe.prototype.getA = function dr() {\n return this.a;\n }, qe.prototype.getB = function pr() {\n return this.b;\n }, qe.prototype.equals = function vr(t) {\n return t == this || this.q.equals(t.q) && this.a.equals(t.a) && this.b.equals(t.b);\n }, qe.prototype.getInfinity = function yr() {\n return this.infinity;\n }, qe.prototype.fromBigInteger = function mr(t) {\n return new Ve(this.q, t);\n }, qe.prototype.decodePointHex = function _r(t) {\n switch (parseInt(t.substr(0, 2), 16)) {\n case 0:\n return this.infinity;\n case 2:\n case 3:\n return null;\n case 4:\n case 6:\n case 7:\n var e = (t.length - 2) / 2,\n r = t.substr(2, e),\n n = t.substr(e + 2, e);\n return new Ke(this, this.fromBigInteger(new F(r, 16)), this.fromBigInteger(new F(n, 16)));\n default:\n return null;\n }\n },\n /*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib\n */\n Ve.prototype.getByteLength = function () {\n return Math.floor((this.toBigInteger().bitLength() + 7) / 8);\n }, Ke.prototype.getEncoded = function (t) {\n var e = function t(e, r) {\n var n = e.toByteArrayUnsigned();\n if (r < n.length) n = n.slice(n.length - r);else for (; r > n.length;) n.unshift(0);\n return n;\n },\n r = this.getX().toBigInteger(),\n n = this.getY().toBigInteger(),\n i = e(r, 32);\n return t ? n.isEven() ? i.unshift(2) : i.unshift(3) : (i.unshift(4), i = i.concat(e(n, 32))), i;\n }, Ke.decodeFrom = function (t, e) {\n e[0];\n var r = e.length - 1,\n n = e.slice(1, 1 + r / 2),\n i = e.slice(1 + r / 2, 1 + r);\n n.unshift(0), i.unshift(0);\n var o = new F(n),\n s = new F(i);\n return new Ke(t, t.fromBigInteger(o), t.fromBigInteger(s));\n }, Ke.decodeFromHex = function (t, e) {\n e.substr(0, 2);\n var r = e.length - 2,\n n = e.substr(2, r / 2),\n i = e.substr(2 + r / 2, r / 2),\n o = new F(n, 16),\n s = new F(i, 16);\n return new Ke(t, t.fromBigInteger(o), t.fromBigInteger(s));\n }, Ke.prototype.add2D = function (t) {\n if (this.isInfinity()) return t;\n if (t.isInfinity()) return this;\n if (this.x.equals(t.x)) return this.y.equals(t.y) ? this.twice() : this.curve.getInfinity();\n var e = t.x.subtract(this.x),\n r = t.y.subtract(this.y).divide(e),\n n = r.square().subtract(this.x).subtract(t.x),\n i = r.multiply(this.x.subtract(n)).subtract(this.y);\n return new Ke(this.curve, n, i);\n }, Ke.prototype.twice2D = function () {\n if (this.isInfinity()) return this;\n if (0 == this.y.toBigInteger().signum()) return this.curve.getInfinity();\n var t = this.curve.fromBigInteger(F.valueOf(2)),\n e = this.curve.fromBigInteger(F.valueOf(3)),\n r = this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),\n n = r.square().subtract(this.x.multiply(t)),\n i = r.multiply(this.x.subtract(n)).subtract(this.y);\n return new Ke(this.curve, n, i);\n }, Ke.prototype.multiply2D = function (t) {\n if (this.isInfinity()) return this;\n if (0 == t.signum()) return this.curve.getInfinity();\n var e,\n r = t,\n n = r.multiply(new F(\"3\")),\n i = this.negate(),\n o = this;\n for (e = n.bitLength() - 2; e > 0; --e) {\n o = o.twice();\n var s = n.testBit(e);\n s != r.testBit(e) && (o = o.add2D(s ? this : i));\n }\n return o;\n }, Ke.prototype.isOnCurve = function () {\n var t = this.getX().toBigInteger(),\n e = this.getY().toBigInteger(),\n r = this.curve.getA().toBigInteger(),\n n = this.curve.getB().toBigInteger(),\n i = this.curve.getQ(),\n o = e.multiply(e).mod(i),\n s = t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);\n return o.equals(s);\n }, Ke.prototype.toString = function () {\n return \"(\" + this.getX().toBigInteger().toString() + \",\" + this.getY().toBigInteger().toString() + \")\";\n }, Ke.prototype.validate = function () {\n var t = this.curve.getQ();\n if (this.isInfinity()) throw new Error(\"Point is at infinity.\");\n var e = this.getX().toBigInteger(),\n r = this.getY().toBigInteger();\n if (e.compareTo(F.ONE) < 0 || e.compareTo(t.subtract(F.ONE)) > 0) throw new Error(\"x coordinate out of bounds\");\n if (r.compareTo(F.ONE) < 0 || r.compareTo(t.subtract(F.ONE)) > 0) throw new Error(\"y coordinate out of bounds\");\n if (!this.isOnCurve()) throw new Error(\"Point is not on the curve.\");\n if (this.multiply(t).isInfinity()) throw new Error(\"Point is not a scalar multiple of G.\");\n return !0;\n };\n /*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval\n */\n var Sr = function () {\n var t = new RegExp('(?:false|true|null|[\\\\{\\\\}\\\\[\\\\]]|(?:-?\\\\b(?:0|[1-9][0-9]*)(?:\\\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\\\b)|(?:\"(?:[^\\\\0-\\\\x08\\\\x0a-\\\\x1f\"\\\\\\\\]|\\\\\\\\(?:[\"/\\\\\\\\bfnrt]|u[0-9A-Fa-f]{4}))*\"))', \"g\"),\n e = new RegExp(\"\\\\\\\\(?:([^u])|u(.{4}))\", \"g\"),\n n = {\n '\"': '\"',\n \"/\": \"/\",\n \"\\\\\": \"\\\\\",\n b: \"\\b\",\n f: \"\\f\",\n n: \"\\n\",\n r: \"\\r\",\n t: \"\\t\"\n };\n function i(t, e, r) {\n return e ? n[e] : String.fromCharCode(parseInt(r, 16));\n }\n var o = new String(\"\"),\n s = Object.hasOwnProperty;\n return function (n, a) {\n var u,\n c,\n h = n.match(t),\n l = h[0],\n f = !1;\n \"{\" === l ? u = {} : \"[\" === l ? u = [] : (u = [], f = !0);\n for (var g = [u], d = 1 - f, p = h.length; d < p; ++d) {\n var v;\n switch ((l = h[d]).charCodeAt(0)) {\n default:\n (v = g[0])[c || v.length] = +l, c = void 0;\n break;\n case 34:\n if (-1 !== (l = l.substring(1, l.length - 1)).indexOf(\"\\\\\") && (l = l.replace(e, i)), v = g[0], !c) {\n if (!(v instanceof Array)) {\n c = l || o;\n break;\n }\n c = v.length;\n }\n v[c] = l, c = void 0;\n break;\n case 91:\n v = g[0], g.unshift(v[c || v.length] = []), c = void 0;\n break;\n case 93:\n g.shift();\n break;\n case 102:\n (v = g[0])[c || v.length] = !1, c = void 0;\n break;\n case 110:\n (v = g[0])[c || v.length] = null, c = void 0;\n break;\n case 116:\n (v = g[0])[c || v.length] = !0, c = void 0;\n break;\n case 123:\n v = g[0], g.unshift(v[c || v.length] = {}), c = void 0;\n break;\n case 125:\n g.shift();\n }\n }\n if (f) {\n if (1 !== g.length) throw new Error();\n u = u[0];\n } else if (g.length) throw new Error();\n if (a) {\n u = function t(e, n) {\n var i = e[n];\n if (i && \"object\" === (void 0 === i ? \"undefined\" : r(i))) {\n var o = null;\n for (var u in i) if (s.call(i, u) && i !== e) {\n var c = t(i, u);\n void 0 !== c ? i[u] = c : (o || (o = []), o.push(u));\n }\n if (o) for (var h = o.length; --h >= 0;) delete i[o[h]];\n }\n return a.call(e, n, i);\n }({\n \"\": u\n }, \"\");\n }\n return u;\n };\n }();\n void 0 !== br && br || (e.KJUR = br = {}), void 0 !== br.asn1 && br.asn1 || (br.asn1 = {}), br.asn1.ASN1Util = new function () {\n this.integerToByteHex = function (t) {\n var e = t.toString(16);\n return e.length % 2 == 1 && (e = \"0\" + e), e;\n }, this.bigIntToMinTwosComplementsHex = function (t) {\n var e = t.toString(16);\n if (\"-\" != e.substr(0, 1)) e.length % 2 == 1 ? e = \"0\" + e : e.match(/^[0-7]/) || (e = \"00\" + e);else {\n var r = e.substr(1).length;\n r % 2 == 1 ? r += 1 : e.match(/^[0-7]/) || (r += 2);\n for (var n = \"\", i = 0; i < r; i++) n += \"f\";\n e = new F(n, 16).xor(t).add(F.ONE).toString(16).replace(/^-/, \"\");\n }\n return e;\n }, this.getPEMStringFromHex = function (t, e) {\n return Mr(t, e);\n }, this.newObject = function (t) {\n var e = br.asn1,\n r = e.ASN1Object,\n n = e.DERBoolean,\n i = e.DERInteger,\n o = e.DERBitString,\n s = e.DEROctetString,\n a = e.DERNull,\n u = e.DERObjectIdentifier,\n c = e.DEREnumerated,\n h = e.DERUTF8String,\n l = e.DERNumericString,\n f = e.DERPrintableString,\n g = e.DERTeletexString,\n d = e.DERIA5String,\n p = e.DERUTCTime,\n v = e.DERGeneralizedTime,\n y = e.DERVisibleString,\n m = e.DERBMPString,\n _ = e.DERSequence,\n S = e.DERSet,\n b = e.DERTaggedObject,\n w = e.ASN1Util.newObject;\n if (t instanceof e.ASN1Object) return t;\n var F = Object.keys(t);\n if (1 != F.length) throw new Error(\"key of param shall be only one.\");\n var E = F[0];\n if (-1 == \":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:\".indexOf(\":\" + E + \":\")) throw new Error(\"undefined key: \" + E);\n if (\"bool\" == E) return new n(t[E]);\n if (\"int\" == E) return new i(t[E]);\n if (\"bitstr\" == E) return new o(t[E]);\n if (\"octstr\" == E) return new s(t[E]);\n if (\"null\" == E) return new a(t[E]);\n if (\"oid\" == E) return new u(t[E]);\n if (\"enum\" == E) return new c(t[E]);\n if (\"utf8str\" == E) return new h(t[E]);\n if (\"numstr\" == E) return new l(t[E]);\n if (\"prnstr\" == E) return new f(t[E]);\n if (\"telstr\" == E) return new g(t[E]);\n if (\"ia5str\" == E) return new d(t[E]);\n if (\"utctime\" == E) return new p(t[E]);\n if (\"gentime\" == E) return new v(t[E]);\n if (\"visstr\" == E) return new y(t[E]);\n if (\"bmpstr\" == E) return new m(t[E]);\n if (\"asn1\" == E) return new r(t[E]);\n if (\"seq\" == E) {\n for (var x = t[E], A = [], k = 0; k < x.length; k++) {\n var P = w(x[k]);\n A.push(P);\n }\n return new _({\n array: A\n });\n }\n if (\"set\" == E) {\n for (x = t[E], A = [], k = 0; k < x.length; k++) {\n P = w(x[k]);\n A.push(P);\n }\n return new S({\n array: A\n });\n }\n if (\"tag\" == E) {\n var C = t[E];\n if (\"[object Array]\" === Object.prototype.toString.call(C) && 3 == C.length) {\n var T = w(C[2]);\n return new b({\n tag: C[0],\n explicit: C[1],\n obj: T\n });\n }\n return new b(C);\n }\n }, this.jsonToASN1HEX = function (t) {\n return this.newObject(t).getEncodedHex();\n };\n }(), br.asn1.ASN1Util.oidHexToInt = function (t) {\n for (var e = \"\", r = parseInt(t.substr(0, 2), 16), n = (e = Math.floor(r / 40) + \".\" + r % 40, \"\"), i = 2; i < t.length; i += 2) {\n var o = (\"00000000\" + parseInt(t.substr(i, 2), 16).toString(2)).slice(-8);\n if (n += o.substr(1, 7), \"0\" == o.substr(0, 1)) e = e + \".\" + new F(n, 2).toString(10), n = \"\";\n }\n return e;\n }, br.asn1.ASN1Util.oidIntToHex = function (t) {\n var e = function t(e) {\n var r = e.toString(16);\n return 1 == r.length && (r = \"0\" + r), r;\n },\n r = function t(r) {\n var n = \"\",\n i = new F(r, 10).toString(2),\n o = 7 - i.length % 7;\n 7 == o && (o = 0);\n for (var s = \"\", a = 0; a < o; a++) s += \"0\";\n i = s + i;\n for (a = 0; a < i.length - 1; a += 7) {\n var u = i.substr(a, 7);\n a != i.length - 7 && (u = \"1\" + u), n += e(parseInt(u, 2));\n }\n return n;\n };\n if (!t.match(/^[0-9.]+$/)) throw \"malformed oid string: \" + t;\n var n = \"\",\n i = t.split(\".\"),\n o = 40 * parseInt(i[0]) + parseInt(i[1]);\n n += e(o), i.splice(0, 2);\n for (var s = 0; s < i.length; s++) n += r(i[s]);\n return n;\n }, br.asn1.ASN1Object = function (t) {\n this.params = null, this.getLengthHexFromValue = function () {\n if (void 0 === this.hV || null == this.hV) throw new Error(\"this.hV is null or undefined\");\n if (this.hV.length % 2 == 1) throw new Error(\"value hex must be even length: n=\" + \"\".length + \",v=\" + this.hV);\n var t = this.hV.length / 2,\n e = t.toString(16);\n if (e.length % 2 == 1 && (e = \"0\" + e), t < 128) return e;\n var r = e.length / 2;\n if (r > 15) throw \"ASN.1 length too long to represent by 8x: n = \" + t.toString(16);\n return (128 + r).toString(16) + e;\n }, this.getEncodedHex = function () {\n return (null == this.hTLV || this.isModified) && (this.hV = this.getFreshValueHex(), this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV, this.isModified = !1), this.hTLV;\n }, this.getValueHex = function () {\n return this.getEncodedHex(), this.hV;\n }, this.getFreshValueHex = function () {\n return \"\";\n }, this.setByParam = function (t) {\n this.params = t;\n }, null != t && null != t.tlv && (this.hTLV = t.tlv, this.isModified = !1);\n }, br.asn1.DERAbstractString = function (t) {\n br.asn1.DERAbstractString.superclass.constructor.call(this);\n this.getString = function () {\n return this.s;\n }, this.setString = function (t) {\n this.hTLV = null, this.isModified = !0, this.s = t, this.hV = Dr(this.s).toLowerCase();\n }, this.setStringHex = function (t) {\n this.hTLV = null, this.isModified = !0, this.s = null, this.hV = t;\n }, this.getFreshValueHex = function () {\n return this.hV;\n }, void 0 !== t && (\"string\" == typeof t ? this.setString(t) : void 0 !== t.str ? this.setString(t.str) : void 0 !== t.hex && this.setStringHex(t.hex));\n }, o.lang.extend(br.asn1.DERAbstractString, br.asn1.ASN1Object), br.asn1.DERAbstractTime = function (t) {\n br.asn1.DERAbstractTime.superclass.constructor.call(this);\n this.localDateToUTC = function (t) {\n var e = t.getTime() + 6e4 * t.getTimezoneOffset();\n return new Date(e);\n }, this.formatDate = function (t, e, r) {\n var n = this.zeroPadding,\n i = this.localDateToUTC(t),\n o = String(i.getFullYear());\n \"utc\" == e && (o = o.substr(2, 2));\n var s = o + n(String(i.getMonth() + 1), 2) + n(String(i.getDate()), 2) + n(String(i.getHours()), 2) + n(String(i.getMinutes()), 2) + n(String(i.getSeconds()), 2);\n if (!0 === r) {\n var a = i.getMilliseconds();\n if (0 != a) {\n var u = n(String(a), 3);\n s = s + \".\" + (u = u.replace(/[0]+$/, \"\"));\n }\n }\n return s + \"Z\";\n }, this.zeroPadding = function (t, e) {\n return t.length >= e ? t : new Array(e - t.length + 1).join(\"0\") + t;\n }, this.getString = function () {\n return this.s;\n }, this.setString = function (t) {\n this.hTLV = null, this.isModified = !0, this.s = t, this.hV = Pr(t);\n }, this.setByDateValue = function (t, e, r, n, i, o) {\n var s = new Date(Date.UTC(t, e - 1, r, n, i, o, 0));\n this.setByDate(s);\n }, this.getFreshValueHex = function () {\n return this.hV;\n };\n }, o.lang.extend(br.asn1.DERAbstractTime, br.asn1.ASN1Object), br.asn1.DERAbstractStructured = function (t) {\n br.asn1.DERAbstractString.superclass.constructor.call(this);\n this.setByASN1ObjectArray = function (t) {\n this.hTLV = null, this.isModified = !0, this.asn1Array = t;\n }, this.appendASN1Object = function (t) {\n this.hTLV = null, this.isModified = !0, this.asn1Array.push(t);\n }, this.asn1Array = new Array(), void 0 !== t && void 0 !== t.array && (this.asn1Array = t.array);\n }, o.lang.extend(br.asn1.DERAbstractStructured, br.asn1.ASN1Object), br.asn1.DERBoolean = function (t) {\n br.asn1.DERBoolean.superclass.constructor.call(this), this.hT = \"01\", this.hTLV = 0 == t ? \"010100\" : \"0101ff\";\n }, o.lang.extend(br.asn1.DERBoolean, br.asn1.ASN1Object), br.asn1.DERInteger = function (t) {\n br.asn1.DERInteger.superclass.constructor.call(this), this.hT = \"02\", this.setByBigInteger = function (t) {\n this.hTLV = null, this.isModified = !0, this.hV = br.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t);\n }, this.setByInteger = function (t) {\n var e = new F(String(t), 10);\n this.setByBigInteger(e);\n }, this.setValueHex = function (t) {\n this.hV = t;\n }, this.getFreshValueHex = function () {\n return this.hV;\n }, void 0 !== t && (void 0 !== t.bigint ? this.setByBigInteger(t.bigint) : void 0 !== t.int ? this.setByInteger(t.int) : \"number\" == typeof t ? this.setByInteger(t) : void 0 !== t.hex && this.setValueHex(t.hex));\n }, o.lang.extend(br.asn1.DERInteger, br.asn1.ASN1Object), br.asn1.DERBitString = function (t) {\n if (void 0 !== t && void 0 !== t.obj) {\n var e = br.asn1.ASN1Util.newObject(t.obj);\n t.hex = \"00\" + e.getEncodedHex();\n }\n br.asn1.DERBitString.superclass.constructor.call(this), this.hT = \"03\", this.setHexValueIncludingUnusedBits = function (t) {\n this.hTLV = null, this.isModified = !0, this.hV = t;\n }, this.setUnusedBitsAndHexValue = function (t, e) {\n if (t < 0 || 7 < t) throw \"unused bits shall be from 0 to 7: u = \" + t;\n var r = \"0\" + t;\n this.hTLV = null, this.isModified = !0, this.hV = r + e;\n }, this.setByBinaryString = function (t) {\n var e = 8 - (t = t.replace(/0+$/, \"\")).length % 8;\n 8 == e && (e = 0);\n for (var r = 0; r <= e; r++) t += \"0\";\n var n = \"\";\n for (r = 0; r < t.length - 1; r += 8) {\n var i = t.substr(r, 8),\n o = parseInt(i, 2).toString(16);\n 1 == o.length && (o = \"0\" + o), n += o;\n }\n this.hTLV = null, this.isModified = !0, this.hV = \"0\" + e + n;\n }, this.setByBooleanArray = function (t) {\n for (var e = \"\", r = 0; r < t.length; r++) 1 == t[r] ? e += \"1\" : e += \"0\";\n this.setByBinaryString(e);\n }, this.newFalseArray = function (t) {\n for (var e = new Array(t), r = 0; r < t; r++) e[r] = !1;\n return e;\n }, this.getFreshValueHex = function () {\n return this.hV;\n }, void 0 !== t && (\"string\" == typeof t && t.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(t) : void 0 !== t.hex ? this.setHexValueIncludingUnusedBits(t.hex) : void 0 !== t.bin ? this.setByBinaryString(t.bin) : void 0 !== t.array && this.setByBooleanArray(t.array));\n }, o.lang.extend(br.asn1.DERBitString, br.asn1.ASN1Object), br.asn1.DEROctetString = function (t) {\n if (void 0 !== t && void 0 !== t.obj) {\n var e = br.asn1.ASN1Util.newObject(t.obj);\n t.hex = e.getEncodedHex();\n }\n br.asn1.DEROctetString.superclass.constructor.call(this, t), this.hT = \"04\";\n }, o.lang.extend(br.asn1.DEROctetString, br.asn1.DERAbstractString), br.asn1.DERNull = function () {\n br.asn1.DERNull.superclass.constructor.call(this), this.hT = \"05\", this.hTLV = \"0500\";\n }, o.lang.extend(br.asn1.DERNull, br.asn1.ASN1Object), br.asn1.DERObjectIdentifier = function (t) {\n br.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = \"06\", this.setValueHex = function (t) {\n this.hTLV = null, this.isModified = !0, this.s = null, this.hV = t;\n }, this.setValueOidString = function (t) {\n var e = function r(t) {\n var e = function t(e) {\n var r = e.toString(16);\n return 1 == r.length && (r = \"0\" + r), r;\n },\n r = function t(r) {\n var n = \"\",\n i = parseInt(r, 10).toString(2),\n o = 7 - i.length % 7;\n 7 == o && (o = 0);\n for (var s = \"\", a = 0; a < o; a++) s += \"0\";\n i = s + i;\n for (a = 0; a < i.length - 1; a += 7) {\n var u = i.substr(a, 7);\n a != i.length - 7 && (u = \"1\" + u), n += e(parseInt(u, 2));\n }\n return n;\n };\n try {\n if (!t.match(/^[0-9.]+$/)) return null;\n var n = \"\",\n i = t.split(\".\"),\n o = 40 * parseInt(i[0], 10) + parseInt(i[1], 10);\n n += e(o), i.splice(0, 2);\n for (var s = 0; s < i.length; s++) n += r(i[s]);\n return n;\n } catch (t) {\n return null;\n }\n }(t);\n if (null == e) throw new Error(\"malformed oid string: \" + t);\n this.hTLV = null, this.isModified = !0, this.s = null, this.hV = e;\n }, this.setValueName = function (t) {\n var e = br.asn1.x509.OID.name2oid(t);\n if (\"\" === e) throw new Error(\"DERObjectIdentifier oidName undefined: \" + t);\n this.setValueOidString(e);\n }, this.setValueNameOrOid = function (t) {\n t.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(t) : this.setValueName(t);\n }, this.getFreshValueHex = function () {\n return this.hV;\n }, this.setByParam = function (t) {\n \"string\" == typeof t ? this.setValueNameOrOid(t) : void 0 !== t.oid ? this.setValueNameOrOid(t.oid) : void 0 !== t.name ? this.setValueNameOrOid(t.name) : void 0 !== t.hex && this.setValueHex(t.hex);\n }, void 0 !== t && this.setByParam(t);\n }, o.lang.extend(br.asn1.DERObjectIdentifier, br.asn1.ASN1Object), br.asn1.DEREnumerated = function (t) {\n br.asn1.DEREnumerated.superclass.constructor.call(this), this.hT = \"0a\", this.setByBigInteger = function (t) {\n this.hTLV = null, this.isModified = !0, this.hV = br.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t);\n }, this.setByInteger = function (t) {\n var e = new F(String(t), 10);\n this.setByBigInteger(e);\n }, this.setValueHex = function (t) {\n this.hV = t;\n }, this.getFreshValueHex = function () {\n return this.hV;\n }, void 0 !== t && (void 0 !== t.int ? this.setByInteger(t.int) : \"number\" == typeof t ? this.setByInteger(t) : void 0 !== t.hex && this.setValueHex(t.hex));\n }, o.lang.extend(br.asn1.DEREnumerated, br.asn1.ASN1Object), br.asn1.DERUTF8String = function (t) {\n br.asn1.DERUTF8String.superclass.constructor.call(this, t), this.hT = \"0c\";\n }, o.lang.extend(br.asn1.DERUTF8String, br.asn1.DERAbstractString), br.asn1.DERNumericString = function (t) {\n br.asn1.DERNumericString.superclass.constructor.call(this, t), this.hT = \"12\";\n }, o.lang.extend(br.asn1.DERNumericString, br.asn1.DERAbstractString), br.asn1.DERPrintableString = function (t) {\n br.asn1.DERPrintableString.superclass.constructor.call(this, t), this.hT = \"13\";\n }, o.lang.extend(br.asn1.DERPrintableString, br.asn1.DERAbstractString), br.asn1.DERTeletexString = function (t) {\n br.asn1.DERTeletexString.superclass.constructor.call(this, t), this.hT = \"14\";\n }, o.lang.extend(br.asn1.DERTeletexString, br.asn1.DERAbstractString), br.asn1.DERIA5String = function (t) {\n br.asn1.DERIA5String.superclass.constructor.call(this, t), this.hT = \"16\";\n }, o.lang.extend(br.asn1.DERIA5String, br.asn1.DERAbstractString), br.asn1.DERVisibleString = function (t) {\n br.asn1.DERIA5String.superclass.constructor.call(this, t), this.hT = \"1a\";\n }, o.lang.extend(br.asn1.DERVisibleString, br.asn1.DERAbstractString), br.asn1.DERBMPString = function (t) {\n br.asn1.DERBMPString.superclass.constructor.call(this, t), this.hT = \"1e\";\n }, o.lang.extend(br.asn1.DERBMPString, br.asn1.DERAbstractString), br.asn1.DERUTCTime = function (t) {\n br.asn1.DERUTCTime.superclass.constructor.call(this, t), this.hT = \"17\", this.setByDate = function (t) {\n this.hTLV = null, this.isModified = !0, this.date = t, this.s = this.formatDate(this.date, \"utc\"), this.hV = Pr(this.s);\n }, this.getFreshValueHex = function () {\n return void 0 === this.date && void 0 === this.s && (this.date = new Date(), this.s = this.formatDate(this.date, \"utc\"), this.hV = Pr(this.s)), this.hV;\n }, void 0 !== t && (void 0 !== t.str ? this.setString(t.str) : \"string\" == typeof t && t.match(/^[0-9]{12}Z$/) ? this.setString(t) : void 0 !== t.hex ? this.setStringHex(t.hex) : void 0 !== t.date && this.setByDate(t.date));\n }, o.lang.extend(br.asn1.DERUTCTime, br.asn1.DERAbstractTime), br.asn1.DERGeneralizedTime = function (t) {\n br.asn1.DERGeneralizedTime.superclass.constructor.call(this, t), this.hT = \"18\", this.withMillis = !1, this.setByDate = function (t) {\n this.hTLV = null, this.isModified = !0, this.date = t, this.s = this.formatDate(this.date, \"gen\", this.withMillis), this.hV = Pr(this.s);\n }, this.getFreshValueHex = function () {\n return void 0 === this.date && void 0 === this.s && (this.date = new Date(), this.s = this.formatDate(this.date, \"gen\", this.withMillis), this.hV = Pr(this.s)), this.hV;\n }, void 0 !== t && (void 0 !== t.str ? this.setString(t.str) : \"string\" == typeof t && t.match(/^[0-9]{14}Z$/) ? this.setString(t) : void 0 !== t.hex ? this.setStringHex(t.hex) : void 0 !== t.date && this.setByDate(t.date), !0 === t.millis && (this.withMillis = !0));\n }, o.lang.extend(br.asn1.DERGeneralizedTime, br.asn1.DERAbstractTime), br.asn1.DERSequence = function (t) {\n br.asn1.DERSequence.superclass.constructor.call(this, t), this.hT = \"30\", this.getFreshValueHex = function () {\n for (var t = \"\", e = 0; e < this.asn1Array.length; e++) {\n t += this.asn1Array[e].getEncodedHex();\n }\n return this.hV = t, this.hV;\n };\n }, o.lang.extend(br.asn1.DERSequence, br.asn1.DERAbstractStructured), br.asn1.DERSet = function (t) {\n br.asn1.DERSet.superclass.constructor.call(this, t), this.hT = \"31\", this.sortFlag = !0, this.getFreshValueHex = function () {\n for (var t = new Array(), e = 0; e < this.asn1Array.length; e++) {\n var r = this.asn1Array[e];\n t.push(r.getEncodedHex());\n }\n return 1 == this.sortFlag && t.sort(), this.hV = t.join(\"\"), this.hV;\n }, void 0 !== t && void 0 !== t.sortflag && 0 == t.sortflag && (this.sortFlag = !1);\n }, o.lang.extend(br.asn1.DERSet, br.asn1.DERAbstractStructured), br.asn1.DERTaggedObject = function (t) {\n br.asn1.DERTaggedObject.superclass.constructor.call(this);\n var e = br.asn1;\n this.hT = \"a0\", this.hV = \"\", this.isExplicit = !0, this.asn1Object = null, this.setASN1Object = function (t, e, r) {\n this.hT = e, this.isExplicit = t, this.asn1Object = r, this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), this.hTLV = null, this.isModified = !0) : (this.hV = null, this.hTLV = r.getEncodedHex(), this.hTLV = this.hTLV.replace(/^../, e), this.isModified = !1);\n }, this.getFreshValueHex = function () {\n return this.hV;\n }, this.setByParam = function (t) {\n null != t.tag && (this.hT = t.tag), null != t.explicit && (this.isExplicit = t.explicit), null != t.tage && (this.hT = t.tage, this.isExplicit = !0), null != t.tagi && (this.hT = t.tagi, this.isExplicit = !1), null != t.obj && (t.obj instanceof e.ASN1Object ? (this.asn1Object = t.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)) : \"object\" == r(t.obj) && (this.asn1Object = e.ASN1Util.newObject(t.obj), this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));\n }, null != t && this.setByParam(t);\n }, o.lang.extend(br.asn1.DERTaggedObject, br.asn1.ASN1Object);\n var br,\n wr,\n Fr,\n Er = new function () {}();\n function xr(t) {\n for (var e = new Array(), r = 0; r < t.length; r++) e[r] = t.charCodeAt(r);\n return e;\n }\n function Ar(t) {\n for (var e = \"\", r = 0; r < t.length; r++) e += String.fromCharCode(t[r]);\n return e;\n }\n function kr(t) {\n for (var e = \"\", r = 0; r < t.length; r++) {\n var n = t[r].toString(16);\n 1 == n.length && (n = \"0\" + n), e += n;\n }\n return e;\n }\n function Pr(t) {\n return kr(xr(t));\n }\n function Cr(t) {\n return t = (t = (t = t.replace(/\\=/g, \"\")).replace(/\\+/g, \"-\")).replace(/\\//g, \"_\");\n }\n function Tr(t) {\n return t.length % 4 == 2 ? t += \"==\" : t.length % 4 == 3 && (t += \"=\"), t = (t = t.replace(/-/g, \"+\")).replace(/_/g, \"/\");\n }\n function Rr(t) {\n return t.length % 2 == 1 && (t = \"0\" + t), Cr(S(t));\n }\n function Ir(t) {\n return b(Tr(t));\n }\n function Dr(t) {\n return qr(Gr(t));\n }\n function Lr(t) {\n return decodeURIComponent(Jr(t));\n }\n function Nr(t) {\n for (var e = \"\", r = 0; r < t.length - 1; r += 2) e += String.fromCharCode(parseInt(t.substr(r, 2), 16));\n return e;\n }\n function Ur(t) {\n for (var e = \"\", r = 0; r < t.length; r++) e += (\"0\" + t.charCodeAt(r).toString(16)).slice(-2);\n return e;\n }\n function Br(t) {\n return S(t);\n }\n function Or(t) {\n var e = Br(t).replace(/(.{64})/g, \"$1\\r\\n\");\n return e = e.replace(/\\r\\n$/, \"\");\n }\n function jr(t) {\n return b(t.replace(/[^0-9A-Za-z\\/+=]*/g, \"\"));\n }\n function Mr(t, e) {\n return \"-----BEGIN \" + e + \"-----\\r\\n\" + Or(t) + \"\\r\\n-----END \" + e + \"-----\\r\\n\";\n }\n function Hr(t, e) {\n if (-1 == t.indexOf(\"-----BEGIN \")) throw \"can't find PEM header: \" + e;\n return jr(t = void 0 !== e ? (t = t.replace(new RegExp(\"^[^]*-----BEGIN \" + e + \"-----\"), \"\")).replace(new RegExp(\"-----END \" + e + \"-----[^]*$\"), \"\") : (t = t.replace(/^[^]*-----BEGIN [^-]+-----/, \"\")).replace(/-----END [^-]+-----[^]*$/, \"\"));\n }\n function Vr(t) {\n var e, r, n, i, o, s, a, u, c, h, l;\n if (l = t.match(/^(\\d{2}|\\d{4})(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(|\\.\\d+)Z$/)) return u = l[1], e = parseInt(u), 2 === u.length && (50 <= e && e < 100 ? e = 1900 + e : 0 <= e && e < 50 && (e = 2e3 + e)), r = parseInt(l[2]) - 1, n = parseInt(l[3]), i = parseInt(l[4]), o = parseInt(l[5]), s = parseInt(l[6]), a = 0, \"\" !== (c = l[7]) && (h = (c.substr(1) + \"00\").substr(0, 3), a = parseInt(h)), Date.UTC(e, r, n, i, o, s, a);\n throw \"unsupported zulu format: \" + t;\n }\n function Kr(t) {\n return ~~(Vr(t) / 1e3);\n }\n function qr(t) {\n return t.replace(/%/g, \"\");\n }\n function Jr(t) {\n return t.replace(/(..)/g, \"%$1\");\n }\n function Wr(t) {\n var e = \"malformed IPv6 address\";\n if (!t.match(/^[0-9A-Fa-f:]+$/)) throw e;\n var r = (t = t.toLowerCase()).split(\":\").length - 1;\n if (r < 2) throw e;\n var n = \":\".repeat(7 - r + 2),\n i = (t = t.replace(\"::\", n)).split(\":\");\n if (8 != i.length) throw e;\n for (var o = 0; o < 8; o++) i[o] = (\"0000\" + i[o]).slice(-4);\n return i.join(\"\");\n }\n function zr(t) {\n if (!t.match(/^[0-9A-Fa-f]{32}$/)) throw \"malformed IPv6 address octet\";\n for (var e = (t = t.toLowerCase()).match(/.{1,4}/g), r = 0; r < 8; r++) e[r] = e[r].replace(/^0+/, \"\"), \"\" == e[r] && (e[r] = \"0\");\n var n = (t = \":\" + e.join(\":\") + \":\").match(/:(0:){2,}/g);\n if (null === n) return t.slice(1, -1);\n var i = \"\";\n for (r = 0; r < n.length; r++) n[r].length > i.length && (i = n[r]);\n return (t = t.replace(i, \"::\")).slice(1, -1);\n }\n function Yr(t) {\n var e = \"malformed hex value\";\n if (!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/)) throw e;\n if (8 != t.length) return 32 == t.length ? zr(t) : t;\n try {\n return parseInt(t.substr(0, 2), 16) + \".\" + parseInt(t.substr(2, 2), 16) + \".\" + parseInt(t.substr(4, 2), 16) + \".\" + parseInt(t.substr(6, 2), 16);\n } catch (t) {\n throw e;\n }\n }\n function Gr(t) {\n for (var e = encodeURIComponent(t), r = \"\", n = 0; n < e.length; n++) \"%\" == e[n] ? (r += e.substr(n, 3), n += 2) : r = r + \"%\" + Pr(e[n]);\n return r;\n }\n function Xr(t) {\n return !(t.length % 2 != 0 || !t.match(/^[0-9a-f]+$/) && !t.match(/^[0-9A-F]+$/));\n }\n function $r(t) {\n return t.length % 2 == 1 ? \"0\" + t : t.substr(0, 1) > \"7\" ? \"00\" + t : t;\n }\n Er.getLblen = function (t, e) {\n if (\"8\" != t.substr(e + 2, 1)) return 1;\n var r = parseInt(t.substr(e + 3, 1));\n return 0 == r ? -1 : 0 < r && r < 10 ? r + 1 : -2;\n }, Er.getL = function (t, e) {\n var r = Er.getLblen(t, e);\n return r < 1 ? \"\" : t.substr(e + 2, 2 * r);\n }, Er.getVblen = function (t, e) {\n var r;\n return \"\" == (r = Er.getL(t, e)) ? -1 : (\"8\" === r.substr(0, 1) ? new F(r.substr(2), 16) : new F(r, 16)).intValue();\n }, Er.getVidx = function (t, e) {\n var r = Er.getLblen(t, e);\n return r < 0 ? r : e + 2 * (r + 1);\n }, Er.getV = function (t, e) {\n var r = Er.getVidx(t, e),\n n = Er.getVblen(t, e);\n return t.substr(r, 2 * n);\n }, Er.getTLV = function (t, e) {\n return t.substr(e, 2) + Er.getL(t, e) + Er.getV(t, e);\n }, Er.getTLVblen = function (t, e) {\n return 2 + 2 * Er.getLblen(t, e) + 2 * Er.getVblen(t, e);\n }, Er.getNextSiblingIdx = function (t, e) {\n return Er.getVidx(t, e) + 2 * Er.getVblen(t, e);\n }, Er.getChildIdx = function (t, e) {\n var r,\n n,\n i,\n o = Er,\n s = [];\n r = o.getVidx(t, e), n = 2 * o.getVblen(t, e), \"03\" == t.substr(e, 2) && (r += 2, n -= 2), i = 0;\n for (var a = r; i <= n;) {\n var u = o.getTLVblen(t, a);\n if ((i += u) <= n && s.push(a), a += u, i >= n) break;\n }\n return s;\n }, Er.getNthChildIdx = function (t, e, r) {\n return Er.getChildIdx(t, e)[r];\n }, Er.getIdxbyList = function (t, e, r, n) {\n var i,\n o,\n s = Er;\n return 0 == r.length ? void 0 !== n && t.substr(e, 2) !== n ? -1 : e : (i = r.shift()) >= (o = s.getChildIdx(t, e)).length ? -1 : s.getIdxbyList(t, o[i], r, n);\n }, Er.getIdxbyListEx = function (t, e, r, n) {\n var i,\n o,\n s = Er;\n if (0 == r.length) return void 0 !== n && t.substr(e, 2) !== n ? -1 : e;\n i = r.shift(), o = s.getChildIdx(t, e);\n for (var a = 0, u = 0; u < o.length; u++) {\n var c = t.substr(o[u], 2);\n if (\"number\" == typeof i && !s.isContextTag(c) && a == i || \"string\" == typeof i && s.isContextTag(c, i)) return s.getIdxbyListEx(t, o[u], r, n);\n s.isContextTag(c) || a++;\n }\n return -1;\n }, Er.getTLVbyList = function (t, e, r, n) {\n var i = Er,\n o = i.getIdxbyList(t, e, r, n);\n return -1 == o || o >= t.length ? null : i.getTLV(t, o);\n }, Er.getTLVbyListEx = function (t, e, r, n) {\n var i = Er,\n o = i.getIdxbyListEx(t, e, r, n);\n return -1 == o ? null : i.getTLV(t, o);\n }, Er.getVbyList = function (t, e, r, n, i) {\n var o,\n s,\n a = Er;\n return -1 == (o = a.getIdxbyList(t, e, r, n)) || o >= t.length ? null : (s = a.getV(t, o), !0 === i && (s = s.substr(2)), s);\n }, Er.getVbyListEx = function (t, e, r, n, i) {\n var o,\n s,\n a = Er;\n return -1 == (o = a.getIdxbyListEx(t, e, r, n)) ? null : (s = a.getV(t, o), \"03\" == t.substr(o, 2) && !1 !== i && (s = s.substr(2)), s);\n }, Er.getInt = function (t, e, r) {\n null == r && (r = -1);\n try {\n var n = t.substr(e, 2);\n if (\"02\" != n && \"03\" != n) return r;\n var i = Er.getV(t, e);\n return \"02\" == n ? parseInt(i, 16) : function o(t) {\n try {\n var e = t.substr(0, 2);\n if (\"00\" == e) return parseInt(t.substr(2), 16);\n var r = parseInt(e, 16),\n n = t.substr(2),\n i = parseInt(n, 16).toString(2);\n return \"0\" == i && (i = \"00000000\"), i = i.slice(0, 0 - r), parseInt(i, 2);\n } catch (t) {\n return -1;\n }\n }(i);\n } catch (t) {\n return r;\n }\n }, Er.getOID = function (t, e, r) {\n null == r && (r = null);\n try {\n return \"06\" != t.substr(e, 2) ? r : function n(t) {\n if (!Xr(t)) return null;\n try {\n var e = [],\n r = t.substr(0, 2),\n n = parseInt(r, 16);\n e[0] = new String(Math.floor(n / 40)), e[1] = new String(n % 40);\n for (var i = t.substr(2), o = [], s = 0; s < i.length / 2; s++) o.push(parseInt(i.substr(2 * s, 2), 16));\n var a = [],\n u = \"\";\n for (s = 0; s < o.length; s++) 128 & o[s] ? u += Qr((127 & o[s]).toString(2), 7) : (u += Qr((127 & o[s]).toString(2), 7), a.push(new String(parseInt(u, 2))), u = \"\");\n var c = e.join(\".\");\n return a.length > 0 && (c = c + \".\" + a.join(\".\")), c;\n } catch (t) {\n return null;\n }\n }(Er.getV(t, e));\n } catch (t) {\n return r;\n }\n }, Er.getOIDName = function (t, e, r) {\n null == r && (r = null);\n try {\n var n = Er.getOID(t, e, r);\n if (n == r) return r;\n var i = br.asn1.x509.OID.oid2name(n);\n return \"\" == i ? n : i;\n } catch (t) {\n return r;\n }\n }, Er.getString = function (t, e, r) {\n null == r && (r = null);\n try {\n return Nr(Er.getV(t, e));\n } catch (t) {\n return r;\n }\n }, Er.hextooidstr = function (t) {\n var e = function t(e, r) {\n return e.length >= r ? e : new Array(r - e.length + 1).join(\"0\") + e;\n },\n r = [],\n n = t.substr(0, 2),\n i = parseInt(n, 16);\n r[0] = new String(Math.floor(i / 40)), r[1] = new String(i % 40);\n for (var o = t.substr(2), s = [], a = 0; a < o.length / 2; a++) s.push(parseInt(o.substr(2 * a, 2), 16));\n var u = [],\n c = \"\";\n for (a = 0; a < s.length; a++) 128 & s[a] ? c += e((127 & s[a]).toString(2), 7) : (c += e((127 & s[a]).toString(2), 7), u.push(new String(parseInt(c, 2))), c = \"\");\n var h = r.join(\".\");\n return u.length > 0 && (h = h + \".\" + u.join(\".\")), h;\n }, Er.dump = function (t, e, r, n) {\n var i = Er,\n o = i.getV,\n s = i.dump,\n a = i.getChildIdx,\n u = t;\n t instanceof br.asn1.ASN1Object && (u = t.getEncodedHex());\n var c = function t(e, r) {\n return e.length <= 2 * r ? e : e.substr(0, r) + \"..(total \" + e.length / 2 + \"bytes)..\" + e.substr(e.length - r, r);\n };\n void 0 === e && (e = {\n ommit_long_octet: 32\n }), void 0 === r && (r = 0), void 0 === n && (n = \"\");\n var h,\n l = e.ommit_long_octet;\n if (\"01\" == (h = u.substr(r, 2))) return \"00\" == (f = o(u, r)) ? n + \"BOOLEAN FALSE\\n\" : n + \"BOOLEAN TRUE\\n\";\n if (\"02\" == h) return n + \"INTEGER \" + c(f = o(u, r), l) + \"\\n\";\n if (\"03\" == h) {\n var f = o(u, r);\n if (i.isASN1HEX(f.substr(2))) {\n var g = n + \"BITSTRING, encapsulates\\n\";\n return g += s(f.substr(2), e, 0, n + \" \");\n }\n return n + \"BITSTRING \" + c(f, l) + \"\\n\";\n }\n if (\"04\" == h) {\n f = o(u, r);\n if (i.isASN1HEX(f)) {\n g = n + \"OCTETSTRING, encapsulates\\n\";\n return g += s(f, e, 0, n + \" \");\n }\n return n + \"OCTETSTRING \" + c(f, l) + \"\\n\";\n }\n if (\"05\" == h) return n + \"NULL\\n\";\n if (\"06\" == h) {\n var d = o(u, r),\n p = br.asn1.ASN1Util.oidHexToInt(d),\n v = br.asn1.x509.OID.oid2name(p),\n y = p.replace(/\\./g, \" \");\n return \"\" != v ? n + \"ObjectIdentifier \" + v + \" (\" + y + \")\\n\" : n + \"ObjectIdentifier (\" + y + \")\\n\";\n }\n if (\"0a\" == h) return n + \"ENUMERATED \" + parseInt(o(u, r)) + \"\\n\";\n if (\"0c\" == h) return n + \"UTF8String '\" + Lr(o(u, r)) + \"'\\n\";\n if (\"13\" == h) return n + \"PrintableString '\" + Lr(o(u, r)) + \"'\\n\";\n if (\"14\" == h) return n + \"TeletexString '\" + Lr(o(u, r)) + \"'\\n\";\n if (\"16\" == h) return n + \"IA5String '\" + Lr(o(u, r)) + \"'\\n\";\n if (\"17\" == h) return n + \"UTCTime \" + Lr(o(u, r)) + \"\\n\";\n if (\"18\" == h) return n + \"GeneralizedTime \" + Lr(o(u, r)) + \"\\n\";\n if (\"1a\" == h) return n + \"VisualString '\" + Lr(o(u, r)) + \"'\\n\";\n if (\"1e\" == h) return n + \"BMPString '\" + Lr(o(u, r)) + \"'\\n\";\n if (\"30\" == h) {\n if (\"3000\" == u.substr(r, 4)) return n + \"SEQUENCE {}\\n\";\n g = n + \"SEQUENCE\\n\";\n var m = e;\n if ((2 == (b = a(u, r)).length || 3 == b.length) && \"06\" == u.substr(b[0], 2) && \"04\" == u.substr(b[b.length - 1], 2)) {\n v = i.oidname(o(u, b[0]));\n var _ = JSON.parse(JSON.stringify(e));\n _.x509ExtName = v, m = _;\n }\n for (var S = 0; S < b.length; S++) g += s(u, m, b[S], n + \" \");\n return g;\n }\n if (\"31\" == h) {\n g = n + \"SET\\n\";\n var b = a(u, r);\n for (S = 0; S < b.length; S++) g += s(u, e, b[S], n + \" \");\n return g;\n }\n if (0 != (128 & (h = parseInt(h, 16)))) {\n var w = 31 & h;\n if (0 != (32 & h)) {\n for (g = n + \"[\" + w + \"]\\n\", b = a(u, r), S = 0; S < b.length; S++) g += s(u, e, b[S], n + \" \");\n return g;\n }\n f = o(u, r);\n if (Er.isASN1HEX(f)) {\n var g = n + \"[\" + w + \"]\\n\";\n return g += s(f, e, 0, n + \" \");\n }\n return (\"68747470\" == f.substr(0, 8) || \"subjectAltName\" === e.x509ExtName && 2 == w) && (f = Lr(f)), g = n + \"[\" + w + \"] \" + f + \"\\n\";\n }\n return n + \"UNKNOWN(\" + h + \") \" + o(u, r) + \"\\n\";\n }, Er.isContextTag = function (t, e) {\n var r, n;\n t = t.toLowerCase();\n try {\n r = parseInt(t, 16);\n } catch (t) {\n return -1;\n }\n if (void 0 === e) return 128 == (192 & r);\n try {\n return null != e.match(/^\\[[0-9]+\\]$/) && !((n = parseInt(e.substr(1, e.length - 1), 10)) > 31) && 128 == (192 & r) && (31 & r) == n;\n } catch (t) {\n return !1;\n }\n }, Er.isASN1HEX = function (t) {\n var e = Er;\n if (t.length % 2 == 1) return !1;\n var r = e.getVblen(t, 0),\n n = t.substr(0, 2),\n i = e.getL(t, 0);\n return t.length - n.length - i.length == 2 * r;\n }, Er.checkStrictDER = function (t, e, r, n, i) {\n var o = Er;\n if (void 0 === r) {\n if (\"string\" != typeof t) throw new Error(\"not hex string\");\n if (t = t.toLowerCase(), !br.lang.String.isHex(t)) throw new Error(\"not hex string\");\n r = t.length, i = (n = t.length / 2) < 128 ? 1 : Math.ceil(n.toString(16)) + 1;\n }\n if (o.getL(t, e).length > 2 * i) throw new Error(\"L of TLV too long: idx=\" + e);\n var s = o.getVblen(t, e);\n if (s > n) throw new Error(\"value of L too long than hex: idx=\" + e);\n var a = o.getTLV(t, e),\n u = a.length - 2 - o.getL(t, e).length;\n if (u !== 2 * s) throw new Error(\"V string length and L's value not the same:\" + u + \"/\" + 2 * s);\n if (0 === e && t.length != a.length) throw new Error(\"total length and TLV length unmatch:\" + t.length + \"!=\" + a.length);\n var c = t.substr(e, 2);\n if (\"02\" === c) {\n var h = o.getVidx(t, e);\n if (\"00\" == t.substr(h, 2) && t.charCodeAt(h + 2) < 56) throw new Error(\"not least zeros for DER INTEGER\");\n }\n if (32 & parseInt(c, 16)) {\n for (var l = o.getVblen(t, e), f = 0, g = o.getChildIdx(t, e), d = 0; d < g.length; d++) {\n f += o.getTLV(t, g[d]).length, o.checkStrictDER(t, g[d], r, n, i);\n }\n if (2 * l != f) throw new Error(\"sum of children's TLV length and L unmatch: \" + 2 * l + \"!=\" + f);\n }\n }, Er.oidname = function (t) {\n var e = br.asn1;\n br.lang.String.isHex(t) && (t = e.ASN1Util.oidHexToInt(t));\n var r = e.x509.OID.oid2name(t);\n return \"\" === r && (r = t), r;\n }, void 0 !== br && br || (e.KJUR = br = {}), void 0 !== br.lang && br.lang || (br.lang = {}), br.lang.String = function () {}, \"function\" == typeof t ? (e.utf8tob64u = wr = function e(r) {\n return Cr(t.from(r, \"utf8\").toString(\"base64\"));\n }, e.b64utoutf8 = Fr = function e(r) {\n return t.from(Tr(r), \"base64\").toString(\"utf8\");\n }) : (e.utf8tob64u = wr = function t(e) {\n return Rr(qr(Gr(e)));\n }, e.b64utoutf8 = Fr = function t(e) {\n return decodeURIComponent(Jr(Ir(e)));\n }), br.lang.String.isInteger = function (t) {\n return !!t.match(/^[0-9]+$/) || !!t.match(/^-[0-9]+$/);\n }, br.lang.String.isHex = function (t) {\n return Xr(t);\n }, br.lang.String.isBase64 = function (t) {\n return !(!(t = t.replace(/\\s+/g, \"\")).match(/^[0-9A-Za-z+\\/]+={0,3}$/) || t.length % 4 != 0);\n }, br.lang.String.isBase64URL = function (t) {\n return !t.match(/[+/=]/) && (t = Tr(t), br.lang.String.isBase64(t));\n }, br.lang.String.isIntegerArray = function (t) {\n return !!(t = t.replace(/\\s+/g, \"\")).match(/^\\[[0-9,]+\\]$/);\n }, br.lang.String.isPrintable = function (t) {\n return null !== t.match(/^[0-9A-Za-z '()+,-./:=?]*$/);\n }, br.lang.String.isIA5 = function (t) {\n return null !== t.match(/^[\\x20-\\x21\\x23-\\x7f]*$/);\n }, br.lang.String.isMail = function (t) {\n return null !== t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\\.[A-Za-z0-9]{1,}$/);\n };\n var Qr = function t(e, r, n) {\n return null == n && (n = \"0\"), e.length >= r ? e : new Array(r - e.length + 1).join(n) + e;\n };\n void 0 !== br && br || (e.KJUR = br = {}), void 0 !== br.crypto && br.crypto || (br.crypto = {}), br.crypto.Util = new function () {\n this.DIGESTINFOHEAD = {\n sha1: \"3021300906052b0e03021a05000414\",\n sha224: \"302d300d06096086480165030402040500041c\",\n sha256: \"3031300d060960864801650304020105000420\",\n sha384: \"3041300d060960864801650304020205000430\",\n sha512: \"3051300d060960864801650304020305000440\",\n md2: \"3020300c06082a864886f70d020205000410\",\n md5: \"3020300c06082a864886f70d020505000410\",\n ripemd160: \"3021300906052b2403020105000414\"\n }, this.DEFAULTPROVIDER = {\n md5: \"cryptojs\",\n sha1: \"cryptojs\",\n sha224: \"cryptojs\",\n sha256: \"cryptojs\",\n sha384: \"cryptojs\",\n sha512: \"cryptojs\",\n ripemd160: \"cryptojs\",\n hmacmd5: \"cryptojs\",\n hmacsha1: \"cryptojs\",\n hmacsha224: \"cryptojs\",\n hmacsha256: \"cryptojs\",\n hmacsha384: \"cryptojs\",\n hmacsha512: \"cryptojs\",\n hmacripemd160: \"cryptojs\",\n MD5withRSA: \"cryptojs/jsrsa\",\n SHA1withRSA: \"cryptojs/jsrsa\",\n SHA224withRSA: \"cryptojs/jsrsa\",\n SHA256withRSA: \"cryptojs/jsrsa\",\n SHA384withRSA: \"cryptojs/jsrsa\",\n SHA512withRSA: \"cryptojs/jsrsa\",\n RIPEMD160withRSA: \"cryptojs/jsrsa\",\n MD5withECDSA: \"cryptojs/jsrsa\",\n SHA1withECDSA: \"cryptojs/jsrsa\",\n SHA224withECDSA: \"cryptojs/jsrsa\",\n SHA256withECDSA: \"cryptojs/jsrsa\",\n SHA384withECDSA: \"cryptojs/jsrsa\",\n SHA512withECDSA: \"cryptojs/jsrsa\",\n RIPEMD160withECDSA: \"cryptojs/jsrsa\",\n SHA1withDSA: \"cryptojs/jsrsa\",\n SHA224withDSA: \"cryptojs/jsrsa\",\n SHA256withDSA: \"cryptojs/jsrsa\",\n MD5withRSAandMGF1: \"cryptojs/jsrsa\",\n SHAwithRSAandMGF1: \"cryptojs/jsrsa\",\n SHA1withRSAandMGF1: \"cryptojs/jsrsa\",\n SHA224withRSAandMGF1: \"cryptojs/jsrsa\",\n SHA256withRSAandMGF1: \"cryptojs/jsrsa\",\n SHA384withRSAandMGF1: \"cryptojs/jsrsa\",\n SHA512withRSAandMGF1: \"cryptojs/jsrsa\",\n RIPEMD160withRSAandMGF1: \"cryptojs/jsrsa\"\n }, this.CRYPTOJSMESSAGEDIGESTNAME = {\n md5: y.algo.MD5,\n sha1: y.algo.SHA1,\n sha224: y.algo.SHA224,\n sha256: y.algo.SHA256,\n sha384: y.algo.SHA384,\n sha512: y.algo.SHA512,\n ripemd160: y.algo.RIPEMD160\n }, this.getDigestInfoHex = function (t, e) {\n if (void 0 === this.DIGESTINFOHEAD[e]) throw \"alg not supported in Util.DIGESTINFOHEAD: \" + e;\n return this.DIGESTINFOHEAD[e] + t;\n }, this.getPaddedDigestInfoHex = function (t, e, r) {\n var n = this.getDigestInfoHex(t, e),\n i = r / 4;\n if (n.length + 22 > i) throw \"key is too short for SigAlg: keylen=\" + r + \",\" + e;\n for (var o = \"0001\", s = \"00\" + n, a = \"\", u = i - o.length - s.length, c = 0; c < u; c += 2) a += \"ff\";\n return o + a + s;\n }, this.hashString = function (t, e) {\n return new br.crypto.MessageDigest({\n alg: e\n }).digestString(t);\n }, this.hashHex = function (t, e) {\n return new br.crypto.MessageDigest({\n alg: e\n }).digestHex(t);\n }, this.sha1 = function (t) {\n return this.hashString(t, \"sha1\");\n }, this.sha256 = function (t) {\n return this.hashString(t, \"sha256\");\n }, this.sha256Hex = function (t) {\n return this.hashHex(t, \"sha256\");\n }, this.sha512 = function (t) {\n return this.hashString(t, \"sha512\");\n }, this.sha512Hex = function (t) {\n return this.hashHex(t, \"sha512\");\n }, this.isKey = function (t) {\n return t instanceof He || t instanceof br.crypto.DSA || t instanceof br.crypto.ECDSA;\n };\n }(), br.crypto.Util.md5 = function (t) {\n return new br.crypto.MessageDigest({\n alg: \"md5\",\n prov: \"cryptojs\"\n }).digestString(t);\n }, br.crypto.Util.ripemd160 = function (t) {\n return new br.crypto.MessageDigest({\n alg: \"ripemd160\",\n prov: \"cryptojs\"\n }).digestString(t);\n }, br.crypto.Util.SECURERANDOMGEN = new Oe(), br.crypto.Util.getRandomHexOfNbytes = function (t) {\n var e = new Array(t);\n return br.crypto.Util.SECURERANDOMGEN.nextBytes(e), kr(e);\n }, br.crypto.Util.getRandomBigIntegerOfNbytes = function (t) {\n return new F(br.crypto.Util.getRandomHexOfNbytes(t), 16);\n }, br.crypto.Util.getRandomHexOfNbits = function (t) {\n var e = t % 8,\n r = new Array((t - e) / 8 + 1);\n return br.crypto.Util.SECURERANDOMGEN.nextBytes(r), r[0] = (255 << e & 255 ^ 255) & r[0], kr(r);\n }, br.crypto.Util.getRandomBigIntegerOfNbits = function (t) {\n return new F(br.crypto.Util.getRandomHexOfNbits(t), 16);\n }, br.crypto.Util.getRandomBigIntegerZeroToMax = function (t) {\n for (var e = t.bitLength();;) {\n var r = br.crypto.Util.getRandomBigIntegerOfNbits(e);\n if (-1 != t.compareTo(r)) return r;\n }\n }, br.crypto.Util.getRandomBigIntegerMinToMax = function (t, e) {\n var r = t.compareTo(e);\n if (1 == r) throw \"biMin is greater than biMax\";\n if (0 == r) return t;\n var n = e.subtract(t);\n return br.crypto.Util.getRandomBigIntegerZeroToMax(n).add(t);\n }, br.crypto.MessageDigest = function (t) {\n this.setAlgAndProvider = function (t, e) {\n if (null !== (t = br.crypto.MessageDigest.getCanonicalAlgName(t)) && void 0 === e && (e = br.crypto.Util.DEFAULTPROVIDER[t]), -1 != \":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:\".indexOf(t) && \"cryptojs\" == e) {\n try {\n this.md = br.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create();\n } catch (e) {\n throw \"setAlgAndProvider hash alg set fail alg=\" + t + \"/\" + e;\n }\n this.updateString = function (t) {\n this.md.update(t);\n }, this.updateHex = function (t) {\n var e = y.enc.Hex.parse(t);\n this.md.update(e);\n }, this.digest = function () {\n return this.md.finalize().toString(y.enc.Hex);\n }, this.digestString = function (t) {\n return this.updateString(t), this.digest();\n }, this.digestHex = function (t) {\n return this.updateHex(t), this.digest();\n };\n }\n if (-1 != \":sha256:\".indexOf(t) && \"sjcl\" == e) {\n try {\n this.md = new sjcl.hash.sha256();\n } catch (e) {\n throw \"setAlgAndProvider hash alg set fail alg=\" + t + \"/\" + e;\n }\n this.updateString = function (t) {\n this.md.update(t);\n }, this.updateHex = function (t) {\n var e = sjcl.codec.hex.toBits(t);\n this.md.update(e);\n }, this.digest = function () {\n var t = this.md.finalize();\n return sjcl.codec.hex.fromBits(t);\n }, this.digestString = function (t) {\n return this.updateString(t), this.digest();\n }, this.digestHex = function (t) {\n return this.updateHex(t), this.digest();\n };\n }\n }, this.updateString = function (t) {\n throw \"updateString(str) not supported for this alg/prov: \" + this.algName + \"/\" + this.provName;\n }, this.updateHex = function (t) {\n throw \"updateHex(hex) not supported for this alg/prov: \" + this.algName + \"/\" + this.provName;\n }, this.digest = function () {\n throw \"digest() not supported for this alg/prov: \" + this.algName + \"/\" + this.provName;\n }, this.digestString = function (t) {\n throw \"digestString(str) not supported for this alg/prov: \" + this.algName + \"/\" + this.provName;\n }, this.digestHex = function (t) {\n throw \"digestHex(hex) not supported for this alg/prov: \" + this.algName + \"/\" + this.provName;\n }, void 0 !== t && void 0 !== t.alg && (this.algName = t.alg, void 0 === t.prov && (this.provName = br.crypto.Util.DEFAULTPROVIDER[this.algName]), this.setAlgAndProvider(this.algName, this.provName));\n }, br.crypto.MessageDigest.getCanonicalAlgName = function (t) {\n return \"string\" == typeof t && (t = (t = t.toLowerCase()).replace(/-/, \"\")), t;\n }, br.crypto.MessageDigest.getHashLength = function (t) {\n var e = br.crypto.MessageDigest,\n r = e.getCanonicalAlgName(t);\n if (void 0 === e.HASHLENGTH[r]) throw \"not supported algorithm: \" + t;\n return e.HASHLENGTH[r];\n }, br.crypto.MessageDigest.HASHLENGTH = {\n md5: 16,\n sha1: 20,\n sha224: 28,\n sha256: 32,\n sha384: 48,\n sha512: 64,\n ripemd160: 20\n }, br.crypto.Mac = function (t) {\n this.setAlgAndProvider = function (t, e) {\n if (null == (t = t.toLowerCase()) && (t = \"hmacsha1\"), \"hmac\" != (t = t.toLowerCase()).substr(0, 4)) throw \"setAlgAndProvider unsupported HMAC alg: \" + t;\n void 0 === e && (e = br.crypto.Util.DEFAULTPROVIDER[t]), this.algProv = t + \"/\" + e;\n var r = t.substr(4);\n if (-1 != \":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:\".indexOf(r) && \"cryptojs\" == e) {\n try {\n var n = br.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[r];\n this.mac = y.algo.HMAC.create(n, this.pass);\n } catch (t) {\n throw \"setAlgAndProvider hash alg set fail hashAlg=\" + r + \"/\" + t;\n }\n this.updateString = function (t) {\n this.mac.update(t);\n }, this.updateHex = function (t) {\n var e = y.enc.Hex.parse(t);\n this.mac.update(e);\n }, this.doFinal = function () {\n return this.mac.finalize().toString(y.enc.Hex);\n }, this.doFinalString = function (t) {\n return this.updateString(t), this.doFinal();\n }, this.doFinalHex = function (t) {\n return this.updateHex(t), this.doFinal();\n };\n }\n }, this.updateString = function (t) {\n throw \"updateString(str) not supported for this alg/prov: \" + this.algProv;\n }, this.updateHex = function (t) {\n throw \"updateHex(hex) not supported for this alg/prov: \" + this.algProv;\n }, this.doFinal = function () {\n throw \"digest() not supported for this alg/prov: \" + this.algProv;\n }, this.doFinalString = function (t) {\n throw \"digestString(str) not supported for this alg/prov: \" + this.algProv;\n }, this.doFinalHex = function (t) {\n throw \"digestHex(hex) not supported for this alg/prov: \" + this.algProv;\n }, this.setPassword = function (t) {\n if (\"string\" == typeof t) {\n var e = t;\n return t.length % 2 != 1 && t.match(/^[0-9A-Fa-f]+$/) || (e = Ur(t)), void (this.pass = y.enc.Hex.parse(e));\n }\n if (\"object\" != (void 0 === t ? \"undefined\" : r(t))) throw \"KJUR.crypto.Mac unsupported password type: \" + t;\n e = null;\n if (void 0 !== t.hex) {\n if (t.hex.length % 2 != 0 || !t.hex.match(/^[0-9A-Fa-f]+$/)) throw \"Mac: wrong hex password: \" + t.hex;\n e = t.hex;\n }\n if (void 0 !== t.utf8 && (e = Dr(t.utf8)), void 0 !== t.rstr && (e = Ur(t.rstr)), void 0 !== t.b64 && (e = b(t.b64)), void 0 !== t.b64u && (e = Ir(t.b64u)), null == e) throw \"KJUR.crypto.Mac unsupported password type: \" + t;\n this.pass = y.enc.Hex.parse(e);\n }, void 0 !== t && (void 0 !== t.pass && this.setPassword(t.pass), void 0 !== t.alg && (this.algName = t.alg, void 0 === t.prov && (this.provName = br.crypto.Util.DEFAULTPROVIDER[this.algName]), this.setAlgAndProvider(this.algName, this.provName)));\n }, br.crypto.Signature = function (t) {\n var e = null;\n if (this._setAlgNames = function () {\n var t = this.algName.match(/^(.+)with(.+)$/);\n t && (this.mdAlgName = t[1].toLowerCase(), this.pubkeyAlgName = t[2].toLowerCase(), \"rsaandmgf1\" == this.pubkeyAlgName && \"sha\" == this.mdAlgName && (this.mdAlgName = \"sha1\"));\n }, this._zeroPaddingOfSignature = function (t, e) {\n for (var r = \"\", n = e / 4 - t.length, i = 0; i < n; i++) r += \"0\";\n return r + t;\n }, this.setAlgAndProvider = function (t, e) {\n if (this._setAlgNames(), \"cryptojs/jsrsa\" != e) throw new Error(\"provider not supported: \" + e);\n if (-1 != \":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:\".indexOf(this.mdAlgName)) {\n try {\n this.md = new br.crypto.MessageDigest({\n alg: this.mdAlgName\n });\n } catch (t) {\n throw new Error(\"setAlgAndProvider hash alg set fail alg=\" + this.mdAlgName + \"/\" + t);\n }\n this.init = function (t, e) {\n var r = null;\n try {\n r = void 0 === e ? Zr.getKey(t) : Zr.getKey(t, e);\n } catch (t) {\n throw \"init failed:\" + t;\n }\n if (!0 === r.isPrivate) this.prvKey = r, this.state = \"SIGN\";else {\n if (!0 !== r.isPublic) throw \"init failed.:\" + r;\n this.pubKey = r, this.state = \"VERIFY\";\n }\n }, this.updateString = function (t) {\n this.md.updateString(t);\n }, this.updateHex = function (t) {\n this.md.updateHex(t);\n }, this.sign = function () {\n if (this.sHashHex = this.md.digest(), void 0 === this.prvKey && void 0 !== this.ecprvhex && void 0 !== this.eccurvename && void 0 !== br.crypto.ECDSA && (this.prvKey = new br.crypto.ECDSA({\n curve: this.eccurvename,\n prv: this.ecprvhex\n })), this.prvKey instanceof He && \"rsaandmgf1\" === this.pubkeyAlgName) this.hSign = this.prvKey.signWithMessageHashPSS(this.sHashHex, this.mdAlgName, this.pssSaltLen);else if (this.prvKey instanceof He && \"rsa\" === this.pubkeyAlgName) this.hSign = this.prvKey.signWithMessageHash(this.sHashHex, this.mdAlgName);else if (this.prvKey instanceof br.crypto.ECDSA) this.hSign = this.prvKey.signWithMessageHash(this.sHashHex);else {\n if (!(this.prvKey instanceof br.crypto.DSA)) throw \"Signature: unsupported private key alg: \" + this.pubkeyAlgName;\n this.hSign = this.prvKey.signWithMessageHash(this.sHashHex);\n }\n return this.hSign;\n }, this.signString = function (t) {\n return this.updateString(t), this.sign();\n }, this.signHex = function (t) {\n return this.updateHex(t), this.sign();\n }, this.verify = function (t) {\n if (this.sHashHex = this.md.digest(), void 0 === this.pubKey && void 0 !== this.ecpubhex && void 0 !== this.eccurvename && void 0 !== br.crypto.ECDSA && (this.pubKey = new br.crypto.ECDSA({\n curve: this.eccurvename,\n pub: this.ecpubhex\n })), this.pubKey instanceof He && \"rsaandmgf1\" === this.pubkeyAlgName) return this.pubKey.verifyWithMessageHashPSS(this.sHashHex, t, this.mdAlgName, this.pssSaltLen);\n if (this.pubKey instanceof He && \"rsa\" === this.pubkeyAlgName) return this.pubKey.verifyWithMessageHash(this.sHashHex, t);\n if (void 0 !== br.crypto.ECDSA && this.pubKey instanceof br.crypto.ECDSA) return this.pubKey.verifyWithMessageHash(this.sHashHex, t);\n if (void 0 !== br.crypto.DSA && this.pubKey instanceof br.crypto.DSA) return this.pubKey.verifyWithMessageHash(this.sHashHex, t);\n throw \"Signature: unsupported public key alg: \" + this.pubkeyAlgName;\n };\n }\n }, this.init = function (t, e) {\n throw \"init(key, pass) not supported for this alg:prov=\" + this.algProvName;\n }, this.updateString = function (t) {\n throw \"updateString(str) not supported for this alg:prov=\" + this.algProvName;\n }, this.updateHex = function (t) {\n throw \"updateHex(hex) not supported for this alg:prov=\" + this.algProvName;\n }, this.sign = function () {\n throw \"sign() not supported for this alg:prov=\" + this.algProvName;\n }, this.signString = function (t) {\n throw \"digestString(str) not supported for this alg:prov=\" + this.algProvName;\n }, this.signHex = function (t) {\n throw \"digestHex(hex) not supported for this alg:prov=\" + this.algProvName;\n }, this.verify = function (t) {\n throw \"verify(hSigVal) not supported for this alg:prov=\" + this.algProvName;\n }, this.initParams = t, void 0 !== t && (void 0 !== t.alg && (this.algName = t.alg, void 0 === t.prov ? this.provName = br.crypto.Util.DEFAULTPROVIDER[this.algName] : this.provName = t.prov, this.algProvName = this.algName + \":\" + this.provName, this.setAlgAndProvider(this.algName, this.provName), this._setAlgNames()), void 0 !== t.psssaltlen && (this.pssSaltLen = t.psssaltlen), void 0 !== t.prvkeypem)) {\n if (void 0 !== t.prvkeypas) throw \"both prvkeypem and prvkeypas parameters not supported\";\n try {\n e = Zr.getKey(t.prvkeypem);\n this.init(e);\n } catch (t) {\n throw \"fatal error to load pem private key: \" + t;\n }\n }\n }, br.crypto.Cipher = function (t) {}, br.crypto.Cipher.encrypt = function (t, e, r) {\n if (e instanceof He && e.isPublic) {\n var n = br.crypto.Cipher.getAlgByKeyAndName(e, r);\n if (\"RSA\" === n) return e.encrypt(t);\n if (\"RSAOAEP\" === n) return e.encryptOAEP(t, \"sha1\");\n var i = n.match(/^RSAOAEP(\\d+)$/);\n if (null !== i) return e.encryptOAEP(t, \"sha\" + i[1]);\n throw \"Cipher.encrypt: unsupported algorithm for RSAKey: \" + r;\n }\n throw \"Cipher.encrypt: unsupported key or algorithm\";\n }, br.crypto.Cipher.decrypt = function (t, e, r) {\n if (e instanceof He && e.isPrivate) {\n var n = br.crypto.Cipher.getAlgByKeyAndName(e, r);\n if (\"RSA\" === n) return e.decrypt(t);\n if (\"RSAOAEP\" === n) return e.decryptOAEP(t, \"sha1\");\n var i = n.match(/^RSAOAEP(\\d+)$/);\n if (null !== i) return e.decryptOAEP(t, \"sha\" + i[1]);\n throw \"Cipher.decrypt: unsupported algorithm for RSAKey: \" + r;\n }\n throw \"Cipher.decrypt: unsupported key or algorithm\";\n }, br.crypto.Cipher.getAlgByKeyAndName = function (t, e) {\n if (t instanceof He) {\n if (-1 != \":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:\".indexOf(e)) return e;\n if (null == e) return \"RSA\";\n throw \"getAlgByKeyAndName: not supported algorithm name for RSAKey: \" + e;\n }\n throw \"getAlgByKeyAndName: not supported algorithm name: \" + e;\n }, br.crypto.OID = new function () {\n this.oidhex2name = {\n \"2a864886f70d010101\": \"rsaEncryption\",\n \"2a8648ce3d0201\": \"ecPublicKey\",\n \"2a8648ce380401\": \"dsa\",\n \"2a8648ce3d030107\": \"secp256r1\",\n \"2b8104001f\": \"secp192k1\",\n \"2b81040021\": \"secp224r1\",\n \"2b8104000a\": \"secp256k1\",\n \"2b81040023\": \"secp521r1\",\n \"2b81040022\": \"secp384r1\",\n \"2a8648ce380403\": \"SHA1withDSA\",\n \"608648016503040301\": \"SHA224withDSA\",\n \"608648016503040302\": \"SHA256withDSA\"\n };\n }(), void 0 !== br && br || (e.KJUR = br = {}), void 0 !== br.crypto && br.crypto || (br.crypto = {}), br.crypto.ECDSA = function (t) {\n var e = Error,\n n = F,\n i = Ke,\n o = br.crypto.ECDSA,\n s = br.crypto.ECParameterDB,\n a = o.getName,\n u = Er,\n c = u.getVbyListEx,\n h = u.isASN1HEX,\n l = new Oe();\n this.type = \"EC\", this.isPrivate = !1, this.isPublic = !1, this.getBigRandom = function (t) {\n return new n(t.bitLength(), l).mod(t.subtract(n.ONE)).add(n.ONE);\n }, this.setNamedCurve = function (t) {\n this.ecparams = s.getByName(t), this.prvKeyHex = null, this.pubKeyHex = null, this.curveName = t;\n }, this.setPrivateKeyHex = function (t) {\n this.isPrivate = !0, this.prvKeyHex = t;\n }, this.setPublicKeyHex = function (t) {\n this.isPublic = !0, this.pubKeyHex = t;\n }, this.getPublicKeyXYHex = function () {\n var t = this.pubKeyHex;\n if (\"04\" !== t.substr(0, 2)) throw \"this method supports uncompressed format(04) only\";\n var e = this.ecparams.keylen / 4;\n if (t.length !== 2 + 2 * e) throw \"malformed public key hex length\";\n var r = {};\n return r.x = t.substr(2, e), r.y = t.substr(2 + e), r;\n }, this.getShortNISTPCurveName = function () {\n var t = this.curveName;\n return \"secp256r1\" === t || \"NIST P-256\" === t || \"P-256\" === t || \"prime256v1\" === t ? \"P-256\" : \"secp384r1\" === t || \"NIST P-384\" === t || \"P-384\" === t ? \"P-384\" : null;\n }, this.generateKeyPairHex = function () {\n var t = this.ecparams.n,\n e = this.getBigRandom(t),\n r = this.ecparams.G.multiply(e),\n n = r.getX().toBigInteger(),\n i = r.getY().toBigInteger(),\n o = this.ecparams.keylen / 4,\n s = (\"0000000000\" + e.toString(16)).slice(-o),\n a = \"04\" + (\"0000000000\" + n.toString(16)).slice(-o) + (\"0000000000\" + i.toString(16)).slice(-o);\n return this.setPrivateKeyHex(s), this.setPublicKeyHex(a), {\n ecprvhex: s,\n ecpubhex: a\n };\n }, this.signWithMessageHash = function (t) {\n return this.signHex(t, this.prvKeyHex);\n }, this.signHex = function (t, e) {\n var r = new n(e, 16),\n i = this.ecparams.n,\n s = new n(t.substring(0, this.ecparams.keylen / 4), 16);\n do {\n var a = this.getBigRandom(i),\n u = this.ecparams.G.multiply(a).getX().toBigInteger().mod(i);\n } while (u.compareTo(n.ZERO) <= 0);\n var c = a.modInverse(i).multiply(s.add(r.multiply(u))).mod(i);\n return o.biRSSigToASN1Sig(u, c);\n }, this.sign = function (t, e) {\n var r = e,\n i = this.ecparams.n,\n o = n.fromByteArrayUnsigned(t);\n do {\n var s = this.getBigRandom(i),\n a = this.ecparams.G.multiply(s).getX().toBigInteger().mod(i);\n } while (a.compareTo(F.ZERO) <= 0);\n var u = s.modInverse(i).multiply(o.add(r.multiply(a))).mod(i);\n return this.serializeSig(a, u);\n }, this.verifyWithMessageHash = function (t, e) {\n return this.verifyHex(t, e, this.pubKeyHex);\n }, this.verifyHex = function (t, e, r) {\n try {\n var s,\n a,\n u = o.parseSigHex(e);\n s = u.r, a = u.s;\n var c = i.decodeFromHex(this.ecparams.curve, r),\n h = new n(t.substring(0, this.ecparams.keylen / 4), 16);\n return this.verifyRaw(h, s, a, c);\n } catch (t) {\n return !1;\n }\n }, this.verify = function (t, e, o) {\n var s, a, u;\n if (Bitcoin.Util.isArray(e)) {\n var c = this.parseSig(e);\n s = c.r, a = c.s;\n } else {\n if (\"object\" !== (void 0 === e ? \"undefined\" : r(e)) || !e.r || !e.s) throw \"Invalid value for signature\";\n s = e.r, a = e.s;\n }\n if (o instanceof Ke) u = o;else {\n if (!Bitcoin.Util.isArray(o)) throw \"Invalid format for pubkey value, must be byte array or ECPointFp\";\n u = i.decodeFrom(this.ecparams.curve, o);\n }\n var h = n.fromByteArrayUnsigned(t);\n return this.verifyRaw(h, s, a, u);\n }, this.verifyRaw = function (t, e, r, i) {\n var o = this.ecparams.n,\n s = this.ecparams.G;\n if (e.compareTo(n.ONE) < 0 || e.compareTo(o) >= 0) return !1;\n if (r.compareTo(n.ONE) < 0 || r.compareTo(o) >= 0) return !1;\n var a = r.modInverse(o),\n u = t.multiply(a).mod(o),\n c = e.multiply(a).mod(o);\n return s.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(o).equals(e);\n }, this.serializeSig = function (t, e) {\n var r = t.toByteArraySigned(),\n n = e.toByteArraySigned(),\n i = [];\n return i.push(2), i.push(r.length), (i = i.concat(r)).push(2), i.push(n.length), (i = i.concat(n)).unshift(i.length), i.unshift(48), i;\n }, this.parseSig = function (t) {\n var e;\n if (48 != t[0]) throw new Error(\"Signature not a valid DERSequence\");\n if (2 != t[e = 2]) throw new Error(\"First element in signature must be a DERInteger\");\n var r = t.slice(e + 2, e + 2 + t[e + 1]);\n if (2 != t[e += 2 + t[e + 1]]) throw new Error(\"Second element in signature must be a DERInteger\");\n var i = t.slice(e + 2, e + 2 + t[e + 1]);\n return e += 2 + t[e + 1], {\n r: n.fromByteArrayUnsigned(r),\n s: n.fromByteArrayUnsigned(i)\n };\n }, this.parseSigCompact = function (t) {\n if (65 !== t.length) throw \"Signature has the wrong length\";\n var e = t[0] - 27;\n if (e < 0 || e > 7) throw \"Invalid signature type\";\n var r = this.ecparams.n;\n return {\n r: n.fromByteArrayUnsigned(t.slice(1, 33)).mod(r),\n s: n.fromByteArrayUnsigned(t.slice(33, 65)).mod(r),\n i: e\n };\n }, this.readPKCS5PrvKeyHex = function (t) {\n if (!1 === h(t)) throw new Error(\"not ASN.1 hex string\");\n var e, r, n;\n try {\n e = c(t, 0, [\"[0]\", 0], \"06\"), r = c(t, 0, [1], \"04\");\n try {\n n = c(t, 0, [\"[1]\", 0], \"03\");\n } catch (t) {}\n } catch (t) {\n throw new Error(\"malformed PKCS#1/5 plain ECC private key\");\n }\n if (this.curveName = a(e), void 0 === this.curveName) throw \"unsupported curve name\";\n this.setNamedCurve(this.curveName), this.setPublicKeyHex(n), this.setPrivateKeyHex(r), this.isPublic = !1;\n }, this.readPKCS8PrvKeyHex = function (t) {\n if (!1 === h(t)) throw new e(\"not ASN.1 hex string\");\n var r, n, i;\n try {\n c(t, 0, [1, 0], \"06\"), r = c(t, 0, [1, 1], \"06\"), n = c(t, 0, [2, 0, 1], \"04\");\n try {\n i = c(t, 0, [2, 0, \"[1]\", 0], \"03\");\n } catch (t) {}\n } catch (t) {\n throw new e(\"malformed PKCS#8 plain ECC private key\");\n }\n if (this.curveName = a(r), void 0 === this.curveName) throw new e(\"unsupported curve name\");\n this.setNamedCurve(this.curveName), this.setPublicKeyHex(i), this.setPrivateKeyHex(n), this.isPublic = !1;\n }, this.readPKCS8PubKeyHex = function (t) {\n if (!1 === h(t)) throw new e(\"not ASN.1 hex string\");\n var r, n;\n try {\n c(t, 0, [0, 0], \"06\"), r = c(t, 0, [0, 1], \"06\"), n = c(t, 0, [1], \"03\");\n } catch (t) {\n throw new e(\"malformed PKCS#8 ECC public key\");\n }\n if (this.curveName = a(r), null === this.curveName) throw new e(\"unsupported curve name\");\n this.setNamedCurve(this.curveName), this.setPublicKeyHex(n);\n }, this.readCertPubKeyHex = function (t, r) {\n if (!1 === h(t)) throw new e(\"not ASN.1 hex string\");\n var n, i;\n try {\n n = c(t, 0, [0, 5, 0, 1], \"06\"), i = c(t, 0, [0, 5, 1], \"03\");\n } catch (t) {\n throw new e(\"malformed X.509 certificate ECC public key\");\n }\n if (this.curveName = a(n), null === this.curveName) throw new e(\"unsupported curve name\");\n this.setNamedCurve(this.curveName), this.setPublicKeyHex(i);\n }, void 0 !== t && void 0 !== t.curve && (this.curveName = t.curve), void 0 === this.curveName && (this.curveName = \"secp256r1\"), this.setNamedCurve(this.curveName), void 0 !== t && (void 0 !== t.prv && this.setPrivateKeyHex(t.prv), void 0 !== t.pub && this.setPublicKeyHex(t.pub));\n }, br.crypto.ECDSA.parseSigHex = function (t) {\n var e = br.crypto.ECDSA.parseSigHexInHexRS(t);\n return {\n r: new F(e.r, 16),\n s: new F(e.s, 16)\n };\n }, br.crypto.ECDSA.parseSigHexInHexRS = function (t) {\n var e = Er,\n r = e.getChildIdx,\n n = e.getV;\n if (e.checkStrictDER(t, 0), \"30\" != t.substr(0, 2)) throw new Error(\"signature is not a ASN.1 sequence\");\n var i = r(t, 0);\n if (2 != i.length) throw new Error(\"signature shall have two elements\");\n var o = i[0],\n s = i[1];\n if (\"02\" != t.substr(o, 2)) throw new Error(\"1st item not ASN.1 integer\");\n if (\"02\" != t.substr(s, 2)) throw new Error(\"2nd item not ASN.1 integer\");\n return {\n r: n(t, o),\n s: n(t, s)\n };\n }, br.crypto.ECDSA.asn1SigToConcatSig = function (t) {\n var e = br.crypto.ECDSA.parseSigHexInHexRS(t),\n r = e.r,\n n = e.s;\n if (\"00\" == r.substr(0, 2) && r.length % 32 == 2 && (r = r.substr(2)), \"00\" == n.substr(0, 2) && n.length % 32 == 2 && (n = n.substr(2)), r.length % 32 == 30 && (r = \"00\" + r), n.length % 32 == 30 && (n = \"00\" + n), r.length % 32 != 0) throw \"unknown ECDSA sig r length error\";\n if (n.length % 32 != 0) throw \"unknown ECDSA sig s length error\";\n return r + n;\n }, br.crypto.ECDSA.concatSigToASN1Sig = function (t) {\n if (t.length / 2 * 8 % 128 != 0) throw \"unknown ECDSA concatinated r-s sig length error\";\n var e = t.substr(0, t.length / 2),\n r = t.substr(t.length / 2);\n return br.crypto.ECDSA.hexRSSigToASN1Sig(e, r);\n }, br.crypto.ECDSA.hexRSSigToASN1Sig = function (t, e) {\n var r = new F(t, 16),\n n = new F(e, 16);\n return br.crypto.ECDSA.biRSSigToASN1Sig(r, n);\n }, br.crypto.ECDSA.biRSSigToASN1Sig = function (t, e) {\n var r = br.asn1,\n n = new r.DERInteger({\n bigint: t\n }),\n i = new r.DERInteger({\n bigint: e\n });\n return new r.DERSequence({\n array: [n, i]\n }).getEncodedHex();\n }, br.crypto.ECDSA.getName = function (t) {\n return \"2b8104001f\" === t ? \"secp192k1\" : \"2a8648ce3d030107\" === t ? \"secp256r1\" : \"2b8104000a\" === t ? \"secp256k1\" : \"2b81040021\" === t ? \"secp224r1\" : \"2b81040022\" === t ? \"secp384r1\" : -1 !== \"|secp256r1|NIST P-256|P-256|prime256v1|\".indexOf(t) ? \"secp256r1\" : -1 !== \"|secp256k1|\".indexOf(t) ? \"secp256k1\" : -1 !== \"|secp224r1|NIST P-224|P-224|\".indexOf(t) ? \"secp224r1\" : -1 !== \"|secp384r1|NIST P-384|P-384|\".indexOf(t) ? \"secp384r1\" : null;\n }, void 0 !== br && br || (e.KJUR = br = {}), void 0 !== br.crypto && br.crypto || (br.crypto = {}), br.crypto.ECParameterDB = new function () {\n var t = {},\n e = {};\n function r(t) {\n return new F(t, 16);\n }\n this.getByName = function (r) {\n var n = r;\n if (void 0 !== e[n] && (n = e[r]), void 0 !== t[n]) return t[n];\n throw \"unregistered EC curve name: \" + n;\n }, this.regist = function (n, i, o, s, a, u, c, h, l, f, g, d) {\n t[n] = {};\n var p = r(o),\n v = r(s),\n y = r(a),\n m = r(u),\n _ = r(c),\n S = new qe(p, v, y),\n b = S.decodePointHex(\"04\" + h + l);\n t[n].name = n, t[n].keylen = i, t[n].curve = S, t[n].G = b, t[n].n = m, t[n].h = _, t[n].oid = g, t[n].info = d;\n for (var w = 0; w < f.length; w++) e[f[w]] = n;\n };\n }(), br.crypto.ECParameterDB.regist(\"secp128r1\", 128, \"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF\", \"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC\", \"E87579C11079F43DD824993C2CEE5ED3\", \"FFFFFFFE0000000075A30D1B9038A115\", \"1\", \"161FF7528B899B2D0C28607CA52C5B86\", \"CF5AC8395BAFEB13C02DA292DDED7A83\", [], \"\", \"secp128r1 : SECG curve over a 128 bit prime field\"), br.crypto.ECParameterDB.regist(\"secp160k1\", 160, \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73\", \"0\", \"7\", \"0100000000000000000001B8FA16DFAB9ACA16B6B3\", \"1\", \"3B4C382CE37AA192A4019E763036F4F5DD4D7EBB\", \"938CF935318FDCED6BC28286531733C3F03C4FEE\", [], \"\", \"secp160k1 : SECG curve over a 160 bit prime field\"), br.crypto.ECParameterDB.regist(\"secp160r1\", 160, \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF\", \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC\", \"1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45\", \"0100000000000000000001F4C8F927AED3CA752257\", \"1\", \"4A96B5688EF573284664698968C38BB913CBFC82\", \"23A628553168947D59DCC912042351377AC5FB32\", [], \"\", \"secp160r1 : SECG curve over a 160 bit prime field\"), br.crypto.ECParameterDB.regist(\"secp192k1\", 192, \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37\", \"0\", \"3\", \"FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D\", \"1\", \"DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D\", \"9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D\", []), br.crypto.ECParameterDB.regist(\"secp192r1\", 192, \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF\", \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC\", \"64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1\", \"FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831\", \"1\", \"188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012\", \"07192B95FFC8DA78631011ED6B24CDD573F977A11E794811\", []), br.crypto.ECParameterDB.regist(\"secp224r1\", 224, \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001\", \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE\", \"B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4\", \"FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D\", \"1\", \"B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21\", \"BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34\", []), br.crypto.ECParameterDB.regist(\"secp256k1\", 256, \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F\", \"0\", \"7\", \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141\", \"1\", \"79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798\", \"483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8\", []), br.crypto.ECParameterDB.regist(\"secp256r1\", 256, \"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF\", \"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC\", \"5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B\", \"FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551\", \"1\", \"6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296\", \"4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5\", [\"NIST P-256\", \"P-256\", \"prime256v1\"]), br.crypto.ECParameterDB.regist(\"secp384r1\", 384, \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF\", \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC\", \"B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF\", \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973\", \"1\", \"AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7\", \"3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f\", [\"NIST P-384\", \"P-384\"]), br.crypto.ECParameterDB.regist(\"secp521r1\", 521, \"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\", \"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC\", \"051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00\", \"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409\", \"1\", \"C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66\", \"011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650\", [\"NIST P-521\", \"P-521\"]);\n var Zr = function () {\n var t = function t(r, n, i) {\n return e(y.AES, r, n, i);\n },\n e = function t(e, r, n, i) {\n var o = y.enc.Hex.parse(r),\n s = y.enc.Hex.parse(n),\n a = y.enc.Hex.parse(i),\n u = {};\n u.key = s, u.iv = a, u.ciphertext = o;\n var c = e.decrypt(u, s, {\n iv: a\n });\n return y.enc.Hex.stringify(c);\n },\n r = function t(e, r, i) {\n return n(y.AES, e, r, i);\n },\n n = function t(e, r, n, i) {\n var o = y.enc.Hex.parse(r),\n s = y.enc.Hex.parse(n),\n a = y.enc.Hex.parse(i),\n u = e.encrypt(o, s, {\n iv: a\n }),\n c = y.enc.Hex.parse(u.toString());\n return y.enc.Base64.stringify(c);\n },\n i = {\n \"AES-256-CBC\": {\n proc: t,\n eproc: r,\n keylen: 32,\n ivlen: 16\n },\n \"AES-192-CBC\": {\n proc: t,\n eproc: r,\n keylen: 24,\n ivlen: 16\n },\n \"AES-128-CBC\": {\n proc: t,\n eproc: r,\n keylen: 16,\n ivlen: 16\n },\n \"DES-EDE3-CBC\": {\n proc: function t(r, n, i) {\n return e(y.TripleDES, r, n, i);\n },\n eproc: function t(e, r, i) {\n return n(y.TripleDES, e, r, i);\n },\n keylen: 24,\n ivlen: 8\n },\n \"DES-CBC\": {\n proc: function t(r, n, i) {\n return e(y.DES, r, n, i);\n },\n eproc: function t(e, r, i) {\n return n(y.DES, e, r, i);\n },\n keylen: 8,\n ivlen: 8\n }\n },\n o = function t(e) {\n var r = {},\n n = e.match(new RegExp(\"DEK-Info: ([^,]+),([0-9A-Fa-f]+)\", \"m\"));\n n && (r.cipher = n[1], r.ivsalt = n[2]);\n var i = e.match(new RegExp(\"-----BEGIN ([A-Z]+) PRIVATE KEY-----\"));\n i && (r.type = i[1]);\n var o = -1,\n s = 0;\n -1 != e.indexOf(\"\\r\\n\\r\\n\") && (o = e.indexOf(\"\\r\\n\\r\\n\"), s = 2), -1 != e.indexOf(\"\\n\\n\") && (o = e.indexOf(\"\\n\\n\"), s = 1);\n var a = e.indexOf(\"-----END\");\n if (-1 != o && -1 != a) {\n var u = e.substring(o + 2 * s, a - s);\n u = u.replace(/\\s+/g, \"\"), r.data = u;\n }\n return r;\n },\n s = function t(e, r, n) {\n for (var o = n.substring(0, 16), s = y.enc.Hex.parse(o), a = y.enc.Utf8.parse(r), u = i[e].keylen + i[e].ivlen, c = \"\", h = null;;) {\n var l = y.algo.MD5.create();\n if (null != h && l.update(h), l.update(a), l.update(s), h = l.finalize(), (c += y.enc.Hex.stringify(h)).length >= 2 * u) break;\n }\n var f = {};\n return f.keyhex = c.substr(0, 2 * i[e].keylen), f.ivhex = c.substr(2 * i[e].keylen, 2 * i[e].ivlen), f;\n },\n a = function t(e, r, n, o) {\n var s = y.enc.Base64.parse(e),\n a = y.enc.Hex.stringify(s);\n return (0, i[r].proc)(a, n, o);\n };\n return {\n version: \"1.0.0\",\n parsePKCS5PEM: function t(e) {\n return o(e);\n },\n getKeyAndUnusedIvByPasscodeAndIvsalt: function t(e, r, n) {\n return s(e, r, n);\n },\n decryptKeyB64: function t(e, r, n, i) {\n return a(e, r, n, i);\n },\n getDecryptedKeyHex: function t(e, r) {\n var n = o(e),\n i = (n.type, n.cipher),\n u = n.ivsalt,\n c = n.data,\n h = s(i, r, u).keyhex;\n return a(c, i, h, u);\n },\n getEncryptedPKCS5PEMFromPrvKeyHex: function t(e, r, n, o, a) {\n var u = \"\";\n if (void 0 !== o && null != o || (o = \"AES-256-CBC\"), void 0 === i[o]) throw \"KEYUTIL unsupported algorithm: \" + o;\n void 0 !== a && null != a || (a = function t(e) {\n var r = y.lib.WordArray.random(e);\n return y.enc.Hex.stringify(r);\n }(i[o].ivlen).toUpperCase());\n var c = function t(e, r, n, o) {\n return (0, i[r].eproc)(e, n, o);\n }(r, o, s(o, n, a).keyhex, a);\n u = \"-----BEGIN \" + e + \" PRIVATE KEY-----\\r\\n\";\n return u += \"Proc-Type: 4,ENCRYPTED\\r\\n\", u += \"DEK-Info: \" + o + \",\" + a + \"\\r\\n\", u += \"\\r\\n\", u += c.replace(/(.{64})/g, \"$1\\r\\n\"), u += \"\\r\\n-----END \" + e + \" PRIVATE KEY-----\\r\\n\";\n },\n parseHexOfEncryptedPKCS8: function t(e) {\n var r = Er,\n n = r.getChildIdx,\n i = r.getV,\n o = {},\n s = n(e, 0);\n if (2 != s.length) throw \"malformed format: SEQUENCE(0).items != 2: \" + s.length;\n o.ciphertext = i(e, s[1]);\n var a = n(e, s[0]);\n if (2 != a.length) throw \"malformed format: SEQUENCE(0.0).items != 2: \" + a.length;\n if (\"2a864886f70d01050d\" != i(e, a[0])) throw \"this only supports pkcs5PBES2\";\n var u = n(e, a[1]);\n if (2 != a.length) throw \"malformed format: SEQUENCE(0.0.1).items != 2: \" + u.length;\n var c = n(e, u[1]);\n if (2 != c.length) throw \"malformed format: SEQUENCE(0.0.1.1).items != 2: \" + c.length;\n if (\"2a864886f70d0307\" != i(e, c[0])) throw \"this only supports TripleDES\";\n o.encryptionSchemeAlg = \"TripleDES\", o.encryptionSchemeIV = i(e, c[1]);\n var h = n(e, u[0]);\n if (2 != h.length) throw \"malformed format: SEQUENCE(0.0.1.0).items != 2: \" + h.length;\n if (\"2a864886f70d01050c\" != i(e, h[0])) throw \"this only supports pkcs5PBKDF2\";\n var l = n(e, h[1]);\n if (l.length < 2) throw \"malformed format: SEQUENCE(0.0.1.0.1).items < 2: \" + l.length;\n o.pbkdf2Salt = i(e, l[0]);\n var f = i(e, l[1]);\n try {\n o.pbkdf2Iter = parseInt(f, 16);\n } catch (t) {\n throw \"malformed format pbkdf2Iter: \" + f;\n }\n return o;\n },\n getPBKDF2KeyHexFromParam: function t(e, r) {\n var n = y.enc.Hex.parse(e.pbkdf2Salt),\n i = e.pbkdf2Iter,\n o = y.PBKDF2(r, n, {\n keySize: 6,\n iterations: i\n });\n return y.enc.Hex.stringify(o);\n },\n _getPlainPKCS8HexFromEncryptedPKCS8PEM: function t(e, r) {\n var n = Hr(e, \"ENCRYPTED PRIVATE KEY\"),\n i = this.parseHexOfEncryptedPKCS8(n),\n o = Zr.getPBKDF2KeyHexFromParam(i, r),\n s = {};\n s.ciphertext = y.enc.Hex.parse(i.ciphertext);\n var a = y.enc.Hex.parse(o),\n u = y.enc.Hex.parse(i.encryptionSchemeIV),\n c = y.TripleDES.decrypt(s, a, {\n iv: u\n });\n return y.enc.Hex.stringify(c);\n },\n getKeyFromEncryptedPKCS8PEM: function t(e, r) {\n var n = this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e, r);\n return this.getKeyFromPlainPrivatePKCS8Hex(n);\n },\n parsePlainPrivatePKCS8Hex: function t(e) {\n var r = Er,\n n = r.getChildIdx,\n i = r.getV,\n o = {\n algparam: null\n };\n if (\"30\" != e.substr(0, 2)) throw \"malformed plain PKCS8 private key(code:001)\";\n var s = n(e, 0);\n if (3 != s.length) throw \"malformed plain PKCS8 private key(code:002)\";\n if (\"30\" != e.substr(s[1], 2)) throw \"malformed PKCS8 private key(code:003)\";\n var a = n(e, s[1]);\n if (2 != a.length) throw \"malformed PKCS8 private key(code:004)\";\n if (\"06\" != e.substr(a[0], 2)) throw \"malformed PKCS8 private key(code:005)\";\n if (o.algoid = i(e, a[0]), \"06\" == e.substr(a[1], 2) && (o.algparam = i(e, a[1])), \"04\" != e.substr(s[2], 2)) throw \"malformed PKCS8 private key(code:006)\";\n return o.keyidx = r.getVidx(e, s[2]), o;\n },\n getKeyFromPlainPrivatePKCS8PEM: function t(e) {\n var r = Hr(e, \"PRIVATE KEY\");\n return this.getKeyFromPlainPrivatePKCS8Hex(r);\n },\n getKeyFromPlainPrivatePKCS8Hex: function t(e) {\n var r,\n n = this.parsePlainPrivatePKCS8Hex(e);\n if (\"2a864886f70d010101\" == n.algoid) r = new He();else if (\"2a8648ce380401\" == n.algoid) r = new br.crypto.DSA();else {\n if (\"2a8648ce3d0201\" != n.algoid) throw \"unsupported private key algorithm\";\n r = new br.crypto.ECDSA();\n }\n return r.readPKCS8PrvKeyHex(e), r;\n },\n _getKeyFromPublicPKCS8Hex: function t(e) {\n var r,\n n = Er.getVbyList(e, 0, [0, 0], \"06\");\n if (\"2a864886f70d010101\" === n) r = new He();else if (\"2a8648ce380401\" === n) r = new br.crypto.DSA();else {\n if (\"2a8648ce3d0201\" !== n) throw \"unsupported PKCS#8 public key hex\";\n r = new br.crypto.ECDSA();\n }\n return r.readPKCS8PubKeyHex(e), r;\n },\n parsePublicRawRSAKeyHex: function t(e) {\n var r = Er,\n n = r.getChildIdx,\n i = r.getV,\n o = {};\n if (\"30\" != e.substr(0, 2)) throw \"malformed RSA key(code:001)\";\n var s = n(e, 0);\n if (2 != s.length) throw \"malformed RSA key(code:002)\";\n if (\"02\" != e.substr(s[0], 2)) throw \"malformed RSA key(code:003)\";\n if (o.n = i(e, s[0]), \"02\" != e.substr(s[1], 2)) throw \"malformed RSA key(code:004)\";\n return o.e = i(e, s[1]), o;\n },\n parsePublicPKCS8Hex: function t(e) {\n var r = Er,\n n = r.getChildIdx,\n i = r.getV,\n o = {\n algparam: null\n },\n s = n(e, 0);\n if (2 != s.length) throw \"outer DERSequence shall have 2 elements: \" + s.length;\n var a = s[0];\n if (\"30\" != e.substr(a, 2)) throw \"malformed PKCS8 public key(code:001)\";\n var u = n(e, a);\n if (2 != u.length) throw \"malformed PKCS8 public key(code:002)\";\n if (\"06\" != e.substr(u[0], 2)) throw \"malformed PKCS8 public key(code:003)\";\n if (o.algoid = i(e, u[0]), \"06\" == e.substr(u[1], 2) ? o.algparam = i(e, u[1]) : \"30\" == e.substr(u[1], 2) && (o.algparam = {}, o.algparam.p = r.getVbyList(e, u[1], [0], \"02\"), o.algparam.q = r.getVbyList(e, u[1], [1], \"02\"), o.algparam.g = r.getVbyList(e, u[1], [2], \"02\")), \"03\" != e.substr(s[1], 2)) throw \"malformed PKCS8 public key(code:004)\";\n return o.key = i(e, s[1]).substr(2), o;\n }\n };\n }();\n Zr.getKey = function (t, e, r) {\n var n = (v = Er).getChildIdx,\n i = (v.getV, v.getVbyList),\n o = br.crypto,\n s = o.ECDSA,\n a = o.DSA,\n u = He,\n c = Hr,\n h = Zr;\n if (void 0 !== u && t instanceof u) return t;\n if (void 0 !== s && t instanceof s) return t;\n if (void 0 !== a && t instanceof a) return t;\n if (void 0 !== t.curve && void 0 !== t.xy && void 0 === t.d) return new s({\n pub: t.xy,\n curve: t.curve\n });\n if (void 0 !== t.curve && void 0 !== t.d) return new s({\n prv: t.d,\n curve: t.curve\n });\n if (void 0 === t.kty && void 0 !== t.n && void 0 !== t.e && void 0 === t.d) return (P = new u()).setPublic(t.n, t.e), P;\n if (void 0 === t.kty && void 0 !== t.n && void 0 !== t.e && void 0 !== t.d && void 0 !== t.p && void 0 !== t.q && void 0 !== t.dp && void 0 !== t.dq && void 0 !== t.co && void 0 === t.qi) return (P = new u()).setPrivateEx(t.n, t.e, t.d, t.p, t.q, t.dp, t.dq, t.co), P;\n if (void 0 === t.kty && void 0 !== t.n && void 0 !== t.e && void 0 !== t.d && void 0 === t.p) return (P = new u()).setPrivate(t.n, t.e, t.d), P;\n if (void 0 !== t.p && void 0 !== t.q && void 0 !== t.g && void 0 !== t.y && void 0 === t.x) return (P = new a()).setPublic(t.p, t.q, t.g, t.y), P;\n if (void 0 !== t.p && void 0 !== t.q && void 0 !== t.g && void 0 !== t.y && void 0 !== t.x) return (P = new a()).setPrivate(t.p, t.q, t.g, t.y, t.x), P;\n if (\"RSA\" === t.kty && void 0 !== t.n && void 0 !== t.e && void 0 === t.d) return (P = new u()).setPublic(Ir(t.n), Ir(t.e)), P;\n if (\"RSA\" === t.kty && void 0 !== t.n && void 0 !== t.e && void 0 !== t.d && void 0 !== t.p && void 0 !== t.q && void 0 !== t.dp && void 0 !== t.dq && void 0 !== t.qi) return (P = new u()).setPrivateEx(Ir(t.n), Ir(t.e), Ir(t.d), Ir(t.p), Ir(t.q), Ir(t.dp), Ir(t.dq), Ir(t.qi)), P;\n if (\"RSA\" === t.kty && void 0 !== t.n && void 0 !== t.e && void 0 !== t.d) return (P = new u()).setPrivate(Ir(t.n), Ir(t.e), Ir(t.d)), P;\n if (\"EC\" === t.kty && void 0 !== t.crv && void 0 !== t.x && void 0 !== t.y && void 0 === t.d) {\n var l = (k = new s({\n curve: t.crv\n })).ecparams.keylen / 4,\n f = \"04\" + (\"0000000000\" + Ir(t.x)).slice(-l) + (\"0000000000\" + Ir(t.y)).slice(-l);\n return k.setPublicKeyHex(f), k;\n }\n if (\"EC\" === t.kty && void 0 !== t.crv && void 0 !== t.x && void 0 !== t.y && void 0 !== t.d) {\n l = (k = new s({\n curve: t.crv\n })).ecparams.keylen / 4, f = \"04\" + (\"0000000000\" + Ir(t.x)).slice(-l) + (\"0000000000\" + Ir(t.y)).slice(-l);\n var g = (\"0000000000\" + Ir(t.d)).slice(-l);\n return k.setPublicKeyHex(f), k.setPrivateKeyHex(g), k;\n }\n if (\"pkcs5prv\" === r) {\n var d,\n p = t,\n v = Er;\n if (9 === (d = n(p, 0)).length) (P = new u()).readPKCS5PrvKeyHex(p);else if (6 === d.length) (P = new a()).readPKCS5PrvKeyHex(p);else {\n if (!(d.length > 2 && \"04\" === p.substr(d[1], 2))) throw \"unsupported PKCS#1/5 hexadecimal key\";\n (P = new s()).readPKCS5PrvKeyHex(p);\n }\n return P;\n }\n if (\"pkcs8prv\" === r) return P = h.getKeyFromPlainPrivatePKCS8Hex(t);\n if (\"pkcs8pub\" === r) return h._getKeyFromPublicPKCS8Hex(t);\n if (\"x509pub\" === r) return on.getPublicKeyFromCertHex(t);\n if (-1 != t.indexOf(\"-END CERTIFICATE-\", 0) || -1 != t.indexOf(\"-END X509 CERTIFICATE-\", 0) || -1 != t.indexOf(\"-END TRUSTED CERTIFICATE-\", 0)) return on.getPublicKeyFromCertPEM(t);\n if (-1 != t.indexOf(\"-END PUBLIC KEY-\")) {\n var y = Hr(t, \"PUBLIC KEY\");\n return h._getKeyFromPublicPKCS8Hex(y);\n }\n if (-1 != t.indexOf(\"-END RSA PRIVATE KEY-\") && -1 == t.indexOf(\"4,ENCRYPTED\")) {\n var m = c(t, \"RSA PRIVATE KEY\");\n return h.getKey(m, null, \"pkcs5prv\");\n }\n if (-1 != t.indexOf(\"-END DSA PRIVATE KEY-\") && -1 == t.indexOf(\"4,ENCRYPTED\")) {\n var _ = i(R = c(t, \"DSA PRIVATE KEY\"), 0, [1], \"02\"),\n S = i(R, 0, [2], \"02\"),\n b = i(R, 0, [3], \"02\"),\n w = i(R, 0, [4], \"02\"),\n E = i(R, 0, [5], \"02\");\n return (P = new a()).setPrivate(new F(_, 16), new F(S, 16), new F(b, 16), new F(w, 16), new F(E, 16)), P;\n }\n if (-1 != t.indexOf(\"-END EC PRIVATE KEY-\") && -1 == t.indexOf(\"4,ENCRYPTED\")) {\n m = c(t, \"EC PRIVATE KEY\");\n return h.getKey(m, null, \"pkcs5prv\");\n }\n if (-1 != t.indexOf(\"-END PRIVATE KEY-\")) return h.getKeyFromPlainPrivatePKCS8PEM(t);\n if (-1 != t.indexOf(\"-END RSA PRIVATE KEY-\") && -1 != t.indexOf(\"4,ENCRYPTED\")) {\n var x = h.getDecryptedKeyHex(t, e),\n A = new He();\n return A.readPKCS5PrvKeyHex(x), A;\n }\n if (-1 != t.indexOf(\"-END EC PRIVATE KEY-\") && -1 != t.indexOf(\"4,ENCRYPTED\")) {\n var k,\n P = i(R = h.getDecryptedKeyHex(t, e), 0, [1], \"04\"),\n C = i(R, 0, [2, 0], \"06\"),\n T = i(R, 0, [3, 0], \"03\").substr(2);\n if (void 0 === br.crypto.OID.oidhex2name[C]) throw \"undefined OID(hex) in KJUR.crypto.OID: \" + C;\n return (k = new s({\n curve: br.crypto.OID.oidhex2name[C]\n })).setPublicKeyHex(T), k.setPrivateKeyHex(P), k.isPublic = !1, k;\n }\n if (-1 != t.indexOf(\"-END DSA PRIVATE KEY-\") && -1 != t.indexOf(\"4,ENCRYPTED\")) {\n var R;\n _ = i(R = h.getDecryptedKeyHex(t, e), 0, [1], \"02\"), S = i(R, 0, [2], \"02\"), b = i(R, 0, [3], \"02\"), w = i(R, 0, [4], \"02\"), E = i(R, 0, [5], \"02\");\n return (P = new a()).setPrivate(new F(_, 16), new F(S, 16), new F(b, 16), new F(w, 16), new F(E, 16)), P;\n }\n if (-1 != t.indexOf(\"-END ENCRYPTED PRIVATE KEY-\")) return h.getKeyFromEncryptedPKCS8PEM(t, e);\n throw new Error(\"not supported argument\");\n }, Zr.generateKeypair = function (t, e) {\n if (\"RSA\" == t) {\n var r = e;\n (s = new He()).generate(r, \"10001\"), s.isPrivate = !0, s.isPublic = !0;\n var n = new He(),\n i = s.n.toString(16),\n o = s.e.toString(16);\n return n.setPublic(i, o), n.isPrivate = !1, n.isPublic = !0, (a = {}).prvKeyObj = s, a.pubKeyObj = n, a;\n }\n if (\"EC\" == t) {\n var s,\n a,\n u = e,\n c = new br.crypto.ECDSA({\n curve: u\n }).generateKeyPairHex();\n return (s = new br.crypto.ECDSA({\n curve: u\n })).setPublicKeyHex(c.ecpubhex), s.setPrivateKeyHex(c.ecprvhex), s.isPrivate = !0, s.isPublic = !1, (n = new br.crypto.ECDSA({\n curve: u\n })).setPublicKeyHex(c.ecpubhex), n.isPrivate = !1, n.isPublic = !0, (a = {}).prvKeyObj = s, a.pubKeyObj = n, a;\n }\n throw \"unknown algorithm: \" + t;\n }, Zr.getPEM = function (t, e, r, n, i, o) {\n var s = br,\n a = s.asn1,\n u = a.DERObjectIdentifier,\n c = a.DERInteger,\n h = a.ASN1Util.newObject,\n l = a.x509.SubjectPublicKeyInfo,\n f = s.crypto,\n g = f.DSA,\n d = f.ECDSA,\n p = He;\n function v(t) {\n return h({\n seq: [{\n int: 0\n }, {\n int: {\n bigint: t.n\n }\n }, {\n int: t.e\n }, {\n int: {\n bigint: t.d\n }\n }, {\n int: {\n bigint: t.p\n }\n }, {\n int: {\n bigint: t.q\n }\n }, {\n int: {\n bigint: t.dmp1\n }\n }, {\n int: {\n bigint: t.dmq1\n }\n }, {\n int: {\n bigint: t.coeff\n }\n }]\n });\n }\n function m(t) {\n return h({\n seq: [{\n int: 1\n }, {\n octstr: {\n hex: t.prvKeyHex\n }\n }, {\n tag: [\"a0\", !0, {\n oid: {\n name: t.curveName\n }\n }]\n }, {\n tag: [\"a1\", !0, {\n bitstr: {\n hex: \"00\" + t.pubKeyHex\n }\n }]\n }]\n });\n }\n function _(t) {\n return h({\n seq: [{\n int: 0\n }, {\n int: {\n bigint: t.p\n }\n }, {\n int: {\n bigint: t.q\n }\n }, {\n int: {\n bigint: t.g\n }\n }, {\n int: {\n bigint: t.y\n }\n }, {\n int: {\n bigint: t.x\n }\n }]\n });\n }\n if ((void 0 !== p && t instanceof p || void 0 !== g && t instanceof g || void 0 !== d && t instanceof d) && 1 == t.isPublic && (void 0 === e || \"PKCS8PUB\" == e)) return Mr(F = new l(t).getEncodedHex(), \"PUBLIC KEY\");\n if (\"PKCS1PRV\" == e && void 0 !== p && t instanceof p && (void 0 === r || null == r) && 1 == t.isPrivate) return Mr(F = v(t).getEncodedHex(), \"RSA PRIVATE KEY\");\n if (\"PKCS1PRV\" == e && void 0 !== d && t instanceof d && (void 0 === r || null == r) && 1 == t.isPrivate) {\n var S = new u({\n name: t.curveName\n }).getEncodedHex(),\n b = m(t).getEncodedHex(),\n w = \"\";\n return w += Mr(S, \"EC PARAMETERS\"), w += Mr(b, \"EC PRIVATE KEY\");\n }\n if (\"PKCS1PRV\" == e && void 0 !== g && t instanceof g && (void 0 === r || null == r) && 1 == t.isPrivate) return Mr(F = _(t).getEncodedHex(), \"DSA PRIVATE KEY\");\n if (\"PKCS5PRV\" == e && void 0 !== p && t instanceof p && void 0 !== r && null != r && 1 == t.isPrivate) {\n var F = v(t).getEncodedHex();\n return void 0 === n && (n = \"DES-EDE3-CBC\"), this.getEncryptedPKCS5PEMFromPrvKeyHex(\"RSA\", F, r, n, o);\n }\n if (\"PKCS5PRV\" == e && void 0 !== d && t instanceof d && void 0 !== r && null != r && 1 == t.isPrivate) {\n F = m(t).getEncodedHex();\n return void 0 === n && (n = \"DES-EDE3-CBC\"), this.getEncryptedPKCS5PEMFromPrvKeyHex(\"EC\", F, r, n, o);\n }\n if (\"PKCS5PRV\" == e && void 0 !== g && t instanceof g && void 0 !== r && null != r && 1 == t.isPrivate) {\n F = _(t).getEncodedHex();\n return void 0 === n && (n = \"DES-EDE3-CBC\"), this.getEncryptedPKCS5PEMFromPrvKeyHex(\"DSA\", F, r, n, o);\n }\n var E = function t(e, r) {\n var n = x(e, r);\n return new h({\n seq: [{\n seq: [{\n oid: {\n name: \"pkcs5PBES2\"\n }\n }, {\n seq: [{\n seq: [{\n oid: {\n name: \"pkcs5PBKDF2\"\n }\n }, {\n seq: [{\n octstr: {\n hex: n.pbkdf2Salt\n }\n }, {\n int: n.pbkdf2Iter\n }]\n }]\n }, {\n seq: [{\n oid: {\n name: \"des-EDE3-CBC\"\n }\n }, {\n octstr: {\n hex: n.encryptionSchemeIV\n }\n }]\n }]\n }]\n }, {\n octstr: {\n hex: n.ciphertext\n }\n }]\n }).getEncodedHex();\n },\n x = function t(e, r) {\n var n = y.lib.WordArray.random(8),\n i = y.lib.WordArray.random(8),\n o = y.PBKDF2(r, n, {\n keySize: 6,\n iterations: 100\n }),\n s = y.enc.Hex.parse(e),\n a = y.TripleDES.encrypt(s, o, {\n iv: i\n }) + \"\",\n u = {};\n return u.ciphertext = a, u.pbkdf2Salt = y.enc.Hex.stringify(n), u.pbkdf2Iter = 100, u.encryptionSchemeAlg = \"DES-EDE3-CBC\", u.encryptionSchemeIV = y.enc.Hex.stringify(i), u;\n };\n if (\"PKCS8PRV\" == e && null != p && t instanceof p && 1 == t.isPrivate) {\n var A = v(t).getEncodedHex();\n F = h({\n seq: [{\n int: 0\n }, {\n seq: [{\n oid: {\n name: \"rsaEncryption\"\n }\n }, {\n null: !0\n }]\n }, {\n octstr: {\n hex: A\n }\n }]\n }).getEncodedHex();\n return void 0 === r || null == r ? Mr(F, \"PRIVATE KEY\") : Mr(b = E(F, r), \"ENCRYPTED PRIVATE KEY\");\n }\n if (\"PKCS8PRV\" == e && void 0 !== d && t instanceof d && 1 == t.isPrivate) {\n A = new h({\n seq: [{\n int: 1\n }, {\n octstr: {\n hex: t.prvKeyHex\n }\n }, {\n tag: [\"a1\", !0, {\n bitstr: {\n hex: \"00\" + t.pubKeyHex\n }\n }]\n }]\n }).getEncodedHex(), F = h({\n seq: [{\n int: 0\n }, {\n seq: [{\n oid: {\n name: \"ecPublicKey\"\n }\n }, {\n oid: {\n name: t.curveName\n }\n }]\n }, {\n octstr: {\n hex: A\n }\n }]\n }).getEncodedHex();\n return void 0 === r || null == r ? Mr(F, \"PRIVATE KEY\") : Mr(b = E(F, r), \"ENCRYPTED PRIVATE KEY\");\n }\n if (\"PKCS8PRV\" == e && void 0 !== g && t instanceof g && 1 == t.isPrivate) {\n A = new c({\n bigint: t.x\n }).getEncodedHex(), F = h({\n seq: [{\n int: 0\n }, {\n seq: [{\n oid: {\n name: \"dsa\"\n }\n }, {\n seq: [{\n int: {\n bigint: t.p\n }\n }, {\n int: {\n bigint: t.q\n }\n }, {\n int: {\n bigint: t.g\n }\n }]\n }]\n }, {\n octstr: {\n hex: A\n }\n }]\n }).getEncodedHex();\n return void 0 === r || null == r ? Mr(F, \"PRIVATE KEY\") : Mr(b = E(F, r), \"ENCRYPTED PRIVATE KEY\");\n }\n throw new Error(\"unsupported object nor format\");\n }, Zr.getKeyFromCSRPEM = function (t) {\n var e = Hr(t, \"CERTIFICATE REQUEST\");\n return Zr.getKeyFromCSRHex(e);\n }, Zr.getKeyFromCSRHex = function (t) {\n var e = Zr.parseCSRHex(t);\n return Zr.getKey(e.p8pubkeyhex, null, \"pkcs8pub\");\n }, Zr.parseCSRHex = function (t) {\n var e = Er,\n r = e.getChildIdx,\n n = e.getTLV,\n i = {},\n o = t;\n if (\"30\" != o.substr(0, 2)) throw \"malformed CSR(code:001)\";\n var s = r(o, 0);\n if (s.length < 1) throw \"malformed CSR(code:002)\";\n if (\"30\" != o.substr(s[0], 2)) throw \"malformed CSR(code:003)\";\n var a = r(o, s[0]);\n if (a.length < 3) throw \"malformed CSR(code:004)\";\n return i.p8pubkeyhex = n(o, a[2]), i;\n }, Zr.getKeyID = function (t) {\n var e = Zr,\n r = Er;\n \"string\" == typeof t && -1 != t.indexOf(\"BEGIN \") && (t = e.getKey(t));\n var n = Hr(e.getPEM(t)),\n i = r.getIdxbyList(n, 0, [1]),\n o = r.getV(n, i).substring(2);\n return br.crypto.Util.hashHex(o, \"sha1\");\n }, Zr.getJWKFromKey = function (t) {\n var e = {};\n if (t instanceof He && t.isPrivate) return e.kty = \"RSA\", e.n = Rr(t.n.toString(16)), e.e = Rr(t.e.toString(16)), e.d = Rr(t.d.toString(16)), e.p = Rr(t.p.toString(16)), e.q = Rr(t.q.toString(16)), e.dp = Rr(t.dmp1.toString(16)), e.dq = Rr(t.dmq1.toString(16)), e.qi = Rr(t.coeff.toString(16)), e;\n if (t instanceof He && t.isPublic) return e.kty = \"RSA\", e.n = Rr(t.n.toString(16)), e.e = Rr(t.e.toString(16)), e;\n if (t instanceof br.crypto.ECDSA && t.isPrivate) {\n if (\"P-256\" !== (n = t.getShortNISTPCurveName()) && \"P-384\" !== n) throw \"unsupported curve name for JWT: \" + n;\n var r = t.getPublicKeyXYHex();\n return e.kty = \"EC\", e.crv = n, e.x = Rr(r.x), e.y = Rr(r.y), e.d = Rr(t.prvKeyHex), e;\n }\n if (t instanceof br.crypto.ECDSA && t.isPublic) {\n var n;\n if (\"P-256\" !== (n = t.getShortNISTPCurveName()) && \"P-384\" !== n) throw \"unsupported curve name for JWT: \" + n;\n r = t.getPublicKeyXYHex();\n return e.kty = \"EC\", e.crv = n, e.x = Rr(r.x), e.y = Rr(r.y), e;\n }\n throw \"not supported key object\";\n }, He.getPosArrayOfChildrenFromHex = function (t) {\n return Er.getChildIdx(t, 0);\n }, He.getHexValueArrayOfChildrenFromHex = function (t) {\n var e,\n r = Er.getV,\n n = r(t, (e = He.getPosArrayOfChildrenFromHex(t))[0]),\n i = r(t, e[1]),\n o = r(t, e[2]),\n s = r(t, e[3]),\n a = r(t, e[4]),\n u = r(t, e[5]),\n c = r(t, e[6]),\n h = r(t, e[7]),\n l = r(t, e[8]);\n return (e = new Array()).push(n, i, o, s, a, u, c, h, l), e;\n }, He.prototype.readPrivateKeyFromPEMString = function (t) {\n var e = Hr(t),\n r = He.getHexValueArrayOfChildrenFromHex(e);\n this.setPrivateEx(r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);\n }, He.prototype.readPKCS5PrvKeyHex = function (t) {\n var e = He.getHexValueArrayOfChildrenFromHex(t);\n this.setPrivateEx(e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8]);\n }, He.prototype.readPKCS8PrvKeyHex = function (t) {\n var e,\n r,\n n,\n i,\n o,\n s,\n a,\n u,\n c = Er,\n h = c.getVbyListEx;\n if (!1 === c.isASN1HEX(t)) throw new Error(\"not ASN.1 hex string\");\n try {\n e = h(t, 0, [2, 0, 1], \"02\"), r = h(t, 0, [2, 0, 2], \"02\"), n = h(t, 0, [2, 0, 3], \"02\"), i = h(t, 0, [2, 0, 4], \"02\"), o = h(t, 0, [2, 0, 5], \"02\"), s = h(t, 0, [2, 0, 6], \"02\"), a = h(t, 0, [2, 0, 7], \"02\"), u = h(t, 0, [2, 0, 8], \"02\");\n } catch (t) {\n throw new Error(\"malformed PKCS#8 plain RSA private key\");\n }\n this.setPrivateEx(e, r, n, i, o, s, a, u);\n }, He.prototype.readPKCS5PubKeyHex = function (t) {\n var e = Er,\n r = e.getV;\n if (!1 === e.isASN1HEX(t)) throw new Error(\"keyHex is not ASN.1 hex string\");\n var n = e.getChildIdx(t, 0);\n if (2 !== n.length || \"02\" !== t.substr(n[0], 2) || \"02\" !== t.substr(n[1], 2)) throw new Error(\"wrong hex for PKCS#5 public key\");\n var i = r(t, n[0]),\n o = r(t, n[1]);\n this.setPublic(i, o);\n }, He.prototype.readPKCS8PubKeyHex = function (t) {\n var e = Er;\n if (!1 === e.isASN1HEX(t)) throw new Error(\"not ASN.1 hex string\");\n if (\"06092a864886f70d010101\" !== e.getTLVbyListEx(t, 0, [0, 0])) throw new Error(\"not PKCS8 RSA public key\");\n var r = e.getTLVbyListEx(t, 0, [1, 0]);\n this.readPKCS5PubKeyHex(r);\n }, He.prototype.readCertPubKeyHex = function (t, e) {\n var r, n;\n (r = new on()).readCertHex(t), n = r.getPublicKeyHex(), this.readPKCS8PubKeyHex(n);\n };\n var tn = new RegExp(\"[^0-9a-f]\", \"gi\");\n function en(t, e) {\n for (var r = \"\", n = e / 4 - t.length, i = 0; i < n; i++) r += \"0\";\n return r + t;\n }\n function rn(t, e, r) {\n for (var n = \"\", i = 0; n.length < e;) n += Nr(r(Ur(t + String.fromCharCode.apply(String, [(4278190080 & i) >> 24, (16711680 & i) >> 16, (65280 & i) >> 8, 255 & i])))), i += 1;\n return n;\n }\n function nn(t) {\n for (var e in br.crypto.Util.DIGESTINFOHEAD) {\n var r = br.crypto.Util.DIGESTINFOHEAD[e],\n n = r.length;\n if (t.substring(0, n) == r) return [e, t.substring(n)];\n }\n return [];\n }\n function on(t) {\n var e,\n r = Er,\n n = r.getChildIdx,\n i = r.getV,\n o = r.getTLV,\n s = r.getVbyList,\n a = r.getVbyListEx,\n u = r.getTLVbyList,\n c = r.getTLVbyListEx,\n h = r.getIdxbyList,\n l = r.getIdxbyListEx,\n f = r.getVidx,\n g = r.oidname,\n d = r.hextooidstr,\n p = on,\n v = Hr;\n try {\n e = br.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;\n } catch (t) {}\n this.HEX2STAG = {\n \"0c\": \"utf8\",\n 13: \"prn\",\n 16: \"ia5\",\n \"1a\": \"vis\",\n \"1e\": \"bmp\"\n }, this.hex = null, this.version = 0, this.foffset = 0, this.aExtInfo = null, this.getVersion = function () {\n return null === this.hex || 0 !== this.version ? this.version : \"a003020102\" !== u(this.hex, 0, [0, 0]) ? (this.version = 1, this.foffset = -1, 1) : (this.version = 3, 3);\n }, this.getSerialNumberHex = function () {\n return a(this.hex, 0, [0, 0], \"02\");\n }, this.getSignatureAlgorithmField = function () {\n var t = c(this.hex, 0, [0, 1]);\n return this.getAlgorithmIdentifierName(t);\n }, this.getAlgorithmIdentifierName = function (t) {\n for (var r in e) if (t === e[r]) return r;\n return g(a(t, 0, [0], \"06\"));\n }, this.getIssuer = function () {\n return this.getX500Name(this.getIssuerHex());\n }, this.getIssuerHex = function () {\n return u(this.hex, 0, [0, 3 + this.foffset], \"30\");\n }, this.getIssuerString = function () {\n return p.hex2dn(this.getIssuerHex());\n }, this.getSubject = function () {\n return this.getX500Name(this.getSubjectHex());\n }, this.getSubjectHex = function () {\n return u(this.hex, 0, [0, 5 + this.foffset], \"30\");\n }, this.getSubjectString = function () {\n return p.hex2dn(this.getSubjectHex());\n }, this.getNotBefore = function () {\n var t = s(this.hex, 0, [0, 4 + this.foffset, 0]);\n return t = t.replace(/(..)/g, \"%$1\"), t = decodeURIComponent(t);\n }, this.getNotAfter = function () {\n var t = s(this.hex, 0, [0, 4 + this.foffset, 1]);\n return t = t.replace(/(..)/g, \"%$1\"), t = decodeURIComponent(t);\n }, this.getPublicKeyHex = function () {\n return r.getTLVbyList(this.hex, 0, [0, 6 + this.foffset], \"30\");\n }, this.getPublicKeyIdx = function () {\n return h(this.hex, 0, [0, 6 + this.foffset], \"30\");\n }, this.getPublicKeyContentIdx = function () {\n var t = this.getPublicKeyIdx();\n return h(this.hex, t, [1, 0], \"30\");\n }, this.getPublicKey = function () {\n return Zr.getKey(this.getPublicKeyHex(), null, \"pkcs8pub\");\n }, this.getSignatureAlgorithmName = function () {\n var t = u(this.hex, 0, [1], \"30\");\n return this.getAlgorithmIdentifierName(t);\n }, this.getSignatureValueHex = function () {\n return s(this.hex, 0, [2], \"03\", !0);\n }, this.verifySignature = function (t) {\n var e = this.getSignatureAlgorithmField(),\n r = this.getSignatureValueHex(),\n n = u(this.hex, 0, [0], \"30\"),\n i = new br.crypto.Signature({\n alg: e\n });\n return i.init(t), i.updateHex(n), i.verify(r);\n }, this.parseExt = function (t) {\n var e, o, a;\n if (void 0 === t) {\n if (a = this.hex, 3 !== this.version) return -1;\n e = h(a, 0, [0, 7, 0], \"30\"), o = n(a, e);\n } else {\n a = Hr(t);\n var u = h(a, 0, [0, 3, 0, 0], \"06\");\n if (\"2a864886f70d01090e\" != i(a, u)) return void (this.aExtInfo = new Array());\n e = h(a, 0, [0, 3, 0, 1, 0], \"30\"), o = n(a, e), this.hex = a;\n }\n this.aExtInfo = new Array();\n for (var c = 0; c < o.length; c++) {\n var l = {\n critical: !1\n },\n g = 0;\n 3 === n(a, o[c]).length && (l.critical = !0, g = 1), l.oid = r.hextooidstr(s(a, o[c], [0], \"06\"));\n var d = h(a, o[c], [1 + g]);\n l.vidx = f(a, d), this.aExtInfo.push(l);\n }\n }, this.getExtInfo = function (t) {\n var e = this.aExtInfo,\n r = t;\n if (t.match(/^[0-9.]+$/) || (r = br.asn1.x509.OID.name2oid(t)), \"\" !== r) for (var n = 0; n < e.length; n++) if (e[n].oid === r) return e[n];\n }, this.getExtBasicConstraints = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"basicConstraints\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var n = {\n extname: \"basicConstraints\"\n };\n if (e && (n.critical = !0), \"3000\" === t) return n;\n if (\"30030101ff\" === t) return n.cA = !0, n;\n if (\"30060101ff02\" === t.substr(0, 12)) {\n var s = i(t, 10),\n a = parseInt(s, 16);\n return n.cA = !0, n.pathLen = a, n;\n }\n throw new Error(\"hExtV parse error: \" + t);\n }, this.getExtKeyUsage = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"keyUsage\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var n = {\n extname: \"keyUsage\"\n };\n return e && (n.critical = !0), n.names = this.getExtKeyUsageString(t).split(\",\"), n;\n }, this.getExtKeyUsageBin = function (t) {\n if (void 0 === t) {\n var e = this.getExtInfo(\"keyUsage\");\n if (void 0 === e) return \"\";\n t = o(this.hex, e.vidx);\n }\n if (8 != t.length && 10 != t.length) throw new Error(\"malformed key usage value: \" + t);\n var r = \"000000000000000\" + parseInt(t.substr(6), 16).toString(2);\n return 8 == t.length && (r = r.slice(-8)), 10 == t.length && (r = r.slice(-16)), \"\" == (r = r.replace(/0+$/, \"\")) && (r = \"0\"), r;\n }, this.getExtKeyUsageString = function (t) {\n for (var e = this.getExtKeyUsageBin(t), r = new Array(), n = 0; n < e.length; n++) \"1\" == e.substr(n, 1) && r.push(on.KEYUSAGE_NAME[n]);\n return r.join(\",\");\n }, this.getExtSubjectKeyIdentifier = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"subjectKeyIdentifier\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var n = {\n extname: \"subjectKeyIdentifier\"\n };\n e && (n.critical = !0);\n var s = i(t, 0);\n return n.kid = {\n hex: s\n }, n;\n }, this.getExtAuthorityKeyIdentifier = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"authorityKeyIdentifier\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var s = {\n extname: \"authorityKeyIdentifier\"\n };\n e && (s.critical = !0);\n for (var a = n(t, 0), u = 0; u < a.length; u++) {\n var c = t.substr(a[u], 2);\n if (\"80\" === c && (s.kid = {\n hex: i(t, a[u])\n }), \"a1\" === c) {\n var h = o(t, a[u]),\n l = this.getGeneralNames(h);\n s.issuer = l[0].dn;\n }\n \"82\" === c && (s.sn = {\n hex: i(t, a[u])\n });\n }\n return s;\n }, this.getExtExtKeyUsage = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"extKeyUsage\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var s = {\n extname: \"extKeyUsage\",\n array: []\n };\n e && (s.critical = !0);\n for (var a = n(t, 0), u = 0; u < a.length; u++) s.array.push(g(i(t, a[u])));\n return s;\n }, this.getExtExtKeyUsageName = function () {\n var t = this.getExtInfo(\"extKeyUsage\");\n if (void 0 === t) return t;\n var e = new Array(),\n r = o(this.hex, t.vidx);\n if (\"\" === r) return e;\n for (var s = n(r, 0), a = 0; a < s.length; a++) e.push(g(i(r, s[a])));\n return e;\n }, this.getExtSubjectAltName = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"subjectAltName\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var n = {\n extname: \"subjectAltName\",\n array: []\n };\n return e && (n.critical = !0), n.array = this.getGeneralNames(t), n;\n }, this.getExtIssuerAltName = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"issuerAltName\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var n = {\n extname: \"issuerAltName\",\n array: []\n };\n return e && (n.critical = !0), n.array = this.getGeneralNames(t), n;\n }, this.getGeneralNames = function (t) {\n for (var e = n(t, 0), r = [], i = 0; i < e.length; i++) {\n var s = this.getGeneralName(o(t, e[i]));\n void 0 !== s && r.push(s);\n }\n return r;\n }, this.getGeneralName = function (t) {\n var e = t.substr(0, 2),\n r = i(t, 0),\n n = Nr(r);\n return \"81\" == e ? {\n rfc822: n\n } : \"82\" == e ? {\n dns: n\n } : \"86\" == e ? {\n uri: n\n } : \"87\" == e ? {\n ip: Yr(r)\n } : \"a4\" == e ? {\n dn: this.getX500Name(r)\n } : void 0;\n }, this.getExtSubjectAltName2 = function () {\n var t,\n e,\n r,\n s = this.getExtInfo(\"subjectAltName\");\n if (void 0 === s) return s;\n for (var a = new Array(), u = o(this.hex, s.vidx), c = n(u, 0), h = 0; h < c.length; h++) r = u.substr(c[h], 2), t = i(u, c[h]), \"81\" === r && (e = Lr(t), a.push([\"MAIL\", e])), \"82\" === r && (e = Lr(t), a.push([\"DNS\", e])), \"84\" === r && (e = on.hex2dn(t, 0), a.push([\"DN\", e])), \"86\" === r && (e = Lr(t), a.push([\"URI\", e])), \"87\" === r && (e = Yr(t), a.push([\"IP\", e]));\n return a;\n }, this.getExtCRLDistributionPoints = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"cRLDistributionPoints\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var i = {\n extname: \"cRLDistributionPoints\",\n array: []\n };\n e && (i.critical = !0);\n for (var s = n(t, 0), a = 0; a < s.length; a++) {\n var u = o(t, s[a]);\n i.array.push(this.getDistributionPoint(u));\n }\n return i;\n }, this.getDistributionPoint = function (t) {\n for (var e = {}, r = n(t, 0), i = 0; i < r.length; i++) {\n var s = t.substr(r[i], 2),\n a = o(t, r[i]);\n \"a0\" == s && (e.dpname = this.getDistributionPointName(a));\n }\n return e;\n }, this.getDistributionPointName = function (t) {\n for (var e = {}, r = n(t, 0), i = 0; i < r.length; i++) {\n var s = t.substr(r[i], 2),\n a = o(t, r[i]);\n \"a0\" == s && (e.full = this.getGeneralNames(a));\n }\n return e;\n }, this.getExtCRLDistributionPointsURI = function () {\n var t = this.getExtInfo(\"cRLDistributionPoints\");\n if (void 0 === t) return t;\n for (var e = new Array(), r = n(this.hex, t.vidx), i = 0; i < r.length; i++) try {\n var o = Lr(s(this.hex, r[i], [0, 0, 0], \"86\"));\n e.push(o);\n } catch (t) {}\n return e;\n }, this.getExtAIAInfo = function () {\n var t = this.getExtInfo(\"authorityInfoAccess\");\n if (void 0 === t) return t;\n for (var e = {\n ocsp: [],\n caissuer: []\n }, r = n(this.hex, t.vidx), i = 0; i < r.length; i++) {\n var o = s(this.hex, r[i], [0], \"06\"),\n a = s(this.hex, r[i], [1], \"86\");\n \"2b06010505073001\" === o && e.ocsp.push(Lr(a)), \"2b06010505073002\" === o && e.caissuer.push(Lr(a));\n }\n return e;\n }, this.getExtAuthorityInfoAccess = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"authorityInfoAccess\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var i = {\n extname: \"authorityInfoAccess\",\n array: []\n };\n e && (i.critical = !0);\n for (var u = n(t, 0), c = 0; c < u.length; c++) {\n var h = a(t, u[c], [0], \"06\"),\n l = Lr(s(t, u[c], [1], \"86\"));\n if (\"2b06010505073001\" == h) i.array.push({\n ocsp: l\n });else {\n if (\"2b06010505073002\" != h) throw new Error(\"unknown method: \" + h);\n i.array.push({\n caissuer: l\n });\n }\n }\n return i;\n }, this.getExtCertificatePolicies = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"certificatePolicies\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var i = {\n extname: \"certificatePolicies\",\n array: []\n };\n e && (i.critical = !0);\n for (var s = n(t, 0), a = 0; a < s.length; a++) {\n var u = o(t, s[a]),\n c = this.getPolicyInformation(u);\n i.array.push(c);\n }\n return i;\n }, this.getPolicyInformation = function (t) {\n var e = {},\n r = s(t, 0, [0], \"06\");\n e.policyoid = g(r);\n var i = l(t, 0, [1], \"30\");\n if (-1 != i) {\n e.array = [];\n for (var a = n(t, i), u = 0; u < a.length; u++) {\n var c = o(t, a[u]),\n h = this.getPolicyQualifierInfo(c);\n e.array.push(h);\n }\n }\n return e;\n }, this.getPolicyQualifierInfo = function (t) {\n var e = {},\n r = s(t, 0, [0], \"06\");\n if (\"2b06010505070201\" === r) {\n var n = a(t, 0, [1], \"16\");\n e.cps = Nr(n);\n } else if (\"2b06010505070202\" === r) {\n var i = u(t, 0, [1], \"30\");\n e.unotice = this.getUserNotice(i);\n }\n return e;\n }, this.getUserNotice = function (t) {\n for (var e = {}, r = n(t, 0), i = 0; i < r.length; i++) {\n var s = o(t, r[i]);\n \"30\" != s.substr(0, 2) && (e.exptext = this.getDisplayText(s));\n }\n return e;\n }, this.getDisplayText = function (t) {\n var e = {};\n return e.type = {\n \"0c\": \"utf8\",\n 16: \"ia5\",\n \"1a\": \"vis\",\n \"1e\": \"bmp\"\n }[t.substr(0, 2)], e.str = Nr(i(t, 0)), e;\n }, this.getExtCRLNumber = function (t, e) {\n var r = {\n extname: \"cRLNumber\"\n };\n if (e && (r.critical = !0), \"02\" == t.substr(0, 2)) return r.num = {\n hex: i(t, 0)\n }, r;\n throw new Error(\"hExtV parse error: \" + t);\n }, this.getExtCRLReason = function (t, e) {\n var r = {\n extname: \"cRLReason\"\n };\n if (e && (r.critical = !0), \"0a\" == t.substr(0, 2)) return r.code = parseInt(i(t, 0), 16), r;\n throw new Error(\"hExtV parse error: \" + t);\n }, this.getExtOcspNonce = function (t, e) {\n var r = {\n extname: \"ocspNonce\"\n };\n e && (r.critical = !0);\n var n = i(t, 0);\n return r.hex = n, r;\n }, this.getExtOcspNoCheck = function (t, e) {\n var r = {\n extname: \"ocspNoCheck\"\n };\n return e && (r.critical = !0), r;\n }, this.getExtAdobeTimeStamp = function (t, e) {\n if (void 0 === t && void 0 === e) {\n var r = this.getExtInfo(\"adobeTimeStamp\");\n if (void 0 === r) return;\n t = o(this.hex, r.vidx), e = r.critical;\n }\n var i = {\n extname: \"adobeTimeStamp\"\n };\n e && (i.critical = !0);\n var s = n(t, 0);\n if (s.length > 1) {\n var a = o(t, s[1]),\n u = this.getGeneralName(a);\n null != u.uri && (i.uri = u.uri);\n }\n if (s.length > 2) {\n var c = o(t, s[2]);\n \"0101ff\" == c && (i.reqauth = !0), \"010100\" == c && (i.reqauth = !1);\n }\n return i;\n }, this.getX500NameRule = function (t) {\n for (var e = null, r = [], n = 0; n < t.length; n++) for (var i = t[n], o = 0; o < i.length; o++) r.push(i[o]);\n for (n = 0; n < r.length; n++) {\n var s = r[n],\n a = s.ds,\n u = s.value,\n c = s.type;\n if (\":\" + a, \"prn\" != a && \"utf8\" != a && \"ia5\" != a) return \"mixed\";\n if (\"ia5\" == a) {\n if (\"CN\" != c) return \"mixed\";\n if (br.lang.String.isMail(u)) continue;\n return \"mixed\";\n }\n if (\"C\" == c) {\n if (\"prn\" == a) continue;\n return \"mixed\";\n }\n if (\":\" + a, null == e) e = a;else if (e !== a) return \"mixed\";\n }\n return null == e ? \"prn\" : e;\n }, this.getX500Name = function (t) {\n var e = this.getX500NameArray(t);\n return {\n array: e,\n str: this.dnarraytostr(e)\n };\n }, this.getX500NameArray = function (t) {\n for (var e = [], r = n(t, 0), i = 0; i < r.length; i++) e.push(this.getRDN(o(t, r[i])));\n return e;\n }, this.getRDN = function (t) {\n for (var e = [], r = n(t, 0), i = 0; i < r.length; i++) e.push(this.getAttrTypeAndValue(o(t, r[i])));\n return e;\n }, this.getAttrTypeAndValue = function (t) {\n var e = {\n type: null,\n value: null,\n ds: null\n },\n r = n(t, 0),\n i = s(t, r[0], [], \"06\"),\n o = s(t, r[1], []),\n a = br.asn1.ASN1Util.oidHexToInt(i);\n return e.type = br.asn1.x509.OID.oid2atype(a), e.value = Nr(o), e.ds = this.HEX2STAG[t.substr(r[1], 2)], e;\n }, this.readCertPEM = function (t) {\n this.readCertHex(v(t));\n }, this.readCertHex = function (t) {\n this.hex = t, this.getVersion();\n try {\n h(this.hex, 0, [0, 7], \"a3\"), this.parseExt();\n } catch (t) {}\n }, this.getParam = function () {\n var t = {};\n return t.version = this.getVersion(), t.serial = {\n hex: this.getSerialNumberHex()\n }, t.sigalg = this.getSignatureAlgorithmField(), t.issuer = this.getIssuer(), t.notbefore = this.getNotBefore(), t.notafter = this.getNotAfter(), t.subject = this.getSubject(), t.sbjpubkey = Mr(this.getPublicKeyHex(), \"PUBLIC KEY\"), this.aExtInfo.length > 0 && (t.ext = this.getExtParamArray()), t.sighex = this.getSignatureValueHex(), t;\n }, this.getExtParamArray = function (t) {\n null == t && -1 != l(this.hex, 0, [0, \"[3]\"]) && (t = c(this.hex, 0, [0, \"[3]\", 0], \"30\"));\n for (var e = [], r = n(t, 0), i = 0; i < r.length; i++) {\n var s = o(t, r[i]),\n a = this.getExtParam(s);\n null != a && e.push(a);\n }\n return e;\n }, this.getExtParam = function (t) {\n var e = n(t, 0).length;\n if (2 != e && 3 != e) throw new Error(\"wrong number elements in Extension: \" + e + \" \" + t);\n var r = d(s(t, 0, [0], \"06\")),\n i = !1;\n 3 == e && \"0101ff\" == u(t, 0, [1]) && (i = !0);\n var o = u(t, 0, [e - 1, 0]),\n a = void 0;\n if (\"2.5.29.14\" == r ? a = this.getExtSubjectKeyIdentifier(o, i) : \"2.5.29.15\" == r ? a = this.getExtKeyUsage(o, i) : \"2.5.29.17\" == r ? a = this.getExtSubjectAltName(o, i) : \"2.5.29.18\" == r ? a = this.getExtIssuerAltName(o, i) : \"2.5.29.19\" == r ? a = this.getExtBasicConstraints(o, i) : \"2.5.29.31\" == r ? a = this.getExtCRLDistributionPoints(o, i) : \"2.5.29.32\" == r ? a = this.getExtCertificatePolicies(o, i) : \"2.5.29.35\" == r ? a = this.getExtAuthorityKeyIdentifier(o, i) : \"2.5.29.37\" == r ? a = this.getExtExtKeyUsage(o, i) : \"1.3.6.1.5.5.7.1.1\" == r ? a = this.getExtAuthorityInfoAccess(o, i) : \"2.5.29.20\" == r ? a = this.getExtCRLNumber(o, i) : \"2.5.29.21\" == r ? a = this.getExtCRLReason(o, i) : \"1.3.6.1.5.5.7.48.1.2\" == r ? a = this.getExtOcspNonce(o, i) : \"1.3.6.1.5.5.7.48.1.5\" == r ? a = this.getExtOcspNoCheck(o, i) : \"1.2.840.113583.1.1.9.1\" == r && (a = this.getExtAdobeTimeStamp(o, i)), null != a) return a;\n var c = {\n extname: r,\n extn: o\n };\n return i && (c.critical = !0), c;\n }, this.findExt = function (t, e) {\n for (var r = 0; r < t.length; r++) if (t[r].extname == e) return t[r];\n return null;\n }, this.updateExtCDPFullURI = function (t, e) {\n var r = this.findExt(t, \"cRLDistributionPoints\");\n if (null != r && null != r.array) for (var n = r.array, i = 0; i < n.length; i++) if (null != n[i].dpname && null != n[i].dpname.full) for (var o = n[i].dpname.full, s = 0; s < o.length; s++) {\n var a = o[i];\n null != a.uri && (a.uri = e);\n }\n }, this.updateExtAIAOCSP = function (t, e) {\n var r = this.findExt(t, \"authorityInfoAccess\");\n if (null != r && null != r.array) for (var n = r.array, i = 0; i < n.length; i++) null != n[i].ocsp && (n[i].ocsp = e);\n }, this.updateExtAIACAIssuer = function (t, e) {\n var r = this.findExt(t, \"authorityInfoAccess\");\n if (null != r && null != r.array) for (var n = r.array, i = 0; i < n.length; i++) null != n[i].caissuer && (n[i].caissuer = e);\n }, this.dnarraytostr = function (t) {\n return \"/\" + t.map(function (t) {\n return function e(t) {\n return t.map(function (t) {\n return function e(t) {\n return t.type + \"=\" + t.value;\n }(t);\n }).join(\"+\");\n }(t);\n }).join(\"/\");\n }, this.getInfo = function () {\n var t,\n e,\n r,\n n = function t(e) {\n return JSON.stringify(e.array).replace(/[\\[\\]\\{\\}\\\"]/g, \"\");\n },\n i = function t(e) {\n for (var r = \"\", n = e.array, i = 0; i < n.length; i++) {\n var o = n[i];\n if (r += \" policy oid: \" + o.policyoid + \"\\n\", void 0 !== o.array) for (var s = 0; s < o.array.length; s++) {\n var a = o.array[s];\n void 0 !== a.cps && (r += \" cps: \" + a.cps + \"\\n\");\n }\n }\n return r;\n },\n o = function t(e) {\n for (var r = \"\", n = e.array, i = 0; i < n.length; i++) {\n var o = n[i];\n try {\n void 0 !== o.dpname.full[0].uri && (r += \" \" + o.dpname.full[0].uri + \"\\n\");\n } catch (t) {}\n try {\n void 0 !== o.dname.full[0].dn.hex && (r += \" \" + on.hex2dn(o.dpname.full[0].dn.hex) + \"\\n\");\n } catch (t) {}\n }\n return r;\n },\n s = function t(e) {\n for (var r = \"\", n = e.array, i = 0; i < n.length; i++) {\n var o = n[i];\n void 0 !== o.caissuer && (r += \" caissuer: \" + o.caissuer + \"\\n\"), void 0 !== o.ocsp && (r += \" ocsp: \" + o.ocsp + \"\\n\");\n }\n return r;\n };\n if (t = \"Basic Fields\\n\", t += \" serial number: \" + this.getSerialNumberHex() + \"\\n\", t += \" signature algorithm: \" + this.getSignatureAlgorithmField() + \"\\n\", t += \" issuer: \" + this.getIssuerString() + \"\\n\", t += \" notBefore: \" + this.getNotBefore() + \"\\n\", t += \" notAfter: \" + this.getNotAfter() + \"\\n\", t += \" subject: \" + this.getSubjectString() + \"\\n\", t += \" subject public key info: \\n\", t += \" key algorithm: \" + (e = this.getPublicKey()).type + \"\\n\", \"RSA\" === e.type && (t += \" n=\" + $r(e.n.toString(16)).substr(0, 16) + \"...\\n\", t += \" e=\" + $r(e.e.toString(16)) + \"\\n\"), null != (r = this.aExtInfo)) {\n t += \"X509v3 Extensions:\\n\";\n for (var a = 0; a < r.length; a++) {\n var u = r[a],\n c = br.asn1.x509.OID.oid2name(u.oid);\n \"\" === c && (c = u.oid);\n var h = \"\";\n if (!0 === u.critical && (h = \"CRITICAL\"), t += \" \" + c + \" \" + h + \":\\n\", \"basicConstraints\" === c) {\n var l = this.getExtBasicConstraints();\n void 0 === l.cA ? t += \" {}\\n\" : (t += \" cA=true\", void 0 !== l.pathLen && (t += \", pathLen=\" + l.pathLen), t += \"\\n\");\n } else if (\"keyUsage\" === c) t += \" \" + this.getExtKeyUsageString() + \"\\n\";else if (\"subjectKeyIdentifier\" === c) t += \" \" + this.getExtSubjectKeyIdentifier().kid.hex + \"\\n\";else if (\"authorityKeyIdentifier\" === c) {\n var f = this.getExtAuthorityKeyIdentifier();\n void 0 !== f.kid && (t += \" kid=\" + f.kid.hex + \"\\n\");\n } else {\n if (\"extKeyUsage\" === c) t += \" \" + this.getExtExtKeyUsage().array.join(\", \") + \"\\n\";else if (\"subjectAltName\" === c) t += \" \" + n(this.getExtSubjectAltName()) + \"\\n\";else if (\"cRLDistributionPoints\" === c) t += o(this.getExtCRLDistributionPoints());else if (\"authorityInfoAccess\" === c) t += s(this.getExtAuthorityInfoAccess());else \"certificatePolicies\" === c && (t += i(this.getExtCertificatePolicies()));\n }\n }\n }\n return t += \"signature algorithm: \" + this.getSignatureAlgorithmName() + \"\\n\", t += \"signature: \" + this.getSignatureValueHex().substr(0, 16) + \"...\\n\";\n }, \"string\" == typeof t && (-1 != t.indexOf(\"-----BEGIN\") ? this.readCertPEM(t) : br.lang.String.isHex(t) && this.readCertHex(t));\n }\n He.prototype.sign = function (t, e) {\n var r = function t(r) {\n return br.crypto.Util.hashString(r, e);\n }(t);\n return this.signWithMessageHash(r, e);\n }, He.prototype.signWithMessageHash = function (t, e) {\n var r = je(br.crypto.Util.getPaddedDigestInfoHex(t, e, this.n.bitLength()), 16);\n return en(this.doPrivate(r).toString(16), this.n.bitLength());\n }, He.prototype.signPSS = function (t, e, r) {\n var n = function t(r) {\n return br.crypto.Util.hashHex(r, e);\n }(Ur(t));\n return void 0 === r && (r = -1), this.signWithMessageHashPSS(n, e, r);\n }, He.prototype.signWithMessageHashPSS = function (t, e, r) {\n var n,\n i = Nr(t),\n o = i.length,\n s = this.n.bitLength() - 1,\n a = Math.ceil(s / 8),\n u = function t(r) {\n return br.crypto.Util.hashHex(r, e);\n };\n if (-1 === r || void 0 === r) r = o;else if (-2 === r) r = a - o - 2;else if (r < -2) throw new Error(\"invalid salt length\");\n if (a < o + r + 2) throw new Error(\"data too long\");\n var c = \"\";\n r > 0 && (c = new Array(r), new Oe().nextBytes(c), c = String.fromCharCode.apply(String, c));\n var h = Nr(u(Ur(\"\\0\\0\\0\\0\\0\\0\\0\\0\" + i + c))),\n l = [];\n for (n = 0; n < a - r - o - 2; n += 1) l[n] = 0;\n var f = String.fromCharCode.apply(String, l) + \"\u0001\" + c,\n g = rn(h, f.length, u),\n d = [];\n for (n = 0; n < f.length; n += 1) d[n] = f.charCodeAt(n) ^ g.charCodeAt(n);\n var p = 65280 >> 8 * a - s & 255;\n for (d[0] &= ~p, n = 0; n < o; n++) d.push(h.charCodeAt(n));\n return d.push(188), en(this.doPrivate(new F(d)).toString(16), this.n.bitLength());\n }, He.prototype.verify = function (t, e) {\n var r = je(e = (e = e.replace(tn, \"\")).replace(/[ \\n]+/g, \"\"), 16);\n if (r.bitLength() > this.n.bitLength()) return 0;\n var n = nn(this.doPublic(r).toString(16).replace(/^1f+00/, \"\"));\n if (0 == n.length) return !1;\n var i = n[0];\n return n[1] == function t(e) {\n return br.crypto.Util.hashString(e, i);\n }(t);\n }, He.prototype.verifyWithMessageHash = function (t, e) {\n if (e.length != Math.ceil(this.n.bitLength() / 4)) return !1;\n var r = je(e, 16);\n if (r.bitLength() > this.n.bitLength()) return 0;\n var n = nn(this.doPublic(r).toString(16).replace(/^1f+00/, \"\"));\n if (0 == n.length) return !1;\n n[0];\n return n[1] == t;\n }, He.prototype.verifyPSS = function (t, e, r, n) {\n var i = function t(e) {\n return br.crypto.Util.hashHex(e, r);\n }(Ur(t));\n return void 0 === n && (n = -1), this.verifyWithMessageHashPSS(i, e, r, n);\n }, He.prototype.verifyWithMessageHashPSS = function (t, e, r, n) {\n if (e.length != Math.ceil(this.n.bitLength() / 4)) return !1;\n var i,\n o = new F(e, 16),\n s = function t(e) {\n return br.crypto.Util.hashHex(e, r);\n },\n a = Nr(t),\n u = a.length,\n c = this.n.bitLength() - 1,\n h = Math.ceil(c / 8);\n if (-1 === n || void 0 === n) n = u;else if (-2 === n) n = h - u - 2;else if (n < -2) throw new Error(\"invalid salt length\");\n if (h < u + n + 2) throw new Error(\"data too long\");\n var l = this.doPublic(o).toByteArray();\n for (i = 0; i < l.length; i += 1) l[i] &= 255;\n for (; l.length < h;) l.unshift(0);\n if (188 !== l[h - 1]) throw new Error(\"encoded message does not end in 0xbc\");\n var f = (l = String.fromCharCode.apply(String, l)).substr(0, h - u - 1),\n g = l.substr(f.length, u),\n d = 65280 >> 8 * h - c & 255;\n if (0 != (f.charCodeAt(0) & d)) throw new Error(\"bits beyond keysize not zero\");\n var p = rn(g, f.length, s),\n v = [];\n for (i = 0; i < f.length; i += 1) v[i] = f.charCodeAt(i) ^ p.charCodeAt(i);\n v[0] &= ~d;\n var y = h - u - n - 2;\n for (i = 0; i < y; i += 1) if (0 !== v[i]) throw new Error(\"leftmost octets not zero\");\n if (1 !== v[y]) throw new Error(\"0x01 marker not found\");\n return g === Nr(s(Ur(\"\\0\\0\\0\\0\\0\\0\\0\\0\" + a + String.fromCharCode.apply(String, v.slice(-n)))));\n }, He.SALT_LEN_HLEN = -1, He.SALT_LEN_MAX = -2, He.SALT_LEN_RECOVER = -2, on.hex2dn = function (t, e) {\n if (void 0 === e && (e = 0), \"30\" !== t.substr(e, 2)) throw new Error(\"malformed DN\");\n for (var r = new Array(), n = Er.getChildIdx(t, e), i = 0; i < n.length; i++) r.push(on.hex2rdn(t, n[i]));\n return \"/\" + (r = r.map(function (t) {\n return t.replace(\"/\", \"\\\\/\");\n })).join(\"/\");\n }, on.hex2rdn = function (t, e) {\n if (void 0 === e && (e = 0), \"31\" !== t.substr(e, 2)) throw new Error(\"malformed RDN\");\n for (var r = new Array(), n = Er.getChildIdx(t, e), i = 0; i < n.length; i++) r.push(on.hex2attrTypeValue(t, n[i]));\n return (r = r.map(function (t) {\n return t.replace(\"+\", \"\\\\+\");\n })).join(\"+\");\n }, on.hex2attrTypeValue = function (t, e) {\n var r = Er,\n n = r.getV;\n if (void 0 === e && (e = 0), \"30\" !== t.substr(e, 2)) throw new Error(\"malformed attribute type and value\");\n var i = r.getChildIdx(t, e);\n 2 !== i.length || t.substr(i[0], 2);\n var o = n(t, i[0]),\n s = br.asn1.ASN1Util.oidHexToInt(o);\n return br.asn1.x509.OID.oid2atype(s) + \"=\" + Nr(n(t, i[1]));\n }, on.getPublicKeyFromCertHex = function (t) {\n var e = new on();\n return e.readCertHex(t), e.getPublicKey();\n }, on.getPublicKeyFromCertPEM = function (t) {\n var e = new on();\n return e.readCertPEM(t), e.getPublicKey();\n }, on.getPublicKeyInfoPropOfCertPEM = function (t) {\n var e,\n r,\n n = Er.getVbyList,\n i = {};\n return i.algparam = null, (e = new on()).readCertPEM(t), r = e.getPublicKeyHex(), i.keyhex = n(r, 0, [1], \"03\").substr(2), i.algoid = n(r, 0, [0, 0], \"06\"), \"2a8648ce3d0201\" === i.algoid && (i.algparam = n(r, 0, [0, 1], \"06\")), i;\n }, on.KEYUSAGE_NAME = [\"digitalSignature\", \"nonRepudiation\", \"keyEncipherment\", \"dataEncipherment\", \"keyAgreement\", \"keyCertSign\", \"cRLSign\", \"encipherOnly\", \"decipherOnly\"], void 0 !== br && br || (e.KJUR = br = {}), void 0 !== br.jws && br.jws || (br.jws = {}), br.jws.JWS = function () {\n var t = br.jws.JWS.isSafeJSONString;\n this.parseJWS = function (e, r) {\n if (void 0 === this.parsedJWS || !r && void 0 === this.parsedJWS.sigvalH) {\n var n = e.match(/^([^.]+)\\.([^.]+)\\.([^.]+)$/);\n if (null == n) throw \"JWS signature is not a form of 'Head.Payload.SigValue'.\";\n var i = n[1],\n o = n[2],\n s = n[3],\n a = i + \".\" + o;\n if (this.parsedJWS = {}, this.parsedJWS.headB64U = i, this.parsedJWS.payloadB64U = o, this.parsedJWS.sigvalB64U = s, this.parsedJWS.si = a, !r) {\n var u = Ir(s),\n c = je(u, 16);\n this.parsedJWS.sigvalH = u, this.parsedJWS.sigvalBI = c;\n }\n var h = Fr(i),\n l = Fr(o);\n if (this.parsedJWS.headS = h, this.parsedJWS.payloadS = l, !t(h, this.parsedJWS, \"headP\")) throw \"malformed JSON string for JWS Head: \" + h;\n }\n };\n }, br.jws.JWS.sign = function (t, e, n, i, o) {\n var s,\n a,\n u,\n c = br,\n h = c.jws.JWS,\n l = h.readSafeJSONString,\n f = h.isSafeJSONString,\n g = c.crypto,\n d = (g.ECDSA, g.Mac),\n p = g.Signature,\n v = JSON;\n if (\"string\" != typeof e && \"object\" != (void 0 === e ? \"undefined\" : r(e))) throw \"spHeader must be JSON string or object: \" + e;\n if (\"object\" == (void 0 === e ? \"undefined\" : r(e)) && (a = e, s = v.stringify(a)), \"string\" == typeof e) {\n if (!f(s = e)) throw \"JWS Head is not safe JSON string: \" + s;\n a = l(s);\n }\n if (u = n, \"object\" == (void 0 === n ? \"undefined\" : r(n)) && (u = v.stringify(n)), \"\" != t && null != t || void 0 === a.alg || (t = a.alg), \"\" != t && null != t && void 0 === a.alg && (a.alg = t, s = v.stringify(a)), t !== a.alg) throw \"alg and sHeader.alg doesn't match: \" + t + \"!=\" + a.alg;\n var y = null;\n if (void 0 === h.jwsalg2sigalg[t]) throw \"unsupported alg name: \" + t;\n y = h.jwsalg2sigalg[t];\n var m = wr(s) + \".\" + wr(u),\n _ = \"\";\n if (\"Hmac\" == y.substr(0, 4)) {\n if (void 0 === i) throw \"mac key shall be specified for HS* alg\";\n var S = new d({\n alg: y,\n prov: \"cryptojs\",\n pass: i\n });\n S.updateString(m), _ = S.doFinal();\n } else if (-1 != y.indexOf(\"withECDSA\")) {\n (w = new p({\n alg: y\n })).init(i, o), w.updateString(m);\n var b = w.sign();\n _ = br.crypto.ECDSA.asn1SigToConcatSig(b);\n } else {\n var w;\n if (\"none\" != y) (w = new p({\n alg: y\n })).init(i, o), w.updateString(m), _ = w.sign();\n }\n return m + \".\" + Rr(_);\n }, br.jws.JWS.verify = function (t, e, n) {\n var i,\n o = br,\n s = o.jws.JWS,\n a = s.readSafeJSONString,\n u = o.crypto,\n c = u.ECDSA,\n h = u.Mac,\n l = u.Signature;\n void 0 !== r(He) && (i = He);\n var f = t.split(\".\");\n if (3 !== f.length) return !1;\n var g = f[0] + \".\" + f[1],\n d = Ir(f[2]),\n p = a(Fr(f[0])),\n v = null,\n y = null;\n if (void 0 === p.alg) throw \"algorithm not specified in header\";\n if ((y = (v = p.alg).substr(0, 2), null != n && \"[object Array]\" === Object.prototype.toString.call(n) && n.length > 0) && -1 == (\":\" + n.join(\":\") + \":\").indexOf(\":\" + v + \":\")) throw \"algorithm '\" + v + \"' not accepted in the list\";\n if (\"none\" != v && null === e) throw \"key shall be specified to verify.\";\n if (\"string\" == typeof e && -1 != e.indexOf(\"-----BEGIN \") && (e = Zr.getKey(e)), !(\"RS\" != y && \"PS\" != y || e instanceof i)) throw \"key shall be a RSAKey obj for RS* and PS* algs\";\n if (\"ES\" == y && !(e instanceof c)) throw \"key shall be a ECDSA obj for ES* algs\";\n var m = null;\n if (void 0 === s.jwsalg2sigalg[p.alg]) throw \"unsupported alg name: \" + v;\n if (\"none\" == (m = s.jwsalg2sigalg[v])) throw \"not supported\";\n if (\"Hmac\" == m.substr(0, 4)) {\n if (void 0 === e) throw \"hexadecimal key shall be specified for HMAC\";\n var _ = new h({\n alg: m,\n pass: e\n });\n return _.updateString(g), d == _.doFinal();\n }\n if (-1 != m.indexOf(\"withECDSA\")) {\n var S,\n b = null;\n try {\n b = c.concatSigToASN1Sig(d);\n } catch (t) {\n return !1;\n }\n return (S = new l({\n alg: m\n })).init(e), S.updateString(g), S.verify(b);\n }\n return (S = new l({\n alg: m\n })).init(e), S.updateString(g), S.verify(d);\n }, br.jws.JWS.parse = function (t) {\n var e,\n r,\n n,\n i = t.split(\".\"),\n o = {};\n if (2 != i.length && 3 != i.length) throw \"malformed sJWS: wrong number of '.' splitted elements\";\n return e = i[0], r = i[1], 3 == i.length && (n = i[2]), o.headerObj = br.jws.JWS.readSafeJSONString(Fr(e)), o.payloadObj = br.jws.JWS.readSafeJSONString(Fr(r)), o.headerPP = JSON.stringify(o.headerObj, null, \" \"), null == o.payloadObj ? o.payloadPP = Fr(r) : o.payloadPP = JSON.stringify(o.payloadObj, null, \" \"), void 0 !== n && (o.sigHex = Ir(n)), o;\n }, br.jws.JWS.verifyJWT = function (t, e, n) {\n var i = br.jws,\n o = i.JWS,\n s = o.readSafeJSONString,\n a = o.inArray,\n u = o.includedArray,\n c = t.split(\".\"),\n h = c[0],\n l = c[1],\n f = (Ir(c[2]), s(Fr(h))),\n g = s(Fr(l));\n if (void 0 === f.alg) return !1;\n if (void 0 === n.alg) throw \"acceptField.alg shall be specified\";\n if (!a(f.alg, n.alg)) return !1;\n if (void 0 !== g.iss && \"object\" === r(n.iss) && !a(g.iss, n.iss)) return !1;\n if (void 0 !== g.sub && \"object\" === r(n.sub) && !a(g.sub, n.sub)) return !1;\n if (void 0 !== g.aud && \"object\" === r(n.aud)) if (\"string\" == typeof g.aud) {\n if (!a(g.aud, n.aud)) return !1;\n } else if (\"object\" == r(g.aud) && !u(g.aud, n.aud)) return !1;\n var d = i.IntDate.getNow();\n return void 0 !== n.verifyAt && \"number\" == typeof n.verifyAt && (d = n.verifyAt), void 0 !== n.gracePeriod && \"number\" == typeof n.gracePeriod || (n.gracePeriod = 0), !(void 0 !== g.exp && \"number\" == typeof g.exp && g.exp + n.gracePeriod < d) && !(void 0 !== g.nbf && \"number\" == typeof g.nbf && d < g.nbf - n.gracePeriod) && !(void 0 !== g.iat && \"number\" == typeof g.iat && d < g.iat - n.gracePeriod) && (void 0 === g.jti || void 0 === n.jti || g.jti === n.jti) && !!o.verify(t, e, n.alg);\n }, br.jws.JWS.includedArray = function (t, e) {\n var n = br.jws.JWS.inArray;\n if (null === t) return !1;\n if (\"object\" !== (void 0 === t ? \"undefined\" : r(t))) return !1;\n if (\"number\" != typeof t.length) return !1;\n for (var i = 0; i < t.length; i++) if (!n(t[i], e)) return !1;\n return !0;\n }, br.jws.JWS.inArray = function (t, e) {\n if (null === e) return !1;\n if (\"object\" !== (void 0 === e ? \"undefined\" : r(e))) return !1;\n if (\"number\" != typeof e.length) return !1;\n for (var n = 0; n < e.length; n++) if (e[n] == t) return !0;\n return !1;\n }, br.jws.JWS.jwsalg2sigalg = {\n HS256: \"HmacSHA256\",\n HS384: \"HmacSHA384\",\n HS512: \"HmacSHA512\",\n RS256: \"SHA256withRSA\",\n RS384: \"SHA384withRSA\",\n RS512: \"SHA512withRSA\",\n ES256: \"SHA256withECDSA\",\n ES384: \"SHA384withECDSA\",\n PS256: \"SHA256withRSAandMGF1\",\n PS384: \"SHA384withRSAandMGF1\",\n PS512: \"SHA512withRSAandMGF1\",\n none: \"none\"\n }, br.jws.JWS.isSafeJSONString = function (t, e, n) {\n var i = null;\n try {\n return \"object\" != (void 0 === (i = Sr(t)) ? \"undefined\" : r(i)) || i.constructor === Array ? 0 : (e && (e[n] = i), 1);\n } catch (t) {\n return 0;\n }\n }, br.jws.JWS.readSafeJSONString = function (t) {\n var e = null;\n try {\n return \"object\" != (void 0 === (e = Sr(t)) ? \"undefined\" : r(e)) || e.constructor === Array ? null : e;\n } catch (t) {\n return null;\n }\n }, br.jws.JWS.getEncodedSignatureValueFromJWS = function (t) {\n var e = t.match(/^[^.]+\\.[^.]+\\.([^.]+)$/);\n if (null == e) throw \"JWS signature is not a form of 'Head.Payload.SigValue'.\";\n return e[1];\n }, br.jws.JWS.getJWKthumbprint = function (t) {\n if (\"RSA\" !== t.kty && \"EC\" !== t.kty && \"oct\" !== t.kty) throw \"unsupported algorithm for JWK Thumprint\";\n var e = \"{\";\n if (\"RSA\" === t.kty) {\n if (\"string\" != typeof t.n || \"string\" != typeof t.e) throw \"wrong n and e value for RSA key\";\n e += '\"e\":\"' + t.e + '\",', e += '\"kty\":\"' + t.kty + '\",', e += '\"n\":\"' + t.n + '\"}';\n } else if (\"EC\" === t.kty) {\n if (\"string\" != typeof t.crv || \"string\" != typeof t.x || \"string\" != typeof t.y) throw \"wrong crv, x and y value for EC key\";\n e += '\"crv\":\"' + t.crv + '\",', e += '\"kty\":\"' + t.kty + '\",', e += '\"x\":\"' + t.x + '\",', e += '\"y\":\"' + t.y + '\"}';\n } else if (\"oct\" === t.kty) {\n if (\"string\" != typeof t.k) throw \"wrong k value for oct(symmetric) key\";\n e += '\"kty\":\"' + t.kty + '\",', e += '\"k\":\"' + t.k + '\"}';\n }\n var r = Ur(e);\n return Rr(br.crypto.Util.hashHex(r, \"sha256\"));\n }, br.jws.IntDate = {}, br.jws.IntDate.get = function (t) {\n var e = br.jws.IntDate,\n r = e.getNow,\n n = e.getZulu;\n if (\"now\" == t) return r();\n if (\"now + 1hour\" == t) return r() + 3600;\n if (\"now + 1day\" == t) return r() + 86400;\n if (\"now + 1month\" == t) return r() + 2592e3;\n if (\"now + 1year\" == t) return r() + 31536e3;\n if (t.match(/Z$/)) return n(t);\n if (t.match(/^[0-9]+$/)) return parseInt(t);\n throw \"unsupported format: \" + t;\n }, br.jws.IntDate.getZulu = function (t) {\n return Kr(t);\n }, br.jws.IntDate.getNow = function () {\n return ~~(new Date() / 1e3);\n }, br.jws.IntDate.intDate2UTCString = function (t) {\n return new Date(1e3 * t).toUTCString();\n }, br.jws.IntDate.intDate2Zulu = function (t) {\n var e = new Date(1e3 * t);\n return (\"0000\" + e.getUTCFullYear()).slice(-4) + (\"00\" + (e.getUTCMonth() + 1)).slice(-2) + (\"00\" + e.getUTCDate()).slice(-2) + (\"00\" + e.getUTCHours()).slice(-2) + (\"00\" + e.getUTCMinutes()).slice(-2) + (\"00\" + e.getUTCSeconds()).slice(-2) + \"Z\";\n }, e.SecureRandom = Oe, e.rng_seed_time = Ie, e.BigInteger = F, e.RSAKey = He;\n var sn = br.crypto.EDSA;\n e.EDSA = sn;\n var an = br.crypto.DSA;\n e.DSA = an;\n var un = br.crypto.Signature;\n e.Signature = un;\n var cn = br.crypto.MessageDigest;\n e.MessageDigest = cn;\n var hn = br.crypto.Mac;\n e.Mac = hn;\n var ln = br.crypto.Cipher;\n e.Cipher = ln, e.KEYUTIL = Zr, e.ASN1HEX = Er, e.X509 = on, e.CryptoJS = y, e.b64tohex = b, e.b64toBA = w, e.stoBA = xr, e.BAtos = Ar, e.BAtohex = kr, e.stohex = Pr, e.stob64 = function fn(t) {\n return S(Pr(t));\n }, e.stob64u = function gn(t) {\n return Cr(S(Pr(t)));\n }, e.b64utos = function dn(t) {\n return Ar(w(Tr(t)));\n }, e.b64tob64u = Cr, e.b64utob64 = Tr, e.hex2b64 = S, e.hextob64u = Rr, e.b64utohex = Ir, e.utf8tob64u = wr, e.b64utoutf8 = Fr, e.utf8tob64 = function pn(t) {\n return S(qr(Gr(t)));\n }, e.b64toutf8 = function vn(t) {\n return decodeURIComponent(Jr(b(t)));\n }, e.utf8tohex = Dr, e.hextoutf8 = Lr, e.hextorstr = Nr, e.rstrtohex = Ur, e.hextob64 = Br, e.hextob64nl = Or, e.b64nltohex = jr, e.hextopem = Mr, e.pemtohex = Hr, e.hextoArrayBuffer = function yn(t) {\n if (t.length % 2 != 0) throw \"input is not even length\";\n if (null == t.match(/^[0-9A-Fa-f]+$/)) throw \"input is not hexadecimal\";\n for (var e = new ArrayBuffer(t.length / 2), r = new DataView(e), n = 0; n < t.length / 2; n++) r.setUint8(n, parseInt(t.substr(2 * n, 2), 16));\n return e;\n }, e.ArrayBuffertohex = function mn(t) {\n for (var e = \"\", r = new DataView(t), n = 0; n < t.byteLength; n++) e += (\"00\" + r.getUint8(n).toString(16)).slice(-2);\n return e;\n }, e.zulutomsec = Vr, e.zulutosec = Kr, e.zulutodate = function _n(t) {\n return new Date(Vr(t));\n }, e.datetozulu = function Sn(t, e, r) {\n var n,\n i = t.getUTCFullYear();\n if (e) {\n if (i < 1950 || 2049 < i) throw \"not proper year for UTCTime: \" + i;\n n = (\"\" + i).slice(-2);\n } else n = (\"000\" + i).slice(-4);\n if (n += (\"0\" + (t.getUTCMonth() + 1)).slice(-2), n += (\"0\" + t.getUTCDate()).slice(-2), n += (\"0\" + t.getUTCHours()).slice(-2), n += (\"0\" + t.getUTCMinutes()).slice(-2), n += (\"0\" + t.getUTCSeconds()).slice(-2), r) {\n var o = t.getUTCMilliseconds();\n 0 !== o && (n += \".\" + (o = (o = (\"00\" + o).slice(-3)).replace(/0+$/g, \"\")));\n }\n return n += \"Z\";\n }, e.uricmptohex = qr, e.hextouricmp = Jr, e.ipv6tohex = Wr, e.hextoipv6 = zr, e.hextoip = Yr, e.iptohex = function bn(t) {\n var e = \"malformed IP address\";\n if (!(t = t.toLowerCase(t)).match(/^[0-9.]+$/)) {\n if (t.match(/^[0-9a-f:]+$/) && -1 !== t.indexOf(\":\")) return Wr(t);\n throw e;\n }\n var r = t.split(\".\");\n if (4 !== r.length) throw e;\n var n = \"\";\n try {\n for (var i = 0; i < 4; i++) {\n n += (\"0\" + parseInt(r[i]).toString(16)).slice(-2);\n }\n return n;\n } catch (t) {\n throw e;\n }\n }, e.encodeURIComponentAll = Gr, e.newline_toUnix = function wn(t) {\n return t = t.replace(/\\r\\n/gm, \"\\n\");\n }, e.newline_toDos = function Fn(t) {\n return t = (t = t.replace(/\\r\\n/gm, \"\\n\")).replace(/\\n/gm, \"\\r\\n\");\n }, e.hextoposhex = $r, e.intarystrtohex = function En(t) {\n t = (t = (t = t.replace(/^\\s*\\[\\s*/, \"\")).replace(/\\s*\\]\\s*$/, \"\")).replace(/\\s*/g, \"\");\n try {\n return t.split(/,/).map(function (t, e, r) {\n var n = parseInt(t);\n if (n < 0 || 255 < n) throw \"integer not in range 0-255\";\n return (\"00\" + n.toString(16)).slice(-2);\n }).join(\"\");\n } catch (t) {\n throw \"malformed integer array string: \" + t;\n }\n }, e.strdiffidx = function t(e, r) {\n var n = e.length;\n e.length > r.length && (n = r.length);\n for (var i = 0; i < n; i++) if (e.charCodeAt(i) != r.charCodeAt(i)) return i;\n return e.length != r.length ? n : -1;\n }, e.KJUR = br;\n var xn = br.crypto;\n e.crypto = xn;\n var An = br.asn1;\n e.asn1 = An;\n var kn = br.jws;\n e.jws = kn;\n var Pn = br.lang;\n e.lang = Pn;\n }).call(this, r(28).Buffer);\n }, function (t, e, r) {\n \"use strict\";\n\n (function (t) {\n /*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n var n = r(30),\n i = r(31),\n o = r(32);\n function s() {\n return u.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;\n }\n function a(t, e) {\n if (s() < e) throw new RangeError(\"Invalid typed array length\");\n return u.TYPED_ARRAY_SUPPORT ? (t = new Uint8Array(e)).__proto__ = u.prototype : (null === t && (t = new u(e)), t.length = e), t;\n }\n function u(t, e, r) {\n if (!(u.TYPED_ARRAY_SUPPORT || this instanceof u)) return new u(t, e, r);\n if (\"number\" == typeof t) {\n if (\"string\" == typeof e) throw new Error(\"If encoding is specified then the first argument must be a string\");\n return l(this, t);\n }\n return c(this, t, e, r);\n }\n function c(t, e, r, n) {\n if (\"number\" == typeof e) throw new TypeError('\"value\" argument must not be a number');\n return \"undefined\" != typeof ArrayBuffer && e instanceof ArrayBuffer ? function i(t, e, r, n) {\n if (e.byteLength, r < 0 || e.byteLength < r) throw new RangeError(\"'offset' is out of bounds\");\n if (e.byteLength < r + (n || 0)) throw new RangeError(\"'length' is out of bounds\");\n e = void 0 === r && void 0 === n ? new Uint8Array(e) : void 0 === n ? new Uint8Array(e, r) : new Uint8Array(e, r, n);\n u.TYPED_ARRAY_SUPPORT ? (t = e).__proto__ = u.prototype : t = f(t, e);\n return t;\n }(t, e, r, n) : \"string\" == typeof e ? function s(t, e, r) {\n \"string\" == typeof r && \"\" !== r || (r = \"utf8\");\n if (!u.isEncoding(r)) throw new TypeError('\"encoding\" must be a valid string encoding');\n var n = 0 | d(e, r),\n i = (t = a(t, n)).write(e, r);\n i !== n && (t = t.slice(0, i));\n return t;\n }(t, e, r) : function c(t, e) {\n if (u.isBuffer(e)) {\n var r = 0 | g(e.length);\n return 0 === (t = a(t, r)).length || e.copy(t, 0, 0, r), t;\n }\n if (e) {\n if (\"undefined\" != typeof ArrayBuffer && e.buffer instanceof ArrayBuffer || \"length\" in e) return \"number\" != typeof e.length || function n(t) {\n return t != t;\n }(e.length) ? a(t, 0) : f(t, e);\n if (\"Buffer\" === e.type && o(e.data)) return f(t, e.data);\n }\n throw new TypeError(\"First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.\");\n }(t, e);\n }\n function h(t) {\n if (\"number\" != typeof t) throw new TypeError('\"size\" argument must be a number');\n if (t < 0) throw new RangeError('\"size\" argument must not be negative');\n }\n function l(t, e) {\n if (h(e), t = a(t, e < 0 ? 0 : 0 | g(e)), !u.TYPED_ARRAY_SUPPORT) for (var r = 0; r < e; ++r) t[r] = 0;\n return t;\n }\n function f(t, e) {\n var r = e.length < 0 ? 0 : 0 | g(e.length);\n t = a(t, r);\n for (var n = 0; n < r; n += 1) t[n] = 255 & e[n];\n return t;\n }\n function g(t) {\n if (t >= s()) throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\" + s().toString(16) + \" bytes\");\n return 0 | t;\n }\n function d(t, e) {\n if (u.isBuffer(t)) return t.length;\n if (\"undefined\" != typeof ArrayBuffer && \"function\" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(t) || t instanceof ArrayBuffer)) return t.byteLength;\n \"string\" != typeof t && (t = \"\" + t);\n var r = t.length;\n if (0 === r) return 0;\n for (var n = !1;;) switch (e) {\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n return r;\n case \"utf8\":\n case \"utf-8\":\n case void 0:\n return K(t).length;\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return 2 * r;\n case \"hex\":\n return r >>> 1;\n case \"base64\":\n return q(t).length;\n default:\n if (n) return K(t).length;\n e = (\"\" + e).toLowerCase(), n = !0;\n }\n }\n function p(t, e, r) {\n var n = !1;\n if ((void 0 === e || e < 0) && (e = 0), e > this.length) return \"\";\n if ((void 0 === r || r > this.length) && (r = this.length), r <= 0) return \"\";\n if ((r >>>= 0) <= (e >>>= 0)) return \"\";\n for (t || (t = \"utf8\");;) switch (t) {\n case \"hex\":\n return I(this, e, r);\n case \"utf8\":\n case \"utf-8\":\n return A(this, e, r);\n case \"ascii\":\n return T(this, e, r);\n case \"latin1\":\n case \"binary\":\n return R(this, e, r);\n case \"base64\":\n return x(this, e, r);\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return D(this, e, r);\n default:\n if (n) throw new TypeError(\"Unknown encoding: \" + t);\n t = (t + \"\").toLowerCase(), n = !0;\n }\n }\n function v(t, e, r) {\n var n = t[e];\n t[e] = t[r], t[r] = n;\n }\n function y(t, e, r, n, i) {\n if (0 === t.length) return -1;\n if (\"string\" == typeof r ? (n = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, isNaN(r) && (r = i ? 0 : t.length - 1), r < 0 && (r = t.length + r), r >= t.length) {\n if (i) return -1;\n r = t.length - 1;\n } else if (r < 0) {\n if (!i) return -1;\n r = 0;\n }\n if (\"string\" == typeof e && (e = u.from(e, n)), u.isBuffer(e)) return 0 === e.length ? -1 : m(t, e, r, n, i);\n if (\"number\" == typeof e) return e &= 255, u.TYPED_ARRAY_SUPPORT && \"function\" == typeof Uint8Array.prototype.indexOf ? i ? Uint8Array.prototype.indexOf.call(t, e, r) : Uint8Array.prototype.lastIndexOf.call(t, e, r) : m(t, [e], r, n, i);\n throw new TypeError(\"val must be string, number or Buffer\");\n }\n function m(t, e, r, n, i) {\n var o,\n s = 1,\n a = t.length,\n u = e.length;\n if (void 0 !== n && (\"ucs2\" === (n = String(n).toLowerCase()) || \"ucs-2\" === n || \"utf16le\" === n || \"utf-16le\" === n)) {\n if (t.length < 2 || e.length < 2) return -1;\n s = 2, a /= 2, u /= 2, r /= 2;\n }\n function c(t, e) {\n return 1 === s ? t[e] : t.readUInt16BE(e * s);\n }\n if (i) {\n var h = -1;\n for (o = r; o < a; o++) if (c(t, o) === c(e, -1 === h ? 0 : o - h)) {\n if (-1 === h && (h = o), o - h + 1 === u) return h * s;\n } else -1 !== h && (o -= o - h), h = -1;\n } else for (r + u > a && (r = a - u), o = r; o >= 0; o--) {\n for (var l = !0, f = 0; f < u; f++) if (c(t, o + f) !== c(e, f)) {\n l = !1;\n break;\n }\n if (l) return o;\n }\n return -1;\n }\n function _(t, e, r, n) {\n r = Number(r) || 0;\n var i = t.length - r;\n n ? (n = Number(n)) > i && (n = i) : n = i;\n var o = e.length;\n if (o % 2 != 0) throw new TypeError(\"Invalid hex string\");\n n > o / 2 && (n = o / 2);\n for (var s = 0; s < n; ++s) {\n var a = parseInt(e.substr(2 * s, 2), 16);\n if (isNaN(a)) return s;\n t[r + s] = a;\n }\n return s;\n }\n function S(t, e, r, n) {\n return J(K(e, t.length - r), t, r, n);\n }\n function b(t, e, r, n) {\n return J(function i(t) {\n for (var e = [], r = 0; r < t.length; ++r) e.push(255 & t.charCodeAt(r));\n return e;\n }(e), t, r, n);\n }\n function w(t, e, r, n) {\n return b(t, e, r, n);\n }\n function F(t, e, r, n) {\n return J(q(e), t, r, n);\n }\n function E(t, e, r, n) {\n return J(function i(t, e) {\n for (var r, n, i, o = [], s = 0; s < t.length && !((e -= 2) < 0); ++s) n = (r = t.charCodeAt(s)) >> 8, i = r % 256, o.push(i), o.push(n);\n return o;\n }(e, t.length - r), t, r, n);\n }\n function x(t, e, r) {\n return 0 === e && r === t.length ? n.fromByteArray(t) : n.fromByteArray(t.slice(e, r));\n }\n function A(t, e, r) {\n r = Math.min(t.length, r);\n for (var n = [], i = e; i < r;) {\n var o,\n s,\n a,\n u,\n c = t[i],\n h = null,\n l = c > 239 ? 4 : c > 223 ? 3 : c > 191 ? 2 : 1;\n if (i + l <= r) switch (l) {\n case 1:\n c < 128 && (h = c);\n break;\n case 2:\n 128 == (192 & (o = t[i + 1])) && (u = (31 & c) << 6 | 63 & o) > 127 && (h = u);\n break;\n case 3:\n o = t[i + 1], s = t[i + 2], 128 == (192 & o) && 128 == (192 & s) && (u = (15 & c) << 12 | (63 & o) << 6 | 63 & s) > 2047 && (u < 55296 || u > 57343) && (h = u);\n break;\n case 4:\n o = t[i + 1], s = t[i + 2], a = t[i + 3], 128 == (192 & o) && 128 == (192 & s) && 128 == (192 & a) && (u = (15 & c) << 18 | (63 & o) << 12 | (63 & s) << 6 | 63 & a) > 65535 && u < 1114112 && (h = u);\n }\n null === h ? (h = 65533, l = 1) : h > 65535 && (h -= 65536, n.push(h >>> 10 & 1023 | 55296), h = 56320 | 1023 & h), n.push(h), i += l;\n }\n return function f(t) {\n var e = t.length;\n if (e <= C) return String.fromCharCode.apply(String, t);\n var r = \"\",\n n = 0;\n for (; n < e;) r += String.fromCharCode.apply(String, t.slice(n, n += C));\n return r;\n }(n);\n }\n e.Buffer = u, e.SlowBuffer = function k(t) {\n +t != t && (t = 0);\n return u.alloc(+t);\n }, e.INSPECT_MAX_BYTES = 50, u.TYPED_ARRAY_SUPPORT = void 0 !== t.TYPED_ARRAY_SUPPORT ? t.TYPED_ARRAY_SUPPORT : function P() {\n try {\n var t = new Uint8Array(1);\n return t.__proto__ = {\n __proto__: Uint8Array.prototype,\n foo: function () {\n return 42;\n }\n }, 42 === t.foo() && \"function\" == typeof t.subarray && 0 === t.subarray(1, 1).byteLength;\n } catch (t) {\n return !1;\n }\n }(), e.kMaxLength = s(), u.poolSize = 8192, u._augment = function (t) {\n return t.__proto__ = u.prototype, t;\n }, u.from = function (t, e, r) {\n return c(null, t, e, r);\n }, u.TYPED_ARRAY_SUPPORT && (u.prototype.__proto__ = Uint8Array.prototype, u.__proto__ = Uint8Array, \"undefined\" != typeof Symbol && Symbol.species && u[Symbol.species] === u && Object.defineProperty(u, Symbol.species, {\n value: null,\n configurable: !0\n })), u.alloc = function (t, e, r) {\n return function n(t, e, r, i) {\n return h(e), e <= 0 ? a(t, e) : void 0 !== r ? \"string\" == typeof i ? a(t, e).fill(r, i) : a(t, e).fill(r) : a(t, e);\n }(null, t, e, r);\n }, u.allocUnsafe = function (t) {\n return l(null, t);\n }, u.allocUnsafeSlow = function (t) {\n return l(null, t);\n }, u.isBuffer = function t(e) {\n return !(null == e || !e._isBuffer);\n }, u.compare = function t(e, r) {\n if (!u.isBuffer(e) || !u.isBuffer(r)) throw new TypeError(\"Arguments must be Buffers\");\n if (e === r) return 0;\n for (var n = e.length, i = r.length, o = 0, s = Math.min(n, i); o < s; ++o) if (e[o] !== r[o]) {\n n = e[o], i = r[o];\n break;\n }\n return n < i ? -1 : i < n ? 1 : 0;\n }, u.isEncoding = function t(e) {\n switch (String(e).toLowerCase()) {\n case \"hex\":\n case \"utf8\":\n case \"utf-8\":\n case \"ascii\":\n case \"latin1\":\n case \"binary\":\n case \"base64\":\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return !0;\n default:\n return !1;\n }\n }, u.concat = function t(e, r) {\n if (!o(e)) throw new TypeError('\"list\" argument must be an Array of Buffers');\n if (0 === e.length) return u.alloc(0);\n var n;\n if (void 0 === r) for (r = 0, n = 0; n < e.length; ++n) r += e[n].length;\n var i = u.allocUnsafe(r),\n s = 0;\n for (n = 0; n < e.length; ++n) {\n var a = e[n];\n if (!u.isBuffer(a)) throw new TypeError('\"list\" argument must be an Array of Buffers');\n a.copy(i, s), s += a.length;\n }\n return i;\n }, u.byteLength = d, u.prototype._isBuffer = !0, u.prototype.swap16 = function t() {\n var e = this.length;\n if (e % 2 != 0) throw new RangeError(\"Buffer size must be a multiple of 16-bits\");\n for (var r = 0; r < e; r += 2) v(this, r, r + 1);\n return this;\n }, u.prototype.swap32 = function t() {\n var e = this.length;\n if (e % 4 != 0) throw new RangeError(\"Buffer size must be a multiple of 32-bits\");\n for (var r = 0; r < e; r += 4) v(this, r, r + 3), v(this, r + 1, r + 2);\n return this;\n }, u.prototype.swap64 = function t() {\n var e = this.length;\n if (e % 8 != 0) throw new RangeError(\"Buffer size must be a multiple of 64-bits\");\n for (var r = 0; r < e; r += 8) v(this, r, r + 7), v(this, r + 1, r + 6), v(this, r + 2, r + 5), v(this, r + 3, r + 4);\n return this;\n }, u.prototype.toString = function t() {\n var e = 0 | this.length;\n return 0 === e ? \"\" : 0 === arguments.length ? A(this, 0, e) : p.apply(this, arguments);\n }, u.prototype.equals = function t(e) {\n if (!u.isBuffer(e)) throw new TypeError(\"Argument must be a Buffer\");\n return this === e || 0 === u.compare(this, e);\n }, u.prototype.inspect = function t() {\n var r = \"\",\n n = e.INSPECT_MAX_BYTES;\n return this.length > 0 && (r = this.toString(\"hex\", 0, n).match(/.{2}/g).join(\" \"), this.length > n && (r += \" ... \")), \"\";\n }, u.prototype.compare = function t(e, r, n, i, o) {\n if (!u.isBuffer(e)) throw new TypeError(\"Argument must be a Buffer\");\n if (void 0 === r && (r = 0), void 0 === n && (n = e ? e.length : 0), void 0 === i && (i = 0), void 0 === o && (o = this.length), r < 0 || n > e.length || i < 0 || o > this.length) throw new RangeError(\"out of range index\");\n if (i >= o && r >= n) return 0;\n if (i >= o) return -1;\n if (r >= n) return 1;\n if (this === e) return 0;\n for (var s = (o >>>= 0) - (i >>>= 0), a = (n >>>= 0) - (r >>>= 0), c = Math.min(s, a), h = this.slice(i, o), l = e.slice(r, n), f = 0; f < c; ++f) if (h[f] !== l[f]) {\n s = h[f], a = l[f];\n break;\n }\n return s < a ? -1 : a < s ? 1 : 0;\n }, u.prototype.includes = function t(e, r, n) {\n return -1 !== this.indexOf(e, r, n);\n }, u.prototype.indexOf = function t(e, r, n) {\n return y(this, e, r, n, !0);\n }, u.prototype.lastIndexOf = function t(e, r, n) {\n return y(this, e, r, n, !1);\n }, u.prototype.write = function t(e, r, n, i) {\n if (void 0 === r) i = \"utf8\", n = this.length, r = 0;else if (void 0 === n && \"string\" == typeof r) i = r, n = this.length, r = 0;else {\n if (!isFinite(r)) throw new Error(\"Buffer.write(string, encoding, offset[, length]) is no longer supported\");\n r |= 0, isFinite(n) ? (n |= 0, void 0 === i && (i = \"utf8\")) : (i = n, n = void 0);\n }\n var o = this.length - r;\n if ((void 0 === n || n > o) && (n = o), e.length > 0 && (n < 0 || r < 0) || r > this.length) throw new RangeError(\"Attempt to write outside buffer bounds\");\n i || (i = \"utf8\");\n for (var s = !1;;) switch (i) {\n case \"hex\":\n return _(this, e, r, n);\n case \"utf8\":\n case \"utf-8\":\n return S(this, e, r, n);\n case \"ascii\":\n return b(this, e, r, n);\n case \"latin1\":\n case \"binary\":\n return w(this, e, r, n);\n case \"base64\":\n return F(this, e, r, n);\n case \"ucs2\":\n case \"ucs-2\":\n case \"utf16le\":\n case \"utf-16le\":\n return E(this, e, r, n);\n default:\n if (s) throw new TypeError(\"Unknown encoding: \" + i);\n i = (\"\" + i).toLowerCase(), s = !0;\n }\n }, u.prototype.toJSON = function t() {\n return {\n type: \"Buffer\",\n data: Array.prototype.slice.call(this._arr || this, 0)\n };\n };\n var C = 4096;\n function T(t, e, r) {\n var n = \"\";\n r = Math.min(t.length, r);\n for (var i = e; i < r; ++i) n += String.fromCharCode(127 & t[i]);\n return n;\n }\n function R(t, e, r) {\n var n = \"\";\n r = Math.min(t.length, r);\n for (var i = e; i < r; ++i) n += String.fromCharCode(t[i]);\n return n;\n }\n function I(t, e, r) {\n var n = t.length;\n (!e || e < 0) && (e = 0), (!r || r < 0 || r > n) && (r = n);\n for (var i = \"\", o = e; o < r; ++o) i += V(t[o]);\n return i;\n }\n function D(t, e, r) {\n for (var n = t.slice(e, r), i = \"\", o = 0; o < n.length; o += 2) i += String.fromCharCode(n[o] + 256 * n[o + 1]);\n return i;\n }\n function L(t, e, r) {\n if (t % 1 != 0 || t < 0) throw new RangeError(\"offset is not uint\");\n if (t + e > r) throw new RangeError(\"Trying to access beyond buffer length\");\n }\n function N(t, e, r, n, i, o) {\n if (!u.isBuffer(t)) throw new TypeError('\"buffer\" argument must be a Buffer instance');\n if (e > i || e < o) throw new RangeError('\"value\" argument is out of bounds');\n if (r + n > t.length) throw new RangeError(\"Index out of range\");\n }\n function U(t, e, r, n) {\n e < 0 && (e = 65535 + e + 1);\n for (var i = 0, o = Math.min(t.length - r, 2); i < o; ++i) t[r + i] = (e & 255 << 8 * (n ? i : 1 - i)) >>> 8 * (n ? i : 1 - i);\n }\n function B(t, e, r, n) {\n e < 0 && (e = 4294967295 + e + 1);\n for (var i = 0, o = Math.min(t.length - r, 4); i < o; ++i) t[r + i] = e >>> 8 * (n ? i : 3 - i) & 255;\n }\n function O(t, e, r, n, i, o) {\n if (r + n > t.length) throw new RangeError(\"Index out of range\");\n if (r < 0) throw new RangeError(\"Index out of range\");\n }\n function j(t, e, r, n, o) {\n return o || O(t, 0, r, 4), i.write(t, e, r, n, 23, 4), r + 4;\n }\n function M(t, e, r, n, o) {\n return o || O(t, 0, r, 8), i.write(t, e, r, n, 52, 8), r + 8;\n }\n u.prototype.slice = function t(e, r) {\n var n,\n i = this.length;\n if ((e = ~~e) < 0 ? (e += i) < 0 && (e = 0) : e > i && (e = i), (r = void 0 === r ? i : ~~r) < 0 ? (r += i) < 0 && (r = 0) : r > i && (r = i), r < e && (r = e), u.TYPED_ARRAY_SUPPORT) (n = this.subarray(e, r)).__proto__ = u.prototype;else {\n var o = r - e;\n n = new u(o, void 0);\n for (var s = 0; s < o; ++s) n[s] = this[s + e];\n }\n return n;\n }, u.prototype.readUIntLE = function t(e, r, n) {\n e |= 0, r |= 0, n || L(e, r, this.length);\n for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256);) i += this[e + s] * o;\n return i;\n }, u.prototype.readUIntBE = function t(e, r, n) {\n e |= 0, r |= 0, n || L(e, r, this.length);\n for (var i = this[e + --r], o = 1; r > 0 && (o *= 256);) i += this[e + --r] * o;\n return i;\n }, u.prototype.readUInt8 = function t(e, r) {\n return r || L(e, 1, this.length), this[e];\n }, u.prototype.readUInt16LE = function t(e, r) {\n return r || L(e, 2, this.length), this[e] | this[e + 1] << 8;\n }, u.prototype.readUInt16BE = function t(e, r) {\n return r || L(e, 2, this.length), this[e] << 8 | this[e + 1];\n }, u.prototype.readUInt32LE = function t(e, r) {\n return r || L(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3];\n }, u.prototype.readUInt32BE = function t(e, r) {\n return r || L(e, 4, this.length), 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);\n }, u.prototype.readIntLE = function t(e, r, n) {\n e |= 0, r |= 0, n || L(e, r, this.length);\n for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256);) i += this[e + s] * o;\n return i >= (o *= 128) && (i -= Math.pow(2, 8 * r)), i;\n }, u.prototype.readIntBE = function t(e, r, n) {\n e |= 0, r |= 0, n || L(e, r, this.length);\n for (var i = r, o = 1, s = this[e + --i]; i > 0 && (o *= 256);) s += this[e + --i] * o;\n return s >= (o *= 128) && (s -= Math.pow(2, 8 * r)), s;\n }, u.prototype.readInt8 = function t(e, r) {\n return r || L(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e];\n }, u.prototype.readInt16LE = function t(e, r) {\n r || L(e, 2, this.length);\n var n = this[e] | this[e + 1] << 8;\n return 32768 & n ? 4294901760 | n : n;\n }, u.prototype.readInt16BE = function t(e, r) {\n r || L(e, 2, this.length);\n var n = this[e + 1] | this[e] << 8;\n return 32768 & n ? 4294901760 | n : n;\n }, u.prototype.readInt32LE = function t(e, r) {\n return r || L(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;\n }, u.prototype.readInt32BE = function t(e, r) {\n return r || L(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];\n }, u.prototype.readFloatLE = function t(e, r) {\n return r || L(e, 4, this.length), i.read(this, e, !0, 23, 4);\n }, u.prototype.readFloatBE = function t(e, r) {\n return r || L(e, 4, this.length), i.read(this, e, !1, 23, 4);\n }, u.prototype.readDoubleLE = function t(e, r) {\n return r || L(e, 8, this.length), i.read(this, e, !0, 52, 8);\n }, u.prototype.readDoubleBE = function t(e, r) {\n return r || L(e, 8, this.length), i.read(this, e, !1, 52, 8);\n }, u.prototype.writeUIntLE = function t(e, r, n, i) {\n (e = +e, r |= 0, n |= 0, i) || N(this, e, r, n, Math.pow(2, 8 * n) - 1, 0);\n var o = 1,\n s = 0;\n for (this[r] = 255 & e; ++s < n && (o *= 256);) this[r + s] = e / o & 255;\n return r + n;\n }, u.prototype.writeUIntBE = function t(e, r, n, i) {\n (e = +e, r |= 0, n |= 0, i) || N(this, e, r, n, Math.pow(2, 8 * n) - 1, 0);\n var o = n - 1,\n s = 1;\n for (this[r + o] = 255 & e; --o >= 0 && (s *= 256);) this[r + o] = e / s & 255;\n return r + n;\n }, u.prototype.writeUInt8 = function t(e, r, n) {\n return e = +e, r |= 0, n || N(this, e, r, 1, 255, 0), u.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), this[r] = 255 & e, r + 1;\n }, u.prototype.writeUInt16LE = function t(e, r, n) {\n return e = +e, r |= 0, n || N(this, e, r, 2, 65535, 0), u.TYPED_ARRAY_SUPPORT ? (this[r] = 255 & e, this[r + 1] = e >>> 8) : U(this, e, r, !0), r + 2;\n }, u.prototype.writeUInt16BE = function t(e, r, n) {\n return e = +e, r |= 0, n || N(this, e, r, 2, 65535, 0), u.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = 255 & e) : U(this, e, r, !1), r + 2;\n }, u.prototype.writeUInt32LE = function t(e, r, n) {\n return e = +e, r |= 0, n || N(this, e, r, 4, 4294967295, 0), u.TYPED_ARRAY_SUPPORT ? (this[r + 3] = e >>> 24, this[r + 2] = e >>> 16, this[r + 1] = e >>> 8, this[r] = 255 & e) : B(this, e, r, !0), r + 4;\n }, u.prototype.writeUInt32BE = function t(e, r, n) {\n return e = +e, r |= 0, n || N(this, e, r, 4, 4294967295, 0), u.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = 255 & e) : B(this, e, r, !1), r + 4;\n }, u.prototype.writeIntLE = function t(e, r, n, i) {\n if (e = +e, r |= 0, !i) {\n var o = Math.pow(2, 8 * n - 1);\n N(this, e, r, n, o - 1, -o);\n }\n var s = 0,\n a = 1,\n u = 0;\n for (this[r] = 255 & e; ++s < n && (a *= 256);) e < 0 && 0 === u && 0 !== this[r + s - 1] && (u = 1), this[r + s] = (e / a >> 0) - u & 255;\n return r + n;\n }, u.prototype.writeIntBE = function t(e, r, n, i) {\n if (e = +e, r |= 0, !i) {\n var o = Math.pow(2, 8 * n - 1);\n N(this, e, r, n, o - 1, -o);\n }\n var s = n - 1,\n a = 1,\n u = 0;\n for (this[r + s] = 255 & e; --s >= 0 && (a *= 256);) e < 0 && 0 === u && 0 !== this[r + s + 1] && (u = 1), this[r + s] = (e / a >> 0) - u & 255;\n return r + n;\n }, u.prototype.writeInt8 = function t(e, r, n) {\n return e = +e, r |= 0, n || N(this, e, r, 1, 127, -128), u.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), e < 0 && (e = 255 + e + 1), this[r] = 255 & e, r + 1;\n }, u.prototype.writeInt16LE = function t(e, r, n) {\n return e = +e, r |= 0, n || N(this, e, r, 2, 32767, -32768), u.TYPED_ARRAY_SUPPORT ? (this[r] = 255 & e, this[r + 1] = e >>> 8) : U(this, e, r, !0), r + 2;\n }, u.prototype.writeInt16BE = function t(e, r, n) {\n return e = +e, r |= 0, n || N(this, e, r, 2, 32767, -32768), u.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = 255 & e) : U(this, e, r, !1), r + 2;\n }, u.prototype.writeInt32LE = function t(e, r, n) {\n return e = +e, r |= 0, n || N(this, e, r, 4, 2147483647, -2147483648), u.TYPED_ARRAY_SUPPORT ? (this[r] = 255 & e, this[r + 1] = e >>> 8, this[r + 2] = e >>> 16, this[r + 3] = e >>> 24) : B(this, e, r, !0), r + 4;\n }, u.prototype.writeInt32BE = function t(e, r, n) {\n return e = +e, r |= 0, n || N(this, e, r, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), u.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = 255 & e) : B(this, e, r, !1), r + 4;\n }, u.prototype.writeFloatLE = function t(e, r, n) {\n return j(this, e, r, !0, n);\n }, u.prototype.writeFloatBE = function t(e, r, n) {\n return j(this, e, r, !1, n);\n }, u.prototype.writeDoubleLE = function t(e, r, n) {\n return M(this, e, r, !0, n);\n }, u.prototype.writeDoubleBE = function t(e, r, n) {\n return M(this, e, r, !1, n);\n }, u.prototype.copy = function t(e, r, n, i) {\n if (n || (n = 0), i || 0 === i || (i = this.length), r >= e.length && (r = e.length), r || (r = 0), i > 0 && i < n && (i = n), i === n) return 0;\n if (0 === e.length || 0 === this.length) return 0;\n if (r < 0) throw new RangeError(\"targetStart out of bounds\");\n if (n < 0 || n >= this.length) throw new RangeError(\"sourceStart out of bounds\");\n if (i < 0) throw new RangeError(\"sourceEnd out of bounds\");\n i > this.length && (i = this.length), e.length - r < i - n && (i = e.length - r + n);\n var o,\n s = i - n;\n if (this === e && n < r && r < i) for (o = s - 1; o >= 0; --o) e[o + r] = this[o + n];else if (s < 1e3 || !u.TYPED_ARRAY_SUPPORT) for (o = 0; o < s; ++o) e[o + r] = this[o + n];else Uint8Array.prototype.set.call(e, this.subarray(n, n + s), r);\n return s;\n }, u.prototype.fill = function t(e, r, n, i) {\n if (\"string\" == typeof e) {\n if (\"string\" == typeof r ? (i = r, r = 0, n = this.length) : \"string\" == typeof n && (i = n, n = this.length), 1 === e.length) {\n var o = e.charCodeAt(0);\n o < 256 && (e = o);\n }\n if (void 0 !== i && \"string\" != typeof i) throw new TypeError(\"encoding must be a string\");\n if (\"string\" == typeof i && !u.isEncoding(i)) throw new TypeError(\"Unknown encoding: \" + i);\n } else \"number\" == typeof e && (e &= 255);\n if (r < 0 || this.length < r || this.length < n) throw new RangeError(\"Out of range index\");\n if (n <= r) return this;\n var s;\n if (r >>>= 0, n = void 0 === n ? this.length : n >>> 0, e || (e = 0), \"number\" == typeof e) for (s = r; s < n; ++s) this[s] = e;else {\n var a = u.isBuffer(e) ? e : K(new u(e, i).toString()),\n c = a.length;\n for (s = 0; s < n - r; ++s) this[s + r] = a[s % c];\n }\n return this;\n };\n var H = /[^+\\/0-9A-Za-z-_]/g;\n function V(t) {\n return t < 16 ? \"0\" + t.toString(16) : t.toString(16);\n }\n function K(t, e) {\n var r;\n e = e || 1 / 0;\n for (var n = t.length, i = null, o = [], s = 0; s < n; ++s) {\n if ((r = t.charCodeAt(s)) > 55295 && r < 57344) {\n if (!i) {\n if (r > 56319) {\n (e -= 3) > -1 && o.push(239, 191, 189);\n continue;\n }\n if (s + 1 === n) {\n (e -= 3) > -1 && o.push(239, 191, 189);\n continue;\n }\n i = r;\n continue;\n }\n if (r < 56320) {\n (e -= 3) > -1 && o.push(239, 191, 189), i = r;\n continue;\n }\n r = 65536 + (i - 55296 << 10 | r - 56320);\n } else i && (e -= 3) > -1 && o.push(239, 191, 189);\n if (i = null, r < 128) {\n if ((e -= 1) < 0) break;\n o.push(r);\n } else if (r < 2048) {\n if ((e -= 2) < 0) break;\n o.push(r >> 6 | 192, 63 & r | 128);\n } else if (r < 65536) {\n if ((e -= 3) < 0) break;\n o.push(r >> 12 | 224, r >> 6 & 63 | 128, 63 & r | 128);\n } else {\n if (!(r < 1114112)) throw new Error(\"Invalid code point\");\n if ((e -= 4) < 0) break;\n o.push(r >> 18 | 240, r >> 12 & 63 | 128, r >> 6 & 63 | 128, 63 & r | 128);\n }\n }\n return o;\n }\n function q(t) {\n return n.toByteArray(function e(t) {\n if ((t = function e(t) {\n return t.trim ? t.trim() : t.replace(/^\\s+|\\s+$/g, \"\");\n }(t).replace(H, \"\")).length < 2) return \"\";\n for (; t.length % 4 != 0;) t += \"=\";\n return t;\n }(t));\n }\n function J(t, e, r, n) {\n for (var i = 0; i < n && !(i + r >= e.length || i >= t.length); ++i) e[i + r] = t[i];\n return i;\n }\n }).call(this, r(29));\n }, function (t, e) {\n var r;\n r = function () {\n return this;\n }();\n try {\n r = r || new Function(\"return this\")();\n } catch (t) {\n \"object\" == typeof window && (r = window);\n }\n t.exports = r;\n }, function (t, e, r) {\n \"use strict\";\n\n e.byteLength = function n(t) {\n var e = f(t),\n r = e[0],\n n = e[1];\n return 3 * (r + n) / 4 - n;\n }, e.toByteArray = function i(t) {\n var e,\n r,\n n = f(t),\n i = n[0],\n o = n[1],\n s = new u(function c(t, e, r) {\n return 3 * (e + r) / 4 - r;\n }(0, i, o)),\n h = 0,\n l = o > 0 ? i - 4 : i;\n for (r = 0; r < l; r += 4) e = a[t.charCodeAt(r)] << 18 | a[t.charCodeAt(r + 1)] << 12 | a[t.charCodeAt(r + 2)] << 6 | a[t.charCodeAt(r + 3)], s[h++] = e >> 16 & 255, s[h++] = e >> 8 & 255, s[h++] = 255 & e;\n 2 === o && (e = a[t.charCodeAt(r)] << 2 | a[t.charCodeAt(r + 1)] >> 4, s[h++] = 255 & e);\n 1 === o && (e = a[t.charCodeAt(r)] << 10 | a[t.charCodeAt(r + 1)] << 4 | a[t.charCodeAt(r + 2)] >> 2, s[h++] = e >> 8 & 255, s[h++] = 255 & e);\n return s;\n }, e.fromByteArray = function o(t) {\n for (var e, r = t.length, n = r % 3, i = [], o = 16383, a = 0, u = r - n; a < u; a += o) i.push(g(t, a, a + o > u ? u : a + o));\n 1 === n ? (e = t[r - 1], i.push(s[e >> 2] + s[e << 4 & 63] + \"==\")) : 2 === n && (e = (t[r - 2] << 8) + t[r - 1], i.push(s[e >> 10] + s[e >> 4 & 63] + s[e << 2 & 63] + \"=\"));\n return i.join(\"\");\n };\n for (var s = [], a = [], u = \"undefined\" != typeof Uint8Array ? Uint8Array : Array, c = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\", h = 0, l = c.length; h < l; ++h) s[h] = c[h], a[c.charCodeAt(h)] = h;\n function f(t) {\n var e = t.length;\n if (e % 4 > 0) throw new Error(\"Invalid string. Length must be a multiple of 4\");\n var r = t.indexOf(\"=\");\n return -1 === r && (r = e), [r, r === e ? 0 : 4 - r % 4];\n }\n function g(t, e, r) {\n for (var n, i, o = [], a = e; a < r; a += 3) n = (t[a] << 16 & 16711680) + (t[a + 1] << 8 & 65280) + (255 & t[a + 2]), o.push(s[(i = n) >> 18 & 63] + s[i >> 12 & 63] + s[i >> 6 & 63] + s[63 & i]);\n return o.join(\"\");\n }\n a[\"-\".charCodeAt(0)] = 62, a[\"_\".charCodeAt(0)] = 63;\n }, function (t, e) {\n /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\n e.read = function (t, e, r, n, i) {\n var o,\n s,\n a = 8 * i - n - 1,\n u = (1 << a) - 1,\n c = u >> 1,\n h = -7,\n l = r ? i - 1 : 0,\n f = r ? -1 : 1,\n g = t[e + l];\n for (l += f, o = g & (1 << -h) - 1, g >>= -h, h += a; h > 0; o = 256 * o + t[e + l], l += f, h -= 8);\n for (s = o & (1 << -h) - 1, o >>= -h, h += n; h > 0; s = 256 * s + t[e + l], l += f, h -= 8);\n if (0 === o) o = 1 - c;else {\n if (o === u) return s ? NaN : 1 / 0 * (g ? -1 : 1);\n s += Math.pow(2, n), o -= c;\n }\n return (g ? -1 : 1) * s * Math.pow(2, o - n);\n }, e.write = function (t, e, r, n, i, o) {\n var s,\n a,\n u,\n c = 8 * o - i - 1,\n h = (1 << c) - 1,\n l = h >> 1,\n f = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0,\n g = n ? 0 : o - 1,\n d = n ? 1 : -1,\n p = e < 0 || 0 === e && 1 / e < 0 ? 1 : 0;\n for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (a = isNaN(e) ? 1 : 0, s = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (u = Math.pow(2, -s)) < 1 && (s--, u *= 2), (e += s + l >= 1 ? f / u : f * Math.pow(2, 1 - l)) * u >= 2 && (s++, u /= 2), s + l >= h ? (a = 0, s = h) : s + l >= 1 ? (a = (e * u - 1) * Math.pow(2, i), s += l) : (a = e * Math.pow(2, l - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + g] = 255 & a, g += d, a /= 256, i -= 8);\n for (s = s << i | a, c += i; c > 0; t[r + g] = 255 & s, g += d, s /= 256, c -= 8);\n t[r + g - d] |= 128 * p;\n };\n }, function (t, e) {\n var r = {}.toString;\n t.exports = Array.isArray || function (t) {\n return \"[object Array]\" == r.call(t);\n };\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.default = function n(t) {\n var e = t.jws,\n r = t.KeyUtil,\n n = t.X509,\n o = t.crypto,\n s = t.hextob64u,\n a = t.b64tohex,\n u = t.AllowedSigningAlgs;\n return function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n }\n return t.parseJwt = function t(r) {\n i.Log.debug(\"JoseUtil.parseJwt\");\n try {\n var n = e.JWS.parse(r);\n return {\n header: n.headerObj,\n payload: n.payloadObj\n };\n } catch (t) {\n i.Log.error(t);\n }\n }, t.validateJwt = function e(o, s, u, c, h, l, f) {\n i.Log.debug(\"JoseUtil.validateJwt\");\n try {\n if (\"RSA\" === s.kty) {\n if (s.e && s.n) s = r.getKey(s);else {\n if (!s.x5c || !s.x5c.length) return i.Log.error(\"JoseUtil.validateJwt: RSA key missing key material\", s), Promise.reject(new Error(\"RSA key missing key material\"));\n var g = a(s.x5c[0]);\n s = n.getPublicKeyFromCertHex(g);\n }\n } else {\n if (\"EC\" !== s.kty) return i.Log.error(\"JoseUtil.validateJwt: Unsupported key type\", s && s.kty), Promise.reject(new Error(s.kty));\n if (!(s.crv && s.x && s.y)) return i.Log.error(\"JoseUtil.validateJwt: EC key missing key material\", s), Promise.reject(new Error(\"EC key missing key material\"));\n s = r.getKey(s);\n }\n return t._validateJwt(o, s, u, c, h, l, f);\n } catch (t) {\n return i.Log.error(t && t.message || t), Promise.reject(\"JWT validation failed\");\n }\n }, t.validateJwtAttributes = function e(r, n, o, s, a, u) {\n s || (s = 0), a || (a = parseInt(Date.now() / 1e3));\n var c = t.parseJwt(r).payload;\n if (!c.iss) return i.Log.error(\"JoseUtil._validateJwt: issuer was not provided\"), Promise.reject(new Error(\"issuer was not provided\"));\n if (c.iss !== n) return i.Log.error(\"JoseUtil._validateJwt: Invalid issuer in token\", c.iss), Promise.reject(new Error(\"Invalid issuer in token: \" + c.iss));\n if (!c.aud) return i.Log.error(\"JoseUtil._validateJwt: aud was not provided\"), Promise.reject(new Error(\"aud was not provided\"));\n if (!(c.aud === o || Array.isArray(c.aud) && c.aud.indexOf(o) >= 0)) return i.Log.error(\"JoseUtil._validateJwt: Invalid audience in token\", c.aud), Promise.reject(new Error(\"Invalid audience in token: \" + c.aud));\n if (c.azp && c.azp !== o) return i.Log.error(\"JoseUtil._validateJwt: Invalid azp in token\", c.azp), Promise.reject(new Error(\"Invalid azp in token: \" + c.azp));\n if (!u) {\n var h = a + s,\n l = a - s;\n if (!c.iat) return i.Log.error(\"JoseUtil._validateJwt: iat was not provided\"), Promise.reject(new Error(\"iat was not provided\"));\n if (h < c.iat) return i.Log.error(\"JoseUtil._validateJwt: iat is in the future\", c.iat), Promise.reject(new Error(\"iat is in the future: \" + c.iat));\n if (c.nbf && h < c.nbf) return i.Log.error(\"JoseUtil._validateJwt: nbf is in the future\", c.nbf), Promise.reject(new Error(\"nbf is in the future: \" + c.nbf));\n if (!c.exp) return i.Log.error(\"JoseUtil._validateJwt: exp was not provided\"), Promise.reject(new Error(\"exp was not provided\"));\n if (c.exp < l) return i.Log.error(\"JoseUtil._validateJwt: exp is in the past\", c.exp), Promise.reject(new Error(\"exp is in the past:\" + c.exp));\n }\n return Promise.resolve(c);\n }, t._validateJwt = function r(n, o, s, a, c, h, l) {\n return t.validateJwtAttributes(n, s, a, c, h, l).then(function (t) {\n try {\n return e.JWS.verify(n, o, u) ? t : (i.Log.error(\"JoseUtil._validateJwt: signature validation failed\"), Promise.reject(new Error(\"signature validation failed\")));\n } catch (t) {\n return i.Log.error(t && t.message || t), Promise.reject(new Error(\"signature validation failed\"));\n }\n });\n }, t.hashString = function t(e, r) {\n try {\n return o.Util.hashString(e, r);\n } catch (t) {\n i.Log.error(t);\n }\n }, t.hexToBase64Url = function t(e) {\n try {\n return s(e);\n } catch (t) {\n i.Log.error(t);\n }\n }, t;\n }();\n };\n var i = r(0);\n t.exports = e.default;\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.SigninResponse = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(3);\n function o(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n e.SigninResponse = function () {\n function t(e) {\n var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : \"#\";\n o(this, t);\n var n = i.UrlUtility.parseUrlFragment(e, r);\n this.error = n.error, this.error_description = n.error_description, this.error_uri = n.error_uri, this.code = n.code, this.state = n.state, this.id_token = n.id_token, this.session_state = n.session_state, this.access_token = n.access_token, this.token_type = n.token_type, this.scope = n.scope, this.profile = void 0, this.expires_in = n.expires_in;\n }\n return n(t, [{\n key: \"expires_in\",\n get: function t() {\n if (this.expires_at) {\n var e = parseInt(Date.now() / 1e3);\n return this.expires_at - e;\n }\n },\n set: function t(e) {\n var r = parseInt(e);\n if (\"number\" == typeof r && r > 0) {\n var n = parseInt(Date.now() / 1e3);\n this.expires_at = n + r;\n }\n }\n }, {\n key: \"expired\",\n get: function t() {\n var e = this.expires_in;\n if (void 0 !== e) return e <= 0;\n }\n }, {\n key: \"scopes\",\n get: function t() {\n return (this.scope || \"\").split(\" \");\n }\n }, {\n key: \"isOpenIdConnect\",\n get: function t() {\n return this.scopes.indexOf(\"openid\") >= 0 || !!this.id_token;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.SignoutRequest = void 0;\n var n = r(0),\n i = r(3),\n o = r(9);\n e.SignoutRequest = function t(e) {\n var r = e.url,\n s = e.id_token_hint,\n a = e.post_logout_redirect_uri,\n u = e.data,\n c = e.extraQueryParams,\n h = e.request_type;\n if (function l(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t), !r) throw n.Log.error(\"SignoutRequest.ctor: No url passed\"), new Error(\"url\");\n for (var f in s && (r = i.UrlUtility.addQueryParam(r, \"id_token_hint\", s)), a && (r = i.UrlUtility.addQueryParam(r, \"post_logout_redirect_uri\", a), u && (this.state = new o.State({\n data: u,\n request_type: h\n }), r = i.UrlUtility.addQueryParam(r, \"state\", this.state.id))), c) r = i.UrlUtility.addQueryParam(r, f, c[f]);\n this.url = r;\n };\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.SignoutResponse = void 0;\n var n = r(3);\n e.SignoutResponse = function t(e) {\n !function r(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n var i = n.UrlUtility.parseUrlFragment(e, \"?\");\n this.error = i.error, this.error_description = i.error_description, this.error_uri = i.error_uri, this.state = i.state;\n };\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.InMemoryWebStorage = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0);\n e.InMemoryWebStorage = function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t), this._data = {};\n }\n return t.prototype.getItem = function t(e) {\n return i.Log.debug(\"InMemoryWebStorage.getItem\", e), this._data[e];\n }, t.prototype.setItem = function t(e, r) {\n i.Log.debug(\"InMemoryWebStorage.setItem\", e), this._data[e] = r;\n }, t.prototype.removeItem = function t(e) {\n i.Log.debug(\"InMemoryWebStorage.removeItem\", e), delete this._data[e];\n }, t.prototype.key = function t(e) {\n return Object.getOwnPropertyNames(this._data)[e];\n }, n(t, [{\n key: \"length\",\n get: function t() {\n return Object.getOwnPropertyNames(this._data).length;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.UserManager = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0),\n o = r(10),\n s = r(39),\n a = r(15),\n u = r(45),\n c = r(47),\n h = r(18),\n l = r(8),\n f = r(20),\n g = r(11),\n d = r(4);\n function p(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n function v(t, e) {\n if (!t) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return !e || \"object\" != typeof e && \"function\" != typeof e ? t : e;\n }\n e.UserManager = function (t) {\n function e() {\n var r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : c.SilentRenewService,\n o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : h.SessionMonitor,\n a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : f.TokenRevocationClient,\n l = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : g.TokenClient,\n y = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : d.JoseUtil;\n p(this, e), r instanceof s.UserManagerSettings || (r = new s.UserManagerSettings(r));\n var m = v(this, t.call(this, r));\n return m._events = new u.UserManagerEvents(r), m._silentRenewService = new n(m), m.settings.automaticSilentRenew && (i.Log.debug(\"UserManager.ctor: automaticSilentRenew is configured, setting up silent renew\"), m.startSilentRenew()), m.settings.monitorSession && (i.Log.debug(\"UserManager.ctor: monitorSession is configured, setting up session monitor\"), m._sessionMonitor = new o(m)), m._tokenRevocationClient = new a(m._settings), m._tokenClient = new l(m._settings), m._joseUtil = y, m;\n }\n return function r(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function, not \" + typeof e);\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);\n }(e, t), e.prototype.getUser = function t() {\n var e = this;\n return this._loadUser().then(function (t) {\n return t ? (i.Log.info(\"UserManager.getUser: user loaded\"), e._events.load(t, !1), t) : (i.Log.info(\"UserManager.getUser: user not found in storage\"), null);\n });\n }, e.prototype.removeUser = function t() {\n var e = this;\n return this.storeUser(null).then(function () {\n i.Log.info(\"UserManager.removeUser: user removed from storage\"), e._events.unload();\n });\n }, e.prototype.signinRedirect = function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};\n (e = Object.assign({}, e)).request_type = \"si:r\";\n var r = {\n useReplaceToNavigate: e.useReplaceToNavigate\n };\n return this._signinStart(e, this._redirectNavigator, r).then(function () {\n i.Log.info(\"UserManager.signinRedirect: successful\");\n });\n }, e.prototype.signinRedirectCallback = function t(e) {\n return this._signinEnd(e || this._redirectNavigator.url).then(function (t) {\n return t.profile && t.profile.sub ? i.Log.info(\"UserManager.signinRedirectCallback: successful, signed in sub: \", t.profile.sub) : i.Log.info(\"UserManager.signinRedirectCallback: no sub\"), t;\n });\n }, e.prototype.signinPopup = function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};\n (e = Object.assign({}, e)).request_type = \"si:p\";\n var r = e.redirect_uri || this.settings.popup_redirect_uri || this.settings.redirect_uri;\n return r ? (e.redirect_uri = r, e.display = \"popup\", this._signin(e, this._popupNavigator, {\n startUrl: r,\n popupWindowFeatures: e.popupWindowFeatures || this.settings.popupWindowFeatures,\n popupWindowTarget: e.popupWindowTarget || this.settings.popupWindowTarget\n }).then(function (t) {\n return t && (t.profile && t.profile.sub ? i.Log.info(\"UserManager.signinPopup: signinPopup successful, signed in sub: \", t.profile.sub) : i.Log.info(\"UserManager.signinPopup: no sub\")), t;\n })) : (i.Log.error(\"UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured\"), Promise.reject(new Error(\"No popup_redirect_uri or redirect_uri configured\")));\n }, e.prototype.signinPopupCallback = function t(e) {\n return this._signinCallback(e, this._popupNavigator).then(function (t) {\n return t && (t.profile && t.profile.sub ? i.Log.info(\"UserManager.signinPopupCallback: successful, signed in sub: \", t.profile.sub) : i.Log.info(\"UserManager.signinPopupCallback: no sub\")), t;\n }).catch(function (t) {\n i.Log.error(t.message);\n });\n }, e.prototype.signinSilent = function t() {\n var e = this,\n r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};\n return r = Object.assign({}, r), this._loadUser().then(function (t) {\n return t && t.refresh_token ? (r.refresh_token = t.refresh_token, e._useRefreshToken(r)) : (r.request_type = \"si:s\", r.id_token_hint = r.id_token_hint || e.settings.includeIdTokenInSilentRenew && t && t.id_token, t && e._settings.validateSubOnSilentRenew && (i.Log.debug(\"UserManager.signinSilent, subject prior to silent renew: \", t.profile.sub), r.current_sub = t.profile.sub), e._signinSilentIframe(r));\n });\n }, e.prototype._useRefreshToken = function t() {\n var e = this,\n r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};\n return this._tokenClient.exchangeRefreshToken(r).then(function (t) {\n return t ? t.access_token ? e._loadUser().then(function (r) {\n if (r) {\n var n = Promise.resolve();\n return t.id_token && (n = e._validateIdTokenFromTokenRefreshToken(r.profile, t.id_token)), n.then(function () {\n return i.Log.debug(\"UserManager._useRefreshToken: refresh token response success\"), r.id_token = t.id_token || r.id_token, r.access_token = t.access_token, r.refresh_token = t.refresh_token || r.refresh_token, r.expires_in = t.expires_in, e.storeUser(r).then(function () {\n return e._events.load(r), r;\n });\n });\n }\n return null;\n }) : (i.Log.error(\"UserManager._useRefreshToken: No access token returned from token endpoint\"), Promise.reject(\"No access token returned from token endpoint\")) : (i.Log.error(\"UserManager._useRefreshToken: No response returned from token endpoint\"), Promise.reject(\"No response returned from token endpoint\"));\n });\n }, e.prototype._validateIdTokenFromTokenRefreshToken = function t(e, r) {\n var n = this;\n return this._metadataService.getIssuer().then(function (t) {\n return n.settings.getEpochTime().then(function (o) {\n return n._joseUtil.validateJwtAttributes(r, t, n._settings.client_id, n._settings.clockSkew, o).then(function (t) {\n return t ? t.sub !== e.sub ? (i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: sub in id_token does not match current sub\"), Promise.reject(new Error(\"sub in id_token does not match current sub\"))) : t.auth_time && t.auth_time !== e.auth_time ? (i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: auth_time in id_token does not match original auth_time\"), Promise.reject(new Error(\"auth_time in id_token does not match original auth_time\"))) : t.azp && t.azp !== e.azp ? (i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: azp in id_token does not match original azp\"), Promise.reject(new Error(\"azp in id_token does not match original azp\"))) : !t.azp && e.azp ? (i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: azp not in id_token, but present in original id_token\"), Promise.reject(new Error(\"azp not in id_token, but present in original id_token\"))) : void 0 : (i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: Failed to validate id_token\"), Promise.reject(new Error(\"Failed to validate id_token\")));\n });\n });\n });\n }, e.prototype._signinSilentIframe = function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n r = e.redirect_uri || this.settings.silent_redirect_uri || this.settings.redirect_uri;\n return r ? (e.redirect_uri = r, e.prompt = e.prompt || \"none\", this._signin(e, this._iframeNavigator, {\n startUrl: r,\n silentRequestTimeout: e.silentRequestTimeout || this.settings.silentRequestTimeout\n }).then(function (t) {\n return t && (t.profile && t.profile.sub ? i.Log.info(\"UserManager.signinSilent: successful, signed in sub: \", t.profile.sub) : i.Log.info(\"UserManager.signinSilent: no sub\")), t;\n })) : (i.Log.error(\"UserManager.signinSilent: No silent_redirect_uri configured\"), Promise.reject(new Error(\"No silent_redirect_uri configured\")));\n }, e.prototype.signinSilentCallback = function t(e) {\n return this._signinCallback(e, this._iframeNavigator).then(function (t) {\n return t && (t.profile && t.profile.sub ? i.Log.info(\"UserManager.signinSilentCallback: successful, signed in sub: \", t.profile.sub) : i.Log.info(\"UserManager.signinSilentCallback: no sub\")), t;\n });\n }, e.prototype.signinCallback = function t(e) {\n var r = this;\n return this.readSigninResponseState(e).then(function (t) {\n var n = t.state;\n t.response;\n return \"si:r\" === n.request_type ? r.signinRedirectCallback(e) : \"si:p\" === n.request_type ? r.signinPopupCallback(e) : \"si:s\" === n.request_type ? r.signinSilentCallback(e) : Promise.reject(new Error(\"invalid response_type in state\"));\n });\n }, e.prototype.signoutCallback = function t(e, r) {\n var n = this;\n return this.readSignoutResponseState(e).then(function (t) {\n var i = t.state,\n o = t.response;\n return i ? \"so:r\" === i.request_type ? n.signoutRedirectCallback(e) : \"so:p\" === i.request_type ? n.signoutPopupCallback(e, r) : Promise.reject(new Error(\"invalid response_type in state\")) : o;\n });\n }, e.prototype.querySessionStatus = function t() {\n var e = this,\n r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};\n (r = Object.assign({}, r)).request_type = \"si:s\";\n var n = r.redirect_uri || this.settings.silent_redirect_uri || this.settings.redirect_uri;\n return n ? (r.redirect_uri = n, r.prompt = \"none\", r.response_type = r.response_type || this.settings.query_status_response_type, r.scope = r.scope || \"openid\", r.skipUserInfo = !0, this._signinStart(r, this._iframeNavigator, {\n startUrl: n,\n silentRequestTimeout: r.silentRequestTimeout || this.settings.silentRequestTimeout\n }).then(function (t) {\n return e.processSigninResponse(t.url).then(function (t) {\n if (i.Log.debug(\"UserManager.querySessionStatus: got signin response\"), t.session_state && t.profile.sub) return i.Log.info(\"UserManager.querySessionStatus: querySessionStatus success for sub: \", t.profile.sub), {\n session_state: t.session_state,\n sub: t.profile.sub,\n sid: t.profile.sid\n };\n i.Log.info(\"querySessionStatus successful, user not authenticated\");\n }).catch(function (t) {\n if (t.session_state && e.settings.monitorAnonymousSession && (\"login_required\" == t.message || \"consent_required\" == t.message || \"interaction_required\" == t.message || \"account_selection_required\" == t.message)) return i.Log.info(\"UserManager.querySessionStatus: querySessionStatus success for anonymous user\"), {\n session_state: t.session_state\n };\n throw t;\n });\n })) : (i.Log.error(\"UserManager.querySessionStatus: No silent_redirect_uri configured\"), Promise.reject(new Error(\"No silent_redirect_uri configured\")));\n }, e.prototype._signin = function t(e, r) {\n var n = this,\n i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};\n return this._signinStart(e, r, i).then(function (t) {\n return n._signinEnd(t.url, e);\n });\n }, e.prototype._signinStart = function t(e, r) {\n var n = this,\n o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};\n return r.prepare(o).then(function (t) {\n return i.Log.debug(\"UserManager._signinStart: got navigator window handle\"), n.createSigninRequest(e).then(function (e) {\n return i.Log.debug(\"UserManager._signinStart: got signin request\"), o.url = e.url, o.id = e.state.id, t.navigate(o);\n }).catch(function (e) {\n throw t.close && (i.Log.debug(\"UserManager._signinStart: Error after preparing navigator, closing navigator window\"), t.close()), e;\n });\n });\n }, e.prototype._signinEnd = function t(e) {\n var r = this,\n n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};\n return this.processSigninResponse(e).then(function (t) {\n i.Log.debug(\"UserManager._signinEnd: got signin response\");\n var e = new a.User(t);\n if (n.current_sub) {\n if (n.current_sub !== e.profile.sub) return i.Log.debug(\"UserManager._signinEnd: current user does not match user returned from signin. sub from signin: \", e.profile.sub), Promise.reject(new Error(\"login_required\"));\n i.Log.debug(\"UserManager._signinEnd: current user matches user returned from signin\");\n }\n return r.storeUser(e).then(function () {\n return i.Log.debug(\"UserManager._signinEnd: user stored\"), r._events.load(e), e;\n });\n });\n }, e.prototype._signinCallback = function t(e, r) {\n i.Log.debug(\"UserManager._signinCallback\");\n var n = \"query\" === this._settings.response_mode || !this._settings.response_mode && l.SigninRequest.isCode(this._settings.response_type) ? \"?\" : \"#\";\n return r.callback(e, void 0, n);\n }, e.prototype.signoutRedirect = function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};\n (e = Object.assign({}, e)).request_type = \"so:r\";\n var r = e.post_logout_redirect_uri || this.settings.post_logout_redirect_uri;\n r && (e.post_logout_redirect_uri = r);\n var n = {\n useReplaceToNavigate: e.useReplaceToNavigate\n };\n return this._signoutStart(e, this._redirectNavigator, n).then(function () {\n i.Log.info(\"UserManager.signoutRedirect: successful\");\n });\n }, e.prototype.signoutRedirectCallback = function t(e) {\n return this._signoutEnd(e || this._redirectNavigator.url).then(function (t) {\n return i.Log.info(\"UserManager.signoutRedirectCallback: successful\"), t;\n });\n }, e.prototype.signoutPopup = function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};\n (e = Object.assign({}, e)).request_type = \"so:p\";\n var r = e.post_logout_redirect_uri || this.settings.popup_post_logout_redirect_uri || this.settings.post_logout_redirect_uri;\n return e.post_logout_redirect_uri = r, e.display = \"popup\", e.post_logout_redirect_uri && (e.state = e.state || {}), this._signout(e, this._popupNavigator, {\n startUrl: r,\n popupWindowFeatures: e.popupWindowFeatures || this.settings.popupWindowFeatures,\n popupWindowTarget: e.popupWindowTarget || this.settings.popupWindowTarget\n }).then(function () {\n i.Log.info(\"UserManager.signoutPopup: successful\");\n });\n }, e.prototype.signoutPopupCallback = function t(e, r) {\n void 0 === r && \"boolean\" == typeof e && (r = e, e = null);\n return this._popupNavigator.callback(e, r, \"?\").then(function () {\n i.Log.info(\"UserManager.signoutPopupCallback: successful\");\n });\n }, e.prototype._signout = function t(e, r) {\n var n = this,\n i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};\n return this._signoutStart(e, r, i).then(function (t) {\n return n._signoutEnd(t.url);\n });\n }, e.prototype._signoutStart = function t() {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n r = this,\n n = arguments[1],\n o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};\n return n.prepare(o).then(function (t) {\n return i.Log.debug(\"UserManager._signoutStart: got navigator window handle\"), r._loadUser().then(function (n) {\n return i.Log.debug(\"UserManager._signoutStart: loaded current user from storage\"), (r._settings.revokeAccessTokenOnSignout ? r._revokeInternal(n) : Promise.resolve()).then(function () {\n var s = e.id_token_hint || n && n.id_token;\n return s && (i.Log.debug(\"UserManager._signoutStart: Setting id_token into signout request\"), e.id_token_hint = s), r.removeUser().then(function () {\n return i.Log.debug(\"UserManager._signoutStart: user removed, creating signout request\"), r.createSignoutRequest(e).then(function (e) {\n return i.Log.debug(\"UserManager._signoutStart: got signout request\"), o.url = e.url, e.state && (o.id = e.state.id), t.navigate(o);\n });\n });\n });\n }).catch(function (e) {\n throw t.close && (i.Log.debug(\"UserManager._signoutStart: Error after preparing navigator, closing navigator window\"), t.close()), e;\n });\n });\n }, e.prototype._signoutEnd = function t(e) {\n return this.processSignoutResponse(e).then(function (t) {\n return i.Log.debug(\"UserManager._signoutEnd: got signout response\"), t;\n });\n }, e.prototype.revokeAccessToken = function t() {\n var e = this;\n return this._loadUser().then(function (t) {\n return e._revokeInternal(t, !0).then(function (r) {\n if (r) return i.Log.debug(\"UserManager.revokeAccessToken: removing token properties from user and re-storing\"), t.access_token = null, t.refresh_token = null, t.expires_at = null, t.token_type = null, e.storeUser(t).then(function () {\n i.Log.debug(\"UserManager.revokeAccessToken: user stored\"), e._events.load(t);\n });\n });\n }).then(function () {\n i.Log.info(\"UserManager.revokeAccessToken: access token revoked successfully\");\n });\n }, e.prototype._revokeInternal = function t(e, r) {\n var n = this;\n if (e) {\n var o = e.access_token,\n s = e.refresh_token;\n return this._revokeAccessTokenInternal(o, r).then(function (t) {\n return n._revokeRefreshTokenInternal(s, r).then(function (e) {\n return t || e || i.Log.debug(\"UserManager.revokeAccessToken: no need to revoke due to no token(s), or JWT format\"), t || e;\n });\n });\n }\n return Promise.resolve(!1);\n }, e.prototype._revokeAccessTokenInternal = function t(e, r) {\n return !e || e.indexOf(\".\") >= 0 ? Promise.resolve(!1) : this._tokenRevocationClient.revoke(e, r).then(function () {\n return !0;\n });\n }, e.prototype._revokeRefreshTokenInternal = function t(e, r) {\n return e ? this._tokenRevocationClient.revoke(e, r, \"refresh_token\").then(function () {\n return !0;\n }) : Promise.resolve(!1);\n }, e.prototype.startSilentRenew = function t() {\n this._silentRenewService.start();\n }, e.prototype.stopSilentRenew = function t() {\n this._silentRenewService.stop();\n }, e.prototype._loadUser = function t() {\n return this._userStore.get(this._userStoreKey).then(function (t) {\n return t ? (i.Log.debug(\"UserManager._loadUser: user storageString loaded\"), a.User.fromStorageString(t)) : (i.Log.debug(\"UserManager._loadUser: no user storageString\"), null);\n });\n }, e.prototype.storeUser = function t(e) {\n if (e) {\n i.Log.debug(\"UserManager.storeUser: storing user\");\n var r = e.toStorageString();\n return this._userStore.set(this._userStoreKey, r);\n }\n return i.Log.debug(\"storeUser.storeUser: removing user\"), this._userStore.remove(this._userStoreKey);\n }, n(e, [{\n key: \"_redirectNavigator\",\n get: function t() {\n return this.settings.redirectNavigator;\n }\n }, {\n key: \"_popupNavigator\",\n get: function t() {\n return this.settings.popupNavigator;\n }\n }, {\n key: \"_iframeNavigator\",\n get: function t() {\n return this.settings.iframeNavigator;\n }\n }, {\n key: \"_userStore\",\n get: function t() {\n return this.settings.userStore;\n }\n }, {\n key: \"events\",\n get: function t() {\n return this._events;\n }\n }, {\n key: \"_userStoreKey\",\n get: function t() {\n return \"user:\" + this.settings.authority + \":\" + this.settings.client_id;\n }\n }]), e;\n }(o.OidcClient);\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.UserManagerSettings = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = (r(0), r(5)),\n o = r(40),\n s = r(41),\n a = r(43),\n u = r(6),\n c = r(1),\n h = r(8);\n function l(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n function f(t, e) {\n if (!t) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return !e || \"object\" != typeof e && \"function\" != typeof e ? t : e;\n }\n e.UserManagerSettings = function (t) {\n function e() {\n var r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},\n n = r.popup_redirect_uri,\n i = r.popup_post_logout_redirect_uri,\n g = r.popupWindowFeatures,\n d = r.popupWindowTarget,\n p = r.silent_redirect_uri,\n v = r.silentRequestTimeout,\n y = r.automaticSilentRenew,\n m = void 0 !== y && y,\n _ = r.validateSubOnSilentRenew,\n S = void 0 !== _ && _,\n b = r.includeIdTokenInSilentRenew,\n w = void 0 === b || b,\n F = r.monitorSession,\n E = void 0 === F || F,\n x = r.monitorAnonymousSession,\n A = void 0 !== x && x,\n k = r.checkSessionInterval,\n P = void 0 === k ? 2e3 : k,\n C = r.stopCheckSessionOnError,\n T = void 0 === C || C,\n R = r.query_status_response_type,\n I = r.revokeAccessTokenOnSignout,\n D = void 0 !== I && I,\n L = r.accessTokenExpiringNotificationTime,\n N = void 0 === L ? 60 : L,\n U = r.redirectNavigator,\n B = void 0 === U ? new o.RedirectNavigator() : U,\n O = r.popupNavigator,\n j = void 0 === O ? new s.PopupNavigator() : O,\n M = r.iframeNavigator,\n H = void 0 === M ? new a.IFrameNavigator() : M,\n V = r.userStore,\n K = void 0 === V ? new u.WebStorageStateStore({\n store: c.Global.sessionStorage\n }) : V;\n l(this, e);\n var q = f(this, t.call(this, arguments[0]));\n return q._popup_redirect_uri = n, q._popup_post_logout_redirect_uri = i, q._popupWindowFeatures = g, q._popupWindowTarget = d, q._silent_redirect_uri = p, q._silentRequestTimeout = v, q._automaticSilentRenew = m, q._validateSubOnSilentRenew = S, q._includeIdTokenInSilentRenew = w, q._accessTokenExpiringNotificationTime = N, q._monitorSession = E, q._monitorAnonymousSession = A, q._checkSessionInterval = P, q._stopCheckSessionOnError = T, R ? q._query_status_response_type = R : arguments[0] && arguments[0].response_type ? q._query_status_response_type = h.SigninRequest.isOidc(arguments[0].response_type) ? \"id_token\" : \"code\" : q._query_status_response_type = \"id_token\", q._revokeAccessTokenOnSignout = D, q._redirectNavigator = B, q._popupNavigator = j, q._iframeNavigator = H, q._userStore = K, q;\n }\n return function r(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function, not \" + typeof e);\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);\n }(e, t), n(e, [{\n key: \"popup_redirect_uri\",\n get: function t() {\n return this._popup_redirect_uri;\n }\n }, {\n key: \"popup_post_logout_redirect_uri\",\n get: function t() {\n return this._popup_post_logout_redirect_uri;\n }\n }, {\n key: \"popupWindowFeatures\",\n get: function t() {\n return this._popupWindowFeatures;\n }\n }, {\n key: \"popupWindowTarget\",\n get: function t() {\n return this._popupWindowTarget;\n }\n }, {\n key: \"silent_redirect_uri\",\n get: function t() {\n return this._silent_redirect_uri;\n }\n }, {\n key: \"silentRequestTimeout\",\n get: function t() {\n return this._silentRequestTimeout;\n }\n }, {\n key: \"automaticSilentRenew\",\n get: function t() {\n return this._automaticSilentRenew;\n }\n }, {\n key: \"validateSubOnSilentRenew\",\n get: function t() {\n return this._validateSubOnSilentRenew;\n }\n }, {\n key: \"includeIdTokenInSilentRenew\",\n get: function t() {\n return this._includeIdTokenInSilentRenew;\n }\n }, {\n key: \"accessTokenExpiringNotificationTime\",\n get: function t() {\n return this._accessTokenExpiringNotificationTime;\n }\n }, {\n key: \"monitorSession\",\n get: function t() {\n return this._monitorSession;\n }\n }, {\n key: \"monitorAnonymousSession\",\n get: function t() {\n return this._monitorAnonymousSession;\n }\n }, {\n key: \"checkSessionInterval\",\n get: function t() {\n return this._checkSessionInterval;\n }\n }, {\n key: \"stopCheckSessionOnError\",\n get: function t() {\n return this._stopCheckSessionOnError;\n }\n }, {\n key: \"query_status_response_type\",\n get: function t() {\n return this._query_status_response_type;\n }\n }, {\n key: \"revokeAccessTokenOnSignout\",\n get: function t() {\n return this._revokeAccessTokenOnSignout;\n }\n }, {\n key: \"redirectNavigator\",\n get: function t() {\n return this._redirectNavigator;\n }\n }, {\n key: \"popupNavigator\",\n get: function t() {\n return this._popupNavigator;\n }\n }, {\n key: \"iframeNavigator\",\n get: function t() {\n return this._iframeNavigator;\n }\n }, {\n key: \"userStore\",\n get: function t() {\n return this._userStore;\n }\n }]), e;\n }(i.OidcClientSettings);\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.RedirectNavigator = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0);\n e.RedirectNavigator = function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n }\n return t.prototype.prepare = function t() {\n return Promise.resolve(this);\n }, t.prototype.navigate = function t(e) {\n return e && e.url ? (e.useReplaceToNavigate ? window.location.replace(e.url) : window.location = e.url, Promise.resolve()) : (i.Log.error(\"RedirectNavigator.navigate: No url provided\"), Promise.reject(new Error(\"No url provided\")));\n }, n(t, [{\n key: \"url\",\n get: function t() {\n return window.location.href;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.PopupNavigator = void 0;\n var n = r(0),\n i = r(42);\n e.PopupNavigator = function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n }\n return t.prototype.prepare = function t(e) {\n var r = new i.PopupWindow(e);\n return Promise.resolve(r);\n }, t.prototype.callback = function t(e, r, o) {\n n.Log.debug(\"PopupNavigator.callback\");\n try {\n return i.PopupWindow.notifyOpener(e, r, o), Promise.resolve();\n } catch (t) {\n return Promise.reject(t);\n }\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.PopupWindow = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0),\n o = r(3);\n e.PopupWindow = function () {\n function t(e) {\n var r = this;\n !function n(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t), this._promise = new Promise(function (t, e) {\n r._resolve = t, r._reject = e;\n });\n var o = e.popupWindowTarget || \"_blank\",\n s = e.popupWindowFeatures || \"location=no,toolbar=no,width=500,height=500,left=100,top=100;\";\n this._popup = window.open(\"\", o, s), this._popup && (i.Log.debug(\"PopupWindow.ctor: popup successfully created\"), this._checkForPopupClosedTimer = window.setInterval(this._checkForPopupClosed.bind(this), 500));\n }\n return t.prototype.navigate = function t(e) {\n return this._popup ? e && e.url ? (i.Log.debug(\"PopupWindow.navigate: Setting URL in popup\"), this._id = e.id, this._id && (window[\"popupCallback_\" + e.id] = this._callback.bind(this)), this._popup.focus(), this._popup.window.location = e.url) : (this._error(\"PopupWindow.navigate: no url provided\"), this._error(\"No url provided\")) : this._error(\"PopupWindow.navigate: Error opening popup window\"), this.promise;\n }, t.prototype._success = function t(e) {\n i.Log.debug(\"PopupWindow.callback: Successful response from popup window\"), this._cleanup(), this._resolve(e);\n }, t.prototype._error = function t(e) {\n i.Log.error(\"PopupWindow.error: \", e), this._cleanup(), this._reject(new Error(e));\n }, t.prototype.close = function t() {\n this._cleanup(!1);\n }, t.prototype._cleanup = function t(e) {\n i.Log.debug(\"PopupWindow.cleanup\"), window.clearInterval(this._checkForPopupClosedTimer), this._checkForPopupClosedTimer = null, delete window[\"popupCallback_\" + this._id], this._popup && !e && this._popup.close(), this._popup = null;\n }, t.prototype._checkForPopupClosed = function t() {\n this._popup && !this._popup.closed || this._error(\"Popup window closed\");\n }, t.prototype._callback = function t(e, r) {\n this._cleanup(r), e ? (i.Log.debug(\"PopupWindow.callback success\"), this._success({\n url: e\n })) : (i.Log.debug(\"PopupWindow.callback: Invalid response from popup\"), this._error(\"Invalid response from popup\"));\n }, t.notifyOpener = function t(e, r, n) {\n if (window.opener) {\n if (e = e || window.location.href) {\n var s = o.UrlUtility.parseUrlFragment(e, n);\n if (s.state) {\n var a = \"popupCallback_\" + s.state,\n u = window.opener[a];\n u ? (i.Log.debug(\"PopupWindow.notifyOpener: passing url message to opener\"), u(e, r)) : i.Log.warn(\"PopupWindow.notifyOpener: no matching callback found on opener\");\n } else i.Log.warn(\"PopupWindow.notifyOpener: no state found in response url\");\n }\n } else i.Log.warn(\"PopupWindow.notifyOpener: no window.opener. Can't complete notification.\");\n }, n(t, [{\n key: \"promise\",\n get: function t() {\n return this._promise;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.IFrameNavigator = void 0;\n var n = r(0),\n i = r(44);\n e.IFrameNavigator = function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n }\n return t.prototype.prepare = function t(e) {\n var r = new i.IFrameWindow(e);\n return Promise.resolve(r);\n }, t.prototype.callback = function t(e) {\n n.Log.debug(\"IFrameNavigator.callback\");\n try {\n return i.IFrameWindow.notifyParent(e), Promise.resolve();\n } catch (t) {\n return Promise.reject(t);\n }\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.IFrameWindow = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0);\n e.IFrameWindow = function () {\n function t(e) {\n var r = this;\n !function n(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t), this._promise = new Promise(function (t, e) {\n r._resolve = t, r._reject = e;\n }), this._boundMessageEvent = this._message.bind(this), window.addEventListener(\"message\", this._boundMessageEvent, !1), this._frame = window.document.createElement(\"iframe\"), this._frame.style.visibility = \"hidden\", this._frame.style.position = \"absolute\", this._frame.width = 0, this._frame.height = 0, window.document.body.appendChild(this._frame);\n }\n return t.prototype.navigate = function t(e) {\n if (e && e.url) {\n var r = e.silentRequestTimeout || 1e4;\n i.Log.debug(\"IFrameWindow.navigate: Using timeout of:\", r), this._timer = window.setTimeout(this._timeout.bind(this), r), this._frame.src = e.url;\n } else this._error(\"No url provided\");\n return this.promise;\n }, t.prototype._success = function t(e) {\n this._cleanup(), i.Log.debug(\"IFrameWindow: Successful response from frame window\"), this._resolve(e);\n }, t.prototype._error = function t(e) {\n this._cleanup(), i.Log.error(e), this._reject(new Error(e));\n }, t.prototype.close = function t() {\n this._cleanup();\n }, t.prototype._cleanup = function t() {\n this._frame && (i.Log.debug(\"IFrameWindow: cleanup\"), window.removeEventListener(\"message\", this._boundMessageEvent, !1), window.clearTimeout(this._timer), window.document.body.removeChild(this._frame), this._timer = null, this._frame = null, this._boundMessageEvent = null);\n }, t.prototype._timeout = function t() {\n i.Log.debug(\"IFrameWindow.timeout\"), this._error(\"Frame window timed out\");\n }, t.prototype._message = function t(e) {\n if (i.Log.debug(\"IFrameWindow.message\"), this._timer && e.origin === this._origin && e.source === this._frame.contentWindow && \"string\" == typeof e.data && (e.data.startsWith(\"http://\") || e.data.startsWith(\"https://\"))) {\n var r = e.data;\n r ? this._success({\n url: r\n }) : this._error(\"Invalid response from frame\");\n }\n }, t.notifyParent = function t(e) {\n i.Log.debug(\"IFrameWindow.notifyParent\"), (e = e || window.location.href) && (i.Log.debug(\"IFrameWindow.notifyParent: posting url message to parent\"), window.parent.postMessage(e, location.protocol + \"//\" + location.host));\n }, n(t, [{\n key: \"promise\",\n get: function t() {\n return this._promise;\n }\n }, {\n key: \"_origin\",\n get: function t() {\n return location.protocol + \"//\" + location.host;\n }\n }]), t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.UserManagerEvents = void 0;\n var n = r(0),\n i = r(16),\n o = r(17);\n e.UserManagerEvents = function (t) {\n function e(r) {\n !function n(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, e);\n var i = function s(t, e) {\n if (!t) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return !e || \"object\" != typeof e && \"function\" != typeof e ? t : e;\n }(this, t.call(this, r));\n return i._userLoaded = new o.Event(\"User loaded\"), i._userUnloaded = new o.Event(\"User unloaded\"), i._silentRenewError = new o.Event(\"Silent renew error\"), i._userSignedIn = new o.Event(\"User signed in\"), i._userSignedOut = new o.Event(\"User signed out\"), i._userSessionChanged = new o.Event(\"User session changed\"), i;\n }\n return function r(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function, not \" + typeof e);\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);\n }(e, t), e.prototype.load = function e(r) {\n var i = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];\n n.Log.debug(\"UserManagerEvents.load\"), t.prototype.load.call(this, r), i && this._userLoaded.raise(r);\n }, e.prototype.unload = function e() {\n n.Log.debug(\"UserManagerEvents.unload\"), t.prototype.unload.call(this), this._userUnloaded.raise();\n }, e.prototype.addUserLoaded = function t(e) {\n this._userLoaded.addHandler(e);\n }, e.prototype.removeUserLoaded = function t(e) {\n this._userLoaded.removeHandler(e);\n }, e.prototype.addUserUnloaded = function t(e) {\n this._userUnloaded.addHandler(e);\n }, e.prototype.removeUserUnloaded = function t(e) {\n this._userUnloaded.removeHandler(e);\n }, e.prototype.addSilentRenewError = function t(e) {\n this._silentRenewError.addHandler(e);\n }, e.prototype.removeSilentRenewError = function t(e) {\n this._silentRenewError.removeHandler(e);\n }, e.prototype._raiseSilentRenewError = function t(e) {\n n.Log.debug(\"UserManagerEvents._raiseSilentRenewError\", e.message), this._silentRenewError.raise(e);\n }, e.prototype.addUserSignedIn = function t(e) {\n this._userSignedIn.addHandler(e);\n }, e.prototype.removeUserSignedIn = function t(e) {\n this._userSignedIn.removeHandler(e);\n }, e.prototype._raiseUserSignedIn = function t() {\n n.Log.debug(\"UserManagerEvents._raiseUserSignedIn\"), this._userSignedIn.raise();\n }, e.prototype.addUserSignedOut = function t(e) {\n this._userSignedOut.addHandler(e);\n }, e.prototype.removeUserSignedOut = function t(e) {\n this._userSignedOut.removeHandler(e);\n }, e.prototype._raiseUserSignedOut = function t() {\n n.Log.debug(\"UserManagerEvents._raiseUserSignedOut\"), this._userSignedOut.raise();\n }, e.prototype.addUserSessionChanged = function t(e) {\n this._userSessionChanged.addHandler(e);\n }, e.prototype.removeUserSessionChanged = function t(e) {\n this._userSessionChanged.removeHandler(e);\n }, e.prototype._raiseUserSessionChanged = function t() {\n n.Log.debug(\"UserManagerEvents._raiseUserSessionChanged\"), this._userSessionChanged.raise();\n }, e;\n }(i.AccessTokenEvents);\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.Timer = void 0;\n var n = function () {\n function t(t, e) {\n for (var r = 0; r < e.length; r++) {\n var n = e[r];\n n.enumerable = n.enumerable || !1, n.configurable = !0, \"value\" in n && (n.writable = !0), Object.defineProperty(t, n.key, n);\n }\n }\n return function (e, r, n) {\n return r && t(e.prototype, r), n && t(e, n), e;\n };\n }(),\n i = r(0),\n o = r(1),\n s = r(17);\n function a(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }\n function u(t, e) {\n if (!t) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return !e || \"object\" != typeof e && \"function\" != typeof e ? t : e;\n }\n e.Timer = function (t) {\n function e(r) {\n var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : o.Global.timer,\n i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;\n a(this, e);\n var s = u(this, t.call(this, r));\n return s._timer = n, s._nowFunc = i || function () {\n return Date.now() / 1e3;\n }, s;\n }\n return function r(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function, not \" + typeof e);\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e);\n }(e, t), e.prototype.init = function t(e) {\n e <= 0 && (e = 1), e = parseInt(e);\n var r = this.now + e;\n if (this.expiration === r && this._timerHandle) i.Log.debug(\"Timer.init timer \" + this._name + \" skipping initialization since already initialized for expiration:\", this.expiration);else {\n this.cancel(), i.Log.debug(\"Timer.init timer \" + this._name + \" for duration:\", e), this._expiration = r;\n var n = 5;\n e < n && (n = e), this._timerHandle = this._timer.setInterval(this._callback.bind(this), 1e3 * n);\n }\n }, e.prototype.cancel = function t() {\n this._timerHandle && (i.Log.debug(\"Timer.cancel: \", this._name), this._timer.clearInterval(this._timerHandle), this._timerHandle = null);\n }, e.prototype._callback = function e() {\n var r = this._expiration - this.now;\n i.Log.debug(\"Timer.callback; \" + this._name + \" timer expires in:\", r), this._expiration <= this.now && (this.cancel(), t.prototype.raise.call(this));\n }, n(e, [{\n key: \"now\",\n get: function t() {\n return parseInt(this._nowFunc());\n }\n }, {\n key: \"expiration\",\n get: function t() {\n return this._expiration;\n }\n }]), e;\n }(s.Event);\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.SilentRenewService = void 0;\n var n = r(0);\n e.SilentRenewService = function () {\n function t(e) {\n !function r(t, e) {\n if (!(t instanceof e)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t), this._userManager = e;\n }\n return t.prototype.start = function t() {\n this._callback || (this._callback = this._tokenExpiring.bind(this), this._userManager.events.addAccessTokenExpiring(this._callback), this._userManager.getUser().then(function (t) {}).catch(function (t) {\n n.Log.error(\"SilentRenewService.start: Error from getUser:\", t.message);\n }));\n }, t.prototype.stop = function t() {\n this._callback && (this._userManager.events.removeAccessTokenExpiring(this._callback), delete this._callback);\n }, t.prototype._tokenExpiring = function t() {\n var e = this;\n this._userManager.signinSilent().then(function (t) {\n n.Log.debug(\"SilentRenewService._tokenExpiring: Silent token renewal successful\");\n }, function (t) {\n n.Log.error(\"SilentRenewService._tokenExpiring: Error from signinSilent:\", t.message), e._userManager.events._raiseSilentRenewError(t);\n });\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.CordovaPopupNavigator = void 0;\n var n = r(21);\n e.CordovaPopupNavigator = function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n }\n return t.prototype.prepare = function t(e) {\n var r = new n.CordovaPopupWindow(e);\n return Promise.resolve(r);\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.CordovaIFrameNavigator = void 0;\n var n = r(21);\n e.CordovaIFrameNavigator = function () {\n function t() {\n !function e(t, r) {\n if (!(t instanceof r)) throw new TypeError(\"Cannot call a class as a function\");\n }(this, t);\n }\n return t.prototype.prepare = function t(e) {\n e.popupWindowFeatures = \"hidden=yes\";\n var r = new n.CordovaPopupWindow(e);\n return Promise.resolve(r);\n }, t;\n }();\n }, function (t, e, r) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n e.Version = \"1.11.5\";\n }]);\n});","typeof navigator !== \"undefined\" && function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.lottie = factory());\n}(this, function () {\n 'use strict';\n\n var svgNS = 'http://www.w3.org/2000/svg';\n var locationHref = '';\n var _useWebWorker = false;\n var initialDefaultFrame = -999999;\n var setWebWorker = function setWebWorker(flag) {\n _useWebWorker = !!flag;\n };\n var getWebWorker = function getWebWorker() {\n return _useWebWorker;\n };\n var setLocationHref = function setLocationHref(value) {\n locationHref = value;\n };\n var getLocationHref = function getLocationHref() {\n return locationHref;\n };\n function createTag(type) {\n // return {appendChild:function(){},setAttribute:function(){},style:{}}\n return document.createElement(type);\n }\n function extendPrototype(sources, destination) {\n var i;\n var len = sources.length;\n var sourcePrototype;\n for (i = 0; i < len; i += 1) {\n sourcePrototype = sources[i].prototype;\n for (var attr in sourcePrototype) {\n if (Object.prototype.hasOwnProperty.call(sourcePrototype, attr)) destination.prototype[attr] = sourcePrototype[attr];\n }\n }\n }\n function getDescriptor(object, prop) {\n return Object.getOwnPropertyDescriptor(object, prop);\n }\n function createProxyFunction(prototype) {\n function ProxyFunction() {}\n ProxyFunction.prototype = prototype;\n return ProxyFunction;\n }\n\n // import Howl from '../../3rd_party/howler';\n var audioControllerFactory = function () {\n function AudioController(audioFactory) {\n this.audios = [];\n this.audioFactory = audioFactory;\n this._volume = 1;\n this._isMuted = false;\n }\n AudioController.prototype = {\n addAudio: function addAudio(audio) {\n this.audios.push(audio);\n },\n pause: function pause() {\n var i;\n var len = this.audios.length;\n for (i = 0; i < len; i += 1) {\n this.audios[i].pause();\n }\n },\n resume: function resume() {\n var i;\n var len = this.audios.length;\n for (i = 0; i < len; i += 1) {\n this.audios[i].resume();\n }\n },\n setRate: function setRate(rateValue) {\n var i;\n var len = this.audios.length;\n for (i = 0; i < len; i += 1) {\n this.audios[i].setRate(rateValue);\n }\n },\n createAudio: function createAudio(assetPath) {\n if (this.audioFactory) {\n return this.audioFactory(assetPath);\n }\n if (window.Howl) {\n return new window.Howl({\n src: [assetPath]\n });\n }\n return {\n isPlaying: false,\n play: function play() {\n this.isPlaying = true;\n },\n seek: function seek() {\n this.isPlaying = false;\n },\n playing: function playing() {},\n rate: function rate() {},\n setVolume: function setVolume() {}\n };\n },\n setAudioFactory: function setAudioFactory(audioFactory) {\n this.audioFactory = audioFactory;\n },\n setVolume: function setVolume(value) {\n this._volume = value;\n this._updateVolume();\n },\n mute: function mute() {\n this._isMuted = true;\n this._updateVolume();\n },\n unmute: function unmute() {\n this._isMuted = false;\n this._updateVolume();\n },\n getVolume: function getVolume() {\n return this._volume;\n },\n _updateVolume: function _updateVolume() {\n var i;\n var len = this.audios.length;\n for (i = 0; i < len; i += 1) {\n this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1));\n }\n }\n };\n return function () {\n return new AudioController();\n };\n }();\n var createTypedArray = function () {\n function createRegularArray(type, len) {\n var i = 0;\n var arr = [];\n var value;\n switch (type) {\n case 'int16':\n case 'uint8c':\n value = 1;\n break;\n default:\n value = 1.1;\n break;\n }\n for (i = 0; i < len; i += 1) {\n arr.push(value);\n }\n return arr;\n }\n function createTypedArrayFactory(type, len) {\n if (type === 'float32') {\n return new Float32Array(len);\n }\n if (type === 'int16') {\n return new Int16Array(len);\n }\n if (type === 'uint8c') {\n return new Uint8ClampedArray(len);\n }\n return createRegularArray(type, len);\n }\n if (typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {\n return createTypedArrayFactory;\n }\n return createRegularArray;\n }();\n function createSizedArray(len) {\n return Array.apply(null, {\n length: len\n });\n }\n function _typeof$6(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof$6 = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof$6 = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof$6(obj);\n }\n var subframeEnabled = true;\n var expressionsPlugin = null;\n var expressionsInterfaces = null;\n var idPrefix$1 = '';\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n var _shouldRoundValues = false;\n var bmPow = Math.pow;\n var bmSqrt = Math.sqrt;\n var bmFloor = Math.floor;\n var bmMax = Math.max;\n var bmMin = Math.min;\n var BMMath = {};\n (function () {\n var propertyNames = ['abs', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh', 'atan2', 'ceil', 'cbrt', 'expm1', 'clz32', 'cos', 'cosh', 'exp', 'floor', 'fround', 'hypot', 'imul', 'log', 'log1p', 'log2', 'log10', 'max', 'min', 'pow', 'random', 'round', 'sign', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'E', 'LN10', 'LN2', 'LOG10E', 'LOG2E', 'PI', 'SQRT1_2', 'SQRT2'];\n var i;\n var len = propertyNames.length;\n for (i = 0; i < len; i += 1) {\n BMMath[propertyNames[i]] = Math[propertyNames[i]];\n }\n })();\n function ProjectInterface$1() {\n return {};\n }\n BMMath.random = Math.random;\n BMMath.abs = function (val) {\n var tOfVal = _typeof$6(val);\n if (tOfVal === 'object' && val.length) {\n var absArr = createSizedArray(val.length);\n var i;\n var len = val.length;\n for (i = 0; i < len; i += 1) {\n absArr[i] = Math.abs(val[i]);\n }\n return absArr;\n }\n return Math.abs(val);\n };\n var defaultCurveSegments = 150;\n var degToRads = Math.PI / 180;\n var roundCorner = 0.5519;\n function roundValues(flag) {\n _shouldRoundValues = !!flag;\n }\n function bmRnd(value) {\n if (_shouldRoundValues) {\n return Math.round(value);\n }\n return value;\n }\n function styleDiv(element) {\n element.style.position = 'absolute';\n element.style.top = 0;\n element.style.left = 0;\n element.style.display = 'block';\n element.style.transformOrigin = '0 0';\n element.style.webkitTransformOrigin = '0 0';\n element.style.backfaceVisibility = 'visible';\n element.style.webkitBackfaceVisibility = 'visible';\n element.style.transformStyle = 'preserve-3d';\n element.style.webkitTransformStyle = 'preserve-3d';\n element.style.mozTransformStyle = 'preserve-3d';\n }\n function BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) {\n this.type = type;\n this.currentTime = currentTime;\n this.totalTime = totalTime;\n this.direction = frameMultiplier < 0 ? -1 : 1;\n }\n function BMCompleteEvent(type, frameMultiplier) {\n this.type = type;\n this.direction = frameMultiplier < 0 ? -1 : 1;\n }\n function BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) {\n this.type = type;\n this.currentLoop = currentLoop;\n this.totalLoops = totalLoops;\n this.direction = frameMultiplier < 0 ? -1 : 1;\n }\n function BMSegmentStartEvent(type, firstFrame, totalFrames) {\n this.type = type;\n this.firstFrame = firstFrame;\n this.totalFrames = totalFrames;\n }\n function BMDestroyEvent(type, target) {\n this.type = type;\n this.target = target;\n }\n function BMRenderFrameErrorEvent(nativeError, currentTime) {\n this.type = 'renderFrameError';\n this.nativeError = nativeError;\n this.currentTime = currentTime;\n }\n function BMConfigErrorEvent(nativeError) {\n this.type = 'configError';\n this.nativeError = nativeError;\n }\n function BMAnimationConfigErrorEvent(type, nativeError) {\n this.type = type;\n this.nativeError = nativeError;\n }\n var createElementID = function () {\n var _count = 0;\n return function createID() {\n _count += 1;\n return idPrefix$1 + '__lottie_element_' + _count;\n };\n }();\n function HSVtoRGB(h, s, v) {\n var r;\n var g;\n var b;\n var i;\n var f;\n var p;\n var q;\n var t;\n i = Math.floor(h * 6);\n f = h * 6 - i;\n p = v * (1 - s);\n q = v * (1 - f * s);\n t = v * (1 - (1 - f) * s);\n switch (i % 6) {\n case 0:\n r = v;\n g = t;\n b = p;\n break;\n case 1:\n r = q;\n g = v;\n b = p;\n break;\n case 2:\n r = p;\n g = v;\n b = t;\n break;\n case 3:\n r = p;\n g = q;\n b = v;\n break;\n case 4:\n r = t;\n g = p;\n b = v;\n break;\n case 5:\n r = v;\n g = p;\n b = q;\n break;\n default:\n break;\n }\n return [r, g, b];\n }\n function RGBtoHSV(r, g, b) {\n var max = Math.max(r, g, b);\n var min = Math.min(r, g, b);\n var d = max - min;\n var h;\n var s = max === 0 ? 0 : d / max;\n var v = max / 255;\n switch (max) {\n case min:\n h = 0;\n break;\n case r:\n h = g - b + d * (g < b ? 6 : 0);\n h /= 6 * d;\n break;\n case g:\n h = b - r + d * 2;\n h /= 6 * d;\n break;\n case b:\n h = r - g + d * 4;\n h /= 6 * d;\n break;\n default:\n break;\n }\n return [h, s, v];\n }\n function addSaturationToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\n hsv[1] += offset;\n if (hsv[1] > 1) {\n hsv[1] = 1;\n } else if (hsv[1] <= 0) {\n hsv[1] = 0;\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\n }\n function addBrightnessToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\n hsv[2] += offset;\n if (hsv[2] > 1) {\n hsv[2] = 1;\n } else if (hsv[2] < 0) {\n hsv[2] = 0;\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\n }\n function addHueToRGB(color, offset) {\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\n hsv[0] += offset / 360;\n if (hsv[0] > 1) {\n hsv[0] -= 1;\n } else if (hsv[0] < 0) {\n hsv[0] += 1;\n }\n return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\n }\n var rgbToHex = function () {\n var colorMap = [];\n var i;\n var hex;\n for (i = 0; i < 256; i += 1) {\n hex = i.toString(16);\n colorMap[i] = hex.length === 1 ? '0' + hex : hex;\n }\n return function (r, g, b) {\n if (r < 0) {\n r = 0;\n }\n if (g < 0) {\n g = 0;\n }\n if (b < 0) {\n b = 0;\n }\n return '#' + colorMap[r] + colorMap[g] + colorMap[b];\n };\n }();\n var setSubframeEnabled = function setSubframeEnabled(flag) {\n subframeEnabled = !!flag;\n };\n var getSubframeEnabled = function getSubframeEnabled() {\n return subframeEnabled;\n };\n var setExpressionsPlugin = function setExpressionsPlugin(value) {\n expressionsPlugin = value;\n };\n var getExpressionsPlugin = function getExpressionsPlugin() {\n return expressionsPlugin;\n };\n var setExpressionInterfaces = function setExpressionInterfaces(value) {\n expressionsInterfaces = value;\n };\n var getExpressionInterfaces = function getExpressionInterfaces() {\n return expressionsInterfaces;\n };\n var setDefaultCurveSegments = function setDefaultCurveSegments(value) {\n defaultCurveSegments = value;\n };\n var getDefaultCurveSegments = function getDefaultCurveSegments() {\n return defaultCurveSegments;\n };\n var setIdPrefix = function setIdPrefix(value) {\n idPrefix$1 = value;\n };\n var getIdPrefix = function getIdPrefix() {\n return idPrefix$1;\n };\n function createNS(type) {\n // return {appendChild:function(){},setAttribute:function(){},style:{}}\n return document.createElementNS(svgNS, type);\n }\n function _typeof$5(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof$5 = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof$5 = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof$5(obj);\n }\n var dataManager = function () {\n var _counterId = 1;\n var processes = [];\n var workerFn;\n var workerInstance;\n var workerProxy = {\n onmessage: function onmessage() {},\n postMessage: function postMessage(path) {\n workerFn({\n data: path\n });\n }\n };\n var _workerSelf = {\n postMessage: function postMessage(data) {\n workerProxy.onmessage({\n data: data\n });\n }\n };\n function createWorker(fn) {\n if (window.Worker && window.Blob && getWebWorker()) {\n var blob = new Blob(['var _workerSelf = self; self.onmessage = ', fn.toString()], {\n type: 'text/javascript'\n }); // var blob = new Blob(['self.onmessage = ', fn.toString()], { type: 'text/javascript' });\n\n var url = URL.createObjectURL(blob);\n return new Worker(url);\n }\n workerFn = fn;\n return workerProxy;\n }\n function setupWorker() {\n if (!workerInstance) {\n workerInstance = createWorker(function workerStart(e) {\n function dataFunctionManager() {\n function completeLayers(layers, comps) {\n var layerData;\n var i;\n var len = layers.length;\n var j;\n var jLen;\n var k;\n var kLen;\n for (i = 0; i < len; i += 1) {\n layerData = layers[i];\n if ('ks' in layerData && !layerData.completed) {\n layerData.completed = true;\n if (layerData.hasMask) {\n var maskProps = layerData.masksProperties;\n jLen = maskProps.length;\n for (j = 0; j < jLen; j += 1) {\n if (maskProps[j].pt.k.i) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k);\n } else {\n kLen = maskProps[j].pt.k.length;\n for (k = 0; k < kLen; k += 1) {\n if (maskProps[j].pt.k[k].s) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]);\n }\n if (maskProps[j].pt.k[k].e) {\n convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]);\n }\n }\n }\n }\n }\n if (layerData.ty === 0) {\n layerData.layers = findCompLayers(layerData.refId, comps);\n completeLayers(layerData.layers, comps);\n } else if (layerData.ty === 4) {\n completeShapes(layerData.shapes);\n } else if (layerData.ty === 5) {\n completeText(layerData);\n }\n }\n }\n }\n function completeChars(chars, assets) {\n if (chars) {\n var i = 0;\n var len = chars.length;\n for (i = 0; i < len; i += 1) {\n if (chars[i].t === 1) {\n // var compData = findComp(chars[i].data.refId, assets);\n chars[i].data.layers = findCompLayers(chars[i].data.refId, assets); // chars[i].data.ip = 0;\n // chars[i].data.op = 99999;\n // chars[i].data.st = 0;\n // chars[i].data.sr = 1;\n // chars[i].w = compData.w;\n // chars[i].data.ks = {\n // a: { k: [0, 0, 0], a: 0 },\n // p: { k: [0, -compData.h, 0], a: 0 },\n // r: { k: 0, a: 0 },\n // s: { k: [100, 100], a: 0 },\n // o: { k: 100, a: 0 },\n // };\n\n completeLayers(chars[i].data.layers, assets);\n }\n }\n }\n }\n function findComp(id, comps) {\n var i = 0;\n var len = comps.length;\n while (i < len) {\n if (comps[i].id === id) {\n return comps[i];\n }\n i += 1;\n }\n return null;\n }\n function findCompLayers(id, comps) {\n var comp = findComp(id, comps);\n if (comp) {\n if (!comp.layers.__used) {\n comp.layers.__used = true;\n return comp.layers;\n }\n return JSON.parse(JSON.stringify(comp.layers));\n }\n return null;\n }\n function completeShapes(arr) {\n var i;\n var len = arr.length;\n var j;\n var jLen;\n for (i = len - 1; i >= 0; i -= 1) {\n if (arr[i].ty === 'sh') {\n if (arr[i].ks.k.i) {\n convertPathsToAbsoluteValues(arr[i].ks.k);\n } else {\n jLen = arr[i].ks.k.length;\n for (j = 0; j < jLen; j += 1) {\n if (arr[i].ks.k[j].s) {\n convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]);\n }\n if (arr[i].ks.k[j].e) {\n convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]);\n }\n }\n }\n } else if (arr[i].ty === 'gr') {\n completeShapes(arr[i].it);\n }\n }\n }\n function convertPathsToAbsoluteValues(path) {\n var i;\n var len = path.i.length;\n for (i = 0; i < len; i += 1) {\n path.i[i][0] += path.v[i][0];\n path.i[i][1] += path.v[i][1];\n path.o[i][0] += path.v[i][0];\n path.o[i][1] += path.v[i][1];\n }\n }\n function checkVersion(minimum, animVersionString) {\n var animVersion = animVersionString ? animVersionString.split('.') : [100, 100, 100];\n if (minimum[0] > animVersion[0]) {\n return true;\n }\n if (animVersion[0] > minimum[0]) {\n return false;\n }\n if (minimum[1] > animVersion[1]) {\n return true;\n }\n if (animVersion[1] > minimum[1]) {\n return false;\n }\n if (minimum[2] > animVersion[2]) {\n return true;\n }\n if (animVersion[2] > minimum[2]) {\n return false;\n }\n return null;\n }\n var checkText = function () {\n var minimumVersion = [4, 4, 14];\n function updateTextLayer(textLayer) {\n var documentData = textLayer.t.d;\n textLayer.t.d = {\n k: [{\n s: documentData,\n t: 0\n }]\n };\n }\n function iterateLayers(layers) {\n var i;\n var len = layers.length;\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 5) {\n updateTextLayer(layers[i]);\n }\n }\n }\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers);\n if (animationData.assets) {\n var i;\n var len = animationData.assets.length;\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers);\n }\n }\n }\n }\n };\n }();\n var checkChars = function () {\n var minimumVersion = [4, 7, 99];\n return function (animationData) {\n if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) {\n var i;\n var len = animationData.chars.length;\n for (i = 0; i < len; i += 1) {\n var charData = animationData.chars[i];\n if (charData.data && charData.data.shapes) {\n completeShapes(charData.data.shapes);\n charData.data.ip = 0;\n charData.data.op = 99999;\n charData.data.st = 0;\n charData.data.sr = 1;\n charData.data.ks = {\n p: {\n k: [0, 0],\n a: 0\n },\n s: {\n k: [100, 100],\n a: 0\n },\n a: {\n k: [0, 0],\n a: 0\n },\n r: {\n k: 0,\n a: 0\n },\n o: {\n k: 100,\n a: 0\n }\n };\n if (!animationData.chars[i].t) {\n charData.data.shapes.push({\n ty: 'no'\n });\n charData.data.shapes[0].it.push({\n p: {\n k: [0, 0],\n a: 0\n },\n s: {\n k: [100, 100],\n a: 0\n },\n a: {\n k: [0, 0],\n a: 0\n },\n r: {\n k: 0,\n a: 0\n },\n o: {\n k: 100,\n a: 0\n },\n sk: {\n k: 0,\n a: 0\n },\n sa: {\n k: 0,\n a: 0\n },\n ty: 'tr'\n });\n }\n }\n }\n }\n };\n }();\n var checkPathProperties = function () {\n var minimumVersion = [5, 7, 15];\n function updateTextLayer(textLayer) {\n var pathData = textLayer.t.p;\n if (typeof pathData.a === 'number') {\n pathData.a = {\n a: 0,\n k: pathData.a\n };\n }\n if (typeof pathData.p === 'number') {\n pathData.p = {\n a: 0,\n k: pathData.p\n };\n }\n if (typeof pathData.r === 'number') {\n pathData.r = {\n a: 0,\n k: pathData.r\n };\n }\n }\n function iterateLayers(layers) {\n var i;\n var len = layers.length;\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 5) {\n updateTextLayer(layers[i]);\n }\n }\n }\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers);\n if (animationData.assets) {\n var i;\n var len = animationData.assets.length;\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers);\n }\n }\n }\n }\n };\n }();\n var checkColors = function () {\n var minimumVersion = [4, 1, 9];\n function iterateShapes(shapes) {\n var i;\n var len = shapes.length;\n var j;\n var jLen;\n for (i = 0; i < len; i += 1) {\n if (shapes[i].ty === 'gr') {\n iterateShapes(shapes[i].it);\n } else if (shapes[i].ty === 'fl' || shapes[i].ty === 'st') {\n if (shapes[i].c.k && shapes[i].c.k[0].i) {\n jLen = shapes[i].c.k.length;\n for (j = 0; j < jLen; j += 1) {\n if (shapes[i].c.k[j].s) {\n shapes[i].c.k[j].s[0] /= 255;\n shapes[i].c.k[j].s[1] /= 255;\n shapes[i].c.k[j].s[2] /= 255;\n shapes[i].c.k[j].s[3] /= 255;\n }\n if (shapes[i].c.k[j].e) {\n shapes[i].c.k[j].e[0] /= 255;\n shapes[i].c.k[j].e[1] /= 255;\n shapes[i].c.k[j].e[2] /= 255;\n shapes[i].c.k[j].e[3] /= 255;\n }\n }\n } else {\n shapes[i].c.k[0] /= 255;\n shapes[i].c.k[1] /= 255;\n shapes[i].c.k[2] /= 255;\n shapes[i].c.k[3] /= 255;\n }\n }\n }\n }\n function iterateLayers(layers) {\n var i;\n var len = layers.length;\n for (i = 0; i < len; i += 1) {\n if (layers[i].ty === 4) {\n iterateShapes(layers[i].shapes);\n }\n }\n }\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers);\n if (animationData.assets) {\n var i;\n var len = animationData.assets.length;\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers);\n }\n }\n }\n }\n };\n }();\n var checkShapes = function () {\n var minimumVersion = [4, 4, 18];\n function completeClosingShapes(arr) {\n var i;\n var len = arr.length;\n var j;\n var jLen;\n for (i = len - 1; i >= 0; i -= 1) {\n if (arr[i].ty === 'sh') {\n if (arr[i].ks.k.i) {\n arr[i].ks.k.c = arr[i].closed;\n } else {\n jLen = arr[i].ks.k.length;\n for (j = 0; j < jLen; j += 1) {\n if (arr[i].ks.k[j].s) {\n arr[i].ks.k[j].s[0].c = arr[i].closed;\n }\n if (arr[i].ks.k[j].e) {\n arr[i].ks.k[j].e[0].c = arr[i].closed;\n }\n }\n }\n } else if (arr[i].ty === 'gr') {\n completeClosingShapes(arr[i].it);\n }\n }\n }\n function iterateLayers(layers) {\n var layerData;\n var i;\n var len = layers.length;\n var j;\n var jLen;\n var k;\n var kLen;\n for (i = 0; i < len; i += 1) {\n layerData = layers[i];\n if (layerData.hasMask) {\n var maskProps = layerData.masksProperties;\n jLen = maskProps.length;\n for (j = 0; j < jLen; j += 1) {\n if (maskProps[j].pt.k.i) {\n maskProps[j].pt.k.c = maskProps[j].cl;\n } else {\n kLen = maskProps[j].pt.k.length;\n for (k = 0; k < kLen; k += 1) {\n if (maskProps[j].pt.k[k].s) {\n maskProps[j].pt.k[k].s[0].c = maskProps[j].cl;\n }\n if (maskProps[j].pt.k[k].e) {\n maskProps[j].pt.k[k].e[0].c = maskProps[j].cl;\n }\n }\n }\n }\n }\n if (layerData.ty === 4) {\n completeClosingShapes(layerData.shapes);\n }\n }\n }\n return function (animationData) {\n if (checkVersion(minimumVersion, animationData.v)) {\n iterateLayers(animationData.layers);\n if (animationData.assets) {\n var i;\n var len = animationData.assets.length;\n for (i = 0; i < len; i += 1) {\n if (animationData.assets[i].layers) {\n iterateLayers(animationData.assets[i].layers);\n }\n }\n }\n }\n };\n }();\n function completeData(animationData) {\n if (animationData.__complete) {\n return;\n }\n checkColors(animationData);\n checkText(animationData);\n checkChars(animationData);\n checkPathProperties(animationData);\n checkShapes(animationData);\n completeLayers(animationData.layers, animationData.assets);\n completeChars(animationData.chars, animationData.assets);\n animationData.__complete = true;\n }\n function completeText(data) {\n if (data.t.a.length === 0 && !('m' in data.t.p)) {// data.singleShape = true;\n }\n }\n var moduleOb = {};\n moduleOb.completeData = completeData;\n moduleOb.checkColors = checkColors;\n moduleOb.checkChars = checkChars;\n moduleOb.checkPathProperties = checkPathProperties;\n moduleOb.checkShapes = checkShapes;\n moduleOb.completeLayers = completeLayers;\n return moduleOb;\n }\n if (!_workerSelf.dataManager) {\n _workerSelf.dataManager = dataFunctionManager();\n }\n if (!_workerSelf.assetLoader) {\n _workerSelf.assetLoader = function () {\n function formatResponse(xhr) {\n // using typeof doubles the time of execution of this method,\n // so if available, it's better to use the header to validate the type\n var contentTypeHeader = xhr.getResponseHeader('content-type');\n if (contentTypeHeader && xhr.responseType === 'json' && contentTypeHeader.indexOf('json') !== -1) {\n return xhr.response;\n }\n if (xhr.response && _typeof$5(xhr.response) === 'object') {\n return xhr.response;\n }\n if (xhr.response && typeof xhr.response === 'string') {\n return JSON.parse(xhr.response);\n }\n if (xhr.responseText) {\n return JSON.parse(xhr.responseText);\n }\n return null;\n }\n function loadAsset(path, fullPath, callback, errorCallback) {\n var response;\n var xhr = new XMLHttpRequest(); // set responseType after calling open or IE will break.\n\n try {\n // This crashes on Android WebView prior to KitKat\n xhr.responseType = 'json';\n } catch (err) {} // eslint-disable-line no-empty\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n response = formatResponse(xhr);\n callback(response);\n } else {\n try {\n response = formatResponse(xhr);\n callback(response);\n } catch (err) {\n if (errorCallback) {\n errorCallback(err);\n }\n }\n }\n }\n };\n try {\n // Hack to workaround banner validation\n xhr.open(['G', 'E', 'T'].join(''), path, true);\n } catch (error) {\n // Hack to workaround banner validation\n xhr.open(['G', 'E', 'T'].join(''), fullPath + '/' + path, true);\n }\n xhr.send();\n }\n return {\n load: loadAsset\n };\n }();\n }\n if (e.data.type === 'loadAnimation') {\n _workerSelf.assetLoader.load(e.data.path, e.data.fullPath, function (data) {\n _workerSelf.dataManager.completeData(data);\n _workerSelf.postMessage({\n id: e.data.id,\n payload: data,\n status: 'success'\n });\n }, function () {\n _workerSelf.postMessage({\n id: e.data.id,\n status: 'error'\n });\n });\n } else if (e.data.type === 'complete') {\n var animation = e.data.animation;\n _workerSelf.dataManager.completeData(animation);\n _workerSelf.postMessage({\n id: e.data.id,\n payload: animation,\n status: 'success'\n });\n } else if (e.data.type === 'loadData') {\n _workerSelf.assetLoader.load(e.data.path, e.data.fullPath, function (data) {\n _workerSelf.postMessage({\n id: e.data.id,\n payload: data,\n status: 'success'\n });\n }, function () {\n _workerSelf.postMessage({\n id: e.data.id,\n status: 'error'\n });\n });\n }\n });\n workerInstance.onmessage = function (event) {\n var data = event.data;\n var id = data.id;\n var process = processes[id];\n processes[id] = null;\n if (data.status === 'success') {\n process.onComplete(data.payload);\n } else if (process.onError) {\n process.onError();\n }\n };\n }\n }\n function createProcess(onComplete, onError) {\n _counterId += 1;\n var id = 'processId_' + _counterId;\n processes[id] = {\n onComplete: onComplete,\n onError: onError\n };\n return id;\n }\n function loadAnimation(path, onComplete, onError) {\n setupWorker();\n var processId = createProcess(onComplete, onError);\n workerInstance.postMessage({\n type: 'loadAnimation',\n path: path,\n fullPath: window.location.origin + window.location.pathname,\n id: processId\n });\n }\n function loadData(path, onComplete, onError) {\n setupWorker();\n var processId = createProcess(onComplete, onError);\n workerInstance.postMessage({\n type: 'loadData',\n path: path,\n fullPath: window.location.origin + window.location.pathname,\n id: processId\n });\n }\n function completeAnimation(anim, onComplete, onError) {\n setupWorker();\n var processId = createProcess(onComplete, onError);\n workerInstance.postMessage({\n type: 'complete',\n animation: anim,\n id: processId\n });\n }\n return {\n loadAnimation: loadAnimation,\n loadData: loadData,\n completeAnimation: completeAnimation\n };\n }();\n var ImagePreloader = function () {\n var proxyImage = function () {\n var canvas = createTag('canvas');\n canvas.width = 1;\n canvas.height = 1;\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = 'rgba(0,0,0,0)';\n ctx.fillRect(0, 0, 1, 1);\n return canvas;\n }();\n function imageLoaded() {\n this.loadedAssets += 1;\n if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\n if (this.imagesLoadedCb) {\n this.imagesLoadedCb(null);\n }\n }\n }\n function footageLoaded() {\n this.loadedFootagesCount += 1;\n if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\n if (this.imagesLoadedCb) {\n this.imagesLoadedCb(null);\n }\n }\n }\n function getAssetsPath(assetData, assetsPath, originalPath) {\n var path = '';\n if (assetData.e) {\n path = assetData.p;\n } else if (assetsPath) {\n var imagePath = assetData.p;\n if (imagePath.indexOf('images/') !== -1) {\n imagePath = imagePath.split('/')[1];\n }\n path = assetsPath + imagePath;\n } else {\n path = originalPath;\n path += assetData.u ? assetData.u : '';\n path += assetData.p;\n }\n return path;\n }\n function testImageLoaded(img) {\n var _count = 0;\n var intervalId = setInterval(function () {\n var box = img.getBBox();\n if (box.width || _count > 500) {\n this._imageLoaded();\n clearInterval(intervalId);\n }\n _count += 1;\n }.bind(this), 50);\n }\n function createImageData(assetData) {\n var path = getAssetsPath(assetData, this.assetsPath, this.path);\n var img = createNS('image');\n if (isSafari) {\n this.testImageLoaded(img);\n } else {\n img.addEventListener('load', this._imageLoaded, false);\n }\n img.addEventListener('error', function () {\n ob.img = proxyImage;\n this._imageLoaded();\n }.bind(this), false);\n img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);\n if (this._elementHelper.append) {\n this._elementHelper.append(img);\n } else {\n this._elementHelper.appendChild(img);\n }\n var ob = {\n img: img,\n assetData: assetData\n };\n return ob;\n }\n function createImgData(assetData) {\n var path = getAssetsPath(assetData, this.assetsPath, this.path);\n var img = createTag('img');\n img.crossOrigin = 'anonymous';\n img.addEventListener('load', this._imageLoaded, false);\n img.addEventListener('error', function () {\n ob.img = proxyImage;\n this._imageLoaded();\n }.bind(this), false);\n img.src = path;\n var ob = {\n img: img,\n assetData: assetData\n };\n return ob;\n }\n function createFootageData(data) {\n var ob = {\n assetData: data\n };\n var path = getAssetsPath(data, this.assetsPath, this.path);\n dataManager.loadData(path, function (footageData) {\n ob.img = footageData;\n this._footageLoaded();\n }.bind(this), function () {\n ob.img = {};\n this._footageLoaded();\n }.bind(this));\n return ob;\n }\n function loadAssets(assets, cb) {\n this.imagesLoadedCb = cb;\n var i;\n var len = assets.length;\n for (i = 0; i < len; i += 1) {\n if (!assets[i].layers) {\n if (!assets[i].t || assets[i].t === 'seq') {\n this.totalImages += 1;\n this.images.push(this._createImageData(assets[i]));\n } else if (assets[i].t === 3) {\n this.totalFootages += 1;\n this.images.push(this.createFootageData(assets[i]));\n }\n }\n }\n }\n function setPath(path) {\n this.path = path || '';\n }\n function setAssetsPath(path) {\n this.assetsPath = path || '';\n }\n function getAsset(assetData) {\n var i = 0;\n var len = this.images.length;\n while (i < len) {\n if (this.images[i].assetData === assetData) {\n return this.images[i].img;\n }\n i += 1;\n }\n return null;\n }\n function destroy() {\n this.imagesLoadedCb = null;\n this.images.length = 0;\n }\n function loadedImages() {\n return this.totalImages === this.loadedAssets;\n }\n function loadedFootages() {\n return this.totalFootages === this.loadedFootagesCount;\n }\n function setCacheType(type, elementHelper) {\n if (type === 'svg') {\n this._elementHelper = elementHelper;\n this._createImageData = this.createImageData.bind(this);\n } else {\n this._createImageData = this.createImgData.bind(this);\n }\n }\n function ImagePreloaderFactory() {\n this._imageLoaded = imageLoaded.bind(this);\n this._footageLoaded = footageLoaded.bind(this);\n this.testImageLoaded = testImageLoaded.bind(this);\n this.createFootageData = createFootageData.bind(this);\n this.assetsPath = '';\n this.path = '';\n this.totalImages = 0;\n this.totalFootages = 0;\n this.loadedAssets = 0;\n this.loadedFootagesCount = 0;\n this.imagesLoadedCb = null;\n this.images = [];\n }\n ImagePreloaderFactory.prototype = {\n loadAssets: loadAssets,\n setAssetsPath: setAssetsPath,\n setPath: setPath,\n loadedImages: loadedImages,\n loadedFootages: loadedFootages,\n destroy: destroy,\n getAsset: getAsset,\n createImgData: createImgData,\n createImageData: createImageData,\n imageLoaded: imageLoaded,\n footageLoaded: footageLoaded,\n setCacheType: setCacheType\n };\n return ImagePreloaderFactory;\n }();\n function BaseEvent() {}\n BaseEvent.prototype = {\n triggerEvent: function triggerEvent(eventName, args) {\n if (this._cbs[eventName]) {\n var callbacks = this._cbs[eventName];\n for (var i = 0; i < callbacks.length; i += 1) {\n callbacks[i](args);\n }\n }\n },\n addEventListener: function addEventListener(eventName, callback) {\n if (!this._cbs[eventName]) {\n this._cbs[eventName] = [];\n }\n this._cbs[eventName].push(callback);\n return function () {\n this.removeEventListener(eventName, callback);\n }.bind(this);\n },\n removeEventListener: function removeEventListener(eventName, callback) {\n if (!callback) {\n this._cbs[eventName] = null;\n } else if (this._cbs[eventName]) {\n var i = 0;\n var len = this._cbs[eventName].length;\n while (i < len) {\n if (this._cbs[eventName][i] === callback) {\n this._cbs[eventName].splice(i, 1);\n i -= 1;\n len -= 1;\n }\n i += 1;\n }\n if (!this._cbs[eventName].length) {\n this._cbs[eventName] = null;\n }\n }\n }\n };\n var markerParser = function () {\n function parsePayloadLines(payload) {\n var lines = payload.split('\\r\\n');\n var keys = {};\n var line;\n var keysCount = 0;\n for (var i = 0; i < lines.length; i += 1) {\n line = lines[i].split(':');\n if (line.length === 2) {\n keys[line[0]] = line[1].trim();\n keysCount += 1;\n }\n }\n if (keysCount === 0) {\n throw new Error();\n }\n return keys;\n }\n return function (_markers) {\n var markers = [];\n for (var i = 0; i < _markers.length; i += 1) {\n var _marker = _markers[i];\n var markerData = {\n time: _marker.tm,\n duration: _marker.dr\n };\n try {\n markerData.payload = JSON.parse(_markers[i].cm);\n } catch (_) {\n try {\n markerData.payload = parsePayloadLines(_markers[i].cm);\n } catch (__) {\n markerData.payload = {\n name: _markers[i].cm\n };\n }\n }\n markers.push(markerData);\n }\n return markers;\n };\n }();\n var ProjectInterface = function () {\n function registerComposition(comp) {\n this.compositions.push(comp);\n }\n return function () {\n function _thisProjectFunction(name) {\n var i = 0;\n var len = this.compositions.length;\n while (i < len) {\n if (this.compositions[i].data && this.compositions[i].data.nm === name) {\n if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) {\n this.compositions[i].prepareFrame(this.currentFrame);\n }\n return this.compositions[i].compInterface;\n }\n i += 1;\n }\n return null;\n }\n _thisProjectFunction.compositions = [];\n _thisProjectFunction.currentFrame = 0;\n _thisProjectFunction.registerComposition = registerComposition;\n return _thisProjectFunction;\n };\n }();\n var renderers = {};\n var registerRenderer = function registerRenderer(key, value) {\n renderers[key] = value;\n };\n function getRenderer(key) {\n return renderers[key];\n }\n function getRegisteredRenderer() {\n // Returns canvas by default for compatibility\n if (renderers.canvas) {\n return 'canvas';\n } // Returns any renderer that is registered\n\n for (var key in renderers) {\n if (renderers[key]) {\n return key;\n }\n }\n return '';\n }\n function _typeof$4(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof$4 = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof$4 = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof$4(obj);\n }\n var AnimationItem = function AnimationItem() {\n this._cbs = [];\n this.name = '';\n this.path = '';\n this.isLoaded = false;\n this.currentFrame = 0;\n this.currentRawFrame = 0;\n this.firstFrame = 0;\n this.totalFrames = 0;\n this.frameRate = 0;\n this.frameMult = 0;\n this.playSpeed = 1;\n this.playDirection = 1;\n this.playCount = 0;\n this.animationData = {};\n this.assets = [];\n this.isPaused = true;\n this.autoplay = false;\n this.loop = true;\n this.renderer = null;\n this.animationID = createElementID();\n this.assetsPath = '';\n this.timeCompleted = 0;\n this.segmentPos = 0;\n this.isSubframeEnabled = getSubframeEnabled();\n this.segments = [];\n this._idle = true;\n this._completedLoop = false;\n this.projectInterface = ProjectInterface();\n this.imagePreloader = new ImagePreloader();\n this.audioController = audioControllerFactory();\n this.markers = [];\n this.configAnimation = this.configAnimation.bind(this);\n this.onSetupError = this.onSetupError.bind(this);\n this.onSegmentComplete = this.onSegmentComplete.bind(this);\n this.drawnFrameEvent = new BMEnterFrameEvent('drawnFrame', 0, 0, 0);\n this.expressionsPlugin = getExpressionsPlugin();\n };\n extendPrototype([BaseEvent], AnimationItem);\n AnimationItem.prototype.setParams = function (params) {\n if (params.wrapper || params.container) {\n this.wrapper = params.wrapper || params.container;\n }\n var animType = 'svg';\n if (params.animType) {\n animType = params.animType;\n } else if (params.renderer) {\n animType = params.renderer;\n }\n var RendererClass = getRenderer(animType);\n this.renderer = new RendererClass(this, params.rendererSettings);\n this.imagePreloader.setCacheType(animType, this.renderer.globalData.defs);\n this.renderer.setProjectInterface(this.projectInterface);\n this.animType = animType;\n if (params.loop === '' || params.loop === null || params.loop === undefined || params.loop === true) {\n this.loop = true;\n } else if (params.loop === false) {\n this.loop = false;\n } else {\n this.loop = parseInt(params.loop, 10);\n }\n this.autoplay = 'autoplay' in params ? params.autoplay : true;\n this.name = params.name ? params.name : '';\n this.autoloadSegments = Object.prototype.hasOwnProperty.call(params, 'autoloadSegments') ? params.autoloadSegments : true;\n this.assetsPath = params.assetsPath;\n this.initialSegment = params.initialSegment;\n if (params.audioFactory) {\n this.audioController.setAudioFactory(params.audioFactory);\n }\n if (params.animationData) {\n this.setupAnimation(params.animationData);\n } else if (params.path) {\n if (params.path.lastIndexOf('\\\\') !== -1) {\n this.path = params.path.substr(0, params.path.lastIndexOf('\\\\') + 1);\n } else {\n this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1);\n }\n this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1);\n this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json'));\n dataManager.loadAnimation(params.path, this.configAnimation, this.onSetupError);\n }\n };\n AnimationItem.prototype.onSetupError = function () {\n this.trigger('data_failed');\n };\n AnimationItem.prototype.setupAnimation = function (data) {\n dataManager.completeAnimation(data, this.configAnimation);\n };\n AnimationItem.prototype.setData = function (wrapper, animationData) {\n if (animationData) {\n if (_typeof$4(animationData) !== 'object') {\n animationData = JSON.parse(animationData);\n }\n }\n var params = {\n wrapper: wrapper,\n animationData: animationData\n };\n var wrapperAttributes = wrapper.attributes;\n params.path = wrapperAttributes.getNamedItem('data-animation-path') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-animation-path').value : wrapperAttributes.getNamedItem('data-bm-path') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-path').value : wrapperAttributes.getNamedItem('bm-path') ? wrapperAttributes.getNamedItem('bm-path').value : '';\n params.animType = wrapperAttributes.getNamedItem('data-anim-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-type').value : wrapperAttributes.getNamedItem('data-bm-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-type').value : wrapperAttributes.getNamedItem('bm-type') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('bm-type').value : wrapperAttributes.getNamedItem('data-bm-renderer') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-renderer').value : wrapperAttributes.getNamedItem('bm-renderer') ? wrapperAttributes.getNamedItem('bm-renderer').value : getRegisteredRenderer() || 'canvas';\n var loop = wrapperAttributes.getNamedItem('data-anim-loop') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-loop').value : wrapperAttributes.getNamedItem('data-bm-loop') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-loop').value : wrapperAttributes.getNamedItem('bm-loop') ? wrapperAttributes.getNamedItem('bm-loop').value : '';\n if (loop === 'false') {\n params.loop = false;\n } else if (loop === 'true') {\n params.loop = true;\n } else if (loop !== '') {\n params.loop = parseInt(loop, 10);\n }\n var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-autoplay').value : wrapperAttributes.getNamedItem('data-bm-autoplay') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-autoplay').value : wrapperAttributes.getNamedItem('bm-autoplay') ? wrapperAttributes.getNamedItem('bm-autoplay').value : true;\n params.autoplay = autoplay !== 'false';\n params.name = wrapperAttributes.getNamedItem('data-name') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-name').value : wrapperAttributes.getNamedItem('data-bm-name') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-name').value : wrapperAttributes.getNamedItem('bm-name') ? wrapperAttributes.getNamedItem('bm-name').value : '';\n var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-anim-prerender').value : wrapperAttributes.getNamedItem('data-bm-prerender') // eslint-disable-line no-nested-ternary\n ? wrapperAttributes.getNamedItem('data-bm-prerender').value : wrapperAttributes.getNamedItem('bm-prerender') ? wrapperAttributes.getNamedItem('bm-prerender').value : '';\n if (prerender === 'false') {\n params.prerender = false;\n }\n if (!params.path) {\n this.trigger('destroy');\n } else {\n this.setParams(params);\n }\n };\n AnimationItem.prototype.includeLayers = function (data) {\n if (data.op > this.animationData.op) {\n this.animationData.op = data.op;\n this.totalFrames = Math.floor(data.op - this.animationData.ip);\n }\n var layers = this.animationData.layers;\n var i;\n var len = layers.length;\n var newLayers = data.layers;\n var j;\n var jLen = newLayers.length;\n for (j = 0; j < jLen; j += 1) {\n i = 0;\n while (i < len) {\n if (layers[i].id === newLayers[j].id) {\n layers[i] = newLayers[j];\n break;\n }\n i += 1;\n }\n }\n if (data.chars || data.fonts) {\n this.renderer.globalData.fontManager.addChars(data.chars);\n this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs);\n }\n if (data.assets) {\n len = data.assets.length;\n for (i = 0; i < len; i += 1) {\n this.animationData.assets.push(data.assets[i]);\n }\n }\n this.animationData.__complete = false;\n dataManager.completeAnimation(this.animationData, this.onSegmentComplete);\n };\n AnimationItem.prototype.onSegmentComplete = function (data) {\n this.animationData = data;\n var expressionsPlugin = getExpressionsPlugin();\n if (expressionsPlugin) {\n expressionsPlugin.initExpressions(this);\n }\n this.loadNextSegment();\n };\n AnimationItem.prototype.loadNextSegment = function () {\n var segments = this.animationData.segments;\n if (!segments || segments.length === 0 || !this.autoloadSegments) {\n this.trigger('data_ready');\n this.timeCompleted = this.totalFrames;\n return;\n }\n var segment = segments.shift();\n this.timeCompleted = segment.time * this.frameRate;\n var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json';\n this.segmentPos += 1;\n dataManager.loadData(segmentPath, this.includeLayers.bind(this), function () {\n this.trigger('data_failed');\n }.bind(this));\n };\n AnimationItem.prototype.loadSegments = function () {\n var segments = this.animationData.segments;\n if (!segments) {\n this.timeCompleted = this.totalFrames;\n }\n this.loadNextSegment();\n };\n AnimationItem.prototype.imagesLoaded = function () {\n this.trigger('loaded_images');\n this.checkLoaded();\n };\n AnimationItem.prototype.preloadImages = function () {\n this.imagePreloader.setAssetsPath(this.assetsPath);\n this.imagePreloader.setPath(this.path);\n this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this));\n };\n AnimationItem.prototype.configAnimation = function (animData) {\n if (!this.renderer) {\n return;\n }\n try {\n this.animationData = animData;\n if (this.initialSegment) {\n this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0]);\n this.firstFrame = Math.round(this.initialSegment[0]);\n } else {\n this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip);\n this.firstFrame = Math.round(this.animationData.ip);\n }\n this.renderer.configAnimation(animData);\n if (!animData.assets) {\n animData.assets = [];\n }\n this.assets = this.animationData.assets;\n this.frameRate = this.animationData.fr;\n this.frameMult = this.animationData.fr / 1000;\n this.renderer.searchExtraCompositions(animData.assets);\n this.markers = markerParser(animData.markers || []);\n this.trigger('config_ready');\n this.preloadImages();\n this.loadSegments();\n this.updaFrameModifier();\n this.waitForFontsLoaded();\n if (this.isPaused) {\n this.audioController.pause();\n }\n } catch (error) {\n this.triggerConfigError(error);\n }\n };\n AnimationItem.prototype.waitForFontsLoaded = function () {\n if (!this.renderer) {\n return;\n }\n if (this.renderer.globalData.fontManager.isLoaded) {\n this.checkLoaded();\n } else {\n setTimeout(this.waitForFontsLoaded.bind(this), 20);\n }\n };\n AnimationItem.prototype.checkLoaded = function () {\n if (!this.isLoaded && this.renderer.globalData.fontManager.isLoaded && (this.imagePreloader.loadedImages() || this.renderer.rendererType !== 'canvas') && this.imagePreloader.loadedFootages()) {\n this.isLoaded = true;\n var expressionsPlugin = getExpressionsPlugin();\n if (expressionsPlugin) {\n expressionsPlugin.initExpressions(this);\n }\n this.renderer.initItems();\n setTimeout(function () {\n this.trigger('DOMLoaded');\n }.bind(this), 0);\n this.gotoFrame();\n if (this.autoplay) {\n this.play();\n }\n }\n };\n AnimationItem.prototype.resize = function (width, height) {\n // Adding this validation for backwards compatibility in case an event object was being passed down\n var _width = typeof width === 'number' ? width : undefined;\n var _height = typeof height === 'number' ? height : undefined;\n this.renderer.updateContainerSize(_width, _height);\n };\n AnimationItem.prototype.setSubframe = function (flag) {\n this.isSubframeEnabled = !!flag;\n };\n AnimationItem.prototype.gotoFrame = function () {\n this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame; // eslint-disable-line no-bitwise\n\n if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) {\n this.currentFrame = this.timeCompleted;\n }\n this.trigger('enterFrame');\n this.renderFrame();\n this.trigger('drawnFrame');\n };\n AnimationItem.prototype.renderFrame = function () {\n if (this.isLoaded === false || !this.renderer) {\n return;\n }\n try {\n if (this.expressionsPlugin) {\n this.expressionsPlugin.resetFrame();\n }\n this.renderer.renderFrame(this.currentFrame + this.firstFrame);\n } catch (error) {\n this.triggerRenderFrameError(error);\n }\n };\n AnimationItem.prototype.play = function (name) {\n if (name && this.name !== name) {\n return;\n }\n if (this.isPaused === true) {\n this.isPaused = false;\n this.trigger('_play');\n this.audioController.resume();\n if (this._idle) {\n this._idle = false;\n this.trigger('_active');\n }\n }\n };\n AnimationItem.prototype.pause = function (name) {\n if (name && this.name !== name) {\n return;\n }\n if (this.isPaused === false) {\n this.isPaused = true;\n this.trigger('_pause');\n this._idle = true;\n this.trigger('_idle');\n this.audioController.pause();\n }\n };\n AnimationItem.prototype.togglePause = function (name) {\n if (name && this.name !== name) {\n return;\n }\n if (this.isPaused === true) {\n this.play();\n } else {\n this.pause();\n }\n };\n AnimationItem.prototype.stop = function (name) {\n if (name && this.name !== name) {\n return;\n }\n this.pause();\n this.playCount = 0;\n this._completedLoop = false;\n this.setCurrentRawFrameValue(0);\n };\n AnimationItem.prototype.getMarkerData = function (markerName) {\n var marker;\n for (var i = 0; i < this.markers.length; i += 1) {\n marker = this.markers[i];\n if (marker.payload && marker.payload.name === markerName) {\n return marker;\n }\n }\n return null;\n };\n AnimationItem.prototype.goToAndStop = function (value, isFrame, name) {\n if (name && this.name !== name) {\n return;\n }\n var numValue = Number(value);\n if (isNaN(numValue)) {\n var marker = this.getMarkerData(value);\n if (marker) {\n this.goToAndStop(marker.time, true);\n }\n } else if (isFrame) {\n this.setCurrentRawFrameValue(value);\n } else {\n this.setCurrentRawFrameValue(value * this.frameModifier);\n }\n this.pause();\n };\n AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {\n if (name && this.name !== name) {\n return;\n }\n var numValue = Number(value);\n if (isNaN(numValue)) {\n var marker = this.getMarkerData(value);\n if (marker) {\n if (!marker.duration) {\n this.goToAndStop(marker.time, true);\n } else {\n this.playSegments([marker.time, marker.time + marker.duration], true);\n }\n }\n } else {\n this.goToAndStop(numValue, isFrame, name);\n }\n this.play();\n };\n AnimationItem.prototype.advanceTime = function (value) {\n if (this.isPaused === true || this.isLoaded === false) {\n return;\n }\n var nextValue = this.currentRawFrame + value * this.frameModifier;\n var _isComplete = false; // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.\n // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.\n\n if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {\n if (!this.loop || this.playCount === this.loop) {\n if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {\n _isComplete = true;\n nextValue = this.totalFrames - 1;\n }\n } else if (nextValue >= this.totalFrames) {\n this.playCount += 1;\n if (!this.checkSegments(nextValue % this.totalFrames)) {\n this.setCurrentRawFrameValue(nextValue % this.totalFrames);\n this._completedLoop = true;\n this.trigger('loopComplete');\n }\n } else {\n this.setCurrentRawFrameValue(nextValue);\n }\n } else if (nextValue < 0) {\n if (!this.checkSegments(nextValue % this.totalFrames)) {\n if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) {\n // eslint-disable-line no-plusplus\n this.setCurrentRawFrameValue(this.totalFrames + nextValue % this.totalFrames);\n if (!this._completedLoop) {\n this._completedLoop = true;\n } else {\n this.trigger('loopComplete');\n }\n } else {\n _isComplete = true;\n nextValue = 0;\n }\n }\n } else {\n this.setCurrentRawFrameValue(nextValue);\n }\n if (_isComplete) {\n this.setCurrentRawFrameValue(nextValue);\n this.pause();\n this.trigger('complete');\n }\n };\n AnimationItem.prototype.adjustSegment = function (arr, offset) {\n this.playCount = 0;\n if (arr[1] < arr[0]) {\n if (this.frameModifier > 0) {\n if (this.playSpeed < 0) {\n this.setSpeed(-this.playSpeed);\n } else {\n this.setDirection(-1);\n }\n }\n this.totalFrames = arr[0] - arr[1];\n this.timeCompleted = this.totalFrames;\n this.firstFrame = arr[1];\n this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset);\n } else if (arr[1] > arr[0]) {\n if (this.frameModifier < 0) {\n if (this.playSpeed < 0) {\n this.setSpeed(-this.playSpeed);\n } else {\n this.setDirection(1);\n }\n }\n this.totalFrames = arr[1] - arr[0];\n this.timeCompleted = this.totalFrames;\n this.firstFrame = arr[0];\n this.setCurrentRawFrameValue(0.001 + offset);\n }\n this.trigger('segmentStart');\n };\n AnimationItem.prototype.setSegment = function (init, end) {\n var pendingFrame = -1;\n if (this.isPaused) {\n if (this.currentRawFrame + this.firstFrame < init) {\n pendingFrame = init;\n } else if (this.currentRawFrame + this.firstFrame > end) {\n pendingFrame = end - init;\n }\n }\n this.firstFrame = init;\n this.totalFrames = end - init;\n this.timeCompleted = this.totalFrames;\n if (pendingFrame !== -1) {\n this.goToAndStop(pendingFrame, true);\n }\n };\n AnimationItem.prototype.playSegments = function (arr, forceFlag) {\n if (forceFlag) {\n this.segments.length = 0;\n }\n if (_typeof$4(arr[0]) === 'object') {\n var i;\n var len = arr.length;\n for (i = 0; i < len; i += 1) {\n this.segments.push(arr[i]);\n }\n } else {\n this.segments.push(arr);\n }\n if (this.segments.length && forceFlag) {\n this.adjustSegment(this.segments.shift(), 0);\n }\n if (this.isPaused) {\n this.play();\n }\n };\n AnimationItem.prototype.resetSegments = function (forceFlag) {\n this.segments.length = 0;\n this.segments.push([this.animationData.ip, this.animationData.op]);\n if (forceFlag) {\n this.checkSegments(0);\n }\n };\n AnimationItem.prototype.checkSegments = function (offset) {\n if (this.segments.length) {\n this.adjustSegment(this.segments.shift(), offset);\n return true;\n }\n return false;\n };\n AnimationItem.prototype.destroy = function (name) {\n if (name && this.name !== name || !this.renderer) {\n return;\n }\n this.renderer.destroy();\n this.imagePreloader.destroy();\n this.trigger('destroy');\n this._cbs = null;\n this.onEnterFrame = null;\n this.onLoopComplete = null;\n this.onComplete = null;\n this.onSegmentStart = null;\n this.onDestroy = null;\n this.renderer = null;\n this.expressionsPlugin = null;\n this.imagePreloader = null;\n this.projectInterface = null;\n };\n AnimationItem.prototype.setCurrentRawFrameValue = function (value) {\n this.currentRawFrame = value;\n this.gotoFrame();\n };\n AnimationItem.prototype.setSpeed = function (val) {\n this.playSpeed = val;\n this.updaFrameModifier();\n };\n AnimationItem.prototype.setDirection = function (val) {\n this.playDirection = val < 0 ? -1 : 1;\n this.updaFrameModifier();\n };\n AnimationItem.prototype.setLoop = function (isLooping) {\n this.loop = isLooping;\n };\n AnimationItem.prototype.setVolume = function (val, name) {\n if (name && this.name !== name) {\n return;\n }\n this.audioController.setVolume(val);\n };\n AnimationItem.prototype.getVolume = function () {\n return this.audioController.getVolume();\n };\n AnimationItem.prototype.mute = function (name) {\n if (name && this.name !== name) {\n return;\n }\n this.audioController.mute();\n };\n AnimationItem.prototype.unmute = function (name) {\n if (name && this.name !== name) {\n return;\n }\n this.audioController.unmute();\n };\n AnimationItem.prototype.updaFrameModifier = function () {\n this.frameModifier = this.frameMult * this.playSpeed * this.playDirection;\n this.audioController.setRate(this.playSpeed * this.playDirection);\n };\n AnimationItem.prototype.getPath = function () {\n return this.path;\n };\n AnimationItem.prototype.getAssetsPath = function (assetData) {\n var path = '';\n if (assetData.e) {\n path = assetData.p;\n } else if (this.assetsPath) {\n var imagePath = assetData.p;\n if (imagePath.indexOf('images/') !== -1) {\n imagePath = imagePath.split('/')[1];\n }\n path = this.assetsPath + imagePath;\n } else {\n path = this.path;\n path += assetData.u ? assetData.u : '';\n path += assetData.p;\n }\n return path;\n };\n AnimationItem.prototype.getAssetData = function (id) {\n var i = 0;\n var len = this.assets.length;\n while (i < len) {\n if (id === this.assets[i].id) {\n return this.assets[i];\n }\n i += 1;\n }\n return null;\n };\n AnimationItem.prototype.hide = function () {\n this.renderer.hide();\n };\n AnimationItem.prototype.show = function () {\n this.renderer.show();\n };\n AnimationItem.prototype.getDuration = function (isFrame) {\n return isFrame ? this.totalFrames : this.totalFrames / this.frameRate;\n };\n AnimationItem.prototype.updateDocumentData = function (path, documentData, index) {\n try {\n var element = this.renderer.getElementByPath(path);\n element.updateDocumentData(documentData, index);\n } catch (error) {// TODO: decide how to handle catch case\n }\n };\n AnimationItem.prototype.trigger = function (name) {\n if (this._cbs && this._cbs[name]) {\n switch (name) {\n case 'enterFrame':\n this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier));\n break;\n case 'drawnFrame':\n this.drawnFrameEvent.currentTime = this.currentFrame;\n this.drawnFrameEvent.totalTime = this.totalFrames;\n this.drawnFrameEvent.direction = this.frameModifier;\n this.triggerEvent(name, this.drawnFrameEvent);\n break;\n case 'loopComplete':\n this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));\n break;\n case 'complete':\n this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult));\n break;\n case 'segmentStart':\n this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));\n break;\n case 'destroy':\n this.triggerEvent(name, new BMDestroyEvent(name, this));\n break;\n default:\n this.triggerEvent(name);\n }\n }\n if (name === 'enterFrame' && this.onEnterFrame) {\n this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult));\n }\n if (name === 'loopComplete' && this.onLoopComplete) {\n this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));\n }\n if (name === 'complete' && this.onComplete) {\n this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult));\n }\n if (name === 'segmentStart' && this.onSegmentStart) {\n this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));\n }\n if (name === 'destroy' && this.onDestroy) {\n this.onDestroy.call(this, new BMDestroyEvent(name, this));\n }\n };\n AnimationItem.prototype.triggerRenderFrameError = function (nativeError) {\n var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame);\n this.triggerEvent('error', error);\n if (this.onError) {\n this.onError.call(this, error);\n }\n };\n AnimationItem.prototype.triggerConfigError = function (nativeError) {\n var error = new BMConfigErrorEvent(nativeError, this.currentFrame);\n this.triggerEvent('error', error);\n if (this.onError) {\n this.onError.call(this, error);\n }\n };\n var animationManager = function () {\n var moduleOb = {};\n var registeredAnimations = [];\n var initTime = 0;\n var len = 0;\n var playingAnimationsNum = 0;\n var _stopped = true;\n var _isFrozen = false;\n function removeElement(ev) {\n var i = 0;\n var animItem = ev.target;\n while (i < len) {\n if (registeredAnimations[i].animation === animItem) {\n registeredAnimations.splice(i, 1);\n i -= 1;\n len -= 1;\n if (!animItem.isPaused) {\n subtractPlayingCount();\n }\n }\n i += 1;\n }\n }\n function registerAnimation(element, animationData) {\n if (!element) {\n return null;\n }\n var i = 0;\n while (i < len) {\n if (registeredAnimations[i].elem === element && registeredAnimations[i].elem !== null) {\n return registeredAnimations[i].animation;\n }\n i += 1;\n }\n var animItem = new AnimationItem();\n setupAnimation(animItem, element);\n animItem.setData(element, animationData);\n return animItem;\n }\n function getRegisteredAnimations() {\n var i;\n var lenAnims = registeredAnimations.length;\n var animations = [];\n for (i = 0; i < lenAnims; i += 1) {\n animations.push(registeredAnimations[i].animation);\n }\n return animations;\n }\n function addPlayingCount() {\n playingAnimationsNum += 1;\n activate();\n }\n function subtractPlayingCount() {\n playingAnimationsNum -= 1;\n }\n function setupAnimation(animItem, element) {\n animItem.addEventListener('destroy', removeElement);\n animItem.addEventListener('_active', addPlayingCount);\n animItem.addEventListener('_idle', subtractPlayingCount);\n registeredAnimations.push({\n elem: element,\n animation: animItem\n });\n len += 1;\n }\n function loadAnimation(params) {\n var animItem = new AnimationItem();\n setupAnimation(animItem, null);\n animItem.setParams(params);\n return animItem;\n }\n function setSpeed(val, animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setSpeed(val, animation);\n }\n }\n function setDirection(val, animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setDirection(val, animation);\n }\n }\n function play(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.play(animation);\n }\n }\n function resume(nowTime) {\n var elapsedTime = nowTime - initTime;\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.advanceTime(elapsedTime);\n }\n initTime = nowTime;\n if (playingAnimationsNum && !_isFrozen) {\n window.requestAnimationFrame(resume);\n } else {\n _stopped = true;\n }\n }\n function first(nowTime) {\n initTime = nowTime;\n window.requestAnimationFrame(resume);\n }\n function pause(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.pause(animation);\n }\n }\n function goToAndStop(value, isFrame, animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.goToAndStop(value, isFrame, animation);\n }\n }\n function stop(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.stop(animation);\n }\n }\n function togglePause(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.togglePause(animation);\n }\n }\n function destroy(animation) {\n var i;\n for (i = len - 1; i >= 0; i -= 1) {\n registeredAnimations[i].animation.destroy(animation);\n }\n }\n function searchAnimations(animationData, standalone, renderer) {\n var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')), [].slice.call(document.getElementsByClassName('bodymovin')));\n var i;\n var lenAnims = animElements.length;\n for (i = 0; i < lenAnims; i += 1) {\n if (renderer) {\n animElements[i].setAttribute('data-bm-type', renderer);\n }\n registerAnimation(animElements[i], animationData);\n }\n if (standalone && lenAnims === 0) {\n if (!renderer) {\n renderer = 'svg';\n }\n var body = document.getElementsByTagName('body')[0];\n body.innerText = '';\n var div = createTag('div');\n div.style.width = '100%';\n div.style.height = '100%';\n div.setAttribute('data-bm-type', renderer);\n body.appendChild(div);\n registerAnimation(div, animationData);\n }\n }\n function resize() {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.resize();\n }\n }\n function activate() {\n if (!_isFrozen && playingAnimationsNum) {\n if (_stopped) {\n window.requestAnimationFrame(first);\n _stopped = false;\n }\n }\n }\n function freeze() {\n _isFrozen = true;\n }\n function unfreeze() {\n _isFrozen = false;\n activate();\n }\n function setVolume(val, animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.setVolume(val, animation);\n }\n }\n function mute(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.mute(animation);\n }\n }\n function unmute(animation) {\n var i;\n for (i = 0; i < len; i += 1) {\n registeredAnimations[i].animation.unmute(animation);\n }\n }\n moduleOb.registerAnimation = registerAnimation;\n moduleOb.loadAnimation = loadAnimation;\n moduleOb.setSpeed = setSpeed;\n moduleOb.setDirection = setDirection;\n moduleOb.play = play;\n moduleOb.pause = pause;\n moduleOb.stop = stop;\n moduleOb.togglePause = togglePause;\n moduleOb.searchAnimations = searchAnimations;\n moduleOb.resize = resize; // moduleOb.start = start;\n\n moduleOb.goToAndStop = goToAndStop;\n moduleOb.destroy = destroy;\n moduleOb.freeze = freeze;\n moduleOb.unfreeze = unfreeze;\n moduleOb.setVolume = setVolume;\n moduleOb.mute = mute;\n moduleOb.unmute = unmute;\n moduleOb.getRegisteredAnimations = getRegisteredAnimations;\n return moduleOb;\n }();\n\n /* eslint-disable */\n var BezierFactory = function () {\n /**\r\n * BezierEasing - use bezier curve for transition easing function\r\n * by Gaëtan Renaudeau 2014 - 2015 – MIT License\r\n *\r\n * Credits: is based on Firefox's nsSMILKeySpline.cpp\r\n * Usage:\r\n * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])\r\n * spline.get(x) => returns the easing value | x must be in [0, 1] range\r\n *\r\n */\n var ob = {};\n ob.getBezierEasing = getBezierEasing;\n var beziers = {};\n function getBezierEasing(a, b, c, d, nm) {\n var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\\./g, 'p');\n if (beziers[str]) {\n return beziers[str];\n }\n var bezEasing = new BezierEasing([a, b, c, d]);\n beziers[str] = bezEasing;\n return bezEasing;\n } // These values are established by empiricism with tests (tradeoff: performance VS precision)\n\n var NEWTON_ITERATIONS = 4;\n var NEWTON_MIN_SLOPE = 0.001;\n var SUBDIVISION_PRECISION = 0.0000001;\n var SUBDIVISION_MAX_ITERATIONS = 10;\n var kSplineTableSize = 11;\n var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);\n var float32ArraySupported = typeof Float32Array === 'function';\n function A(aA1, aA2) {\n return 1.0 - 3.0 * aA2 + 3.0 * aA1;\n }\n function B(aA1, aA2) {\n return 3.0 * aA2 - 6.0 * aA1;\n }\n function C(aA1) {\n return 3.0 * aA1;\n } // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\n\n function calcBezier(aT, aA1, aA2) {\n return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;\n } // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.\n\n function getSlope(aT, aA1, aA2) {\n return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);\n }\n function binarySubdivide(aX, aA, aB, mX1, mX2) {\n var currentX,\n currentT,\n i = 0;\n do {\n currentT = aA + (aB - aA) / 2.0;\n currentX = calcBezier(currentT, mX1, mX2) - aX;\n if (currentX > 0.0) {\n aB = currentT;\n } else {\n aA = currentT;\n }\n } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);\n return currentT;\n }\n function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {\n for (var i = 0; i < NEWTON_ITERATIONS; ++i) {\n var currentSlope = getSlope(aGuessT, mX1, mX2);\n if (currentSlope === 0.0) return aGuessT;\n var currentX = calcBezier(aGuessT, mX1, mX2) - aX;\n aGuessT -= currentX / currentSlope;\n }\n return aGuessT;\n }\n /**\r\n * points is an array of [ mX1, mY1, mX2, mY2 ]\r\n */\n\n function BezierEasing(points) {\n this._p = points;\n this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);\n this._precomputed = false;\n this.get = this.get.bind(this);\n }\n BezierEasing.prototype = {\n get: function get(x) {\n var mX1 = this._p[0],\n mY1 = this._p[1],\n mX2 = this._p[2],\n mY2 = this._p[3];\n if (!this._precomputed) this._precompute();\n if (mX1 === mY1 && mX2 === mY2) return x; // linear\n // Because JavaScript number are imprecise, we should guarantee the extremes are right.\n\n if (x === 0) return 0;\n if (x === 1) return 1;\n return calcBezier(this._getTForX(x), mY1, mY2);\n },\n // Private part\n _precompute: function _precompute() {\n var mX1 = this._p[0],\n mY1 = this._p[1],\n mX2 = this._p[2],\n mY2 = this._p[3];\n this._precomputed = true;\n if (mX1 !== mY1 || mX2 !== mY2) {\n this._calcSampleValues();\n }\n },\n _calcSampleValues: function _calcSampleValues() {\n var mX1 = this._p[0],\n mX2 = this._p[2];\n for (var i = 0; i < kSplineTableSize; ++i) {\n this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);\n }\n },\n /**\r\n * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.\r\n */\n _getTForX: function _getTForX(aX) {\n var mX1 = this._p[0],\n mX2 = this._p[2],\n mSampleValues = this._mSampleValues;\n var intervalStart = 0.0;\n var currentSample = 1;\n var lastSample = kSplineTableSize - 1;\n for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {\n intervalStart += kSampleStepSize;\n }\n --currentSample; // Interpolate to provide an initial guess for t\n\n var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]);\n var guessForT = intervalStart + dist * kSampleStepSize;\n var initialSlope = getSlope(guessForT, mX1, mX2);\n if (initialSlope >= NEWTON_MIN_SLOPE) {\n return newtonRaphsonIterate(aX, guessForT, mX1, mX2);\n }\n if (initialSlope === 0.0) {\n return guessForT;\n }\n return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);\n }\n };\n return ob;\n }();\n var pooling = function () {\n function _double(arr) {\n return arr.concat(createSizedArray(arr.length));\n }\n return {\n \"double\": _double\n };\n }();\n var poolFactory = function () {\n return function (initialLength, _create, _release) {\n var _length = 0;\n var _maxLength = initialLength;\n var pool = createSizedArray(_maxLength);\n var ob = {\n newElement: newElement,\n release: release\n };\n function newElement() {\n var element;\n if (_length) {\n _length -= 1;\n element = pool[_length];\n } else {\n element = _create();\n }\n return element;\n }\n function release(element) {\n if (_length === _maxLength) {\n pool = pooling[\"double\"](pool);\n _maxLength *= 2;\n }\n if (_release) {\n _release(element);\n }\n pool[_length] = element;\n _length += 1;\n }\n return ob;\n };\n }();\n var bezierLengthPool = function () {\n function create() {\n return {\n addedLength: 0,\n percents: createTypedArray('float32', getDefaultCurveSegments()),\n lengths: createTypedArray('float32', getDefaultCurveSegments())\n };\n }\n return poolFactory(8, create);\n }();\n var segmentsLengthPool = function () {\n function create() {\n return {\n lengths: [],\n totalLength: 0\n };\n }\n function release(element) {\n var i;\n var len = element.lengths.length;\n for (i = 0; i < len; i += 1) {\n bezierLengthPool.release(element.lengths[i]);\n }\n element.lengths.length = 0;\n }\n return poolFactory(8, create, release);\n }();\n function bezFunction() {\n var math = Math;\n function pointOnLine2D(x1, y1, x2, y2, x3, y3) {\n var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1;\n return det1 > -0.001 && det1 < 0.001;\n }\n function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) {\n if (z1 === 0 && z2 === 0 && z3 === 0) {\n return pointOnLine2D(x1, y1, x2, y2, x3, y3);\n }\n var dist1 = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2));\n var dist2 = math.sqrt(math.pow(x3 - x1, 2) + math.pow(y3 - y1, 2) + math.pow(z3 - z1, 2));\n var dist3 = math.sqrt(math.pow(x3 - x2, 2) + math.pow(y3 - y2, 2) + math.pow(z3 - z2, 2));\n var diffDist;\n if (dist1 > dist2) {\n if (dist1 > dist3) {\n diffDist = dist1 - dist2 - dist3;\n } else {\n diffDist = dist3 - dist2 - dist1;\n }\n } else if (dist3 > dist2) {\n diffDist = dist3 - dist2 - dist1;\n } else {\n diffDist = dist2 - dist1 - dist3;\n }\n return diffDist > -0.0001 && diffDist < 0.0001;\n }\n var getBezierLength = function () {\n return function (pt1, pt2, pt3, pt4) {\n var curveSegments = getDefaultCurveSegments();\n var k;\n var i;\n var len;\n var ptCoord;\n var perc;\n var addedLength = 0;\n var ptDistance;\n var point = [];\n var lastPoint = [];\n var lengthData = bezierLengthPool.newElement();\n len = pt3.length;\n for (k = 0; k < curveSegments; k += 1) {\n perc = k / (curveSegments - 1);\n ptDistance = 0;\n for (i = 0; i < len; i += 1) {\n ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * pt3[i] + 3 * (1 - perc) * bmPow(perc, 2) * pt4[i] + bmPow(perc, 3) * pt2[i];\n point[i] = ptCoord;\n if (lastPoint[i] !== null) {\n ptDistance += bmPow(point[i] - lastPoint[i], 2);\n }\n lastPoint[i] = point[i];\n }\n if (ptDistance) {\n ptDistance = bmSqrt(ptDistance);\n addedLength += ptDistance;\n }\n lengthData.percents[k] = perc;\n lengthData.lengths[k] = addedLength;\n }\n lengthData.addedLength = addedLength;\n return lengthData;\n };\n }();\n function getSegmentsLength(shapeData) {\n var segmentsLength = segmentsLengthPool.newElement();\n var closed = shapeData.c;\n var pathV = shapeData.v;\n var pathO = shapeData.o;\n var pathI = shapeData.i;\n var i;\n var len = shapeData._length;\n var lengths = segmentsLength.lengths;\n var totalLength = 0;\n for (i = 0; i < len - 1; i += 1) {\n lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1]);\n totalLength += lengths[i].addedLength;\n }\n if (closed && len) {\n lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0]);\n totalLength += lengths[i].addedLength;\n }\n segmentsLength.totalLength = totalLength;\n return segmentsLength;\n }\n function BezierData(length) {\n this.segmentLength = 0;\n this.points = new Array(length);\n }\n function PointData(partial, point) {\n this.partialLength = partial;\n this.point = point;\n }\n var buildBezierData = function () {\n var storedData = {};\n return function (pt1, pt2, pt3, pt4) {\n var bezierName = (pt1[0] + '_' + pt1[1] + '_' + pt2[0] + '_' + pt2[1] + '_' + pt3[0] + '_' + pt3[1] + '_' + pt4[0] + '_' + pt4[1]).replace(/\\./g, 'p');\n if (!storedData[bezierName]) {\n var curveSegments = getDefaultCurveSegments();\n var k;\n var i;\n var len;\n var ptCoord;\n var perc;\n var addedLength = 0;\n var ptDistance;\n var point;\n var lastPoint = null;\n if (pt1.length === 2 && (pt1[0] !== pt2[0] || pt1[1] !== pt2[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])) {\n curveSegments = 2;\n }\n var bezierData = new BezierData(curveSegments);\n len = pt3.length;\n for (k = 0; k < curveSegments; k += 1) {\n point = createSizedArray(len);\n perc = k / (curveSegments - 1);\n ptDistance = 0;\n for (i = 0; i < len; i += 1) {\n ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) + 3 * (1 - perc) * bmPow(perc, 2) * (pt2[i] + pt4[i]) + bmPow(perc, 3) * pt2[i];\n point[i] = ptCoord;\n if (lastPoint !== null) {\n ptDistance += bmPow(point[i] - lastPoint[i], 2);\n }\n }\n ptDistance = bmSqrt(ptDistance);\n addedLength += ptDistance;\n bezierData.points[k] = new PointData(ptDistance, point);\n lastPoint = point;\n }\n bezierData.segmentLength = addedLength;\n storedData[bezierName] = bezierData;\n }\n return storedData[bezierName];\n };\n }();\n function getDistancePerc(perc, bezierData) {\n var percents = bezierData.percents;\n var lengths = bezierData.lengths;\n var len = percents.length;\n var initPos = bmFloor((len - 1) * perc);\n var lengthPos = perc * bezierData.addedLength;\n var lPerc = 0;\n if (initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]) {\n return percents[initPos];\n }\n var dir = lengths[initPos] > lengthPos ? -1 : 1;\n var flag = true;\n while (flag) {\n if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) {\n lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos]);\n flag = false;\n } else {\n initPos += dir;\n }\n if (initPos < 0 || initPos >= len - 1) {\n // FIX for TypedArrays that don't store floating point values with enough accuracy\n if (initPos === len - 1) {\n return percents[initPos];\n }\n flag = false;\n }\n }\n return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc;\n }\n function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {\n var t1 = getDistancePerc(percent, bezierData);\n var u1 = 1 - t1;\n var ptX = math.round((u1 * u1 * u1 * pt1[0] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] + t1 * t1 * t1 * pt2[0]) * 1000) / 1000;\n var ptY = math.round((u1 * u1 * u1 * pt1[1] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] + t1 * t1 * t1 * pt2[1]) * 1000) / 1000;\n return [ptX, ptY];\n }\n var bezierSegmentPoints = createTypedArray('float32', 8);\n function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) {\n if (startPerc < 0) {\n startPerc = 0;\n } else if (startPerc > 1) {\n startPerc = 1;\n }\n var t0 = getDistancePerc(startPerc, bezierData);\n endPerc = endPerc > 1 ? 1 : endPerc;\n var t1 = getDistancePerc(endPerc, bezierData);\n var i;\n var len = pt1.length;\n var u0 = 1 - t0;\n var u1 = 1 - t1;\n var u0u0u0 = u0 * u0 * u0;\n var t0u0u0_3 = t0 * u0 * u0 * 3; // eslint-disable-line camelcase\n\n var t0t0u0_3 = t0 * t0 * u0 * 3; // eslint-disable-line camelcase\n\n var t0t0t0 = t0 * t0 * t0; //\n\n var u0u0u1 = u0 * u0 * u1;\n var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1; // eslint-disable-line camelcase\n\n var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1; // eslint-disable-line camelcase\n\n var t0t0t1 = t0 * t0 * t1; //\n\n var u0u1u1 = u0 * u1 * u1;\n var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1; // eslint-disable-line camelcase\n\n var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1; // eslint-disable-line camelcase\n\n var t0t1t1 = t0 * t1 * t1; //\n\n var u1u1u1 = u1 * u1 * u1;\n var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1; // eslint-disable-line camelcase\n\n var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1; // eslint-disable-line camelcase\n\n var t1t1t1 = t1 * t1 * t1;\n for (i = 0; i < len; i += 1) {\n bezierSegmentPoints[i * 4] = math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\n\n bezierSegmentPoints[i * 4 + 1] = math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\n\n bezierSegmentPoints[i * 4 + 2] = math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\n\n bezierSegmentPoints[i * 4 + 3] = math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\n }\n return bezierSegmentPoints;\n }\n return {\n getSegmentsLength: getSegmentsLength,\n getNewSegment: getNewSegment,\n getPointInSegment: getPointInSegment,\n buildBezierData: buildBezierData,\n pointOnLine2D: pointOnLine2D,\n pointOnLine3D: pointOnLine3D\n };\n }\n var bez = bezFunction();\n var initFrame = initialDefaultFrame;\n var mathAbs = Math.abs;\n function interpolateValue(frameNum, caching) {\n var offsetTime = this.offsetTime;\n var newValue;\n if (this.propType === 'multidimensional') {\n newValue = createTypedArray('float32', this.pv.length);\n }\n var iterationIndex = caching.lastIndex;\n var i = iterationIndex;\n var len = this.keyframes.length - 1;\n var flag = true;\n var keyData;\n var nextKeyData;\n var keyframeMetadata;\n while (flag) {\n keyData = this.keyframes[i];\n nextKeyData = this.keyframes[i + 1];\n if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) {\n if (keyData.h) {\n keyData = nextKeyData;\n }\n iterationIndex = 0;\n break;\n }\n if (nextKeyData.t - offsetTime > frameNum) {\n iterationIndex = i;\n break;\n }\n if (i < len - 1) {\n i += 1;\n } else {\n iterationIndex = 0;\n flag = false;\n }\n }\n keyframeMetadata = this.keyframesMetadata[i] || {};\n var k;\n var kLen;\n var perc;\n var jLen;\n var j;\n var fnc;\n var nextKeyTime = nextKeyData.t - offsetTime;\n var keyTime = keyData.t - offsetTime;\n var endValue;\n if (keyData.to) {\n if (!keyframeMetadata.bezierData) {\n keyframeMetadata.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti);\n }\n var bezierData = keyframeMetadata.bezierData;\n if (frameNum >= nextKeyTime || frameNum < keyTime) {\n var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0;\n kLen = bezierData.points[ind].point.length;\n for (k = 0; k < kLen; k += 1) {\n newValue[k] = bezierData.points[ind].point[k];\n } // caching._lastKeyframeIndex = -1;\n } else {\n if (keyframeMetadata.__fnct) {\n fnc = keyframeMetadata.__fnct;\n } else {\n fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get;\n keyframeMetadata.__fnct = fnc;\n }\n perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));\n var distanceInLine = bezierData.segmentLength * perc;\n var segmentPerc;\n var addedLength = caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastAddedLength : 0;\n j = caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastPoint : 0;\n flag = true;\n jLen = bezierData.points.length;\n while (flag) {\n addedLength += bezierData.points[j].partialLength;\n if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {\n kLen = bezierData.points[j].point.length;\n for (k = 0; k < kLen; k += 1) {\n newValue[k] = bezierData.points[j].point[k];\n }\n break;\n } else if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) {\n segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength;\n kLen = bezierData.points[j].point.length;\n for (k = 0; k < kLen; k += 1) {\n newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc;\n }\n break;\n }\n if (j < jLen - 1) {\n j += 1;\n } else {\n flag = false;\n }\n }\n caching._lastPoint = j;\n caching._lastAddedLength = addedLength - bezierData.points[j].partialLength;\n caching._lastKeyframeIndex = i;\n }\n } else {\n var outX;\n var outY;\n var inX;\n var inY;\n var keyValue;\n len = keyData.s.length;\n endValue = nextKeyData.s || keyData.e;\n if (this.sh && keyData.h !== 1) {\n if (frameNum >= nextKeyTime) {\n newValue[0] = endValue[0];\n newValue[1] = endValue[1];\n newValue[2] = endValue[2];\n } else if (frameNum <= keyTime) {\n newValue[0] = keyData.s[0];\n newValue[1] = keyData.s[1];\n newValue[2] = keyData.s[2];\n } else {\n var quatStart = createQuaternion(keyData.s);\n var quatEnd = createQuaternion(endValue);\n var time = (frameNum - keyTime) / (nextKeyTime - keyTime);\n quaternionToEuler(newValue, slerp(quatStart, quatEnd, time));\n }\n } else {\n for (i = 0; i < len; i += 1) {\n if (keyData.h !== 1) {\n if (frameNum >= nextKeyTime) {\n perc = 1;\n } else if (frameNum < keyTime) {\n perc = 0;\n } else {\n if (keyData.o.x.constructor === Array) {\n if (!keyframeMetadata.__fnct) {\n keyframeMetadata.__fnct = [];\n }\n if (!keyframeMetadata.__fnct[i]) {\n outX = keyData.o.x[i] === undefined ? keyData.o.x[0] : keyData.o.x[i];\n outY = keyData.o.y[i] === undefined ? keyData.o.y[0] : keyData.o.y[i];\n inX = keyData.i.x[i] === undefined ? keyData.i.x[0] : keyData.i.x[i];\n inY = keyData.i.y[i] === undefined ? keyData.i.y[0] : keyData.i.y[i];\n fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;\n keyframeMetadata.__fnct[i] = fnc;\n } else {\n fnc = keyframeMetadata.__fnct[i];\n }\n } else if (!keyframeMetadata.__fnct) {\n outX = keyData.o.x;\n outY = keyData.o.y;\n inX = keyData.i.x;\n inY = keyData.i.y;\n fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;\n keyData.keyframeMetadata = fnc;\n } else {\n fnc = keyframeMetadata.__fnct;\n }\n perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));\n }\n }\n endValue = nextKeyData.s || keyData.e;\n keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc;\n if (this.propType === 'multidimensional') {\n newValue[i] = keyValue;\n } else {\n newValue = keyValue;\n }\n }\n }\n }\n caching.lastIndex = iterationIndex;\n return newValue;\n } // based on @Toji's https://github.com/toji/gl-matrix/\n\n function slerp(a, b, t) {\n var out = [];\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n var bx = b[0];\n var by = b[1];\n var bz = b[2];\n var bw = b[3];\n var omega;\n var cosom;\n var sinom;\n var scale0;\n var scale1;\n cosom = ax * bx + ay * by + az * bz + aw * bw;\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n if (1.0 - cosom > 0.000001) {\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n }\n function quaternionToEuler(out, quat) {\n var qx = quat[0];\n var qy = quat[1];\n var qz = quat[2];\n var qw = quat[3];\n var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz);\n var attitude = Math.asin(2 * qx * qy + 2 * qz * qw);\n var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz);\n out[0] = heading / degToRads;\n out[1] = attitude / degToRads;\n out[2] = bank / degToRads;\n }\n function createQuaternion(values) {\n var heading = values[0] * degToRads;\n var attitude = values[1] * degToRads;\n var bank = values[2] * degToRads;\n var c1 = Math.cos(heading / 2);\n var c2 = Math.cos(attitude / 2);\n var c3 = Math.cos(bank / 2);\n var s1 = Math.sin(heading / 2);\n var s2 = Math.sin(attitude / 2);\n var s3 = Math.sin(bank / 2);\n var w = c1 * c2 * c3 - s1 * s2 * s3;\n var x = s1 * s2 * c3 + c1 * c2 * s3;\n var y = s1 * c2 * c3 + c1 * s2 * s3;\n var z = c1 * s2 * c3 - s1 * c2 * s3;\n return [x, y, z, w];\n }\n function getValueAtCurrentTime() {\n var frameNum = this.comp.renderedFrame - this.offsetTime;\n var initTime = this.keyframes[0].t - this.offsetTime;\n var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;\n if (!(frameNum === this._caching.lastFrame || this._caching.lastFrame !== initFrame && (this._caching.lastFrame >= endTime && frameNum >= endTime || this._caching.lastFrame < initTime && frameNum < initTime))) {\n if (this._caching.lastFrame >= frameNum) {\n this._caching._lastKeyframeIndex = -1;\n this._caching.lastIndex = 0;\n }\n var renderResult = this.interpolateValue(frameNum, this._caching);\n this.pv = renderResult;\n }\n this._caching.lastFrame = frameNum;\n return this.pv;\n }\n function setVValue(val) {\n var multipliedValue;\n if (this.propType === 'unidimensional') {\n multipliedValue = val * this.mult;\n if (mathAbs(this.v - multipliedValue) > 0.00001) {\n this.v = multipliedValue;\n this._mdf = true;\n }\n } else {\n var i = 0;\n var len = this.v.length;\n while (i < len) {\n multipliedValue = val[i] * this.mult;\n if (mathAbs(this.v[i] - multipliedValue) > 0.00001) {\n this.v[i] = multipliedValue;\n this._mdf = true;\n }\n i += 1;\n }\n }\n }\n function processEffectsSequence() {\n if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {\n return;\n }\n if (this.lock) {\n this.setVValue(this.pv);\n return;\n }\n this.lock = true;\n this._mdf = this._isFirstFrame;\n var i;\n var len = this.effectsSequence.length;\n var finalValue = this.kf ? this.pv : this.data.k;\n for (i = 0; i < len; i += 1) {\n finalValue = this.effectsSequence[i](finalValue);\n }\n this.setVValue(finalValue);\n this._isFirstFrame = false;\n this.lock = false;\n this.frameId = this.elem.globalData.frameId;\n }\n function addEffect(effectFunction) {\n this.effectsSequence.push(effectFunction);\n this.container.addDynamicProperty(this);\n }\n function ValueProperty(elem, data, mult, container) {\n this.propType = 'unidimensional';\n this.mult = mult || 1;\n this.data = data;\n this.v = mult ? data.k * mult : data.k;\n this.pv = data.k;\n this._mdf = false;\n this.elem = elem;\n this.container = container;\n this.comp = elem.comp;\n this.k = false;\n this.kf = false;\n this.vel = 0;\n this.effectsSequence = [];\n this._isFirstFrame = true;\n this.getValue = processEffectsSequence;\n this.setVValue = setVValue;\n this.addEffect = addEffect;\n }\n function MultiDimensionalProperty(elem, data, mult, container) {\n this.propType = 'multidimensional';\n this.mult = mult || 1;\n this.data = data;\n this._mdf = false;\n this.elem = elem;\n this.container = container;\n this.comp = elem.comp;\n this.k = false;\n this.kf = false;\n this.frameId = -1;\n var i;\n var len = data.k.length;\n this.v = createTypedArray('float32', len);\n this.pv = createTypedArray('float32', len);\n this.vel = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n this.v[i] = data.k[i] * this.mult;\n this.pv[i] = data.k[i];\n }\n this._isFirstFrame = true;\n this.effectsSequence = [];\n this.getValue = processEffectsSequence;\n this.setVValue = setVValue;\n this.addEffect = addEffect;\n }\n function KeyframedValueProperty(elem, data, mult, container) {\n this.propType = 'unidimensional';\n this.keyframes = data.k;\n this.keyframesMetadata = [];\n this.offsetTime = elem.data.st;\n this.frameId = -1;\n this._caching = {\n lastFrame: initFrame,\n lastIndex: 0,\n value: 0,\n _lastKeyframeIndex: -1\n };\n this.k = true;\n this.kf = true;\n this.data = data;\n this.mult = mult || 1;\n this.elem = elem;\n this.container = container;\n this.comp = elem.comp;\n this.v = initFrame;\n this.pv = initFrame;\n this._isFirstFrame = true;\n this.getValue = processEffectsSequence;\n this.setVValue = setVValue;\n this.interpolateValue = interpolateValue;\n this.effectsSequence = [getValueAtCurrentTime.bind(this)];\n this.addEffect = addEffect;\n }\n function KeyframedMultidimensionalProperty(elem, data, mult, container) {\n this.propType = 'multidimensional';\n var i;\n var len = data.k.length;\n var s;\n var e;\n var to;\n var ti;\n for (i = 0; i < len - 1; i += 1) {\n if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) {\n s = data.k[i].s;\n e = data.k[i + 1].s;\n to = data.k[i].to;\n ti = data.k[i].ti;\n if (s.length === 2 && !(s[0] === e[0] && s[1] === e[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1]) || s.length === 3 && !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2])) {\n data.k[i].to = null;\n data.k[i].ti = null;\n }\n if (s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {\n if (s.length === 2 || s[2] === e[2] && to[2] === 0 && ti[2] === 0) {\n data.k[i].to = null;\n data.k[i].ti = null;\n }\n }\n }\n }\n this.effectsSequence = [getValueAtCurrentTime.bind(this)];\n this.data = data;\n this.keyframes = data.k;\n this.keyframesMetadata = [];\n this.offsetTime = elem.data.st;\n this.k = true;\n this.kf = true;\n this._isFirstFrame = true;\n this.mult = mult || 1;\n this.elem = elem;\n this.container = container;\n this.comp = elem.comp;\n this.getValue = processEffectsSequence;\n this.setVValue = setVValue;\n this.interpolateValue = interpolateValue;\n this.frameId = -1;\n var arrLen = data.k[0].s.length;\n this.v = createTypedArray('float32', arrLen);\n this.pv = createTypedArray('float32', arrLen);\n for (i = 0; i < arrLen; i += 1) {\n this.v[i] = initFrame;\n this.pv[i] = initFrame;\n }\n this._caching = {\n lastFrame: initFrame,\n lastIndex: 0,\n value: createTypedArray('float32', arrLen)\n };\n this.addEffect = addEffect;\n }\n var PropertyFactory = function () {\n function getProp(elem, data, type, mult, container) {\n if (data.sid) {\n data = elem.globalData.slotManager.getProp(data);\n }\n var p;\n if (!data.k.length) {\n p = new ValueProperty(elem, data, mult, container);\n } else if (typeof data.k[0] === 'number') {\n p = new MultiDimensionalProperty(elem, data, mult, container);\n } else {\n switch (type) {\n case 0:\n p = new KeyframedValueProperty(elem, data, mult, container);\n break;\n case 1:\n p = new KeyframedMultidimensionalProperty(elem, data, mult, container);\n break;\n default:\n break;\n }\n }\n if (p.effectsSequence.length) {\n container.addDynamicProperty(p);\n }\n return p;\n }\n var ob = {\n getProp: getProp\n };\n return ob;\n }();\n function DynamicPropertyContainer() {}\n DynamicPropertyContainer.prototype = {\n addDynamicProperty: function addDynamicProperty(prop) {\n if (this.dynamicProperties.indexOf(prop) === -1) {\n this.dynamicProperties.push(prop);\n this.container.addDynamicProperty(this);\n this._isAnimated = true;\n }\n },\n iterateDynamicProperties: function iterateDynamicProperties() {\n this._mdf = false;\n var i;\n var len = this.dynamicProperties.length;\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue();\n if (this.dynamicProperties[i]._mdf) {\n this._mdf = true;\n }\n }\n },\n initDynamicPropertyContainer: function initDynamicPropertyContainer(container) {\n this.container = container;\n this.dynamicProperties = [];\n this._mdf = false;\n this._isAnimated = false;\n }\n };\n var pointPool = function () {\n function create() {\n return createTypedArray('float32', 2);\n }\n return poolFactory(8, create);\n }();\n function ShapePath() {\n this.c = false;\n this._length = 0;\n this._maxLength = 8;\n this.v = createSizedArray(this._maxLength);\n this.o = createSizedArray(this._maxLength);\n this.i = createSizedArray(this._maxLength);\n }\n ShapePath.prototype.setPathData = function (closed, len) {\n this.c = closed;\n this.setLength(len);\n var i = 0;\n while (i < len) {\n this.v[i] = pointPool.newElement();\n this.o[i] = pointPool.newElement();\n this.i[i] = pointPool.newElement();\n i += 1;\n }\n };\n ShapePath.prototype.setLength = function (len) {\n while (this._maxLength < len) {\n this.doubleArrayLength();\n }\n this._length = len;\n };\n ShapePath.prototype.doubleArrayLength = function () {\n this.v = this.v.concat(createSizedArray(this._maxLength));\n this.i = this.i.concat(createSizedArray(this._maxLength));\n this.o = this.o.concat(createSizedArray(this._maxLength));\n this._maxLength *= 2;\n };\n ShapePath.prototype.setXYAt = function (x, y, type, pos, replace) {\n var arr;\n this._length = Math.max(this._length, pos + 1);\n if (this._length >= this._maxLength) {\n this.doubleArrayLength();\n }\n switch (type) {\n case 'v':\n arr = this.v;\n break;\n case 'i':\n arr = this.i;\n break;\n case 'o':\n arr = this.o;\n break;\n default:\n arr = [];\n break;\n }\n if (!arr[pos] || arr[pos] && !replace) {\n arr[pos] = pointPool.newElement();\n }\n arr[pos][0] = x;\n arr[pos][1] = y;\n };\n ShapePath.prototype.setTripleAt = function (vX, vY, oX, oY, iX, iY, pos, replace) {\n this.setXYAt(vX, vY, 'v', pos, replace);\n this.setXYAt(oX, oY, 'o', pos, replace);\n this.setXYAt(iX, iY, 'i', pos, replace);\n };\n ShapePath.prototype.reverse = function () {\n var newPath = new ShapePath();\n newPath.setPathData(this.c, this._length);\n var vertices = this.v;\n var outPoints = this.o;\n var inPoints = this.i;\n var init = 0;\n if (this.c) {\n newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false);\n init = 1;\n }\n var cnt = this._length - 1;\n var len = this._length;\n var i;\n for (i = init; i < len; i += 1) {\n newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false);\n cnt -= 1;\n }\n return newPath;\n };\n ShapePath.prototype.length = function () {\n return this._length;\n };\n var shapePool = function () {\n function create() {\n return new ShapePath();\n }\n function release(shapePath) {\n var len = shapePath._length;\n var i;\n for (i = 0; i < len; i += 1) {\n pointPool.release(shapePath.v[i]);\n pointPool.release(shapePath.i[i]);\n pointPool.release(shapePath.o[i]);\n shapePath.v[i] = null;\n shapePath.i[i] = null;\n shapePath.o[i] = null;\n }\n shapePath._length = 0;\n shapePath.c = false;\n }\n function clone(shape) {\n var cloned = factory.newElement();\n var i;\n var len = shape._length === undefined ? shape.v.length : shape._length;\n cloned.setLength(len);\n cloned.c = shape.c;\n for (i = 0; i < len; i += 1) {\n cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i);\n }\n return cloned;\n }\n var factory = poolFactory(4, create, release);\n factory.clone = clone;\n return factory;\n }();\n function ShapeCollection() {\n this._length = 0;\n this._maxLength = 4;\n this.shapes = createSizedArray(this._maxLength);\n }\n ShapeCollection.prototype.addShape = function (shapeData) {\n if (this._length === this._maxLength) {\n this.shapes = this.shapes.concat(createSizedArray(this._maxLength));\n this._maxLength *= 2;\n }\n this.shapes[this._length] = shapeData;\n this._length += 1;\n };\n ShapeCollection.prototype.releaseShapes = function () {\n var i;\n for (i = 0; i < this._length; i += 1) {\n shapePool.release(this.shapes[i]);\n }\n this._length = 0;\n };\n var shapeCollectionPool = function () {\n var ob = {\n newShapeCollection: newShapeCollection,\n release: release\n };\n var _length = 0;\n var _maxLength = 4;\n var pool = createSizedArray(_maxLength);\n function newShapeCollection() {\n var shapeCollection;\n if (_length) {\n _length -= 1;\n shapeCollection = pool[_length];\n } else {\n shapeCollection = new ShapeCollection();\n }\n return shapeCollection;\n }\n function release(shapeCollection) {\n var i;\n var len = shapeCollection._length;\n for (i = 0; i < len; i += 1) {\n shapePool.release(shapeCollection.shapes[i]);\n }\n shapeCollection._length = 0;\n if (_length === _maxLength) {\n pool = pooling[\"double\"](pool);\n _maxLength *= 2;\n }\n pool[_length] = shapeCollection;\n _length += 1;\n }\n return ob;\n }();\n var ShapePropertyFactory = function () {\n var initFrame = -999999;\n function interpolateShape(frameNum, previousValue, caching) {\n var iterationIndex = caching.lastIndex;\n var keyPropS;\n var keyPropE;\n var isHold;\n var j;\n var k;\n var jLen;\n var kLen;\n var perc;\n var vertexValue;\n var kf = this.keyframes;\n if (frameNum < kf[0].t - this.offsetTime) {\n keyPropS = kf[0].s[0];\n isHold = true;\n iterationIndex = 0;\n } else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) {\n keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0];\n /* if(kf[kf.length - 1].s){\r\n keyPropS = kf[kf.length - 1].s[0];\r\n }else{\r\n keyPropS = kf[kf.length - 2].e[0];\r\n } */\n\n isHold = true;\n } else {\n var i = iterationIndex;\n var len = kf.length - 1;\n var flag = true;\n var keyData;\n var nextKeyData;\n var keyframeMetadata;\n while (flag) {\n keyData = kf[i];\n nextKeyData = kf[i + 1];\n if (nextKeyData.t - this.offsetTime > frameNum) {\n break;\n }\n if (i < len - 1) {\n i += 1;\n } else {\n flag = false;\n }\n }\n keyframeMetadata = this.keyframesMetadata[i] || {};\n isHold = keyData.h === 1;\n iterationIndex = i;\n if (!isHold) {\n if (frameNum >= nextKeyData.t - this.offsetTime) {\n perc = 1;\n } else if (frameNum < keyData.t - this.offsetTime) {\n perc = 0;\n } else {\n var fnc;\n if (keyframeMetadata.__fnct) {\n fnc = keyframeMetadata.__fnct;\n } else {\n fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get;\n keyframeMetadata.__fnct = fnc;\n }\n perc = fnc((frameNum - (keyData.t - this.offsetTime)) / (nextKeyData.t - this.offsetTime - (keyData.t - this.offsetTime)));\n }\n keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0];\n }\n keyPropS = keyData.s[0];\n }\n jLen = previousValue._length;\n kLen = keyPropS.i[0].length;\n caching.lastIndex = iterationIndex;\n for (j = 0; j < jLen; j += 1) {\n for (k = 0; k < kLen; k += 1) {\n vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc;\n previousValue.i[j][k] = vertexValue;\n vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc;\n previousValue.o[j][k] = vertexValue;\n vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc;\n previousValue.v[j][k] = vertexValue;\n }\n }\n }\n function interpolateShapeCurrentTime() {\n var frameNum = this.comp.renderedFrame - this.offsetTime;\n var initTime = this.keyframes[0].t - this.offsetTime;\n var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;\n var lastFrame = this._caching.lastFrame;\n if (!(lastFrame !== initFrame && (lastFrame < initTime && frameNum < initTime || lastFrame > endTime && frameNum > endTime))) {\n /// /\n this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0;\n this.interpolateShape(frameNum, this.pv, this._caching); /// /\n }\n this._caching.lastFrame = frameNum;\n return this.pv;\n }\n function resetShape() {\n this.paths = this.localShapeCollection;\n }\n function shapesEqual(shape1, shape2) {\n if (shape1._length !== shape2._length || shape1.c !== shape2.c) {\n return false;\n }\n var i;\n var len = shape1._length;\n for (i = 0; i < len; i += 1) {\n if (shape1.v[i][0] !== shape2.v[i][0] || shape1.v[i][1] !== shape2.v[i][1] || shape1.o[i][0] !== shape2.o[i][0] || shape1.o[i][1] !== shape2.o[i][1] || shape1.i[i][0] !== shape2.i[i][0] || shape1.i[i][1] !== shape2.i[i][1]) {\n return false;\n }\n }\n return true;\n }\n function setVValue(newPath) {\n if (!shapesEqual(this.v, newPath)) {\n this.v = shapePool.clone(newPath);\n this.localShapeCollection.releaseShapes();\n this.localShapeCollection.addShape(this.v);\n this._mdf = true;\n this.paths = this.localShapeCollection;\n }\n }\n function processEffectsSequence() {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n if (!this.effectsSequence.length) {\n this._mdf = false;\n return;\n }\n if (this.lock) {\n this.setVValue(this.pv);\n return;\n }\n this.lock = true;\n this._mdf = false;\n var finalValue;\n if (this.kf) {\n finalValue = this.pv;\n } else if (this.data.ks) {\n finalValue = this.data.ks.k;\n } else {\n finalValue = this.data.pt.k;\n }\n var i;\n var len = this.effectsSequence.length;\n for (i = 0; i < len; i += 1) {\n finalValue = this.effectsSequence[i](finalValue);\n }\n this.setVValue(finalValue);\n this.lock = false;\n this.frameId = this.elem.globalData.frameId;\n }\n function ShapeProperty(elem, data, type) {\n this.propType = 'shape';\n this.comp = elem.comp;\n this.container = elem;\n this.elem = elem;\n this.data = data;\n this.k = false;\n this.kf = false;\n this._mdf = false;\n var pathData = type === 3 ? data.pt.k : data.ks.k;\n this.v = shapePool.clone(pathData);\n this.pv = shapePool.clone(this.v);\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\n this.paths = this.localShapeCollection;\n this.paths.addShape(this.v);\n this.reset = resetShape;\n this.effectsSequence = [];\n }\n function addEffect(effectFunction) {\n this.effectsSequence.push(effectFunction);\n this.container.addDynamicProperty(this);\n }\n ShapeProperty.prototype.interpolateShape = interpolateShape;\n ShapeProperty.prototype.getValue = processEffectsSequence;\n ShapeProperty.prototype.setVValue = setVValue;\n ShapeProperty.prototype.addEffect = addEffect;\n function KeyframedShapeProperty(elem, data, type) {\n this.propType = 'shape';\n this.comp = elem.comp;\n this.elem = elem;\n this.container = elem;\n this.offsetTime = elem.data.st;\n this.keyframes = type === 3 ? data.pt.k : data.ks.k;\n this.keyframesMetadata = [];\n this.k = true;\n this.kf = true;\n var len = this.keyframes[0].s[0].i.length;\n this.v = shapePool.newElement();\n this.v.setPathData(this.keyframes[0].s[0].c, len);\n this.pv = shapePool.clone(this.v);\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\n this.paths = this.localShapeCollection;\n this.paths.addShape(this.v);\n this.lastFrame = initFrame;\n this.reset = resetShape;\n this._caching = {\n lastFrame: initFrame,\n lastIndex: 0\n };\n this.effectsSequence = [interpolateShapeCurrentTime.bind(this)];\n }\n KeyframedShapeProperty.prototype.getValue = processEffectsSequence;\n KeyframedShapeProperty.prototype.interpolateShape = interpolateShape;\n KeyframedShapeProperty.prototype.setVValue = setVValue;\n KeyframedShapeProperty.prototype.addEffect = addEffect;\n var EllShapeProperty = function () {\n var cPoint = roundCorner;\n function EllShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement();\n this.v.setPathData(true, 4);\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\n this.paths = this.localShapeCollection;\n this.localShapeCollection.addShape(this.v);\n this.d = data.d;\n this.elem = elem;\n this.comp = elem.comp;\n this.frameId = -1;\n this.initDynamicPropertyContainer(elem);\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\n this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);\n if (this.dynamicProperties.length) {\n this.k = true;\n } else {\n this.k = false;\n this.convertEllToPath();\n }\n }\n EllShapePropertyFactory.prototype = {\n reset: resetShape,\n getValue: function getValue() {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n this.frameId = this.elem.globalData.frameId;\n this.iterateDynamicProperties();\n if (this._mdf) {\n this.convertEllToPath();\n }\n },\n convertEllToPath: function convertEllToPath() {\n var p0 = this.p.v[0];\n var p1 = this.p.v[1];\n var s0 = this.s.v[0] / 2;\n var s1 = this.s.v[1] / 2;\n var _cw = this.d !== 3;\n var _v = this.v;\n _v.v[0][0] = p0;\n _v.v[0][1] = p1 - s1;\n _v.v[1][0] = _cw ? p0 + s0 : p0 - s0;\n _v.v[1][1] = p1;\n _v.v[2][0] = p0;\n _v.v[2][1] = p1 + s1;\n _v.v[3][0] = _cw ? p0 - s0 : p0 + s0;\n _v.v[3][1] = p1;\n _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;\n _v.i[0][1] = p1 - s1;\n _v.i[1][0] = _cw ? p0 + s0 : p0 - s0;\n _v.i[1][1] = p1 - s1 * cPoint;\n _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;\n _v.i[2][1] = p1 + s1;\n _v.i[3][0] = _cw ? p0 - s0 : p0 + s0;\n _v.i[3][1] = p1 + s1 * cPoint;\n _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;\n _v.o[0][1] = p1 - s1;\n _v.o[1][0] = _cw ? p0 + s0 : p0 - s0;\n _v.o[1][1] = p1 + s1 * cPoint;\n _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;\n _v.o[2][1] = p1 + s1;\n _v.o[3][0] = _cw ? p0 - s0 : p0 + s0;\n _v.o[3][1] = p1 - s1 * cPoint;\n }\n };\n extendPrototype([DynamicPropertyContainer], EllShapePropertyFactory);\n return EllShapePropertyFactory;\n }();\n var StarShapeProperty = function () {\n function StarShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement();\n this.v.setPathData(true, 0);\n this.elem = elem;\n this.comp = elem.comp;\n this.data = data;\n this.frameId = -1;\n this.d = data.d;\n this.initDynamicPropertyContainer(elem);\n if (data.sy === 1) {\n this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this);\n this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this);\n this.convertToPath = this.convertStarToPath;\n } else {\n this.convertToPath = this.convertPolygonToPath;\n }\n this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this);\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\n this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this);\n this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this);\n this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this);\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\n this.localShapeCollection.addShape(this.v);\n this.paths = this.localShapeCollection;\n if (this.dynamicProperties.length) {\n this.k = true;\n } else {\n this.k = false;\n this.convertToPath();\n }\n }\n StarShapePropertyFactory.prototype = {\n reset: resetShape,\n getValue: function getValue() {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n this.frameId = this.elem.globalData.frameId;\n this.iterateDynamicProperties();\n if (this._mdf) {\n this.convertToPath();\n }\n },\n convertStarToPath: function convertStarToPath() {\n var numPts = Math.floor(this.pt.v) * 2;\n var angle = Math.PI * 2 / numPts;\n /* this.v.v.length = numPts;\r\n this.v.i.length = numPts;\r\n this.v.o.length = numPts; */\n\n var longFlag = true;\n var longRad = this.or.v;\n var shortRad = this.ir.v;\n var longRound = this.os.v;\n var shortRound = this.is.v;\n var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);\n var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);\n var i;\n var rad;\n var roundness;\n var perimSegment;\n var currentAng = -Math.PI / 2;\n currentAng += this.r.v;\n var dir = this.data.d === 3 ? -1 : 1;\n this.v._length = 0;\n for (i = 0; i < numPts; i += 1) {\n rad = longFlag ? longRad : shortRad;\n roundness = longFlag ? longRound : shortRound;\n perimSegment = longFlag ? longPerimSegment : shortPerimSegment;\n var x = rad * Math.cos(currentAng);\n var y = rad * Math.sin(currentAng);\n var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);\n var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);\n x += +this.p.v[0];\n y += +this.p.v[1];\n this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);\n /* this.v.v[i] = [x,y];\r\n this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];\r\n this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];\r\n this.v._length = numPts; */\n\n longFlag = !longFlag;\n currentAng += angle * dir;\n }\n },\n convertPolygonToPath: function convertPolygonToPath() {\n var numPts = Math.floor(this.pt.v);\n var angle = Math.PI * 2 / numPts;\n var rad = this.or.v;\n var roundness = this.os.v;\n var perimSegment = 2 * Math.PI * rad / (numPts * 4);\n var i;\n var currentAng = -Math.PI * 0.5;\n var dir = this.data.d === 3 ? -1 : 1;\n currentAng += this.r.v;\n this.v._length = 0;\n for (i = 0; i < numPts; i += 1) {\n var x = rad * Math.cos(currentAng);\n var y = rad * Math.sin(currentAng);\n var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);\n var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);\n x += +this.p.v[0];\n y += +this.p.v[1];\n this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);\n currentAng += angle * dir;\n }\n this.paths.length = 0;\n this.paths[0] = this.v;\n }\n };\n extendPrototype([DynamicPropertyContainer], StarShapePropertyFactory);\n return StarShapePropertyFactory;\n }();\n var RectShapeProperty = function () {\n function RectShapePropertyFactory(elem, data) {\n this.v = shapePool.newElement();\n this.v.c = true;\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\n this.localShapeCollection.addShape(this.v);\n this.paths = this.localShapeCollection;\n this.elem = elem;\n this.comp = elem.comp;\n this.frameId = -1;\n this.d = data.d;\n this.initDynamicPropertyContainer(elem);\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\n this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);\n this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this);\n if (this.dynamicProperties.length) {\n this.k = true;\n } else {\n this.k = false;\n this.convertRectToPath();\n }\n }\n RectShapePropertyFactory.prototype = {\n convertRectToPath: function convertRectToPath() {\n var p0 = this.p.v[0];\n var p1 = this.p.v[1];\n var v0 = this.s.v[0] / 2;\n var v1 = this.s.v[1] / 2;\n var round = bmMin(v0, v1, this.r.v);\n var cPoint = round * (1 - roundCorner);\n this.v._length = 0;\n if (this.d === 2 || this.d === 1) {\n this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true);\n this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true);\n if (round !== 0) {\n this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true);\n this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true);\n this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true);\n this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true);\n this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true);\n this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true);\n } else {\n this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2);\n this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3);\n }\n } else {\n this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true);\n if (round !== 0) {\n this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true);\n this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true);\n this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true);\n this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true);\n this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true);\n this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true);\n this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true);\n } else {\n this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true);\n this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true);\n this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true);\n }\n }\n },\n getValue: function getValue() {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n this.frameId = this.elem.globalData.frameId;\n this.iterateDynamicProperties();\n if (this._mdf) {\n this.convertRectToPath();\n }\n },\n reset: resetShape\n };\n extendPrototype([DynamicPropertyContainer], RectShapePropertyFactory);\n return RectShapePropertyFactory;\n }();\n function getShapeProp(elem, data, type) {\n var prop;\n if (type === 3 || type === 4) {\n var dataProp = type === 3 ? data.pt : data.ks;\n var keys = dataProp.k;\n if (keys.length) {\n prop = new KeyframedShapeProperty(elem, data, type);\n } else {\n prop = new ShapeProperty(elem, data, type);\n }\n } else if (type === 5) {\n prop = new RectShapeProperty(elem, data);\n } else if (type === 6) {\n prop = new EllShapeProperty(elem, data);\n } else if (type === 7) {\n prop = new StarShapeProperty(elem, data);\n }\n if (prop.k) {\n elem.addDynamicProperty(prop);\n }\n return prop;\n }\n function getConstructorFunction() {\n return ShapeProperty;\n }\n function getKeyframedConstructorFunction() {\n return KeyframedShapeProperty;\n }\n var ob = {};\n ob.getShapeProp = getShapeProp;\n ob.getConstructorFunction = getConstructorFunction;\n ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction;\n return ob;\n }();\n\n /*!\r\n Transformation Matrix v2.0\r\n (c) Epistemex 2014-2015\r\n www.epistemex.com\r\n By Ken Fyrstenberg\r\n Contributions by leeoniya.\r\n License: MIT, header required.\r\n */\n\n /**\r\n * 2D transformation matrix object initialized with identity matrix.\r\n *\r\n * The matrix can synchronize a canvas context by supplying the context\r\n * as an argument, or later apply current absolute transform to an\r\n * existing context.\r\n *\r\n * All values are handled as floating point values.\r\n *\r\n * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix\r\n * @prop {number} a - scale x\r\n * @prop {number} b - shear y\r\n * @prop {number} c - shear x\r\n * @prop {number} d - scale y\r\n * @prop {number} e - translate x\r\n * @prop {number} f - translate y\r\n * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context\r\n * @constructor\r\n */\n\n var Matrix = function () {\n var _cos = Math.cos;\n var _sin = Math.sin;\n var _tan = Math.tan;\n var _rnd = Math.round;\n function reset() {\n this.props[0] = 1;\n this.props[1] = 0;\n this.props[2] = 0;\n this.props[3] = 0;\n this.props[4] = 0;\n this.props[5] = 1;\n this.props[6] = 0;\n this.props[7] = 0;\n this.props[8] = 0;\n this.props[9] = 0;\n this.props[10] = 1;\n this.props[11] = 0;\n this.props[12] = 0;\n this.props[13] = 0;\n this.props[14] = 0;\n this.props[15] = 1;\n return this;\n }\n function rotate(angle) {\n if (angle === 0) {\n return this;\n }\n var mCos = _cos(angle);\n var mSin = _sin(angle);\n return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n }\n function rotateX(angle) {\n if (angle === 0) {\n return this;\n }\n var mCos = _cos(angle);\n var mSin = _sin(angle);\n return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1);\n }\n function rotateY(angle) {\n if (angle === 0) {\n return this;\n }\n var mCos = _cos(angle);\n var mSin = _sin(angle);\n return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1);\n }\n function rotateZ(angle) {\n if (angle === 0) {\n return this;\n }\n var mCos = _cos(angle);\n var mSin = _sin(angle);\n return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n }\n function shear(sx, sy) {\n return this._t(1, sy, sx, 1, 0, 0);\n }\n function skew(ax, ay) {\n return this.shear(_tan(ax), _tan(ay));\n }\n function skewFromAxis(ax, angle) {\n var mCos = _cos(angle);\n var mSin = _sin(angle);\n return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); // return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);\n }\n function scale(sx, sy, sz) {\n if (!sz && sz !== 0) {\n sz = 1;\n }\n if (sx === 1 && sy === 1 && sz === 1) {\n return this;\n }\n return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1);\n }\n function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {\n this.props[0] = a;\n this.props[1] = b;\n this.props[2] = c;\n this.props[3] = d;\n this.props[4] = e;\n this.props[5] = f;\n this.props[6] = g;\n this.props[7] = h;\n this.props[8] = i;\n this.props[9] = j;\n this.props[10] = k;\n this.props[11] = l;\n this.props[12] = m;\n this.props[13] = n;\n this.props[14] = o;\n this.props[15] = p;\n return this;\n }\n function translate(tx, ty, tz) {\n tz = tz || 0;\n if (tx !== 0 || ty !== 0 || tz !== 0) {\n return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1);\n }\n return this;\n }\n function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {\n var _p = this.props;\n if (a2 === 1 && b2 === 0 && c2 === 0 && d2 === 0 && e2 === 0 && f2 === 1 && g2 === 0 && h2 === 0 && i2 === 0 && j2 === 0 && k2 === 1 && l2 === 0) {\n // NOTE: commenting this condition because TurboFan deoptimizes code when present\n // if(m2 !== 0 || n2 !== 0 || o2 !== 0){\n _p[12] = _p[12] * a2 + _p[15] * m2;\n _p[13] = _p[13] * f2 + _p[15] * n2;\n _p[14] = _p[14] * k2 + _p[15] * o2;\n _p[15] *= p2; // }\n\n this._identityCalculated = false;\n return this;\n }\n var a1 = _p[0];\n var b1 = _p[1];\n var c1 = _p[2];\n var d1 = _p[3];\n var e1 = _p[4];\n var f1 = _p[5];\n var g1 = _p[6];\n var h1 = _p[7];\n var i1 = _p[8];\n var j1 = _p[9];\n var k1 = _p[10];\n var l1 = _p[11];\n var m1 = _p[12];\n var n1 = _p[13];\n var o1 = _p[14];\n var p1 = _p[15];\n /* matrix order (canvas compatible):\r\n * ace\r\n * bdf\r\n * 001\r\n */\n\n _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2;\n _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2;\n _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2;\n _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2;\n _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2;\n _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2;\n _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2;\n _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2;\n _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2;\n _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2;\n _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2;\n _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2;\n _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2;\n _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2;\n _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2;\n _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2;\n this._identityCalculated = false;\n return this;\n }\n function multiply(matrix) {\n var matrixProps = matrix.props;\n return this.transform(matrixProps[0], matrixProps[1], matrixProps[2], matrixProps[3], matrixProps[4], matrixProps[5], matrixProps[6], matrixProps[7], matrixProps[8], matrixProps[9], matrixProps[10], matrixProps[11], matrixProps[12], matrixProps[13], matrixProps[14], matrixProps[15]);\n }\n function isIdentity() {\n if (!this._identityCalculated) {\n this._identity = !(this.props[0] !== 1 || this.props[1] !== 0 || this.props[2] !== 0 || this.props[3] !== 0 || this.props[4] !== 0 || this.props[5] !== 1 || this.props[6] !== 0 || this.props[7] !== 0 || this.props[8] !== 0 || this.props[9] !== 0 || this.props[10] !== 1 || this.props[11] !== 0 || this.props[12] !== 0 || this.props[13] !== 0 || this.props[14] !== 0 || this.props[15] !== 1);\n this._identityCalculated = true;\n }\n return this._identity;\n }\n function equals(matr) {\n var i = 0;\n while (i < 16) {\n if (matr.props[i] !== this.props[i]) {\n return false;\n }\n i += 1;\n }\n return true;\n }\n function clone(matr) {\n var i;\n for (i = 0; i < 16; i += 1) {\n matr.props[i] = this.props[i];\n }\n return matr;\n }\n function cloneFromProps(props) {\n var i;\n for (i = 0; i < 16; i += 1) {\n this.props[i] = props[i];\n }\n }\n function applyToPoint(x, y, z) {\n return {\n x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],\n y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],\n z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]\n };\n /* return {\r\n x: x * me.a + y * me.c + me.e,\r\n y: x * me.b + y * me.d + me.f\r\n }; */\n }\n function applyToX(x, y, z) {\n return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12];\n }\n function applyToY(x, y, z) {\n return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13];\n }\n function applyToZ(x, y, z) {\n return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14];\n }\n function getInverseMatrix() {\n var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4];\n var a = this.props[5] / determinant;\n var b = -this.props[1] / determinant;\n var c = -this.props[4] / determinant;\n var d = this.props[0] / determinant;\n var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant;\n var f = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant;\n var inverseMatrix = new Matrix();\n inverseMatrix.props[0] = a;\n inverseMatrix.props[1] = b;\n inverseMatrix.props[4] = c;\n inverseMatrix.props[5] = d;\n inverseMatrix.props[12] = e;\n inverseMatrix.props[13] = f;\n return inverseMatrix;\n }\n function inversePoint(pt) {\n var inverseMatrix = this.getInverseMatrix();\n return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0);\n }\n function inversePoints(pts) {\n var i;\n var len = pts.length;\n var retPts = [];\n for (i = 0; i < len; i += 1) {\n retPts[i] = inversePoint(pts[i]);\n }\n return retPts;\n }\n function applyToTriplePoints(pt1, pt2, pt3) {\n var arr = createTypedArray('float32', 6);\n if (this.isIdentity()) {\n arr[0] = pt1[0];\n arr[1] = pt1[1];\n arr[2] = pt2[0];\n arr[3] = pt2[1];\n arr[4] = pt3[0];\n arr[5] = pt3[1];\n } else {\n var p0 = this.props[0];\n var p1 = this.props[1];\n var p4 = this.props[4];\n var p5 = this.props[5];\n var p12 = this.props[12];\n var p13 = this.props[13];\n arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12;\n arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13;\n arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12;\n arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13;\n arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12;\n arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13;\n }\n return arr;\n }\n function applyToPointArray(x, y, z) {\n var arr;\n if (this.isIdentity()) {\n arr = [x, y, z];\n } else {\n arr = [x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12], x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13], x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]];\n }\n return arr;\n }\n function applyToPointStringified(x, y) {\n if (this.isIdentity()) {\n return x + ',' + y;\n }\n var _p = this.props;\n return Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 + ',' + Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100;\n }\n function toCSS() {\n // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\n\n /* if(this.isIdentity()) {\r\n return '';\r\n } */\n var i = 0;\n var props = this.props;\n var cssValue = 'matrix3d(';\n var v = 10000;\n while (i < 16) {\n cssValue += _rnd(props[i] * v) / v;\n cssValue += i === 15 ? ')' : ',';\n i += 1;\n }\n return cssValue;\n }\n function roundMatrixProperty(val) {\n var v = 10000;\n if (val < 0.000001 && val > 0 || val > -0.000001 && val < 0) {\n return _rnd(val * v) / v;\n }\n return val;\n }\n function to2dCSS() {\n // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\n\n /* if(this.isIdentity()) {\r\n return '';\r\n } */\n var props = this.props;\n var _a = roundMatrixProperty(props[0]);\n var _b = roundMatrixProperty(props[1]);\n var _c = roundMatrixProperty(props[4]);\n var _d = roundMatrixProperty(props[5]);\n var _e = roundMatrixProperty(props[12]);\n var _f = roundMatrixProperty(props[13]);\n return 'matrix(' + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ')';\n }\n return function () {\n this.reset = reset;\n this.rotate = rotate;\n this.rotateX = rotateX;\n this.rotateY = rotateY;\n this.rotateZ = rotateZ;\n this.skew = skew;\n this.skewFromAxis = skewFromAxis;\n this.shear = shear;\n this.scale = scale;\n this.setTransform = setTransform;\n this.translate = translate;\n this.transform = transform;\n this.multiply = multiply;\n this.applyToPoint = applyToPoint;\n this.applyToX = applyToX;\n this.applyToY = applyToY;\n this.applyToZ = applyToZ;\n this.applyToPointArray = applyToPointArray;\n this.applyToTriplePoints = applyToTriplePoints;\n this.applyToPointStringified = applyToPointStringified;\n this.toCSS = toCSS;\n this.to2dCSS = to2dCSS;\n this.clone = clone;\n this.cloneFromProps = cloneFromProps;\n this.equals = equals;\n this.inversePoints = inversePoints;\n this.inversePoint = inversePoint;\n this.getInverseMatrix = getInverseMatrix;\n this._t = this.transform;\n this.isIdentity = isIdentity;\n this._identity = true;\n this._identityCalculated = false;\n this.props = createTypedArray('float32', 16);\n this.reset();\n };\n }();\n function _typeof$3(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof$3 = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof$3 = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof$3(obj);\n }\n var lottie = {};\n var standalone = '__[STANDALONE]__';\n var animationData = '__[ANIMATIONDATA]__';\n var renderer = '';\n function setLocation(href) {\n setLocationHref(href);\n }\n function searchAnimations() {\n if (standalone === true) {\n animationManager.searchAnimations(animationData, standalone, renderer);\n } else {\n animationManager.searchAnimations();\n }\n }\n function setSubframeRendering(flag) {\n setSubframeEnabled(flag);\n }\n function setPrefix(prefix) {\n setIdPrefix(prefix);\n }\n function loadAnimation(params) {\n if (standalone === true) {\n params.animationData = JSON.parse(animationData);\n }\n return animationManager.loadAnimation(params);\n }\n function setQuality(value) {\n if (typeof value === 'string') {\n switch (value) {\n case 'high':\n setDefaultCurveSegments(200);\n break;\n default:\n case 'medium':\n setDefaultCurveSegments(50);\n break;\n case 'low':\n setDefaultCurveSegments(10);\n break;\n }\n } else if (!isNaN(value) && value > 1) {\n setDefaultCurveSegments(value);\n }\n if (getDefaultCurveSegments() >= 50) {\n roundValues(false);\n } else {\n roundValues(true);\n }\n }\n function inBrowser() {\n return typeof navigator !== 'undefined';\n }\n function installPlugin(type, plugin) {\n if (type === 'expressions') {\n setExpressionsPlugin(plugin);\n }\n }\n function getFactory(name) {\n switch (name) {\n case 'propertyFactory':\n return PropertyFactory;\n case 'shapePropertyFactory':\n return ShapePropertyFactory;\n case 'matrix':\n return Matrix;\n default:\n return null;\n }\n }\n lottie.play = animationManager.play;\n lottie.pause = animationManager.pause;\n lottie.setLocationHref = setLocation;\n lottie.togglePause = animationManager.togglePause;\n lottie.setSpeed = animationManager.setSpeed;\n lottie.setDirection = animationManager.setDirection;\n lottie.stop = animationManager.stop;\n lottie.searchAnimations = searchAnimations;\n lottie.registerAnimation = animationManager.registerAnimation;\n lottie.loadAnimation = loadAnimation;\n lottie.setSubframeRendering = setSubframeRendering;\n lottie.resize = animationManager.resize; // lottie.start = start;\n\n lottie.goToAndStop = animationManager.goToAndStop;\n lottie.destroy = animationManager.destroy;\n lottie.setQuality = setQuality;\n lottie.inBrowser = inBrowser;\n lottie.installPlugin = installPlugin;\n lottie.freeze = animationManager.freeze;\n lottie.unfreeze = animationManager.unfreeze;\n lottie.setVolume = animationManager.setVolume;\n lottie.mute = animationManager.mute;\n lottie.unmute = animationManager.unmute;\n lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations;\n lottie.useWebWorker = setWebWorker;\n lottie.setIDPrefix = setPrefix;\n lottie.__getFactory = getFactory;\n lottie.version = '5.12.2';\n function checkReady() {\n if (document.readyState === 'complete') {\n clearInterval(readyStateCheckInterval);\n searchAnimations();\n }\n }\n function getQueryVariable(variable) {\n var vars = queryString.split('&');\n for (var i = 0; i < vars.length; i += 1) {\n var pair = vars[i].split('=');\n if (decodeURIComponent(pair[0]) == variable) {\n // eslint-disable-line eqeqeq\n return decodeURIComponent(pair[1]);\n }\n }\n return null;\n }\n var queryString = '';\n if (standalone) {\n var scripts = document.getElementsByTagName('script');\n var index = scripts.length - 1;\n var myScript = scripts[index] || {\n src: ''\n };\n queryString = myScript.src ? myScript.src.replace(/^[^\\?]+\\??/, '') : ''; // eslint-disable-line no-useless-escape\n\n renderer = getQueryVariable('renderer');\n }\n var readyStateCheckInterval = setInterval(checkReady, 100); // this adds bodymovin to the window object for backwards compatibility\n\n try {\n if (!((typeof exports === \"undefined\" ? \"undefined\" : _typeof$3(exports)) === 'object' && typeof module !== 'undefined') && !(typeof define === 'function' && define.amd) // eslint-disable-line no-undef\n ) {\n window.bodymovin = lottie;\n }\n } catch (err) {//\n }\n var ShapeModifiers = function () {\n var ob = {};\n var modifiers = {};\n ob.registerModifier = registerModifier;\n ob.getModifier = getModifier;\n function registerModifier(nm, factory) {\n if (!modifiers[nm]) {\n modifiers[nm] = factory;\n }\n }\n function getModifier(nm, elem, data) {\n return new modifiers[nm](elem, data);\n }\n return ob;\n }();\n function ShapeModifier() {}\n ShapeModifier.prototype.initModifierProperties = function () {};\n ShapeModifier.prototype.addShapeToModifier = function () {};\n ShapeModifier.prototype.addShape = function (data) {\n if (!this.closed) {\n // Adding shape to dynamic properties. It covers the case where a shape has no effects applied, to reset it's _mdf state on every tick.\n data.sh.container.addDynamicProperty(data.sh);\n var shapeData = {\n shape: data.sh,\n data: data,\n localShapeCollection: shapeCollectionPool.newShapeCollection()\n };\n this.shapes.push(shapeData);\n this.addShapeToModifier(shapeData);\n if (this._isAnimated) {\n data.setAsAnimated();\n }\n }\n };\n ShapeModifier.prototype.init = function (elem, data) {\n this.shapes = [];\n this.elem = elem;\n this.initDynamicPropertyContainer(elem);\n this.initModifierProperties(elem, data);\n this.frameId = initialDefaultFrame;\n this.closed = false;\n this.k = false;\n if (this.dynamicProperties.length) {\n this.k = true;\n } else {\n this.getValue(true);\n }\n };\n ShapeModifier.prototype.processKeys = function () {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n this.frameId = this.elem.globalData.frameId;\n this.iterateDynamicProperties();\n };\n extendPrototype([DynamicPropertyContainer], ShapeModifier);\n function TrimModifier() {}\n extendPrototype([ShapeModifier], TrimModifier);\n TrimModifier.prototype.initModifierProperties = function (elem, data) {\n this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this);\n this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this);\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this);\n this.sValue = 0;\n this.eValue = 0;\n this.getValue = this.processKeys;\n this.m = data.m;\n this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length;\n };\n TrimModifier.prototype.addShapeToModifier = function (shapeData) {\n shapeData.pathsData = [];\n };\n TrimModifier.prototype.calculateShapeEdges = function (s, e, shapeLength, addedLength, totalModifierLength) {\n var segments = [];\n if (e <= 1) {\n segments.push({\n s: s,\n e: e\n });\n } else if (s >= 1) {\n segments.push({\n s: s - 1,\n e: e - 1\n });\n } else {\n segments.push({\n s: s,\n e: 1\n });\n segments.push({\n s: 0,\n e: e - 1\n });\n }\n var shapeSegments = [];\n var i;\n var len = segments.length;\n var segmentOb;\n for (i = 0; i < len; i += 1) {\n segmentOb = segments[i];\n if (!(segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength)) {\n var shapeS;\n var shapeE;\n if (segmentOb.s * totalModifierLength <= addedLength) {\n shapeS = 0;\n } else {\n shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength;\n }\n if (segmentOb.e * totalModifierLength >= addedLength + shapeLength) {\n shapeE = 1;\n } else {\n shapeE = (segmentOb.e * totalModifierLength - addedLength) / shapeLength;\n }\n shapeSegments.push([shapeS, shapeE]);\n }\n }\n if (!shapeSegments.length) {\n shapeSegments.push([0, 0]);\n }\n return shapeSegments;\n };\n TrimModifier.prototype.releasePathsData = function (pathsData) {\n var i;\n var len = pathsData.length;\n for (i = 0; i < len; i += 1) {\n segmentsLengthPool.release(pathsData[i]);\n }\n pathsData.length = 0;\n return pathsData;\n };\n TrimModifier.prototype.processShapes = function (_isFirstFrame) {\n var s;\n var e;\n if (this._mdf || _isFirstFrame) {\n var o = this.o.v % 360 / 360;\n if (o < 0) {\n o += 1;\n }\n if (this.s.v > 1) {\n s = 1 + o;\n } else if (this.s.v < 0) {\n s = 0 + o;\n } else {\n s = this.s.v + o;\n }\n if (this.e.v > 1) {\n e = 1 + o;\n } else if (this.e.v < 0) {\n e = 0 + o;\n } else {\n e = this.e.v + o;\n }\n if (s > e) {\n var _s = s;\n s = e;\n e = _s;\n }\n s = Math.round(s * 10000) * 0.0001;\n e = Math.round(e * 10000) * 0.0001;\n this.sValue = s;\n this.eValue = e;\n } else {\n s = this.sValue;\n e = this.eValue;\n }\n var shapePaths;\n var i;\n var len = this.shapes.length;\n var j;\n var jLen;\n var pathsData;\n var pathData;\n var totalShapeLength;\n var totalModifierLength = 0;\n if (e === s) {\n for (i = 0; i < len; i += 1) {\n this.shapes[i].localShapeCollection.releaseShapes();\n this.shapes[i].shape._mdf = true;\n this.shapes[i].shape.paths = this.shapes[i].localShapeCollection;\n if (this._mdf) {\n this.shapes[i].pathsData.length = 0;\n }\n }\n } else if (!(e === 1 && s === 0 || e === 0 && s === 1)) {\n var segments = [];\n var shapeData;\n var localShapeCollection;\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i]; // if shape hasn't changed and trim properties haven't changed, cached previous path can be used\n\n if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {\n shapeData.shape.paths = shapeData.localShapeCollection;\n } else {\n shapePaths = shapeData.shape.paths;\n jLen = shapePaths._length;\n totalShapeLength = 0;\n if (!shapeData.shape._mdf && shapeData.pathsData.length) {\n totalShapeLength = shapeData.totalShapeLength;\n } else {\n pathsData = this.releasePathsData(shapeData.pathsData);\n for (j = 0; j < jLen; j += 1) {\n pathData = bez.getSegmentsLength(shapePaths.shapes[j]);\n pathsData.push(pathData);\n totalShapeLength += pathData.totalLength;\n }\n shapeData.totalShapeLength = totalShapeLength;\n shapeData.pathsData = pathsData;\n }\n totalModifierLength += totalShapeLength;\n shapeData.shape._mdf = true;\n }\n }\n var shapeS = s;\n var shapeE = e;\n var addedLength = 0;\n var edges;\n for (i = len - 1; i >= 0; i -= 1) {\n shapeData = this.shapes[i];\n if (shapeData.shape._mdf) {\n localShapeCollection = shapeData.localShapeCollection;\n localShapeCollection.releaseShapes(); // if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group\n\n if (this.m === 2 && len > 1) {\n edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength);\n addedLength += shapeData.totalShapeLength;\n } else {\n edges = [[shapeS, shapeE]];\n }\n jLen = edges.length;\n for (j = 0; j < jLen; j += 1) {\n shapeS = edges[j][0];\n shapeE = edges[j][1];\n segments.length = 0;\n if (shapeE <= 1) {\n segments.push({\n s: shapeData.totalShapeLength * shapeS,\n e: shapeData.totalShapeLength * shapeE\n });\n } else if (shapeS >= 1) {\n segments.push({\n s: shapeData.totalShapeLength * (shapeS - 1),\n e: shapeData.totalShapeLength * (shapeE - 1)\n });\n } else {\n segments.push({\n s: shapeData.totalShapeLength * shapeS,\n e: shapeData.totalShapeLength\n });\n segments.push({\n s: 0,\n e: shapeData.totalShapeLength * (shapeE - 1)\n });\n }\n var newShapesData = this.addShapes(shapeData, segments[0]);\n if (segments[0].s !== segments[0].e) {\n if (segments.length > 1) {\n var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1];\n if (lastShapeInCollection.c) {\n var lastShape = newShapesData.pop();\n this.addPaths(newShapesData, localShapeCollection);\n newShapesData = this.addShapes(shapeData, segments[1], lastShape);\n } else {\n this.addPaths(newShapesData, localShapeCollection);\n newShapesData = this.addShapes(shapeData, segments[1]);\n }\n }\n this.addPaths(newShapesData, localShapeCollection);\n }\n }\n shapeData.shape.paths = localShapeCollection;\n }\n }\n } else if (this._mdf) {\n for (i = 0; i < len; i += 1) {\n // Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.\n // Don't remove this even if it's losing cached info.\n this.shapes[i].pathsData.length = 0;\n this.shapes[i].shape._mdf = true;\n }\n }\n };\n TrimModifier.prototype.addPaths = function (newPaths, localShapeCollection) {\n var i;\n var len = newPaths.length;\n for (i = 0; i < len; i += 1) {\n localShapeCollection.addShape(newPaths[i]);\n }\n };\n TrimModifier.prototype.addSegment = function (pt1, pt2, pt3, pt4, shapePath, pos, newShape) {\n shapePath.setXYAt(pt2[0], pt2[1], 'o', pos);\n shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1);\n if (newShape) {\n shapePath.setXYAt(pt1[0], pt1[1], 'v', pos);\n }\n shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1);\n };\n TrimModifier.prototype.addSegmentFromArray = function (points, shapePath, pos, newShape) {\n shapePath.setXYAt(points[1], points[5], 'o', pos);\n shapePath.setXYAt(points[2], points[6], 'i', pos + 1);\n if (newShape) {\n shapePath.setXYAt(points[0], points[4], 'v', pos);\n }\n shapePath.setXYAt(points[3], points[7], 'v', pos + 1);\n };\n TrimModifier.prototype.addShapes = function (shapeData, shapeSegment, shapePath) {\n var pathsData = shapeData.pathsData;\n var shapePaths = shapeData.shape.paths.shapes;\n var i;\n var len = shapeData.shape.paths._length;\n var j;\n var jLen;\n var addedLength = 0;\n var currentLengthData;\n var segmentCount;\n var lengths;\n var segment;\n var shapes = [];\n var initPos;\n var newShape = true;\n if (!shapePath) {\n shapePath = shapePool.newElement();\n segmentCount = 0;\n initPos = 0;\n } else {\n segmentCount = shapePath._length;\n initPos = shapePath._length;\n }\n shapes.push(shapePath);\n for (i = 0; i < len; i += 1) {\n lengths = pathsData[i].lengths;\n shapePath.c = shapePaths[i].c;\n jLen = shapePaths[i].c ? lengths.length : lengths.length + 1;\n for (j = 1; j < jLen; j += 1) {\n currentLengthData = lengths[j - 1];\n if (addedLength + currentLengthData.addedLength < shapeSegment.s) {\n addedLength += currentLengthData.addedLength;\n shapePath.c = false;\n } else if (addedLength > shapeSegment.e) {\n shapePath.c = false;\n break;\n } else {\n if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {\n this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape);\n newShape = false;\n } else {\n segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[j], shapePaths[i].o[j - 1], shapePaths[i].i[j], (shapeSegment.s - addedLength) / currentLengthData.addedLength, (shapeSegment.e - addedLength) / currentLengthData.addedLength, lengths[j - 1]);\n this.addSegmentFromArray(segment, shapePath, segmentCount, newShape); // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\n\n newShape = false;\n shapePath.c = false;\n }\n addedLength += currentLengthData.addedLength;\n segmentCount += 1;\n }\n }\n if (shapePaths[i].c && lengths.length) {\n currentLengthData = lengths[j - 1];\n if (addedLength <= shapeSegment.e) {\n var segmentLength = lengths[j - 1].addedLength;\n if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {\n this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape);\n newShape = false;\n } else {\n segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[0], shapePaths[i].o[j - 1], shapePaths[i].i[0], (shapeSegment.s - addedLength) / segmentLength, (shapeSegment.e - addedLength) / segmentLength, lengths[j - 1]);\n this.addSegmentFromArray(segment, shapePath, segmentCount, newShape); // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\n\n newShape = false;\n shapePath.c = false;\n }\n } else {\n shapePath.c = false;\n }\n addedLength += currentLengthData.addedLength;\n segmentCount += 1;\n }\n if (shapePath._length) {\n shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos);\n shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1], 'o', shapePath._length - 1);\n }\n if (addedLength > shapeSegment.e) {\n break;\n }\n if (i < len - 1) {\n shapePath = shapePool.newElement();\n newShape = true;\n shapes.push(shapePath);\n segmentCount = 0;\n }\n }\n return shapes;\n };\n function PuckerAndBloatModifier() {}\n extendPrototype([ShapeModifier], PuckerAndBloatModifier);\n PuckerAndBloatModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys;\n this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this);\n this._isAnimated = !!this.amount.effectsSequence.length;\n };\n PuckerAndBloatModifier.prototype.processPath = function (path, amount) {\n var percent = amount / 100;\n var centerPoint = [0, 0];\n var pathLength = path._length;\n var i = 0;\n for (i = 0; i < pathLength; i += 1) {\n centerPoint[0] += path.v[i][0];\n centerPoint[1] += path.v[i][1];\n }\n centerPoint[0] /= pathLength;\n centerPoint[1] /= pathLength;\n var clonedPath = shapePool.newElement();\n clonedPath.c = path.c;\n var vX;\n var vY;\n var oX;\n var oY;\n var iX;\n var iY;\n for (i = 0; i < pathLength; i += 1) {\n vX = path.v[i][0] + (centerPoint[0] - path.v[i][0]) * percent;\n vY = path.v[i][1] + (centerPoint[1] - path.v[i][1]) * percent;\n oX = path.o[i][0] + (centerPoint[0] - path.o[i][0]) * -percent;\n oY = path.o[i][1] + (centerPoint[1] - path.o[i][1]) * -percent;\n iX = path.i[i][0] + (centerPoint[0] - path.i[i][0]) * -percent;\n iY = path.i[i][1] + (centerPoint[1] - path.i[i][1]) * -percent;\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, i);\n }\n return clonedPath;\n };\n PuckerAndBloatModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths;\n var i;\n var len = this.shapes.length;\n var j;\n var jLen;\n var amount = this.amount.v;\n if (amount !== 0) {\n var shapeData;\n var localShapeCollection;\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i];\n localShapeCollection = shapeData.localShapeCollection;\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes();\n shapeData.shape._mdf = true;\n shapePaths = shapeData.shape.paths.shapes;\n jLen = shapeData.shape.paths._length;\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], amount));\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection;\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false;\n }\n };\n var TransformPropertyFactory = function () {\n var defaultVector = [0, 0];\n function applyToMatrix(mat) {\n var _mdf = this._mdf;\n this.iterateDynamicProperties();\n this._mdf = this._mdf || _mdf;\n if (this.a) {\n mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\n }\n if (this.s) {\n mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\n }\n if (this.sk) {\n mat.skewFromAxis(-this.sk.v, this.sa.v);\n }\n if (this.r) {\n mat.rotate(-this.r.v);\n } else {\n mat.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);\n }\n if (this.data.p.s) {\n if (this.data.p.z) {\n mat.translate(this.px.v, this.py.v, -this.pz.v);\n } else {\n mat.translate(this.px.v, this.py.v, 0);\n }\n } else {\n mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);\n }\n }\n function processKeys(forceRender) {\n if (this.elem.globalData.frameId === this.frameId) {\n return;\n }\n if (this._isDirty) {\n this.precalculateMatrix();\n this._isDirty = false;\n }\n this.iterateDynamicProperties();\n if (this._mdf || forceRender) {\n var frameRate;\n this.v.cloneFromProps(this.pre.props);\n if (this.appliedTransformations < 1) {\n this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\n }\n if (this.appliedTransformations < 2) {\n this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\n }\n if (this.sk && this.appliedTransformations < 3) {\n this.v.skewFromAxis(-this.sk.v, this.sa.v);\n }\n if (this.r && this.appliedTransformations < 4) {\n this.v.rotate(-this.r.v);\n } else if (!this.r && this.appliedTransformations < 4) {\n this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);\n }\n if (this.autoOriented) {\n var v1;\n var v2;\n frameRate = this.elem.globalData.frameRate;\n if (this.p && this.p.keyframes && this.p.getValueAtTime) {\n if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) {\n v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0);\n v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0);\n } else if (this.p._caching.lastFrame + this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) {\n v1 = this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length - 1].t / frameRate, 0);\n v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0);\n } else {\n v1 = this.p.pv;\n v2 = this.p.getValueAtTime((this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime);\n }\n } else if (this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) {\n v1 = [];\n v2 = [];\n var px = this.px;\n var py = this.py;\n if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) {\n v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0);\n v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0);\n v2[0] = px.getValueAtTime(px.keyframes[0].t / frameRate, 0);\n v2[1] = py.getValueAtTime(py.keyframes[0].t / frameRate, 0);\n } else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {\n v1[0] = px.getValueAtTime(px.keyframes[px.keyframes.length - 1].t / frameRate, 0);\n v1[1] = py.getValueAtTime(py.keyframes[py.keyframes.length - 1].t / frameRate, 0);\n v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0);\n v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0);\n } else {\n v1 = [px.pv, py.pv];\n v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime);\n v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime);\n }\n } else {\n v2 = defaultVector;\n v1 = v2;\n }\n this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]));\n }\n if (this.data.p && this.data.p.s) {\n if (this.data.p.z) {\n this.v.translate(this.px.v, this.py.v, -this.pz.v);\n } else {\n this.v.translate(this.px.v, this.py.v, 0);\n }\n } else {\n this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);\n }\n }\n this.frameId = this.elem.globalData.frameId;\n }\n function precalculateMatrix() {\n this.appliedTransformations = 0;\n this.pre.reset();\n if (!this.a.effectsSequence.length) {\n this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\n this.appliedTransformations = 1;\n } else {\n return;\n }\n if (!this.s.effectsSequence.length) {\n this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\n this.appliedTransformations = 2;\n } else {\n return;\n }\n if (this.sk) {\n if (!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {\n this.pre.skewFromAxis(-this.sk.v, this.sa.v);\n this.appliedTransformations = 3;\n } else {\n return;\n }\n }\n if (this.r) {\n if (!this.r.effectsSequence.length) {\n this.pre.rotate(-this.r.v);\n this.appliedTransformations = 4;\n }\n } else if (!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) {\n this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);\n this.appliedTransformations = 4;\n }\n }\n function autoOrient() {//\n // var prevP = this.getValueAtTime();\n }\n function addDynamicProperty(prop) {\n this._addDynamicProperty(prop);\n this.elem.addDynamicProperty(prop);\n this._isDirty = true;\n }\n function TransformProperty(elem, data, container) {\n this.elem = elem;\n this.frameId = -1;\n this.propType = 'transform';\n this.data = data;\n this.v = new Matrix(); // Precalculated matrix with non animated properties\n\n this.pre = new Matrix();\n this.appliedTransformations = 0;\n this.initDynamicPropertyContainer(container || elem);\n if (data.p && data.p.s) {\n this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this);\n this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this);\n if (data.p.z) {\n this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this);\n }\n } else {\n this.p = PropertyFactory.getProp(elem, data.p || {\n k: [0, 0, 0]\n }, 1, 0, this);\n }\n if (data.rx) {\n this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this);\n this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this);\n this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this);\n if (data.or.k[0].ti) {\n var i;\n var len = data.or.k.length;\n for (i = 0; i < len; i += 1) {\n data.or.k[i].to = null;\n data.or.k[i].ti = null;\n }\n }\n this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this); // sh Indicates it needs to be capped between -180 and 180\n\n this.or.sh = true;\n } else {\n this.r = PropertyFactory.getProp(elem, data.r || {\n k: 0\n }, 0, degToRads, this);\n }\n if (data.sk) {\n this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this);\n this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this);\n }\n this.a = PropertyFactory.getProp(elem, data.a || {\n k: [0, 0, 0]\n }, 1, 0, this);\n this.s = PropertyFactory.getProp(elem, data.s || {\n k: [100, 100, 100]\n }, 1, 0.01, this); // Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes.\n\n if (data.o) {\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem);\n } else {\n this.o = {\n _mdf: false,\n v: 1\n };\n }\n this._isDirty = true;\n if (!this.dynamicProperties.length) {\n this.getValue(true);\n }\n }\n TransformProperty.prototype = {\n applyToMatrix: applyToMatrix,\n getValue: processKeys,\n precalculateMatrix: precalculateMatrix,\n autoOrient: autoOrient\n };\n extendPrototype([DynamicPropertyContainer], TransformProperty);\n TransformProperty.prototype.addDynamicProperty = addDynamicProperty;\n TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty;\n function getTransformProperty(elem, data, container) {\n return new TransformProperty(elem, data, container);\n }\n return {\n getTransformProperty: getTransformProperty\n };\n }();\n function RepeaterModifier() {}\n extendPrototype([ShapeModifier], RepeaterModifier);\n RepeaterModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys;\n this.c = PropertyFactory.getProp(elem, data.c, 0, null, this);\n this.o = PropertyFactory.getProp(elem, data.o, 0, null, this);\n this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this);\n this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this);\n this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this);\n this.data = data;\n if (!this.dynamicProperties.length) {\n this.getValue(true);\n }\n this._isAnimated = !!this.dynamicProperties.length;\n this.pMatrix = new Matrix();\n this.rMatrix = new Matrix();\n this.sMatrix = new Matrix();\n this.tMatrix = new Matrix();\n this.matrix = new Matrix();\n };\n RepeaterModifier.prototype.applyTransforms = function (pMatrix, rMatrix, sMatrix, transform, perc, inv) {\n var dir = inv ? -1 : 1;\n var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc);\n var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc);\n pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]);\n rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);\n rMatrix.rotate(-transform.r.v * dir * perc);\n rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);\n sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);\n sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY);\n sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);\n };\n RepeaterModifier.prototype.init = function (elem, arr, pos, elemsData) {\n this.elem = elem;\n this.arr = arr;\n this.pos = pos;\n this.elemsData = elemsData;\n this._currentCopies = 0;\n this._elements = [];\n this._groups = [];\n this.frameId = -1;\n this.initDynamicPropertyContainer(elem);\n this.initModifierProperties(elem, arr[pos]);\n while (pos > 0) {\n pos -= 1; // this._elements.unshift(arr.splice(pos,1)[0]);\n\n this._elements.unshift(arr[pos]);\n }\n if (this.dynamicProperties.length) {\n this.k = true;\n } else {\n this.getValue(true);\n }\n };\n RepeaterModifier.prototype.resetElements = function (elements) {\n var i;\n var len = elements.length;\n for (i = 0; i < len; i += 1) {\n elements[i]._processed = false;\n if (elements[i].ty === 'gr') {\n this.resetElements(elements[i].it);\n }\n }\n };\n RepeaterModifier.prototype.cloneElements = function (elements) {\n var newElements = JSON.parse(JSON.stringify(elements));\n this.resetElements(newElements);\n return newElements;\n };\n RepeaterModifier.prototype.changeGroupRender = function (elements, renderFlag) {\n var i;\n var len = elements.length;\n for (i = 0; i < len; i += 1) {\n elements[i]._render = renderFlag;\n if (elements[i].ty === 'gr') {\n this.changeGroupRender(elements[i].it, renderFlag);\n }\n }\n };\n RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {\n var items;\n var itemsTransform;\n var i;\n var dir;\n var cont;\n var hasReloaded = false;\n if (this._mdf || _isFirstFrame) {\n var copies = Math.ceil(this.c.v);\n if (this._groups.length < copies) {\n while (this._groups.length < copies) {\n var group = {\n it: this.cloneElements(this._elements),\n ty: 'gr'\n };\n group.it.push({\n a: {\n a: 0,\n ix: 1,\n k: [0, 0]\n },\n nm: 'Transform',\n o: {\n a: 0,\n ix: 7,\n k: 100\n },\n p: {\n a: 0,\n ix: 2,\n k: [0, 0]\n },\n r: {\n a: 1,\n ix: 6,\n k: [{\n s: 0,\n e: 0,\n t: 0\n }, {\n s: 0,\n e: 0,\n t: 1\n }]\n },\n s: {\n a: 0,\n ix: 3,\n k: [100, 100]\n },\n sa: {\n a: 0,\n ix: 5,\n k: 0\n },\n sk: {\n a: 0,\n ix: 4,\n k: 0\n },\n ty: 'tr'\n });\n this.arr.splice(0, 0, group);\n this._groups.splice(0, 0, group);\n this._currentCopies += 1;\n }\n this.elem.reloadShapes();\n hasReloaded = true;\n }\n cont = 0;\n var renderFlag;\n for (i = 0; i <= this._groups.length - 1; i += 1) {\n renderFlag = cont < copies;\n this._groups[i]._render = renderFlag;\n this.changeGroupRender(this._groups[i].it, renderFlag);\n if (!renderFlag) {\n var elems = this.elemsData[i].it;\n var transformData = elems[elems.length - 1];\n if (transformData.transform.op.v !== 0) {\n transformData.transform.op._mdf = true;\n transformData.transform.op.v = 0;\n } else {\n transformData.transform.op._mdf = false;\n }\n }\n cont += 1;\n }\n this._currentCopies = copies; /// /\n\n var offset = this.o.v;\n var offsetModulo = offset % 1;\n var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset);\n var pProps = this.pMatrix.props;\n var rProps = this.rMatrix.props;\n var sProps = this.sMatrix.props;\n this.pMatrix.reset();\n this.rMatrix.reset();\n this.sMatrix.reset();\n this.tMatrix.reset();\n this.matrix.reset();\n var iteration = 0;\n if (offset > 0) {\n while (iteration < roundOffset) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);\n iteration += 1;\n }\n if (offsetModulo) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false);\n iteration += offsetModulo;\n }\n } else if (offset < 0) {\n while (iteration > roundOffset) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true);\n iteration -= 1;\n }\n if (offsetModulo) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -offsetModulo, true);\n iteration -= offsetModulo;\n }\n }\n i = this.data.m === 1 ? 0 : this._currentCopies - 1;\n dir = this.data.m === 1 ? 1 : -1;\n cont = this._currentCopies;\n var j;\n var jLen;\n while (cont) {\n items = this.elemsData[i].it;\n itemsTransform = items[items.length - 1].transform.mProps.v.props;\n jLen = itemsTransform.length;\n items[items.length - 1].transform.mProps._mdf = true;\n items[items.length - 1].transform.op._mdf = true;\n items[items.length - 1].transform.op.v = this._currentCopies === 1 ? this.so.v : this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1));\n if (iteration !== 0) {\n if (i !== 0 && dir === 1 || i !== this._currentCopies - 1 && dir === -1) {\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);\n }\n this.matrix.transform(rProps[0], rProps[1], rProps[2], rProps[3], rProps[4], rProps[5], rProps[6], rProps[7], rProps[8], rProps[9], rProps[10], rProps[11], rProps[12], rProps[13], rProps[14], rProps[15]);\n this.matrix.transform(sProps[0], sProps[1], sProps[2], sProps[3], sProps[4], sProps[5], sProps[6], sProps[7], sProps[8], sProps[9], sProps[10], sProps[11], sProps[12], sProps[13], sProps[14], sProps[15]);\n this.matrix.transform(pProps[0], pProps[1], pProps[2], pProps[3], pProps[4], pProps[5], pProps[6], pProps[7], pProps[8], pProps[9], pProps[10], pProps[11], pProps[12], pProps[13], pProps[14], pProps[15]);\n for (j = 0; j < jLen; j += 1) {\n itemsTransform[j] = this.matrix.props[j];\n }\n this.matrix.reset();\n } else {\n this.matrix.reset();\n for (j = 0; j < jLen; j += 1) {\n itemsTransform[j] = this.matrix.props[j];\n }\n }\n iteration += 1;\n cont -= 1;\n i += dir;\n }\n } else {\n cont = this._currentCopies;\n i = 0;\n dir = 1;\n while (cont) {\n items = this.elemsData[i].it;\n itemsTransform = items[items.length - 1].transform.mProps.v.props;\n items[items.length - 1].transform.mProps._mdf = false;\n items[items.length - 1].transform.op._mdf = false;\n cont -= 1;\n i += dir;\n }\n }\n return hasReloaded;\n };\n RepeaterModifier.prototype.addShape = function () {};\n function RoundCornersModifier() {}\n extendPrototype([ShapeModifier], RoundCornersModifier);\n RoundCornersModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys;\n this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this);\n this._isAnimated = !!this.rd.effectsSequence.length;\n };\n RoundCornersModifier.prototype.processPath = function (path, round) {\n var clonedPath = shapePool.newElement();\n clonedPath.c = path.c;\n var i;\n var len = path._length;\n var currentV;\n var currentI;\n var currentO;\n var closerV;\n var distance;\n var newPosPerc;\n var index = 0;\n var vX;\n var vY;\n var oX;\n var oY;\n var iX;\n var iY;\n for (i = 0; i < len; i += 1) {\n currentV = path.v[i];\n currentO = path.o[i];\n currentI = path.i[i];\n if (currentV[0] === currentO[0] && currentV[1] === currentO[1] && currentV[0] === currentI[0] && currentV[1] === currentI[1]) {\n if ((i === 0 || i === len - 1) && !path.c) {\n clonedPath.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index);\n /* clonedPath.v[index] = currentV;\r\n clonedPath.o[index] = currentO;\r\n clonedPath.i[index] = currentI; */\n\n index += 1;\n } else {\n if (i === 0) {\n closerV = path.v[len - 1];\n } else {\n closerV = path.v[i - 1];\n }\n distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));\n newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;\n iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;\n vX = iX;\n iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc;\n vY = iY;\n oX = vX - (vX - currentV[0]) * roundCorner;\n oY = vY - (vY - currentV[1]) * roundCorner;\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index);\n index += 1;\n if (i === len - 1) {\n closerV = path.v[0];\n } else {\n closerV = path.v[i + 1];\n }\n distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));\n newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;\n oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;\n vX = oX;\n oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc;\n vY = oY;\n iX = vX - (vX - currentV[0]) * roundCorner;\n iY = vY - (vY - currentV[1]) * roundCorner;\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index);\n index += 1;\n }\n } else {\n clonedPath.setTripleAt(path.v[i][0], path.v[i][1], path.o[i][0], path.o[i][1], path.i[i][0], path.i[i][1], index);\n index += 1;\n }\n }\n return clonedPath;\n };\n RoundCornersModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths;\n var i;\n var len = this.shapes.length;\n var j;\n var jLen;\n var rd = this.rd.v;\n if (rd !== 0) {\n var shapeData;\n var localShapeCollection;\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i];\n localShapeCollection = shapeData.localShapeCollection;\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes();\n shapeData.shape._mdf = true;\n shapePaths = shapeData.shape.paths.shapes;\n jLen = shapeData.shape.paths._length;\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], rd));\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection;\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false;\n }\n };\n function floatEqual(a, b) {\n return Math.abs(a - b) * 100000 <= Math.min(Math.abs(a), Math.abs(b));\n }\n function floatZero(f) {\n return Math.abs(f) <= 0.00001;\n }\n function lerp(p0, p1, amount) {\n return p0 * (1 - amount) + p1 * amount;\n }\n function lerpPoint(p0, p1, amount) {\n return [lerp(p0[0], p1[0], amount), lerp(p0[1], p1[1], amount)];\n }\n function quadRoots(a, b, c) {\n // no root\n if (a === 0) return [];\n var s = b * b - 4 * a * c; // Complex roots\n\n if (s < 0) return [];\n var singleRoot = -b / (2 * a); // 1 root\n\n if (s === 0) return [singleRoot];\n var delta = Math.sqrt(s) / (2 * a); // 2 roots\n\n return [singleRoot - delta, singleRoot + delta];\n }\n function polynomialCoefficients(p0, p1, p2, p3) {\n return [-p0 + 3 * p1 - 3 * p2 + p3, 3 * p0 - 6 * p1 + 3 * p2, -3 * p0 + 3 * p1, p0];\n }\n function singlePoint(p) {\n return new PolynomialBezier(p, p, p, p, false);\n }\n function PolynomialBezier(p0, p1, p2, p3, linearize) {\n if (linearize && pointEqual(p0, p1)) {\n p1 = lerpPoint(p0, p3, 1 / 3);\n }\n if (linearize && pointEqual(p2, p3)) {\n p2 = lerpPoint(p0, p3, 2 / 3);\n }\n var coeffx = polynomialCoefficients(p0[0], p1[0], p2[0], p3[0]);\n var coeffy = polynomialCoefficients(p0[1], p1[1], p2[1], p3[1]);\n this.a = [coeffx[0], coeffy[0]];\n this.b = [coeffx[1], coeffy[1]];\n this.c = [coeffx[2], coeffy[2]];\n this.d = [coeffx[3], coeffy[3]];\n this.points = [p0, p1, p2, p3];\n }\n PolynomialBezier.prototype.point = function (t) {\n return [((this.a[0] * t + this.b[0]) * t + this.c[0]) * t + this.d[0], ((this.a[1] * t + this.b[1]) * t + this.c[1]) * t + this.d[1]];\n };\n PolynomialBezier.prototype.derivative = function (t) {\n return [(3 * t * this.a[0] + 2 * this.b[0]) * t + this.c[0], (3 * t * this.a[1] + 2 * this.b[1]) * t + this.c[1]];\n };\n PolynomialBezier.prototype.tangentAngle = function (t) {\n var p = this.derivative(t);\n return Math.atan2(p[1], p[0]);\n };\n PolynomialBezier.prototype.normalAngle = function (t) {\n var p = this.derivative(t);\n return Math.atan2(p[0], p[1]);\n };\n PolynomialBezier.prototype.inflectionPoints = function () {\n var denom = this.a[1] * this.b[0] - this.a[0] * this.b[1];\n if (floatZero(denom)) return [];\n var tcusp = -0.5 * (this.a[1] * this.c[0] - this.a[0] * this.c[1]) / denom;\n var square = tcusp * tcusp - 1 / 3 * (this.b[1] * this.c[0] - this.b[0] * this.c[1]) / denom;\n if (square < 0) return [];\n var root = Math.sqrt(square);\n if (floatZero(root)) {\n if (root > 0 && root < 1) return [tcusp];\n return [];\n }\n return [tcusp - root, tcusp + root].filter(function (r) {\n return r > 0 && r < 1;\n });\n };\n PolynomialBezier.prototype.split = function (t) {\n if (t <= 0) return [singlePoint(this.points[0]), this];\n if (t >= 1) return [this, singlePoint(this.points[this.points.length - 1])];\n var p10 = lerpPoint(this.points[0], this.points[1], t);\n var p11 = lerpPoint(this.points[1], this.points[2], t);\n var p12 = lerpPoint(this.points[2], this.points[3], t);\n var p20 = lerpPoint(p10, p11, t);\n var p21 = lerpPoint(p11, p12, t);\n var p3 = lerpPoint(p20, p21, t);\n return [new PolynomialBezier(this.points[0], p10, p20, p3, true), new PolynomialBezier(p3, p21, p12, this.points[3], true)];\n };\n function extrema(bez, comp) {\n var min = bez.points[0][comp];\n var max = bez.points[bez.points.length - 1][comp];\n if (min > max) {\n var e = max;\n max = min;\n min = e;\n } // Derivative roots to find min/max\n\n var f = quadRoots(3 * bez.a[comp], 2 * bez.b[comp], bez.c[comp]);\n for (var i = 0; i < f.length; i += 1) {\n if (f[i] > 0 && f[i] < 1) {\n var val = bez.point(f[i])[comp];\n if (val < min) min = val;else if (val > max) max = val;\n }\n }\n return {\n min: min,\n max: max\n };\n }\n PolynomialBezier.prototype.bounds = function () {\n return {\n x: extrema(this, 0),\n y: extrema(this, 1)\n };\n };\n PolynomialBezier.prototype.boundingBox = function () {\n var bounds = this.bounds();\n return {\n left: bounds.x.min,\n right: bounds.x.max,\n top: bounds.y.min,\n bottom: bounds.y.max,\n width: bounds.x.max - bounds.x.min,\n height: bounds.y.max - bounds.y.min,\n cx: (bounds.x.max + bounds.x.min) / 2,\n cy: (bounds.y.max + bounds.y.min) / 2\n };\n };\n function intersectData(bez, t1, t2) {\n var box = bez.boundingBox();\n return {\n cx: box.cx,\n cy: box.cy,\n width: box.width,\n height: box.height,\n bez: bez,\n t: (t1 + t2) / 2,\n t1: t1,\n t2: t2\n };\n }\n function splitData(data) {\n var split = data.bez.split(0.5);\n return [intersectData(split[0], data.t1, data.t), intersectData(split[1], data.t, data.t2)];\n }\n function boxIntersect(b1, b2) {\n return Math.abs(b1.cx - b2.cx) * 2 < b1.width + b2.width && Math.abs(b1.cy - b2.cy) * 2 < b1.height + b2.height;\n }\n function intersectsImpl(d1, d2, depth, tolerance, intersections, maxRecursion) {\n if (!boxIntersect(d1, d2)) return;\n if (depth >= maxRecursion || d1.width <= tolerance && d1.height <= tolerance && d2.width <= tolerance && d2.height <= tolerance) {\n intersections.push([d1.t, d2.t]);\n return;\n }\n var d1s = splitData(d1);\n var d2s = splitData(d2);\n intersectsImpl(d1s[0], d2s[0], depth + 1, tolerance, intersections, maxRecursion);\n intersectsImpl(d1s[0], d2s[1], depth + 1, tolerance, intersections, maxRecursion);\n intersectsImpl(d1s[1], d2s[0], depth + 1, tolerance, intersections, maxRecursion);\n intersectsImpl(d1s[1], d2s[1], depth + 1, tolerance, intersections, maxRecursion);\n }\n PolynomialBezier.prototype.intersections = function (other, tolerance, maxRecursion) {\n if (tolerance === undefined) tolerance = 2;\n if (maxRecursion === undefined) maxRecursion = 7;\n var intersections = [];\n intersectsImpl(intersectData(this, 0, 1), intersectData(other, 0, 1), 0, tolerance, intersections, maxRecursion);\n return intersections;\n };\n PolynomialBezier.shapeSegment = function (shapePath, index) {\n var nextIndex = (index + 1) % shapePath.length();\n return new PolynomialBezier(shapePath.v[index], shapePath.o[index], shapePath.i[nextIndex], shapePath.v[nextIndex], true);\n };\n PolynomialBezier.shapeSegmentInverted = function (shapePath, index) {\n var nextIndex = (index + 1) % shapePath.length();\n return new PolynomialBezier(shapePath.v[nextIndex], shapePath.i[nextIndex], shapePath.o[index], shapePath.v[index], true);\n };\n function crossProduct(a, b) {\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\n }\n function lineIntersection(start1, end1, start2, end2) {\n var v1 = [start1[0], start1[1], 1];\n var v2 = [end1[0], end1[1], 1];\n var v3 = [start2[0], start2[1], 1];\n var v4 = [end2[0], end2[1], 1];\n var r = crossProduct(crossProduct(v1, v2), crossProduct(v3, v4));\n if (floatZero(r[2])) return null;\n return [r[0] / r[2], r[1] / r[2]];\n }\n function polarOffset(p, angle, length) {\n return [p[0] + Math.cos(angle) * length, p[1] - Math.sin(angle) * length];\n }\n function pointDistance(p1, p2) {\n return Math.hypot(p1[0] - p2[0], p1[1] - p2[1]);\n }\n function pointEqual(p1, p2) {\n return floatEqual(p1[0], p2[0]) && floatEqual(p1[1], p2[1]);\n }\n function ZigZagModifier() {}\n extendPrototype([ShapeModifier], ZigZagModifier);\n ZigZagModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys;\n this.amplitude = PropertyFactory.getProp(elem, data.s, 0, null, this);\n this.frequency = PropertyFactory.getProp(elem, data.r, 0, null, this);\n this.pointsType = PropertyFactory.getProp(elem, data.pt, 0, null, this);\n this._isAnimated = this.amplitude.effectsSequence.length !== 0 || this.frequency.effectsSequence.length !== 0 || this.pointsType.effectsSequence.length !== 0;\n };\n function setPoint(outputBezier, point, angle, direction, amplitude, outAmplitude, inAmplitude) {\n var angO = angle - Math.PI / 2;\n var angI = angle + Math.PI / 2;\n var px = point[0] + Math.cos(angle) * direction * amplitude;\n var py = point[1] - Math.sin(angle) * direction * amplitude;\n outputBezier.setTripleAt(px, py, px + Math.cos(angO) * outAmplitude, py - Math.sin(angO) * outAmplitude, px + Math.cos(angI) * inAmplitude, py - Math.sin(angI) * inAmplitude, outputBezier.length());\n }\n function getPerpendicularVector(pt1, pt2) {\n var vector = [pt2[0] - pt1[0], pt2[1] - pt1[1]];\n var rot = -Math.PI * 0.5;\n var rotatedVector = [Math.cos(rot) * vector[0] - Math.sin(rot) * vector[1], Math.sin(rot) * vector[0] + Math.cos(rot) * vector[1]];\n return rotatedVector;\n }\n function getProjectingAngle(path, cur) {\n var prevIndex = cur === 0 ? path.length() - 1 : cur - 1;\n var nextIndex = (cur + 1) % path.length();\n var prevPoint = path.v[prevIndex];\n var nextPoint = path.v[nextIndex];\n var pVector = getPerpendicularVector(prevPoint, nextPoint);\n return Math.atan2(0, 1) - Math.atan2(pVector[1], pVector[0]);\n }\n function zigZagCorner(outputBezier, path, cur, amplitude, frequency, pointType, direction) {\n var angle = getProjectingAngle(path, cur);\n var point = path.v[cur % path._length];\n var prevPoint = path.v[cur === 0 ? path._length - 1 : cur - 1];\n var nextPoint = path.v[(cur + 1) % path._length];\n var prevDist = pointType === 2 ? Math.sqrt(Math.pow(point[0] - prevPoint[0], 2) + Math.pow(point[1] - prevPoint[1], 2)) : 0;\n var nextDist = pointType === 2 ? Math.sqrt(Math.pow(point[0] - nextPoint[0], 2) + Math.pow(point[1] - nextPoint[1], 2)) : 0;\n setPoint(outputBezier, path.v[cur % path._length], angle, direction, amplitude, nextDist / ((frequency + 1) * 2), prevDist / ((frequency + 1) * 2), pointType);\n }\n function zigZagSegment(outputBezier, segment, amplitude, frequency, pointType, direction) {\n for (var i = 0; i < frequency; i += 1) {\n var t = (i + 1) / (frequency + 1);\n var dist = pointType === 2 ? Math.sqrt(Math.pow(segment.points[3][0] - segment.points[0][0], 2) + Math.pow(segment.points[3][1] - segment.points[0][1], 2)) : 0;\n var angle = segment.normalAngle(t);\n var point = segment.point(t);\n setPoint(outputBezier, point, angle, direction, amplitude, dist / ((frequency + 1) * 2), dist / ((frequency + 1) * 2), pointType);\n direction = -direction;\n }\n return direction;\n }\n ZigZagModifier.prototype.processPath = function (path, amplitude, frequency, pointType) {\n var count = path._length;\n var clonedPath = shapePool.newElement();\n clonedPath.c = path.c;\n if (!path.c) {\n count -= 1;\n }\n if (count === 0) return clonedPath;\n var direction = -1;\n var segment = PolynomialBezier.shapeSegment(path, 0);\n zigZagCorner(clonedPath, path, 0, amplitude, frequency, pointType, direction);\n for (var i = 0; i < count; i += 1) {\n direction = zigZagSegment(clonedPath, segment, amplitude, frequency, pointType, -direction);\n if (i === count - 1 && !path.c) {\n segment = null;\n } else {\n segment = PolynomialBezier.shapeSegment(path, (i + 1) % count);\n }\n zigZagCorner(clonedPath, path, i + 1, amplitude, frequency, pointType, direction);\n }\n return clonedPath;\n };\n ZigZagModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths;\n var i;\n var len = this.shapes.length;\n var j;\n var jLen;\n var amplitude = this.amplitude.v;\n var frequency = Math.max(0, Math.round(this.frequency.v));\n var pointType = this.pointsType.v;\n if (amplitude !== 0) {\n var shapeData;\n var localShapeCollection;\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i];\n localShapeCollection = shapeData.localShapeCollection;\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes();\n shapeData.shape._mdf = true;\n shapePaths = shapeData.shape.paths.shapes;\n jLen = shapeData.shape.paths._length;\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], amplitude, frequency, pointType));\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection;\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false;\n }\n };\n function linearOffset(p1, p2, amount) {\n var angle = Math.atan2(p2[0] - p1[0], p2[1] - p1[1]);\n return [polarOffset(p1, angle, amount), polarOffset(p2, angle, amount)];\n }\n function offsetSegment(segment, amount) {\n var p0;\n var p1a;\n var p1b;\n var p2b;\n var p2a;\n var p3;\n var e;\n e = linearOffset(segment.points[0], segment.points[1], amount);\n p0 = e[0];\n p1a = e[1];\n e = linearOffset(segment.points[1], segment.points[2], amount);\n p1b = e[0];\n p2b = e[1];\n e = linearOffset(segment.points[2], segment.points[3], amount);\n p2a = e[0];\n p3 = e[1];\n var p1 = lineIntersection(p0, p1a, p1b, p2b);\n if (p1 === null) p1 = p1a;\n var p2 = lineIntersection(p2a, p3, p1b, p2b);\n if (p2 === null) p2 = p2a;\n return new PolynomialBezier(p0, p1, p2, p3);\n }\n function joinLines(outputBezier, seg1, seg2, lineJoin, miterLimit) {\n var p0 = seg1.points[3];\n var p1 = seg2.points[0]; // Bevel\n\n if (lineJoin === 3) return p0; // Connected, they don't need a joint\n\n if (pointEqual(p0, p1)) return p0; // Round\n\n if (lineJoin === 2) {\n var angleOut = -seg1.tangentAngle(1);\n var angleIn = -seg2.tangentAngle(0) + Math.PI;\n var center = lineIntersection(p0, polarOffset(p0, angleOut + Math.PI / 2, 100), p1, polarOffset(p1, angleOut + Math.PI / 2, 100));\n var radius = center ? pointDistance(center, p0) : pointDistance(p0, p1) / 2;\n var tan = polarOffset(p0, angleOut, 2 * radius * roundCorner);\n outputBezier.setXYAt(tan[0], tan[1], 'o', outputBezier.length() - 1);\n tan = polarOffset(p1, angleIn, 2 * radius * roundCorner);\n outputBezier.setTripleAt(p1[0], p1[1], p1[0], p1[1], tan[0], tan[1], outputBezier.length());\n return p1;\n } // Miter\n\n var t0 = pointEqual(p0, seg1.points[2]) ? seg1.points[0] : seg1.points[2];\n var t1 = pointEqual(p1, seg2.points[1]) ? seg2.points[3] : seg2.points[1];\n var intersection = lineIntersection(t0, p0, p1, t1);\n if (intersection && pointDistance(intersection, p0) < miterLimit) {\n outputBezier.setTripleAt(intersection[0], intersection[1], intersection[0], intersection[1], intersection[0], intersection[1], outputBezier.length());\n return intersection;\n }\n return p0;\n }\n function getIntersection(a, b) {\n var intersect = a.intersections(b);\n if (intersect.length && floatEqual(intersect[0][0], 1)) intersect.shift();\n if (intersect.length) return intersect[0];\n return null;\n }\n function pruneSegmentIntersection(a, b) {\n var outa = a.slice();\n var outb = b.slice();\n var intersect = getIntersection(a[a.length - 1], b[0]);\n if (intersect) {\n outa[a.length - 1] = a[a.length - 1].split(intersect[0])[0];\n outb[0] = b[0].split(intersect[1])[1];\n }\n if (a.length > 1 && b.length > 1) {\n intersect = getIntersection(a[0], b[b.length - 1]);\n if (intersect) {\n return [[a[0].split(intersect[0])[0]], [b[b.length - 1].split(intersect[1])[1]]];\n }\n }\n return [outa, outb];\n }\n function pruneIntersections(segments) {\n var e;\n for (var i = 1; i < segments.length; i += 1) {\n e = pruneSegmentIntersection(segments[i - 1], segments[i]);\n segments[i - 1] = e[0];\n segments[i] = e[1];\n }\n if (segments.length > 1) {\n e = pruneSegmentIntersection(segments[segments.length - 1], segments[0]);\n segments[segments.length - 1] = e[0];\n segments[0] = e[1];\n }\n return segments;\n }\n function offsetSegmentSplit(segment, amount) {\n /*\r\n We split each bezier segment into smaller pieces based\r\n on inflection points, this ensures the control point\r\n polygon is convex.\r\n (A cubic bezier can have none, one, or two inflection points)\r\n */\n var flex = segment.inflectionPoints();\n var left;\n var right;\n var split;\n var mid;\n if (flex.length === 0) {\n return [offsetSegment(segment, amount)];\n }\n if (flex.length === 1 || floatEqual(flex[1], 1)) {\n split = segment.split(flex[0]);\n left = split[0];\n right = split[1];\n return [offsetSegment(left, amount), offsetSegment(right, amount)];\n }\n split = segment.split(flex[0]);\n left = split[0];\n var t = (flex[1] - flex[0]) / (1 - flex[0]);\n split = split[1].split(t);\n mid = split[0];\n right = split[1];\n return [offsetSegment(left, amount), offsetSegment(mid, amount), offsetSegment(right, amount)];\n }\n function OffsetPathModifier() {}\n extendPrototype([ShapeModifier], OffsetPathModifier);\n OffsetPathModifier.prototype.initModifierProperties = function (elem, data) {\n this.getValue = this.processKeys;\n this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this);\n this.miterLimit = PropertyFactory.getProp(elem, data.ml, 0, null, this);\n this.lineJoin = data.lj;\n this._isAnimated = this.amount.effectsSequence.length !== 0;\n };\n OffsetPathModifier.prototype.processPath = function (inputBezier, amount, lineJoin, miterLimit) {\n var outputBezier = shapePool.newElement();\n outputBezier.c = inputBezier.c;\n var count = inputBezier.length();\n if (!inputBezier.c) {\n count -= 1;\n }\n var i;\n var j;\n var segment;\n var multiSegments = [];\n for (i = 0; i < count; i += 1) {\n segment = PolynomialBezier.shapeSegment(inputBezier, i);\n multiSegments.push(offsetSegmentSplit(segment, amount));\n }\n if (!inputBezier.c) {\n for (i = count - 1; i >= 0; i -= 1) {\n segment = PolynomialBezier.shapeSegmentInverted(inputBezier, i);\n multiSegments.push(offsetSegmentSplit(segment, amount));\n }\n }\n multiSegments = pruneIntersections(multiSegments); // Add bezier segments to the output and apply line joints\n\n var lastPoint = null;\n var lastSeg = null;\n for (i = 0; i < multiSegments.length; i += 1) {\n var multiSegment = multiSegments[i];\n if (lastSeg) lastPoint = joinLines(outputBezier, lastSeg, multiSegment[0], lineJoin, miterLimit);\n lastSeg = multiSegment[multiSegment.length - 1];\n for (j = 0; j < multiSegment.length; j += 1) {\n segment = multiSegment[j];\n if (lastPoint && pointEqual(segment.points[0], lastPoint)) {\n outputBezier.setXYAt(segment.points[1][0], segment.points[1][1], 'o', outputBezier.length() - 1);\n } else {\n outputBezier.setTripleAt(segment.points[0][0], segment.points[0][1], segment.points[1][0], segment.points[1][1], segment.points[0][0], segment.points[0][1], outputBezier.length());\n }\n outputBezier.setTripleAt(segment.points[3][0], segment.points[3][1], segment.points[3][0], segment.points[3][1], segment.points[2][0], segment.points[2][1], outputBezier.length());\n lastPoint = segment.points[3];\n }\n }\n if (multiSegments.length) joinLines(outputBezier, lastSeg, multiSegments[0][0], lineJoin, miterLimit);\n return outputBezier;\n };\n OffsetPathModifier.prototype.processShapes = function (_isFirstFrame) {\n var shapePaths;\n var i;\n var len = this.shapes.length;\n var j;\n var jLen;\n var amount = this.amount.v;\n var miterLimit = this.miterLimit.v;\n var lineJoin = this.lineJoin;\n if (amount !== 0) {\n var shapeData;\n var localShapeCollection;\n for (i = 0; i < len; i += 1) {\n shapeData = this.shapes[i];\n localShapeCollection = shapeData.localShapeCollection;\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\n localShapeCollection.releaseShapes();\n shapeData.shape._mdf = true;\n shapePaths = shapeData.shape.paths.shapes;\n jLen = shapeData.shape.paths._length;\n for (j = 0; j < jLen; j += 1) {\n localShapeCollection.addShape(this.processPath(shapePaths[j], amount, lineJoin, miterLimit));\n }\n }\n shapeData.shape.paths = shapeData.localShapeCollection;\n }\n }\n if (!this.dynamicProperties.length) {\n this._mdf = false;\n }\n };\n function getFontProperties(fontData) {\n var styles = fontData.fStyle ? fontData.fStyle.split(' ') : [];\n var fWeight = 'normal';\n var fStyle = 'normal';\n var len = styles.length;\n var styleName;\n for (var i = 0; i < len; i += 1) {\n styleName = styles[i].toLowerCase();\n switch (styleName) {\n case 'italic':\n fStyle = 'italic';\n break;\n case 'bold':\n fWeight = '700';\n break;\n case 'black':\n fWeight = '900';\n break;\n case 'medium':\n fWeight = '500';\n break;\n case 'regular':\n case 'normal':\n fWeight = '400';\n break;\n case 'light':\n case 'thin':\n fWeight = '200';\n break;\n default:\n break;\n }\n }\n return {\n style: fStyle,\n weight: fontData.fWeight || fWeight\n };\n }\n var FontManager = function () {\n var maxWaitingTime = 5000;\n var emptyChar = {\n w: 0,\n size: 0,\n shapes: [],\n data: {\n shapes: []\n }\n };\n var combinedCharacters = []; // Hindi characters\n\n combinedCharacters = combinedCharacters.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]);\n var BLACK_FLAG_CODE_POINT = 127988;\n var CANCEL_TAG_CODE_POINT = 917631;\n var A_TAG_CODE_POINT = 917601;\n var Z_TAG_CODE_POINT = 917626;\n var VARIATION_SELECTOR_16_CODE_POINT = 65039;\n var ZERO_WIDTH_JOINER_CODE_POINT = 8205;\n var REGIONAL_CHARACTER_A_CODE_POINT = 127462;\n var REGIONAL_CHARACTER_Z_CODE_POINT = 127487;\n var surrogateModifiers = ['d83cdffb', 'd83cdffc', 'd83cdffd', 'd83cdffe', 'd83cdfff'];\n function trimFontOptions(font) {\n var familyArray = font.split(',');\n var i;\n var len = familyArray.length;\n var enabledFamilies = [];\n for (i = 0; i < len; i += 1) {\n if (familyArray[i] !== 'sans-serif' && familyArray[i] !== 'monospace') {\n enabledFamilies.push(familyArray[i]);\n }\n }\n return enabledFamilies.join(',');\n }\n function setUpNode(font, family) {\n var parentNode = createTag('span'); // Node is invisible to screen readers.\n\n parentNode.setAttribute('aria-hidden', true);\n parentNode.style.fontFamily = family;\n var node = createTag('span'); // Characters that vary significantly among different fonts\n\n node.innerText = 'giItT1WQy@!-/#'; // Visible - so we can measure it - but not on the screen\n\n parentNode.style.position = 'absolute';\n parentNode.style.left = '-10000px';\n parentNode.style.top = '-10000px'; // Large font size makes even subtle changes obvious\n\n parentNode.style.fontSize = '300px'; // Reset any font properties\n\n parentNode.style.fontVariant = 'normal';\n parentNode.style.fontStyle = 'normal';\n parentNode.style.fontWeight = 'normal';\n parentNode.style.letterSpacing = '0';\n parentNode.appendChild(node);\n document.body.appendChild(parentNode); // Remember width with no applied web font\n\n var width = node.offsetWidth;\n node.style.fontFamily = trimFontOptions(font) + ', ' + family;\n return {\n node: node,\n w: width,\n parent: parentNode\n };\n }\n function checkLoadedFonts() {\n var i;\n var len = this.fonts.length;\n var node;\n var w;\n var loadedCount = len;\n for (i = 0; i < len; i += 1) {\n if (this.fonts[i].loaded) {\n loadedCount -= 1;\n } else if (this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0) {\n this.fonts[i].loaded = true;\n } else {\n node = this.fonts[i].monoCase.node;\n w = this.fonts[i].monoCase.w;\n if (node.offsetWidth !== w) {\n loadedCount -= 1;\n this.fonts[i].loaded = true;\n } else {\n node = this.fonts[i].sansCase.node;\n w = this.fonts[i].sansCase.w;\n if (node.offsetWidth !== w) {\n loadedCount -= 1;\n this.fonts[i].loaded = true;\n }\n }\n if (this.fonts[i].loaded) {\n this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent);\n this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent);\n }\n }\n }\n if (loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime) {\n setTimeout(this.checkLoadedFontsBinded, 20);\n } else {\n setTimeout(this.setIsLoadedBinded, 10);\n }\n }\n function createHelper(fontData, def) {\n var engine = document.body && def ? 'svg' : 'canvas';\n var helper;\n var fontProps = getFontProperties(fontData);\n if (engine === 'svg') {\n var tHelper = createNS('text');\n tHelper.style.fontSize = '100px'; // tHelper.style.fontFamily = fontData.fFamily;\n\n tHelper.setAttribute('font-family', fontData.fFamily);\n tHelper.setAttribute('font-style', fontProps.style);\n tHelper.setAttribute('font-weight', fontProps.weight);\n tHelper.textContent = '1';\n if (fontData.fClass) {\n tHelper.style.fontFamily = 'inherit';\n tHelper.setAttribute('class', fontData.fClass);\n } else {\n tHelper.style.fontFamily = fontData.fFamily;\n }\n def.appendChild(tHelper);\n helper = tHelper;\n } else {\n var tCanvasHelper = new OffscreenCanvas(500, 500).getContext('2d');\n tCanvasHelper.font = fontProps.style + ' ' + fontProps.weight + ' 100px ' + fontData.fFamily;\n helper = tCanvasHelper;\n }\n function measure(text) {\n if (engine === 'svg') {\n helper.textContent = text;\n return helper.getComputedTextLength();\n }\n return helper.measureText(text).width;\n }\n return {\n measureText: measure\n };\n }\n function addFonts(fontData, defs) {\n if (!fontData) {\n this.isLoaded = true;\n return;\n }\n if (this.chars) {\n this.isLoaded = true;\n this.fonts = fontData.list;\n return;\n }\n if (!document.body) {\n this.isLoaded = true;\n fontData.list.forEach(function (data) {\n data.helper = createHelper(data);\n data.cache = {};\n });\n this.fonts = fontData.list;\n return;\n }\n var fontArr = fontData.list;\n var i;\n var len = fontArr.length;\n var _pendingFonts = len;\n for (i = 0; i < len; i += 1) {\n var shouldLoadFont = true;\n var loadedSelector;\n var j;\n fontArr[i].loaded = false;\n fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace');\n fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif');\n if (!fontArr[i].fPath) {\n fontArr[i].loaded = true;\n _pendingFonts -= 1;\n } else if (fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3) {\n loadedSelector = document.querySelectorAll('style[f-forigin=\"p\"][f-family=\"' + fontArr[i].fFamily + '\"], style[f-origin=\"3\"][f-family=\"' + fontArr[i].fFamily + '\"]');\n if (loadedSelector.length > 0) {\n shouldLoadFont = false;\n }\n if (shouldLoadFont) {\n var s = createTag('style');\n s.setAttribute('f-forigin', fontArr[i].fOrigin);\n s.setAttribute('f-origin', fontArr[i].origin);\n s.setAttribute('f-family', fontArr[i].fFamily);\n s.type = 'text/css';\n s.innerText = '@font-face {font-family: ' + fontArr[i].fFamily + \"; font-style: normal; src: url('\" + fontArr[i].fPath + \"');}\";\n defs.appendChild(s);\n }\n } else if (fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1) {\n loadedSelector = document.querySelectorAll('link[f-forigin=\"g\"], link[f-origin=\"1\"]');\n for (j = 0; j < loadedSelector.length; j += 1) {\n if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {\n // Font is already loaded\n shouldLoadFont = false;\n }\n }\n if (shouldLoadFont) {\n var l = createTag('link');\n l.setAttribute('f-forigin', fontArr[i].fOrigin);\n l.setAttribute('f-origin', fontArr[i].origin);\n l.type = 'text/css';\n l.rel = 'stylesheet';\n l.href = fontArr[i].fPath;\n document.body.appendChild(l);\n }\n } else if (fontArr[i].fOrigin === 't' || fontArr[i].origin === 2) {\n loadedSelector = document.querySelectorAll('script[f-forigin=\"t\"], script[f-origin=\"2\"]');\n for (j = 0; j < loadedSelector.length; j += 1) {\n if (fontArr[i].fPath === loadedSelector[j].src) {\n // Font is already loaded\n shouldLoadFont = false;\n }\n }\n if (shouldLoadFont) {\n var sc = createTag('link');\n sc.setAttribute('f-forigin', fontArr[i].fOrigin);\n sc.setAttribute('f-origin', fontArr[i].origin);\n sc.setAttribute('rel', 'stylesheet');\n sc.setAttribute('href', fontArr[i].fPath);\n defs.appendChild(sc);\n }\n }\n fontArr[i].helper = createHelper(fontArr[i], defs);\n fontArr[i].cache = {};\n this.fonts.push(fontArr[i]);\n }\n if (_pendingFonts === 0) {\n this.isLoaded = true;\n } else {\n // On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.\n // Adding this timeout seems to fix it\n setTimeout(this.checkLoadedFonts.bind(this), 100);\n }\n }\n function addChars(chars) {\n if (!chars) {\n return;\n }\n if (!this.chars) {\n this.chars = [];\n }\n var i;\n var len = chars.length;\n var j;\n var jLen = this.chars.length;\n var found;\n for (i = 0; i < len; i += 1) {\n j = 0;\n found = false;\n while (j < jLen) {\n if (this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch) {\n found = true;\n }\n j += 1;\n }\n if (!found) {\n this.chars.push(chars[i]);\n jLen += 1;\n }\n }\n }\n function getCharData(_char, style, font) {\n var i = 0;\n var len = this.chars.length;\n while (i < len) {\n if (this.chars[i].ch === _char && this.chars[i].style === style && this.chars[i].fFamily === font) {\n return this.chars[i];\n }\n i += 1;\n }\n if ((typeof _char === 'string' && _char.charCodeAt(0) !== 13 || !_char) && console && console.warn // eslint-disable-line no-console\n && !this._warned) {\n this._warned = true;\n console.warn('Missing character from exported characters list: ', _char, style, font); // eslint-disable-line no-console\n }\n return emptyChar;\n }\n function measureText(_char2, fontName, size) {\n var fontData = this.getFontByName(fontName); // Using the char instead of char.charCodeAt(0)\n // to avoid collisions between equal chars\n\n var index = _char2;\n if (!fontData.cache[index]) {\n var tHelper = fontData.helper;\n if (_char2 === ' ') {\n var doubleSize = tHelper.measureText('|' + _char2 + '|');\n var singleSize = tHelper.measureText('||');\n fontData.cache[index] = (doubleSize - singleSize) / 100;\n } else {\n fontData.cache[index] = tHelper.measureText(_char2) / 100;\n }\n }\n return fontData.cache[index] * size;\n }\n function getFontByName(name) {\n var i = 0;\n var len = this.fonts.length;\n while (i < len) {\n if (this.fonts[i].fName === name) {\n return this.fonts[i];\n }\n i += 1;\n }\n return this.fonts[0];\n }\n function getCodePoint(string) {\n var codePoint = 0;\n var first = string.charCodeAt(0);\n if (first >= 0xD800 && first <= 0xDBFF) {\n var second = string.charCodeAt(1);\n if (second >= 0xDC00 && second <= 0xDFFF) {\n codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n }\n }\n return codePoint;\n } // Skin tone modifiers\n\n function isModifier(firstCharCode, secondCharCode) {\n var sum = firstCharCode.toString(16) + secondCharCode.toString(16);\n return surrogateModifiers.indexOf(sum) !== -1;\n }\n function isZeroWidthJoiner(charCode) {\n return charCode === ZERO_WIDTH_JOINER_CODE_POINT;\n } // This codepoint may change the appearance of the preceding character.\n // If that is a symbol, dingbat or emoji, U+FE0F forces it to be rendered\n // as a colorful image as compared to a monochrome text variant.\n\n function isVariationSelector(charCode) {\n return charCode === VARIATION_SELECTOR_16_CODE_POINT;\n } // The regional indicator symbols are a set of 26 alphabetic Unicode\n /// characters (A–Z) intended to be used to encode ISO 3166-1 alpha-2\n // two-letter country codes in a way that allows optional special treatment.\n\n function isRegionalCode(string) {\n var codePoint = getCodePoint(string);\n if (codePoint >= REGIONAL_CHARACTER_A_CODE_POINT && codePoint <= REGIONAL_CHARACTER_Z_CODE_POINT) {\n return true;\n }\n return false;\n } // Some Emoji implementations represent combinations of\n // two “regional indicator” letters as a single flag symbol.\n\n function isFlagEmoji(string) {\n return isRegionalCode(string.substr(0, 2)) && isRegionalCode(string.substr(2, 2));\n }\n function isCombinedCharacter(_char3) {\n return combinedCharacters.indexOf(_char3) !== -1;\n } // Regional flags start with a BLACK_FLAG_CODE_POINT\n // folowed by 5 chars in the TAG range\n // and end with a CANCEL_TAG_CODE_POINT\n\n function isRegionalFlag(text, index) {\n var codePoint = getCodePoint(text.substr(index, 2));\n if (codePoint !== BLACK_FLAG_CODE_POINT) {\n return false;\n }\n var count = 0;\n index += 2;\n while (count < 5) {\n codePoint = getCodePoint(text.substr(index, 2));\n if (codePoint < A_TAG_CODE_POINT || codePoint > Z_TAG_CODE_POINT) {\n return false;\n }\n count += 1;\n index += 2;\n }\n return getCodePoint(text.substr(index, 2)) === CANCEL_TAG_CODE_POINT;\n }\n function setIsLoaded() {\n this.isLoaded = true;\n }\n var Font = function Font() {\n this.fonts = [];\n this.chars = null;\n this.typekitLoaded = 0;\n this.isLoaded = false;\n this._warned = false;\n this.initTime = Date.now();\n this.setIsLoadedBinded = this.setIsLoaded.bind(this);\n this.checkLoadedFontsBinded = this.checkLoadedFonts.bind(this);\n };\n Font.isModifier = isModifier;\n Font.isZeroWidthJoiner = isZeroWidthJoiner;\n Font.isFlagEmoji = isFlagEmoji;\n Font.isRegionalCode = isRegionalCode;\n Font.isCombinedCharacter = isCombinedCharacter;\n Font.isRegionalFlag = isRegionalFlag;\n Font.isVariationSelector = isVariationSelector;\n Font.BLACK_FLAG_CODE_POINT = BLACK_FLAG_CODE_POINT;\n var fontPrototype = {\n addChars: addChars,\n addFonts: addFonts,\n getCharData: getCharData,\n getFontByName: getFontByName,\n measureText: measureText,\n checkLoadedFonts: checkLoadedFonts,\n setIsLoaded: setIsLoaded\n };\n Font.prototype = fontPrototype;\n return Font;\n }();\n function SlotManager(animationData) {\n this.animationData = animationData;\n }\n SlotManager.prototype.getProp = function (data) {\n if (this.animationData.slots && this.animationData.slots[data.sid]) {\n return Object.assign(data, this.animationData.slots[data.sid].p);\n }\n return data;\n };\n function slotFactory(animationData) {\n return new SlotManager(animationData);\n }\n function RenderableElement() {}\n RenderableElement.prototype = {\n initRenderable: function initRenderable() {\n // layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange\n this.isInRange = false; // layer's display state\n\n this.hidden = false; // If layer's transparency equals 0, it can be hidden\n\n this.isTransparent = false; // list of animated components\n\n this.renderableComponents = [];\n },\n addRenderableComponent: function addRenderableComponent(component) {\n if (this.renderableComponents.indexOf(component) === -1) {\n this.renderableComponents.push(component);\n }\n },\n removeRenderableComponent: function removeRenderableComponent(component) {\n if (this.renderableComponents.indexOf(component) !== -1) {\n this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1);\n }\n },\n prepareRenderableFrame: function prepareRenderableFrame(num) {\n this.checkLayerLimits(num);\n },\n checkTransparency: function checkTransparency() {\n if (this.finalTransform.mProp.o.v <= 0) {\n if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) {\n this.isTransparent = true;\n this.hide();\n }\n } else if (this.isTransparent) {\n this.isTransparent = false;\n this.show();\n }\n },\n /**\r\n * @function\r\n * Initializes frame related properties.\r\n *\r\n * @param {number} num\r\n * current frame number in Layer's time\r\n *\r\n */\n checkLayerLimits: function checkLayerLimits(num) {\n if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) {\n if (this.isInRange !== true) {\n this.globalData._mdf = true;\n this._mdf = true;\n this.isInRange = true;\n this.show();\n }\n } else if (this.isInRange !== false) {\n this.globalData._mdf = true;\n this.isInRange = false;\n this.hide();\n }\n },\n renderRenderable: function renderRenderable() {\n var i;\n var len = this.renderableComponents.length;\n for (i = 0; i < len; i += 1) {\n this.renderableComponents[i].renderFrame(this._isFirstFrame);\n }\n /* this.maskManager.renderFrame(this.finalTransform.mat);\r\n this.renderableEffectsManager.renderFrame(this._isFirstFrame); */\n },\n sourceRectAtTime: function sourceRectAtTime() {\n return {\n top: 0,\n left: 0,\n width: 100,\n height: 100\n };\n },\n getLayerSize: function getLayerSize() {\n if (this.data.ty === 5) {\n return {\n w: this.data.textData.width,\n h: this.data.textData.height\n };\n }\n return {\n w: this.data.width,\n h: this.data.height\n };\n }\n };\n var getBlendMode = function () {\n var blendModeEnums = {\n 0: 'source-over',\n 1: 'multiply',\n 2: 'screen',\n 3: 'overlay',\n 4: 'darken',\n 5: 'lighten',\n 6: 'color-dodge',\n 7: 'color-burn',\n 8: 'hard-light',\n 9: 'soft-light',\n 10: 'difference',\n 11: 'exclusion',\n 12: 'hue',\n 13: 'saturation',\n 14: 'color',\n 15: 'luminosity'\n };\n return function (mode) {\n return blendModeEnums[mode] || '';\n };\n }();\n function SliderEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\n }\n function AngleEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\n }\n function ColorEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);\n }\n function PointEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);\n }\n function LayerIndexEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\n }\n function MaskIndexEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\n }\n function CheckboxEffect(data, elem, container) {\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\n }\n function NoValueEffect() {\n this.p = {};\n }\n function EffectsManager(data, element) {\n var effects = data.ef || [];\n this.effectElements = [];\n var i;\n var len = effects.length;\n var effectItem;\n for (i = 0; i < len; i += 1) {\n effectItem = new GroupEffect(effects[i], element);\n this.effectElements.push(effectItem);\n }\n }\n function GroupEffect(data, element) {\n this.init(data, element);\n }\n extendPrototype([DynamicPropertyContainer], GroupEffect);\n GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties;\n GroupEffect.prototype.init = function (data, element) {\n this.data = data;\n this.effectElements = [];\n this.initDynamicPropertyContainer(element);\n var i;\n var len = this.data.ef.length;\n var eff;\n var effects = this.data.ef;\n for (i = 0; i < len; i += 1) {\n eff = null;\n switch (effects[i].ty) {\n case 0:\n eff = new SliderEffect(effects[i], element, this);\n break;\n case 1:\n eff = new AngleEffect(effects[i], element, this);\n break;\n case 2:\n eff = new ColorEffect(effects[i], element, this);\n break;\n case 3:\n eff = new PointEffect(effects[i], element, this);\n break;\n case 4:\n case 7:\n eff = new CheckboxEffect(effects[i], element, this);\n break;\n case 10:\n eff = new LayerIndexEffect(effects[i], element, this);\n break;\n case 11:\n eff = new MaskIndexEffect(effects[i], element, this);\n break;\n case 5:\n eff = new EffectsManager(effects[i], element, this);\n break;\n // case 6:\n\n default:\n eff = new NoValueEffect(effects[i], element, this);\n break;\n }\n if (eff) {\n this.effectElements.push(eff);\n }\n }\n };\n function BaseElement() {}\n BaseElement.prototype = {\n checkMasks: function checkMasks() {\n if (!this.data.hasMask) {\n return false;\n }\n var i = 0;\n var len = this.data.masksProperties.length;\n while (i < len) {\n if (this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false) {\n return true;\n }\n i += 1;\n }\n return false;\n },\n initExpressions: function initExpressions() {\n var expressionsInterfaces = getExpressionInterfaces();\n if (!expressionsInterfaces) {\n return;\n }\n var LayerExpressionInterface = expressionsInterfaces('layer');\n var EffectsExpressionInterface = expressionsInterfaces('effects');\n var ShapeExpressionInterface = expressionsInterfaces('shape');\n var TextExpressionInterface = expressionsInterfaces('text');\n var CompExpressionInterface = expressionsInterfaces('comp');\n this.layerInterface = LayerExpressionInterface(this);\n if (this.data.hasMask && this.maskManager) {\n this.layerInterface.registerMaskInterface(this.maskManager);\n }\n var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface);\n this.layerInterface.registerEffectsInterface(effectsInterface);\n if (this.data.ty === 0 || this.data.xt) {\n this.compInterface = CompExpressionInterface(this);\n } else if (this.data.ty === 4) {\n this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData, this.itemsData, this.layerInterface);\n this.layerInterface.content = this.layerInterface.shapeInterface;\n } else if (this.data.ty === 5) {\n this.layerInterface.textInterface = TextExpressionInterface(this);\n this.layerInterface.text = this.layerInterface.textInterface;\n }\n },\n setBlendMode: function setBlendMode() {\n var blendModeValue = getBlendMode(this.data.bm);\n var elem = this.baseElement || this.layerElement;\n elem.style['mix-blend-mode'] = blendModeValue;\n },\n initBaseData: function initBaseData(data, globalData, comp) {\n this.globalData = globalData;\n this.comp = comp;\n this.data = data;\n this.layerId = createElementID(); // Stretch factor for old animations missing this property.\n\n if (!this.data.sr) {\n this.data.sr = 1;\n } // effects manager\n\n this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties);\n },\n getType: function getType() {\n return this.type;\n },\n sourceRectAtTime: function sourceRectAtTime() {}\n };\n\n /**\r\n * @file\r\n * Handles element's layer frame update.\r\n * Checks layer in point and out point\r\n *\r\n */\n function FrameElement() {}\n FrameElement.prototype = {\n /**\r\n * @function\r\n * Initializes frame related properties.\r\n *\r\n */\n initFrame: function initFrame() {\n // set to true when inpoint is rendered\n this._isFirstFrame = false; // list of animated properties\n\n this.dynamicProperties = []; // If layer has been modified in current tick this will be true\n\n this._mdf = false;\n },\n /**\r\n * @function\r\n * Calculates all dynamic values\r\n *\r\n * @param {number} num\r\n * current frame number in Layer's time\r\n * @param {boolean} isVisible\r\n * if layers is currently in range\r\n *\r\n */\n prepareProperties: function prepareProperties(num, isVisible) {\n var i;\n var len = this.dynamicProperties.length;\n for (i = 0; i < len; i += 1) {\n if (isVisible || this._isParent && this.dynamicProperties[i].propType === 'transform') {\n this.dynamicProperties[i].getValue();\n if (this.dynamicProperties[i]._mdf) {\n this.globalData._mdf = true;\n this._mdf = true;\n }\n }\n }\n },\n addDynamicProperty: function addDynamicProperty(prop) {\n if (this.dynamicProperties.indexOf(prop) === -1) {\n this.dynamicProperties.push(prop);\n }\n }\n };\n function FootageElement(data, globalData, comp) {\n this.initFrame();\n this.initRenderable();\n this.assetData = globalData.getAssetData(data.refId);\n this.footageData = globalData.imageLoader.getAsset(this.assetData);\n this.initBaseData(data, globalData, comp);\n }\n FootageElement.prototype.prepareFrame = function () {};\n extendPrototype([RenderableElement, BaseElement, FrameElement], FootageElement);\n FootageElement.prototype.getBaseElement = function () {\n return null;\n };\n FootageElement.prototype.renderFrame = function () {};\n FootageElement.prototype.destroy = function () {};\n FootageElement.prototype.initExpressions = function () {\n var expressionsInterfaces = getExpressionInterfaces();\n if (!expressionsInterfaces) {\n return;\n }\n var FootageInterface = expressionsInterfaces('footage');\n this.layerInterface = FootageInterface(this);\n };\n FootageElement.prototype.getFootageData = function () {\n return this.footageData;\n };\n function AudioElement(data, globalData, comp) {\n this.initFrame();\n this.initRenderable();\n this.assetData = globalData.getAssetData(data.refId);\n this.initBaseData(data, globalData, comp);\n this._isPlaying = false;\n this._canPlay = false;\n var assetPath = this.globalData.getAssetsPath(this.assetData);\n this.audio = this.globalData.audioController.createAudio(assetPath);\n this._currentTime = 0;\n this.globalData.audioController.addAudio(this);\n this._volumeMultiplier = 1;\n this._volume = 1;\n this._previousVolume = null;\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\n _placeholder: true\n };\n this.lv = PropertyFactory.getProp(this, data.au && data.au.lv ? data.au.lv : {\n k: [100]\n }, 1, 0.01, this);\n }\n AudioElement.prototype.prepareFrame = function (num) {\n this.prepareRenderableFrame(num, true);\n this.prepareProperties(num, true);\n if (!this.tm._placeholder) {\n var timeRemapped = this.tm.v;\n this._currentTime = timeRemapped;\n } else {\n this._currentTime = num / this.data.sr;\n }\n this._volume = this.lv.v[0];\n var totalVolume = this._volume * this._volumeMultiplier;\n if (this._previousVolume !== totalVolume) {\n this._previousVolume = totalVolume;\n this.audio.volume(totalVolume);\n }\n };\n extendPrototype([RenderableElement, BaseElement, FrameElement], AudioElement);\n AudioElement.prototype.renderFrame = function () {\n if (this.isInRange && this._canPlay) {\n if (!this._isPlaying) {\n this.audio.play();\n this.audio.seek(this._currentTime / this.globalData.frameRate);\n this._isPlaying = true;\n } else if (!this.audio.playing() || Math.abs(this._currentTime / this.globalData.frameRate - this.audio.seek()) > 0.1) {\n this.audio.seek(this._currentTime / this.globalData.frameRate);\n }\n }\n };\n AudioElement.prototype.show = function () {// this.audio.play()\n };\n AudioElement.prototype.hide = function () {\n this.audio.pause();\n this._isPlaying = false;\n };\n AudioElement.prototype.pause = function () {\n this.audio.pause();\n this._isPlaying = false;\n this._canPlay = false;\n };\n AudioElement.prototype.resume = function () {\n this._canPlay = true;\n };\n AudioElement.prototype.setRate = function (rateValue) {\n this.audio.rate(rateValue);\n };\n AudioElement.prototype.volume = function (volumeValue) {\n this._volumeMultiplier = volumeValue;\n this._previousVolume = volumeValue * this._volume;\n this.audio.volume(this._previousVolume);\n };\n AudioElement.prototype.getBaseElement = function () {\n return null;\n };\n AudioElement.prototype.destroy = function () {};\n AudioElement.prototype.sourceRectAtTime = function () {};\n AudioElement.prototype.initExpressions = function () {};\n function BaseRenderer() {}\n BaseRenderer.prototype.checkLayers = function (num) {\n var i;\n var len = this.layers.length;\n var data;\n this.completeLayers = true;\n for (i = len - 1; i >= 0; i -= 1) {\n if (!this.elements[i]) {\n data = this.layers[i];\n if (data.ip - data.st <= num - this.layers[i].st && data.op - data.st > num - this.layers[i].st) {\n this.buildItem(i);\n }\n }\n this.completeLayers = this.elements[i] ? this.completeLayers : false;\n }\n this.checkPendingElements();\n };\n BaseRenderer.prototype.createItem = function (layer) {\n switch (layer.ty) {\n case 2:\n return this.createImage(layer);\n case 0:\n return this.createComp(layer);\n case 1:\n return this.createSolid(layer);\n case 3:\n return this.createNull(layer);\n case 4:\n return this.createShape(layer);\n case 5:\n return this.createText(layer);\n case 6:\n return this.createAudio(layer);\n case 13:\n return this.createCamera(layer);\n case 15:\n return this.createFootage(layer);\n default:\n return this.createNull(layer);\n }\n };\n BaseRenderer.prototype.createCamera = function () {\n throw new Error('You\\'re using a 3d camera. Try the html renderer.');\n };\n BaseRenderer.prototype.createAudio = function (data) {\n return new AudioElement(data, this.globalData, this);\n };\n BaseRenderer.prototype.createFootage = function (data) {\n return new FootageElement(data, this.globalData, this);\n };\n BaseRenderer.prototype.buildAllItems = function () {\n var i;\n var len = this.layers.length;\n for (i = 0; i < len; i += 1) {\n this.buildItem(i);\n }\n this.checkPendingElements();\n };\n BaseRenderer.prototype.includeLayers = function (newLayers) {\n this.completeLayers = false;\n var i;\n var len = newLayers.length;\n var j;\n var jLen = this.layers.length;\n for (i = 0; i < len; i += 1) {\n j = 0;\n while (j < jLen) {\n if (this.layers[j].id === newLayers[i].id) {\n this.layers[j] = newLayers[i];\n break;\n }\n j += 1;\n }\n }\n };\n BaseRenderer.prototype.setProjectInterface = function (pInterface) {\n this.globalData.projectInterface = pInterface;\n };\n BaseRenderer.prototype.initItems = function () {\n if (!this.globalData.progressiveLoad) {\n this.buildAllItems();\n }\n };\n BaseRenderer.prototype.buildElementParenting = function (element, parentName, hierarchy) {\n var elements = this.elements;\n var layers = this.layers;\n var i = 0;\n var len = layers.length;\n while (i < len) {\n if (layers[i].ind == parentName) {\n // eslint-disable-line eqeqeq\n if (!elements[i] || elements[i] === true) {\n this.buildItem(i);\n this.addPendingElement(element);\n } else {\n hierarchy.push(elements[i]);\n elements[i].setAsParent();\n if (layers[i].parent !== undefined) {\n this.buildElementParenting(element, layers[i].parent, hierarchy);\n } else {\n element.setHierarchy(hierarchy);\n }\n }\n }\n i += 1;\n }\n };\n BaseRenderer.prototype.addPendingElement = function (element) {\n this.pendingElements.push(element);\n };\n BaseRenderer.prototype.searchExtraCompositions = function (assets) {\n var i;\n var len = assets.length;\n for (i = 0; i < len; i += 1) {\n if (assets[i].xt) {\n var comp = this.createComp(assets[i]);\n comp.initExpressions();\n this.globalData.projectInterface.registerComposition(comp);\n }\n }\n };\n BaseRenderer.prototype.getElementById = function (ind) {\n var i;\n var len = this.elements.length;\n for (i = 0; i < len; i += 1) {\n if (this.elements[i].data.ind === ind) {\n return this.elements[i];\n }\n }\n return null;\n };\n BaseRenderer.prototype.getElementByPath = function (path) {\n var pathValue = path.shift();\n var element;\n if (typeof pathValue === 'number') {\n element = this.elements[pathValue];\n } else {\n var i;\n var len = this.elements.length;\n for (i = 0; i < len; i += 1) {\n if (this.elements[i].data.nm === pathValue) {\n element = this.elements[i];\n break;\n }\n }\n }\n if (path.length === 0) {\n return element;\n }\n return element.getElementByPath(path);\n };\n BaseRenderer.prototype.setupGlobalData = function (animData, fontsContainer) {\n this.globalData.fontManager = new FontManager();\n this.globalData.slotManager = slotFactory(animData);\n this.globalData.fontManager.addChars(animData.chars);\n this.globalData.fontManager.addFonts(animData.fonts, fontsContainer);\n this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem);\n this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem);\n this.globalData.imageLoader = this.animationItem.imagePreloader;\n this.globalData.audioController = this.animationItem.audioController;\n this.globalData.frameId = 0;\n this.globalData.frameRate = animData.fr;\n this.globalData.nm = animData.nm;\n this.globalData.compSize = {\n w: animData.w,\n h: animData.h\n };\n };\n var effectTypes = {\n TRANSFORM_EFFECT: 'transformEFfect'\n };\n function TransformElement() {}\n TransformElement.prototype = {\n initTransform: function initTransform() {\n var mat = new Matrix();\n this.finalTransform = {\n mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : {\n o: 0\n },\n _matMdf: false,\n _localMatMdf: false,\n _opMdf: false,\n mat: mat,\n localMat: mat,\n localOpacity: 1\n };\n if (this.data.ao) {\n this.finalTransform.mProp.autoOriented = true;\n } // TODO: check TYPE 11: Guided elements\n\n if (this.data.ty !== 11) {// this.createElements();\n }\n },\n renderTransform: function renderTransform() {\n this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame;\n this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame;\n if (this.hierarchy) {\n var mat;\n var finalMat = this.finalTransform.mat;\n var i = 0;\n var len = this.hierarchy.length; // Checking if any of the transformation matrices in the hierarchy chain has changed.\n\n if (!this.finalTransform._matMdf) {\n while (i < len) {\n if (this.hierarchy[i].finalTransform.mProp._mdf) {\n this.finalTransform._matMdf = true;\n break;\n }\n i += 1;\n }\n }\n if (this.finalTransform._matMdf) {\n mat = this.finalTransform.mProp.v.props;\n finalMat.cloneFromProps(mat);\n for (i = 0; i < len; i += 1) {\n finalMat.multiply(this.hierarchy[i].finalTransform.mProp.v);\n }\n }\n }\n if (this.finalTransform._matMdf) {\n this.finalTransform._localMatMdf = this.finalTransform._matMdf;\n }\n if (this.finalTransform._opMdf) {\n this.finalTransform.localOpacity = this.finalTransform.mProp.o.v;\n }\n },\n renderLocalTransform: function renderLocalTransform() {\n if (this.localTransforms) {\n var i = 0;\n var len = this.localTransforms.length;\n this.finalTransform._localMatMdf = this.finalTransform._matMdf;\n if (!this.finalTransform._localMatMdf || !this.finalTransform._opMdf) {\n while (i < len) {\n if (this.localTransforms[i]._mdf) {\n this.finalTransform._localMatMdf = true;\n }\n if (this.localTransforms[i]._opMdf && !this.finalTransform._opMdf) {\n this.finalTransform.localOpacity = this.finalTransform.mProp.o.v;\n this.finalTransform._opMdf = true;\n }\n i += 1;\n }\n }\n if (this.finalTransform._localMatMdf) {\n var localMat = this.finalTransform.localMat;\n this.localTransforms[0].matrix.clone(localMat);\n for (i = 1; i < len; i += 1) {\n var lmat = this.localTransforms[i].matrix;\n localMat.multiply(lmat);\n }\n localMat.multiply(this.finalTransform.mat);\n }\n if (this.finalTransform._opMdf) {\n var localOp = this.finalTransform.localOpacity;\n for (i = 0; i < len; i += 1) {\n localOp *= this.localTransforms[i].opacity * 0.01;\n }\n this.finalTransform.localOpacity = localOp;\n }\n }\n },\n searchEffectTransforms: function searchEffectTransforms() {\n if (this.renderableEffectsManager) {\n var transformEffects = this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT);\n if (transformEffects.length) {\n this.localTransforms = [];\n this.finalTransform.localMat = new Matrix();\n var i = 0;\n var len = transformEffects.length;\n for (i = 0; i < len; i += 1) {\n this.localTransforms.push(transformEffects[i]);\n }\n }\n }\n },\n globalToLocal: function globalToLocal(pt) {\n var transforms = [];\n transforms.push(this.finalTransform);\n var flag = true;\n var comp = this.comp;\n while (flag) {\n if (comp.finalTransform) {\n if (comp.data.hasMask) {\n transforms.splice(0, 0, comp.finalTransform);\n }\n comp = comp.comp;\n } else {\n flag = false;\n }\n }\n var i;\n var len = transforms.length;\n var ptNew;\n for (i = 0; i < len; i += 1) {\n ptNew = transforms[i].mat.applyToPointArray(0, 0, 0); // ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);\n\n pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0];\n }\n return pt;\n },\n mHelper: new Matrix()\n };\n function MaskElement(data, element, globalData) {\n this.data = data;\n this.element = element;\n this.globalData = globalData;\n this.storedData = [];\n this.masksProperties = this.data.masksProperties || [];\n this.maskElement = null;\n var defs = this.globalData.defs;\n var i;\n var len = this.masksProperties ? this.masksProperties.length : 0;\n this.viewData = createSizedArray(len);\n this.solidPath = '';\n var path;\n var properties = this.masksProperties;\n var count = 0;\n var currentMasks = [];\n var j;\n var jLen;\n var layerId = createElementID();\n var rect;\n var expansor;\n var feMorph;\n var x;\n var maskType = 'clipPath';\n var maskRef = 'clip-path';\n for (i = 0; i < len; i += 1) {\n if (properties[i].mode !== 'a' && properties[i].mode !== 'n' || properties[i].inv || properties[i].o.k !== 100 || properties[i].o.x) {\n maskType = 'mask';\n maskRef = 'mask';\n }\n if ((properties[i].mode === 's' || properties[i].mode === 'i') && count === 0) {\n rect = createNS('rect');\n rect.setAttribute('fill', '#ffffff');\n rect.setAttribute('width', this.element.comp.data.w || 0);\n rect.setAttribute('height', this.element.comp.data.h || 0);\n currentMasks.push(rect);\n } else {\n rect = null;\n }\n path = createNS('path');\n if (properties[i].mode === 'n') {\n // TODO move this to a factory or to a constructor\n this.viewData[i] = {\n op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\n prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\n elem: path,\n lastPath: ''\n };\n defs.appendChild(path);\n } else {\n count += 1;\n path.setAttribute('fill', properties[i].mode === 's' ? '#000000' : '#ffffff');\n path.setAttribute('clip-rule', 'nonzero');\n var filterID;\n if (properties[i].x.k !== 0) {\n maskType = 'mask';\n maskRef = 'mask';\n x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element);\n filterID = createElementID();\n expansor = createNS('filter');\n expansor.setAttribute('id', filterID);\n feMorph = createNS('feMorphology');\n feMorph.setAttribute('operator', 'erode');\n feMorph.setAttribute('in', 'SourceGraphic');\n feMorph.setAttribute('radius', '0');\n expansor.appendChild(feMorph);\n defs.appendChild(expansor);\n path.setAttribute('stroke', properties[i].mode === 's' ? '#000000' : '#ffffff');\n } else {\n feMorph = null;\n x = null;\n } // TODO move this to a factory or to a constructor\n\n this.storedData[i] = {\n elem: path,\n x: x,\n expan: feMorph,\n lastPath: '',\n lastOperator: '',\n filterId: filterID,\n lastRadius: 0\n };\n if (properties[i].mode === 'i') {\n jLen = currentMasks.length;\n var g = createNS('g');\n for (j = 0; j < jLen; j += 1) {\n g.appendChild(currentMasks[j]);\n }\n var mask = createNS('mask');\n mask.setAttribute('mask-type', 'alpha');\n mask.setAttribute('id', layerId + '_' + count);\n mask.appendChild(path);\n defs.appendChild(mask);\n g.setAttribute('mask', 'url(' + getLocationHref() + '#' + layerId + '_' + count + ')');\n currentMasks.length = 0;\n currentMasks.push(g);\n } else {\n currentMasks.push(path);\n }\n if (properties[i].inv && !this.solidPath) {\n this.solidPath = this.createLayerSolidPath();\n } // TODO move this to a factory or to a constructor\n\n this.viewData[i] = {\n elem: path,\n lastPath: '',\n op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\n prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\n invRect: rect\n };\n if (!this.viewData[i].prop.k) {\n this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i]);\n }\n }\n }\n this.maskElement = createNS(maskType);\n len = currentMasks.length;\n for (i = 0; i < len; i += 1) {\n this.maskElement.appendChild(currentMasks[i]);\n }\n if (count > 0) {\n this.maskElement.setAttribute('id', layerId);\n this.element.maskedElement.setAttribute(maskRef, 'url(' + getLocationHref() + '#' + layerId + ')');\n defs.appendChild(this.maskElement);\n }\n if (this.viewData.length) {\n this.element.addRenderableComponent(this);\n }\n }\n MaskElement.prototype.getMaskProperty = function (pos) {\n return this.viewData[pos].prop;\n };\n MaskElement.prototype.renderFrame = function (isFirstFrame) {\n var finalMat = this.element.finalTransform.mat;\n var i;\n var len = this.masksProperties.length;\n for (i = 0; i < len; i += 1) {\n if (this.viewData[i].prop._mdf || isFirstFrame) {\n this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i]);\n }\n if (this.viewData[i].op._mdf || isFirstFrame) {\n this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v);\n }\n if (this.masksProperties[i].mode !== 'n') {\n if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) {\n this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS());\n }\n if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) {\n var feMorph = this.storedData[i].expan;\n if (this.storedData[i].x.v < 0) {\n if (this.storedData[i].lastOperator !== 'erode') {\n this.storedData[i].lastOperator = 'erode';\n this.storedData[i].elem.setAttribute('filter', 'url(' + getLocationHref() + '#' + this.storedData[i].filterId + ')');\n }\n feMorph.setAttribute('radius', -this.storedData[i].x.v);\n } else {\n if (this.storedData[i].lastOperator !== 'dilate') {\n this.storedData[i].lastOperator = 'dilate';\n this.storedData[i].elem.setAttribute('filter', null);\n }\n this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v * 2);\n }\n }\n }\n }\n };\n MaskElement.prototype.getMaskelement = function () {\n return this.maskElement;\n };\n MaskElement.prototype.createLayerSolidPath = function () {\n var path = 'M0,0 ';\n path += ' h' + this.globalData.compSize.w;\n path += ' v' + this.globalData.compSize.h;\n path += ' h-' + this.globalData.compSize.w;\n path += ' v-' + this.globalData.compSize.h + ' ';\n return path;\n };\n MaskElement.prototype.drawPath = function (pathData, pathNodes, viewData) {\n var pathString = ' M' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];\n var i;\n var len;\n len = pathNodes._length;\n for (i = 1; i < len; i += 1) {\n // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[i][0]+','+pathNodes.i[i][1] + \" \"+pathNodes.v[i][0]+','+pathNodes.v[i][1];\n pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[i][0] + ',' + pathNodes.i[i][1] + ' ' + pathNodes.v[i][0] + ',' + pathNodes.v[i][1];\n } // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[0][0]+','+pathNodes.i[0][1] + \" \"+pathNodes.v[0][0]+','+pathNodes.v[0][1];\n\n if (pathNodes.c && len > 1) {\n pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[0][0] + ',' + pathNodes.i[0][1] + ' ' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];\n } // pathNodes.__renderedString = pathString;\n\n if (viewData.lastPath !== pathString) {\n var pathShapeValue = '';\n if (viewData.elem) {\n if (pathNodes.c) {\n pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString;\n }\n viewData.elem.setAttribute('d', pathShapeValue);\n }\n viewData.lastPath = pathString;\n }\n };\n MaskElement.prototype.destroy = function () {\n this.element = null;\n this.globalData = null;\n this.maskElement = null;\n this.data = null;\n this.masksProperties = null;\n };\n var filtersFactory = function () {\n var ob = {};\n ob.createFilter = createFilter;\n ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter;\n function createFilter(filId, skipCoordinates) {\n var fil = createNS('filter');\n fil.setAttribute('id', filId);\n if (skipCoordinates !== true) {\n fil.setAttribute('filterUnits', 'objectBoundingBox');\n fil.setAttribute('x', '0%');\n fil.setAttribute('y', '0%');\n fil.setAttribute('width', '100%');\n fil.setAttribute('height', '100%');\n }\n return fil;\n }\n function createAlphaToLuminanceFilter() {\n var feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\n feColorMatrix.setAttribute('values', '0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1');\n return feColorMatrix;\n }\n return ob;\n }();\n var featureSupport = function () {\n var ob = {\n maskType: true,\n svgLumaHidden: true,\n offscreenCanvas: typeof OffscreenCanvas !== 'undefined'\n };\n if (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\\/\\d./i.test(navigator.userAgent)) {\n ob.maskType = false;\n }\n if (/firefox/i.test(navigator.userAgent)) {\n ob.svgLumaHidden = false;\n }\n return ob;\n }();\n var registeredEffects$1 = {};\n var idPrefix = 'filter_result_';\n function SVGEffects(elem) {\n var i;\n var source = 'SourceGraphic';\n var len = elem.data.ef ? elem.data.ef.length : 0;\n var filId = createElementID();\n var fil = filtersFactory.createFilter(filId, true);\n var count = 0;\n this.filters = [];\n var filterManager;\n for (i = 0; i < len; i += 1) {\n filterManager = null;\n var type = elem.data.ef[i].ty;\n if (registeredEffects$1[type]) {\n var Effect = registeredEffects$1[type].effect;\n filterManager = new Effect(fil, elem.effectsManager.effectElements[i], elem, idPrefix + count, source);\n source = idPrefix + count;\n if (registeredEffects$1[type].countsAsEffect) {\n count += 1;\n }\n }\n if (filterManager) {\n this.filters.push(filterManager);\n }\n }\n if (count) {\n elem.globalData.defs.appendChild(fil);\n elem.layerElement.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')');\n }\n if (this.filters.length) {\n elem.addRenderableComponent(this);\n }\n }\n SVGEffects.prototype.renderFrame = function (_isFirstFrame) {\n var i;\n var len = this.filters.length;\n for (i = 0; i < len; i += 1) {\n this.filters[i].renderFrame(_isFirstFrame);\n }\n };\n SVGEffects.prototype.getEffects = function (type) {\n var i;\n var len = this.filters.length;\n var effects = [];\n for (i = 0; i < len; i += 1) {\n if (this.filters[i].type === type) {\n effects.push(this.filters[i]);\n }\n }\n return effects;\n };\n function registerEffect$1(id, effect, countsAsEffect) {\n registeredEffects$1[id] = {\n effect: effect,\n countsAsEffect: countsAsEffect\n };\n }\n function SVGBaseElement() {}\n SVGBaseElement.prototype = {\n initRendererElement: function initRendererElement() {\n this.layerElement = createNS('g');\n },\n createContainerElements: function createContainerElements() {\n this.matteElement = createNS('g');\n this.transformedElement = this.layerElement;\n this.maskedElement = this.layerElement;\n this._sizeChanged = false;\n var layerElementParent = null; // If this layer acts as a mask for the following layer\n\n if (this.data.td) {\n this.matteMasks = {};\n var gg = createNS('g');\n gg.setAttribute('id', this.layerId);\n gg.appendChild(this.layerElement);\n layerElementParent = gg;\n this.globalData.defs.appendChild(gg);\n } else if (this.data.tt) {\n this.matteElement.appendChild(this.layerElement);\n layerElementParent = this.matteElement;\n this.baseElement = this.matteElement;\n } else {\n this.baseElement = this.layerElement;\n }\n if (this.data.ln) {\n this.layerElement.setAttribute('id', this.data.ln);\n }\n if (this.data.cl) {\n this.layerElement.setAttribute('class', this.data.cl);\n } // Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped\n\n if (this.data.ty === 0 && !this.data.hd) {\n var cp = createNS('clipPath');\n var pt = createNS('path');\n pt.setAttribute('d', 'M0,0 L' + this.data.w + ',0 L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z');\n var clipId = createElementID();\n cp.setAttribute('id', clipId);\n cp.appendChild(pt);\n this.globalData.defs.appendChild(cp);\n if (this.checkMasks()) {\n var cpGroup = createNS('g');\n cpGroup.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')');\n cpGroup.appendChild(this.layerElement);\n this.transformedElement = cpGroup;\n if (layerElementParent) {\n layerElementParent.appendChild(this.transformedElement);\n } else {\n this.baseElement = this.transformedElement;\n }\n } else {\n this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')');\n }\n }\n if (this.data.bm !== 0) {\n this.setBlendMode();\n }\n },\n renderElement: function renderElement() {\n if (this.finalTransform._localMatMdf) {\n this.transformedElement.setAttribute('transform', this.finalTransform.localMat.to2dCSS());\n }\n if (this.finalTransform._opMdf) {\n this.transformedElement.setAttribute('opacity', this.finalTransform.localOpacity);\n }\n },\n destroyBaseElement: function destroyBaseElement() {\n this.layerElement = null;\n this.matteElement = null;\n this.maskManager.destroy();\n },\n getBaseElement: function getBaseElement() {\n if (this.data.hd) {\n return null;\n }\n return this.baseElement;\n },\n createRenderableComponents: function createRenderableComponents() {\n this.maskManager = new MaskElement(this.data, this, this.globalData);\n this.renderableEffectsManager = new SVGEffects(this);\n this.searchEffectTransforms();\n },\n getMatte: function getMatte(matteType) {\n // This should not be a common case. But for backward compatibility, we'll create the matte object.\n // It solves animations that have two consecutive layers marked as matte masks.\n // Which is an undefined behavior in AE.\n if (!this.matteMasks) {\n this.matteMasks = {};\n }\n if (!this.matteMasks[matteType]) {\n var id = this.layerId + '_' + matteType;\n var filId;\n var fil;\n var useElement;\n var gg;\n if (matteType === 1 || matteType === 3) {\n var masker = createNS('mask');\n masker.setAttribute('id', id);\n masker.setAttribute('mask-type', matteType === 3 ? 'luminance' : 'alpha');\n useElement = createNS('use');\n useElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + this.layerId);\n masker.appendChild(useElement);\n this.globalData.defs.appendChild(masker);\n if (!featureSupport.maskType && matteType === 1) {\n masker.setAttribute('mask-type', 'luminance');\n filId = createElementID();\n fil = filtersFactory.createFilter(filId);\n this.globalData.defs.appendChild(fil);\n fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());\n gg = createNS('g');\n gg.appendChild(useElement);\n masker.appendChild(gg);\n gg.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')');\n }\n } else if (matteType === 2) {\n var maskGroup = createNS('mask');\n maskGroup.setAttribute('id', id);\n maskGroup.setAttribute('mask-type', 'alpha');\n var maskGrouper = createNS('g');\n maskGroup.appendChild(maskGrouper);\n filId = createElementID();\n fil = filtersFactory.createFilter(filId); /// /\n\n var feCTr = createNS('feComponentTransfer');\n feCTr.setAttribute('in', 'SourceGraphic');\n fil.appendChild(feCTr);\n var feFunc = createNS('feFuncA');\n feFunc.setAttribute('type', 'table');\n feFunc.setAttribute('tableValues', '1.0 0.0');\n feCTr.appendChild(feFunc); /// /\n\n this.globalData.defs.appendChild(fil);\n var alphaRect = createNS('rect');\n alphaRect.setAttribute('width', this.comp.data.w);\n alphaRect.setAttribute('height', this.comp.data.h);\n alphaRect.setAttribute('x', '0');\n alphaRect.setAttribute('y', '0');\n alphaRect.setAttribute('fill', '#ffffff');\n alphaRect.setAttribute('opacity', '0');\n maskGrouper.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')');\n maskGrouper.appendChild(alphaRect);\n useElement = createNS('use');\n useElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + this.layerId);\n maskGrouper.appendChild(useElement);\n if (!featureSupport.maskType) {\n maskGroup.setAttribute('mask-type', 'luminance');\n fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());\n gg = createNS('g');\n maskGrouper.appendChild(alphaRect);\n gg.appendChild(this.layerElement);\n maskGrouper.appendChild(gg);\n }\n this.globalData.defs.appendChild(maskGroup);\n }\n this.matteMasks[matteType] = id;\n }\n return this.matteMasks[matteType];\n },\n setMatte: function setMatte(id) {\n if (!this.matteElement) {\n return;\n }\n this.matteElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')');\n }\n };\n\n /**\r\n * @file\r\n * Handles AE's layer parenting property.\r\n *\r\n */\n function HierarchyElement() {}\n HierarchyElement.prototype = {\n /**\r\n * @function\r\n * Initializes hierarchy properties\r\n *\r\n */\n initHierarchy: function initHierarchy() {\n // element's parent list\n this.hierarchy = []; // if element is parent of another layer _isParent will be true\n\n this._isParent = false;\n this.checkParenting();\n },\n /**\r\n * @function\r\n * Sets layer's hierarchy.\r\n * @param {array} hierarch\r\n * layer's parent list\r\n *\r\n */\n setHierarchy: function setHierarchy(hierarchy) {\n this.hierarchy = hierarchy;\n },\n /**\r\n * @function\r\n * Sets layer as parent.\r\n *\r\n */\n setAsParent: function setAsParent() {\n this._isParent = true;\n },\n /**\r\n * @function\r\n * Searches layer's parenting chain\r\n *\r\n */\n checkParenting: function checkParenting() {\n if (this.data.parent !== undefined) {\n this.comp.buildElementParenting(this, this.data.parent, []);\n }\n }\n };\n function RenderableDOMElement() {}\n (function () {\n var _prototype = {\n initElement: function initElement(data, globalData, comp) {\n this.initFrame();\n this.initBaseData(data, globalData, comp);\n this.initTransform(data, globalData, comp);\n this.initHierarchy();\n this.initRenderable();\n this.initRendererElement();\n this.createContainerElements();\n this.createRenderableComponents();\n this.createContent();\n this.hide();\n },\n hide: function hide() {\n // console.log('HIDE', this);\n if (!this.hidden && (!this.isInRange || this.isTransparent)) {\n var elem = this.baseElement || this.layerElement;\n elem.style.display = 'none';\n this.hidden = true;\n }\n },\n show: function show() {\n // console.log('SHOW', this);\n if (this.isInRange && !this.isTransparent) {\n if (!this.data.hd) {\n var elem = this.baseElement || this.layerElement;\n elem.style.display = 'block';\n }\n this.hidden = false;\n this._isFirstFrame = true;\n }\n },\n renderFrame: function renderFrame() {\n // If it is exported as hidden (data.hd === true) no need to render\n // If it is not visible no need to render\n if (this.data.hd || this.hidden) {\n return;\n }\n this.renderTransform();\n this.renderRenderable();\n this.renderLocalTransform();\n this.renderElement();\n this.renderInnerContent();\n if (this._isFirstFrame) {\n this._isFirstFrame = false;\n }\n },\n renderInnerContent: function renderInnerContent() {},\n prepareFrame: function prepareFrame(num) {\n this._mdf = false;\n this.prepareRenderableFrame(num);\n this.prepareProperties(num, this.isInRange);\n this.checkTransparency();\n },\n destroy: function destroy() {\n this.innerElem = null;\n this.destroyBaseElement();\n }\n };\n extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement);\n })();\n function IImageElement(data, globalData, comp) {\n this.assetData = globalData.getAssetData(data.refId);\n if (this.assetData && this.assetData.sid) {\n this.assetData = globalData.slotManager.getProp(this.assetData);\n }\n this.initElement(data, globalData, comp);\n this.sourceRect = {\n top: 0,\n left: 0,\n width: this.assetData.w,\n height: this.assetData.h\n };\n }\n extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], IImageElement);\n IImageElement.prototype.createContent = function () {\n var assetPath = this.globalData.getAssetsPath(this.assetData);\n this.innerElem = createNS('image');\n this.innerElem.setAttribute('width', this.assetData.w + 'px');\n this.innerElem.setAttribute('height', this.assetData.h + 'px');\n this.innerElem.setAttribute('preserveAspectRatio', this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio);\n this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);\n this.layerElement.appendChild(this.innerElem);\n };\n IImageElement.prototype.sourceRectAtTime = function () {\n return this.sourceRect;\n };\n function ProcessedElement(element, position) {\n this.elem = element;\n this.pos = position;\n }\n function IShapeElement() {}\n IShapeElement.prototype = {\n addShapeToModifiers: function addShapeToModifiers(data) {\n var i;\n var len = this.shapeModifiers.length;\n for (i = 0; i < len; i += 1) {\n this.shapeModifiers[i].addShape(data);\n }\n },\n isShapeInAnimatedModifiers: function isShapeInAnimatedModifiers(data) {\n var i = 0;\n var len = this.shapeModifiers.length;\n while (i < len) {\n if (this.shapeModifiers[i].isAnimatedWithShape(data)) {\n return true;\n }\n }\n return false;\n },\n renderModifiers: function renderModifiers() {\n if (!this.shapeModifiers.length) {\n return;\n }\n var i;\n var len = this.shapes.length;\n for (i = 0; i < len; i += 1) {\n this.shapes[i].sh.reset();\n }\n len = this.shapeModifiers.length;\n var shouldBreakProcess;\n for (i = len - 1; i >= 0; i -= 1) {\n shouldBreakProcess = this.shapeModifiers[i].processShapes(this._isFirstFrame); // workaround to fix cases where a repeater resets the shape so the following processes get called twice\n // TODO: find a better solution for this\n\n if (shouldBreakProcess) {\n break;\n }\n }\n },\n searchProcessedElement: function searchProcessedElement(elem) {\n var elements = this.processedElements;\n var i = 0;\n var len = elements.length;\n while (i < len) {\n if (elements[i].elem === elem) {\n return elements[i].pos;\n }\n i += 1;\n }\n return 0;\n },\n addProcessedElement: function addProcessedElement(elem, pos) {\n var elements = this.processedElements;\n var i = elements.length;\n while (i) {\n i -= 1;\n if (elements[i].elem === elem) {\n elements[i].pos = pos;\n return;\n }\n }\n elements.push(new ProcessedElement(elem, pos));\n },\n prepareFrame: function prepareFrame(num) {\n this.prepareRenderableFrame(num);\n this.prepareProperties(num, this.isInRange);\n }\n };\n var lineCapEnum = {\n 1: 'butt',\n 2: 'round',\n 3: 'square'\n };\n var lineJoinEnum = {\n 1: 'miter',\n 2: 'round',\n 3: 'bevel'\n };\n function SVGShapeData(transformers, level, shape) {\n this.caches = [];\n this.styles = [];\n this.transformers = transformers;\n this.lStr = '';\n this.sh = shape;\n this.lvl = level; // TODO find if there are some cases where _isAnimated can be false.\n // For now, since shapes add up with other shapes. They have to be calculated every time.\n // One way of finding out is checking if all styles associated to this shape depend only of this shape\n\n this._isAnimated = !!shape.k; // TODO: commenting this for now since all shapes are animated\n\n var i = 0;\n var len = transformers.length;\n while (i < len) {\n if (transformers[i].mProps.dynamicProperties.length) {\n this._isAnimated = true;\n break;\n }\n i += 1;\n }\n }\n SVGShapeData.prototype.setAsAnimated = function () {\n this._isAnimated = true;\n };\n function SVGStyleData(data, level) {\n this.data = data;\n this.type = data.ty;\n this.d = '';\n this.lvl = level;\n this._mdf = false;\n this.closed = data.hd === true;\n this.pElem = createNS('path');\n this.msElem = null;\n }\n SVGStyleData.prototype.reset = function () {\n this.d = '';\n this._mdf = false;\n };\n function DashProperty(elem, data, renderer, container) {\n this.elem = elem;\n this.frameId = -1;\n this.dataProps = createSizedArray(data.length);\n this.renderer = renderer;\n this.k = false;\n this.dashStr = '';\n this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0);\n this.dashoffset = createTypedArray('float32', 1);\n this.initDynamicPropertyContainer(container);\n var i;\n var len = data.length || 0;\n var prop;\n for (i = 0; i < len; i += 1) {\n prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this);\n this.k = prop.k || this.k;\n this.dataProps[i] = {\n n: data[i].n,\n p: prop\n };\n }\n if (!this.k) {\n this.getValue(true);\n }\n this._isAnimated = this.k;\n }\n DashProperty.prototype.getValue = function (forceRender) {\n if (this.elem.globalData.frameId === this.frameId && !forceRender) {\n return;\n }\n this.frameId = this.elem.globalData.frameId;\n this.iterateDynamicProperties();\n this._mdf = this._mdf || forceRender;\n if (this._mdf) {\n var i = 0;\n var len = this.dataProps.length;\n if (this.renderer === 'svg') {\n this.dashStr = '';\n }\n for (i = 0; i < len; i += 1) {\n if (this.dataProps[i].n !== 'o') {\n if (this.renderer === 'svg') {\n this.dashStr += ' ' + this.dataProps[i].p.v;\n } else {\n this.dashArray[i] = this.dataProps[i].p.v;\n }\n } else {\n this.dashoffset[0] = this.dataProps[i].p.v;\n }\n }\n }\n };\n extendPrototype([DynamicPropertyContainer], DashProperty);\n function SVGStrokeStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem);\n this.getValue = this.iterateDynamicProperties;\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\n this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);\n this.d = new DashProperty(elem, data.d || {}, 'svg', this);\n this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);\n this.style = styleOb;\n this._isAnimated = !!this._isAnimated;\n }\n extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData);\n function SVGFillStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem);\n this.getValue = this.iterateDynamicProperties;\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\n this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);\n this.style = styleOb;\n }\n extendPrototype([DynamicPropertyContainer], SVGFillStyleData);\n function SVGNoStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem);\n this.getValue = this.iterateDynamicProperties;\n this.style = styleOb;\n }\n extendPrototype([DynamicPropertyContainer], SVGNoStyleData);\n function GradientProperty(elem, data, container) {\n this.data = data;\n this.c = createTypedArray('uint8c', data.p * 4);\n var cLength = data.k.k[0].s ? data.k.k[0].s.length - data.p * 4 : data.k.k.length - data.p * 4;\n this.o = createTypedArray('float32', cLength);\n this._cmdf = false;\n this._omdf = false;\n this._collapsable = this.checkCollapsable();\n this._hasOpacity = cLength;\n this.initDynamicPropertyContainer(container);\n this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this);\n this.k = this.prop.k;\n this.getValue(true);\n }\n GradientProperty.prototype.comparePoints = function (values, points) {\n var i = 0;\n var len = this.o.length / 2;\n var diff;\n while (i < len) {\n diff = Math.abs(values[i * 4] - values[points * 4 + i * 2]);\n if (diff > 0.01) {\n return false;\n }\n i += 1;\n }\n return true;\n };\n GradientProperty.prototype.checkCollapsable = function () {\n if (this.o.length / 2 !== this.c.length / 4) {\n return false;\n }\n if (this.data.k.k[0].s) {\n var i = 0;\n var len = this.data.k.k.length;\n while (i < len) {\n if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {\n return false;\n }\n i += 1;\n }\n } else if (!this.comparePoints(this.data.k.k, this.data.p)) {\n return false;\n }\n return true;\n };\n GradientProperty.prototype.getValue = function (forceRender) {\n this.prop.getValue();\n this._mdf = false;\n this._cmdf = false;\n this._omdf = false;\n if (this.prop._mdf || forceRender) {\n var i;\n var len = this.data.p * 4;\n var mult;\n var val;\n for (i = 0; i < len; i += 1) {\n mult = i % 4 === 0 ? 100 : 255;\n val = Math.round(this.prop.v[i] * mult);\n if (this.c[i] !== val) {\n this.c[i] = val;\n this._cmdf = !forceRender;\n }\n }\n if (this.o.length) {\n len = this.prop.v.length;\n for (i = this.data.p * 4; i < len; i += 1) {\n mult = i % 2 === 0 ? 100 : 1;\n val = i % 2 === 0 ? Math.round(this.prop.v[i] * 100) : this.prop.v[i];\n if (this.o[i - this.data.p * 4] !== val) {\n this.o[i - this.data.p * 4] = val;\n this._omdf = !forceRender;\n }\n }\n }\n this._mdf = !forceRender;\n }\n };\n extendPrototype([DynamicPropertyContainer], GradientProperty);\n function SVGGradientFillStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem);\n this.getValue = this.iterateDynamicProperties;\n this.initGradientData(elem, data, styleOb);\n }\n SVGGradientFillStyleData.prototype.initGradientData = function (elem, data, styleOb) {\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\n this.s = PropertyFactory.getProp(elem, data.s, 1, null, this);\n this.e = PropertyFactory.getProp(elem, data.e, 1, null, this);\n this.h = PropertyFactory.getProp(elem, data.h || {\n k: 0\n }, 0, 0.01, this);\n this.a = PropertyFactory.getProp(elem, data.a || {\n k: 0\n }, 0, degToRads, this);\n this.g = new GradientProperty(elem, data.g, this);\n this.style = styleOb;\n this.stops = [];\n this.setGradientData(styleOb.pElem, data);\n this.setGradientOpacity(data, styleOb);\n this._isAnimated = !!this._isAnimated;\n };\n SVGGradientFillStyleData.prototype.setGradientData = function (pathElement, data) {\n var gradientId = createElementID();\n var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');\n gfill.setAttribute('id', gradientId);\n gfill.setAttribute('spreadMethod', 'pad');\n gfill.setAttribute('gradientUnits', 'userSpaceOnUse');\n var stops = [];\n var stop;\n var j;\n var jLen;\n jLen = data.g.p * 4;\n for (j = 0; j < jLen; j += 4) {\n stop = createNS('stop');\n gfill.appendChild(stop);\n stops.push(stop);\n }\n pathElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + gradientId + ')');\n this.gf = gfill;\n this.cst = stops;\n };\n SVGGradientFillStyleData.prototype.setGradientOpacity = function (data, styleOb) {\n if (this.g._hasOpacity && !this.g._collapsable) {\n var stop;\n var j;\n var jLen;\n var mask = createNS('mask');\n var maskElement = createNS('path');\n mask.appendChild(maskElement);\n var opacityId = createElementID();\n var maskId = createElementID();\n mask.setAttribute('id', maskId);\n var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');\n opFill.setAttribute('id', opacityId);\n opFill.setAttribute('spreadMethod', 'pad');\n opFill.setAttribute('gradientUnits', 'userSpaceOnUse');\n jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length;\n var stops = this.stops;\n for (j = data.g.p * 4; j < jLen; j += 2) {\n stop = createNS('stop');\n stop.setAttribute('stop-color', 'rgb(255,255,255)');\n opFill.appendChild(stop);\n stops.push(stop);\n }\n maskElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + opacityId + ')');\n if (data.ty === 'gs') {\n maskElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]);\n maskElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]);\n if (data.lj === 1) {\n maskElement.setAttribute('stroke-miterlimit', data.ml);\n }\n }\n this.of = opFill;\n this.ms = mask;\n this.ost = stops;\n this.maskId = maskId;\n styleOb.msElem = maskElement;\n }\n };\n extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData);\n function SVGGradientStrokeStyleData(elem, data, styleOb) {\n this.initDynamicPropertyContainer(elem);\n this.getValue = this.iterateDynamicProperties;\n this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);\n this.d = new DashProperty(elem, data.d || {}, 'svg', this);\n this.initGradientData(elem, data, styleOb);\n this._isAnimated = !!this._isAnimated;\n }\n extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData);\n function ShapeGroupData() {\n this.it = [];\n this.prevViewData = [];\n this.gr = createNS('g');\n }\n function SVGTransformData(mProps, op, container) {\n this.transform = {\n mProps: mProps,\n op: op,\n container: container\n };\n this.elements = [];\n this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length;\n }\n var buildShapeString = function buildShapeString(pathNodes, length, closed, mat) {\n if (length === 0) {\n return '';\n }\n var _o = pathNodes.o;\n var _i = pathNodes.i;\n var _v = pathNodes.v;\n var i;\n var shapeString = ' M' + mat.applyToPointStringified(_v[0][0], _v[0][1]);\n for (i = 1; i < length; i += 1) {\n shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[i][0], _i[i][1]) + ' ' + mat.applyToPointStringified(_v[i][0], _v[i][1]);\n }\n if (closed && length) {\n shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[0][0], _i[0][1]) + ' ' + mat.applyToPointStringified(_v[0][0], _v[0][1]);\n shapeString += 'z';\n }\n return shapeString;\n };\n var SVGElementsRenderer = function () {\n var _identityMatrix = new Matrix();\n var _matrixHelper = new Matrix();\n var ob = {\n createRenderFunction: createRenderFunction\n };\n function createRenderFunction(data) {\n switch (data.ty) {\n case 'fl':\n return renderFill;\n case 'gf':\n return renderGradient;\n case 'gs':\n return renderGradientStroke;\n case 'st':\n return renderStroke;\n case 'sh':\n case 'el':\n case 'rc':\n case 'sr':\n return renderPath;\n case 'tr':\n return renderContentTransform;\n case 'no':\n return renderNoop;\n default:\n return null;\n }\n }\n function renderContentTransform(styleData, itemData, isFirstFrame) {\n if (isFirstFrame || itemData.transform.op._mdf) {\n itemData.transform.container.setAttribute('opacity', itemData.transform.op.v);\n }\n if (isFirstFrame || itemData.transform.mProps._mdf) {\n itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS());\n }\n }\n function renderNoop() {}\n function renderPath(styleData, itemData, isFirstFrame) {\n var j;\n var jLen;\n var pathStringTransformed;\n var redraw;\n var pathNodes;\n var l;\n var lLen = itemData.styles.length;\n var lvl = itemData.lvl;\n var paths;\n var mat;\n var iterations;\n var k;\n for (l = 0; l < lLen; l += 1) {\n redraw = itemData.sh._mdf || isFirstFrame;\n if (itemData.styles[l].lvl < lvl) {\n mat = _matrixHelper.reset();\n iterations = lvl - itemData.styles[l].lvl;\n k = itemData.transformers.length - 1;\n while (!redraw && iterations > 0) {\n redraw = itemData.transformers[k].mProps._mdf || redraw;\n iterations -= 1;\n k -= 1;\n }\n if (redraw) {\n iterations = lvl - itemData.styles[l].lvl;\n k = itemData.transformers.length - 1;\n while (iterations > 0) {\n mat.multiply(itemData.transformers[k].mProps.v);\n iterations -= 1;\n k -= 1;\n }\n }\n } else {\n mat = _identityMatrix;\n }\n paths = itemData.sh.paths;\n jLen = paths._length;\n if (redraw) {\n pathStringTransformed = '';\n for (j = 0; j < jLen; j += 1) {\n pathNodes = paths.shapes[j];\n if (pathNodes && pathNodes._length) {\n pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat);\n }\n }\n itemData.caches[l] = pathStringTransformed;\n } else {\n pathStringTransformed = itemData.caches[l];\n }\n itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed;\n itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf;\n }\n }\n function renderFill(styleData, itemData, isFirstFrame) {\n var styleElem = itemData.style;\n if (itemData.c._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('fill', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')');\n }\n if (itemData.o._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('fill-opacity', itemData.o.v);\n }\n }\n function renderGradientStroke(styleData, itemData, isFirstFrame) {\n renderGradient(styleData, itemData, isFirstFrame);\n renderStroke(styleData, itemData, isFirstFrame);\n }\n function renderGradient(styleData, itemData, isFirstFrame) {\n var gfill = itemData.gf;\n var hasOpacity = itemData.g._hasOpacity;\n var pt1 = itemData.s.v;\n var pt2 = itemData.e.v;\n if (itemData.o._mdf || isFirstFrame) {\n var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity';\n itemData.style.pElem.setAttribute(attr, itemData.o.v);\n }\n if (itemData.s._mdf || isFirstFrame) {\n var attr1 = styleData.t === 1 ? 'x1' : 'cx';\n var attr2 = attr1 === 'x1' ? 'y1' : 'cy';\n gfill.setAttribute(attr1, pt1[0]);\n gfill.setAttribute(attr2, pt1[1]);\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute(attr1, pt1[0]);\n itemData.of.setAttribute(attr2, pt1[1]);\n }\n }\n var stops;\n var i;\n var len;\n var stop;\n if (itemData.g._cmdf || isFirstFrame) {\n stops = itemData.cst;\n var cValues = itemData.g.c;\n len = stops.length;\n for (i = 0; i < len; i += 1) {\n stop = stops[i];\n stop.setAttribute('offset', cValues[i * 4] + '%');\n stop.setAttribute('stop-color', 'rgb(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ')');\n }\n }\n if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {\n var oValues = itemData.g.o;\n if (itemData.g._collapsable) {\n stops = itemData.cst;\n } else {\n stops = itemData.ost;\n }\n len = stops.length;\n for (i = 0; i < len; i += 1) {\n stop = stops[i];\n if (!itemData.g._collapsable) {\n stop.setAttribute('offset', oValues[i * 2] + '%');\n }\n stop.setAttribute('stop-opacity', oValues[i * 2 + 1]);\n }\n }\n if (styleData.t === 1) {\n if (itemData.e._mdf || isFirstFrame) {\n gfill.setAttribute('x2', pt2[0]);\n gfill.setAttribute('y2', pt2[1]);\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('x2', pt2[0]);\n itemData.of.setAttribute('y2', pt2[1]);\n }\n }\n } else {\n var rad;\n if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {\n rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\n gfill.setAttribute('r', rad);\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('r', rad);\n }\n }\n if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {\n if (!rad) {\n rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\n }\n var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);\n var percent = itemData.h.v;\n if (percent >= 1) {\n percent = 0.99;\n } else if (percent <= -1) {\n percent = -0.99;\n }\n var dist = rad * percent;\n var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];\n var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];\n gfill.setAttribute('fx', x);\n gfill.setAttribute('fy', y);\n if (hasOpacity && !itemData.g._collapsable) {\n itemData.of.setAttribute('fx', x);\n itemData.of.setAttribute('fy', y);\n }\n } // gfill.setAttribute('fy','200');\n }\n }\n function renderStroke(styleData, itemData, isFirstFrame) {\n var styleElem = itemData.style;\n var d = itemData.d;\n if (d && (d._mdf || isFirstFrame) && d.dashStr) {\n styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr);\n styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]);\n }\n if (itemData.c && (itemData.c._mdf || isFirstFrame)) {\n styleElem.pElem.setAttribute('stroke', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')');\n }\n if (itemData.o._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v);\n }\n if (itemData.w._mdf || isFirstFrame) {\n styleElem.pElem.setAttribute('stroke-width', itemData.w.v);\n if (styleElem.msElem) {\n styleElem.msElem.setAttribute('stroke-width', itemData.w.v);\n }\n }\n }\n return ob;\n }();\n function SVGShapeElement(data, globalData, comp) {\n // List of drawable elements\n this.shapes = []; // Full shape data\n\n this.shapesData = data.shapes; // List of styles that will be applied to shapes\n\n this.stylesList = []; // List of modifiers that will be applied to shapes\n\n this.shapeModifiers = []; // List of items in shape tree\n\n this.itemsData = []; // List of items in previous shape tree\n\n this.processedElements = []; // List of animated components\n\n this.animatedContents = [];\n this.initElement(data, globalData, comp); // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\n // List of elements that have been created\n\n this.prevViewData = []; // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\n }\n extendPrototype([BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableDOMElement], SVGShapeElement);\n SVGShapeElement.prototype.initSecondaryElement = function () {};\n SVGShapeElement.prototype.identityMatrix = new Matrix();\n SVGShapeElement.prototype.buildExpressionInterface = function () {};\n SVGShapeElement.prototype.createContent = function () {\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);\n this.filterUniqueShapes();\n };\n /*\r\n This method searches for multiple shapes that affect a single element and one of them is animated\r\n */\n\n SVGShapeElement.prototype.filterUniqueShapes = function () {\n var i;\n var len = this.shapes.length;\n var shape;\n var j;\n var jLen = this.stylesList.length;\n var style;\n var tempShapes = [];\n var areAnimated = false;\n for (j = 0; j < jLen; j += 1) {\n style = this.stylesList[j];\n areAnimated = false;\n tempShapes.length = 0;\n for (i = 0; i < len; i += 1) {\n shape = this.shapes[i];\n if (shape.styles.indexOf(style) !== -1) {\n tempShapes.push(shape);\n areAnimated = shape._isAnimated || areAnimated;\n }\n }\n if (tempShapes.length > 1 && areAnimated) {\n this.setShapesAsAnimated(tempShapes);\n }\n }\n };\n SVGShapeElement.prototype.setShapesAsAnimated = function (shapes) {\n var i;\n var len = shapes.length;\n for (i = 0; i < len; i += 1) {\n shapes[i].setAsAnimated();\n }\n };\n SVGShapeElement.prototype.createStyleElement = function (data, level) {\n // TODO: prevent drawing of hidden styles\n var elementData;\n var styleOb = new SVGStyleData(data, level);\n var pathElement = styleOb.pElem;\n if (data.ty === 'st') {\n elementData = new SVGStrokeStyleData(this, data, styleOb);\n } else if (data.ty === 'fl') {\n elementData = new SVGFillStyleData(this, data, styleOb);\n } else if (data.ty === 'gf' || data.ty === 'gs') {\n var GradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData;\n elementData = new GradientConstructor(this, data, styleOb);\n this.globalData.defs.appendChild(elementData.gf);\n if (elementData.maskId) {\n this.globalData.defs.appendChild(elementData.ms);\n this.globalData.defs.appendChild(elementData.of);\n pathElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + elementData.maskId + ')');\n }\n } else if (data.ty === 'no') {\n elementData = new SVGNoStyleData(this, data, styleOb);\n }\n if (data.ty === 'st' || data.ty === 'gs') {\n pathElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]);\n pathElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]);\n pathElement.setAttribute('fill-opacity', '0');\n if (data.lj === 1) {\n pathElement.setAttribute('stroke-miterlimit', data.ml);\n }\n }\n if (data.r === 2) {\n pathElement.setAttribute('fill-rule', 'evenodd');\n }\n if (data.ln) {\n pathElement.setAttribute('id', data.ln);\n }\n if (data.cl) {\n pathElement.setAttribute('class', data.cl);\n }\n if (data.bm) {\n pathElement.style['mix-blend-mode'] = getBlendMode(data.bm);\n }\n this.stylesList.push(styleOb);\n this.addToAnimatedContents(data, elementData);\n return elementData;\n };\n SVGShapeElement.prototype.createGroupElement = function (data) {\n var elementData = new ShapeGroupData();\n if (data.ln) {\n elementData.gr.setAttribute('id', data.ln);\n }\n if (data.cl) {\n elementData.gr.setAttribute('class', data.cl);\n }\n if (data.bm) {\n elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm);\n }\n return elementData;\n };\n SVGShapeElement.prototype.createTransformElement = function (data, container) {\n var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this);\n var elementData = new SVGTransformData(transformProperty, transformProperty.o, container);\n this.addToAnimatedContents(data, elementData);\n return elementData;\n };\n SVGShapeElement.prototype.createShapeElement = function (data, ownTransformers, level) {\n var ty = 4;\n if (data.ty === 'rc') {\n ty = 5;\n } else if (data.ty === 'el') {\n ty = 6;\n } else if (data.ty === 'sr') {\n ty = 7;\n }\n var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this);\n var elementData = new SVGShapeData(ownTransformers, level, shapeProperty);\n this.shapes.push(elementData);\n this.addShapeToModifiers(elementData);\n this.addToAnimatedContents(data, elementData);\n return elementData;\n };\n SVGShapeElement.prototype.addToAnimatedContents = function (data, element) {\n var i = 0;\n var len = this.animatedContents.length;\n while (i < len) {\n if (this.animatedContents[i].element === element) {\n return;\n }\n i += 1;\n }\n this.animatedContents.push({\n fn: SVGElementsRenderer.createRenderFunction(data),\n element: element,\n data: data\n });\n };\n SVGShapeElement.prototype.setElementStyles = function (elementData) {\n var arr = elementData.styles;\n var j;\n var jLen = this.stylesList.length;\n for (j = 0; j < jLen; j += 1) {\n if (!this.stylesList[j].closed) {\n arr.push(this.stylesList[j]);\n }\n }\n };\n SVGShapeElement.prototype.reloadShapes = function () {\n this._isFirstFrame = true;\n var i;\n var len = this.itemsData.length;\n for (i = 0; i < len; i += 1) {\n this.prevViewData[i] = this.itemsData[i];\n }\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);\n this.filterUniqueShapes();\n len = this.dynamicProperties.length;\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue();\n }\n this.renderModifiers();\n };\n SVGShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, container, level, transformers, render) {\n var ownTransformers = [].concat(transformers);\n var i;\n var len = arr.length - 1;\n var j;\n var jLen;\n var ownStyles = [];\n var ownModifiers = [];\n var currentTransform;\n var modifier;\n var processedPos;\n for (i = len; i >= 0; i -= 1) {\n processedPos = this.searchProcessedElement(arr[i]);\n if (!processedPos) {\n arr[i]._render = render;\n } else {\n itemsData[i] = prevViewData[processedPos - 1];\n }\n if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs' || arr[i].ty === 'no') {\n if (!processedPos) {\n itemsData[i] = this.createStyleElement(arr[i], level);\n } else {\n itemsData[i].style.closed = false;\n }\n if (arr[i]._render) {\n if (itemsData[i].style.pElem.parentNode !== container) {\n container.appendChild(itemsData[i].style.pElem);\n }\n }\n ownStyles.push(itemsData[i].style);\n } else if (arr[i].ty === 'gr') {\n if (!processedPos) {\n itemsData[i] = this.createGroupElement(arr[i]);\n } else {\n jLen = itemsData[i].it.length;\n for (j = 0; j < jLen; j += 1) {\n itemsData[i].prevViewData[j] = itemsData[i].it[j];\n }\n }\n this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, itemsData[i].gr, level + 1, ownTransformers, render);\n if (arr[i]._render) {\n if (itemsData[i].gr.parentNode !== container) {\n container.appendChild(itemsData[i].gr);\n }\n }\n } else if (arr[i].ty === 'tr') {\n if (!processedPos) {\n itemsData[i] = this.createTransformElement(arr[i], container);\n }\n currentTransform = itemsData[i].transform;\n ownTransformers.push(currentTransform);\n } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\n if (!processedPos) {\n itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level);\n }\n this.setElementStyles(itemsData[i]);\n } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'ms' || arr[i].ty === 'pb' || arr[i].ty === 'zz' || arr[i].ty === 'op') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty);\n modifier.init(this, arr[i]);\n itemsData[i] = modifier;\n this.shapeModifiers.push(modifier);\n } else {\n modifier = itemsData[i];\n modifier.closed = false;\n }\n ownModifiers.push(modifier);\n } else if (arr[i].ty === 'rp') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty);\n itemsData[i] = modifier;\n modifier.init(this, arr, i, itemsData);\n this.shapeModifiers.push(modifier);\n render = false;\n } else {\n modifier = itemsData[i];\n modifier.closed = true;\n }\n ownModifiers.push(modifier);\n }\n this.addProcessedElement(arr[i], i + 1);\n }\n len = ownStyles.length;\n for (i = 0; i < len; i += 1) {\n ownStyles[i].closed = true;\n }\n len = ownModifiers.length;\n for (i = 0; i < len; i += 1) {\n ownModifiers[i].closed = true;\n }\n };\n SVGShapeElement.prototype.renderInnerContent = function () {\n this.renderModifiers();\n var i;\n var len = this.stylesList.length;\n for (i = 0; i < len; i += 1) {\n this.stylesList[i].reset();\n }\n this.renderShape();\n for (i = 0; i < len; i += 1) {\n if (this.stylesList[i]._mdf || this._isFirstFrame) {\n if (this.stylesList[i].msElem) {\n this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d); // Adding M0 0 fixes same mask bug on all browsers\n\n this.stylesList[i].d = 'M0 0' + this.stylesList[i].d;\n }\n this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0');\n }\n }\n };\n SVGShapeElement.prototype.renderShape = function () {\n var i;\n var len = this.animatedContents.length;\n var animatedContent;\n for (i = 0; i < len; i += 1) {\n animatedContent = this.animatedContents[i];\n if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {\n animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame);\n }\n }\n };\n SVGShapeElement.prototype.destroy = function () {\n this.destroyBaseElement();\n this.shapesData = null;\n this.itemsData = null;\n };\n function LetterProps(o, sw, sc, fc, m, p) {\n this.o = o;\n this.sw = sw;\n this.sc = sc;\n this.fc = fc;\n this.m = m;\n this.p = p;\n this._mdf = {\n o: true,\n sw: !!sw,\n sc: !!sc,\n fc: !!fc,\n m: true,\n p: true\n };\n }\n LetterProps.prototype.update = function (o, sw, sc, fc, m, p) {\n this._mdf.o = false;\n this._mdf.sw = false;\n this._mdf.sc = false;\n this._mdf.fc = false;\n this._mdf.m = false;\n this._mdf.p = false;\n var updated = false;\n if (this.o !== o) {\n this.o = o;\n this._mdf.o = true;\n updated = true;\n }\n if (this.sw !== sw) {\n this.sw = sw;\n this._mdf.sw = true;\n updated = true;\n }\n if (this.sc !== sc) {\n this.sc = sc;\n this._mdf.sc = true;\n updated = true;\n }\n if (this.fc !== fc) {\n this.fc = fc;\n this._mdf.fc = true;\n updated = true;\n }\n if (this.m !== m) {\n this.m = m;\n this._mdf.m = true;\n updated = true;\n }\n if (p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) {\n this.p = p;\n this._mdf.p = true;\n updated = true;\n }\n return updated;\n };\n function TextProperty(elem, data) {\n this._frameId = initialDefaultFrame;\n this.pv = '';\n this.v = '';\n this.kf = false;\n this._isFirstFrame = true;\n this._mdf = false;\n if (data.d && data.d.sid) {\n data.d = elem.globalData.slotManager.getProp(data.d);\n }\n this.data = data;\n this.elem = elem;\n this.comp = this.elem.comp;\n this.keysIndex = 0;\n this.canResize = false;\n this.minimumFontSize = 1;\n this.effectsSequence = [];\n this.currentData = {\n ascent: 0,\n boxWidth: this.defaultBoxWidth,\n f: '',\n fStyle: '',\n fWeight: '',\n fc: '',\n j: '',\n justifyOffset: '',\n l: [],\n lh: 0,\n lineWidths: [],\n ls: '',\n of: '',\n s: '',\n sc: '',\n sw: 0,\n t: 0,\n tr: 0,\n sz: 0,\n ps: null,\n fillColorAnim: false,\n strokeColorAnim: false,\n strokeWidthAnim: false,\n yOffset: 0,\n finalSize: 0,\n finalText: [],\n finalLineHeight: 0,\n __complete: false\n };\n this.copyData(this.currentData, this.data.d.k[0].s);\n if (!this.searchProperty()) {\n this.completeTextData(this.currentData);\n }\n }\n TextProperty.prototype.defaultBoxWidth = [0, 0];\n TextProperty.prototype.copyData = function (obj, data) {\n for (var s in data) {\n if (Object.prototype.hasOwnProperty.call(data, s)) {\n obj[s] = data[s];\n }\n }\n return obj;\n };\n TextProperty.prototype.setCurrentData = function (data) {\n if (!data.__complete) {\n this.completeTextData(data);\n }\n this.currentData = data;\n this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth;\n this._mdf = true;\n };\n TextProperty.prototype.searchProperty = function () {\n return this.searchKeyframes();\n };\n TextProperty.prototype.searchKeyframes = function () {\n this.kf = this.data.d.k.length > 1;\n if (this.kf) {\n this.addEffect(this.getKeyframeValue.bind(this));\n }\n return this.kf;\n };\n TextProperty.prototype.addEffect = function (effectFunction) {\n this.effectsSequence.push(effectFunction);\n this.elem.addDynamicProperty(this);\n };\n TextProperty.prototype.getValue = function (_finalValue) {\n if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {\n return;\n }\n this.currentData.t = this.data.d.k[this.keysIndex].s.t;\n var currentValue = this.currentData;\n var currentIndex = this.keysIndex;\n if (this.lock) {\n this.setCurrentData(this.currentData);\n return;\n }\n this.lock = true;\n this._mdf = false;\n var i;\n var len = this.effectsSequence.length;\n var finalValue = _finalValue || this.data.d.k[this.keysIndex].s;\n for (i = 0; i < len; i += 1) {\n // Checking if index changed to prevent creating a new object every time the expression updates.\n if (currentIndex !== this.keysIndex) {\n finalValue = this.effectsSequence[i](finalValue, finalValue.t);\n } else {\n finalValue = this.effectsSequence[i](this.currentData, finalValue.t);\n }\n }\n if (currentValue !== finalValue) {\n this.setCurrentData(finalValue);\n }\n this.v = this.currentData;\n this.pv = this.v;\n this.lock = false;\n this.frameId = this.elem.globalData.frameId;\n };\n TextProperty.prototype.getKeyframeValue = function () {\n var textKeys = this.data.d.k;\n var frameNum = this.elem.comp.renderedFrame;\n var i = 0;\n var len = textKeys.length;\n while (i <= len - 1) {\n if (i === len - 1 || textKeys[i + 1].t > frameNum) {\n break;\n }\n i += 1;\n }\n if (this.keysIndex !== i) {\n this.keysIndex = i;\n }\n return this.data.d.k[this.keysIndex].s;\n };\n TextProperty.prototype.buildFinalText = function (text) {\n var charactersArray = [];\n var i = 0;\n var len = text.length;\n var charCode;\n var secondCharCode;\n var shouldCombine = false;\n var shouldCombineNext = false;\n var currentChars = '';\n while (i < len) {\n shouldCombine = shouldCombineNext;\n shouldCombineNext = false;\n charCode = text.charCodeAt(i);\n currentChars = text.charAt(i);\n if (FontManager.isCombinedCharacter(charCode)) {\n shouldCombine = true; // It's a potential surrogate pair (this is the High surrogate)\n } else if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n if (FontManager.isRegionalFlag(text, i)) {\n currentChars = text.substr(i, 14);\n } else {\n secondCharCode = text.charCodeAt(i + 1); // It's a surrogate pair (this is the Low surrogate)\n\n if (secondCharCode >= 0xDC00 && secondCharCode <= 0xDFFF) {\n if (FontManager.isModifier(charCode, secondCharCode)) {\n currentChars = text.substr(i, 2);\n shouldCombine = true;\n } else if (FontManager.isFlagEmoji(text.substr(i, 4))) {\n currentChars = text.substr(i, 4);\n } else {\n currentChars = text.substr(i, 2);\n }\n }\n }\n } else if (charCode > 0xDBFF) {\n secondCharCode = text.charCodeAt(i + 1);\n if (FontManager.isVariationSelector(charCode)) {\n shouldCombine = true;\n }\n } else if (FontManager.isZeroWidthJoiner(charCode)) {\n shouldCombine = true;\n shouldCombineNext = true;\n }\n if (shouldCombine) {\n charactersArray[charactersArray.length - 1] += currentChars;\n shouldCombine = false;\n } else {\n charactersArray.push(currentChars);\n }\n i += currentChars.length;\n }\n return charactersArray;\n };\n TextProperty.prototype.completeTextData = function (documentData) {\n documentData.__complete = true;\n var fontManager = this.elem.globalData.fontManager;\n var data = this.data;\n var letters = [];\n var i;\n var len;\n var newLineFlag;\n var index = 0;\n var val;\n var anchorGrouping = data.m.g;\n var currentSize = 0;\n var currentPos = 0;\n var currentLine = 0;\n var lineWidths = [];\n var lineWidth = 0;\n var maxLineWidth = 0;\n var j;\n var jLen;\n var fontData = fontManager.getFontByName(documentData.f);\n var charData;\n var cLength = 0;\n var fontProps = getFontProperties(fontData);\n documentData.fWeight = fontProps.weight;\n documentData.fStyle = fontProps.style;\n documentData.finalSize = documentData.s;\n documentData.finalText = this.buildFinalText(documentData.t);\n len = documentData.finalText.length;\n documentData.finalLineHeight = documentData.lh;\n var trackingOffset = documentData.tr / 1000 * documentData.finalSize;\n var charCode;\n if (documentData.sz) {\n var flag = true;\n var boxWidth = documentData.sz[0];\n var boxHeight = documentData.sz[1];\n var currentHeight;\n var finalText;\n while (flag) {\n finalText = this.buildFinalText(documentData.t);\n currentHeight = 0;\n lineWidth = 0;\n len = finalText.length;\n trackingOffset = documentData.tr / 1000 * documentData.finalSize;\n var lastSpaceIndex = -1;\n for (i = 0; i < len; i += 1) {\n charCode = finalText[i].charCodeAt(0);\n newLineFlag = false;\n if (finalText[i] === ' ') {\n lastSpaceIndex = i;\n } else if (charCode === 13 || charCode === 3) {\n lineWidth = 0;\n newLineFlag = true;\n currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;\n }\n if (fontManager.chars) {\n charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily);\n cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100;\n } else {\n // tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;\n cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize);\n }\n if (lineWidth + cLength > boxWidth && finalText[i] !== ' ') {\n if (lastSpaceIndex === -1) {\n len += 1;\n } else {\n i = lastSpaceIndex;\n }\n currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;\n finalText.splice(i, lastSpaceIndex === i ? 1 : 0, '\\r'); // finalText = finalText.substr(0,i) + \"\\r\" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);\n\n lastSpaceIndex = -1;\n lineWidth = 0;\n } else {\n lineWidth += cLength;\n lineWidth += trackingOffset;\n }\n }\n currentHeight += fontData.ascent * documentData.finalSize / 100;\n if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {\n documentData.finalSize -= 1;\n documentData.finalLineHeight = documentData.finalSize * documentData.lh / documentData.s;\n } else {\n documentData.finalText = finalText;\n len = documentData.finalText.length;\n flag = false;\n }\n }\n }\n lineWidth = -trackingOffset;\n cLength = 0;\n var uncollapsedSpaces = 0;\n var currentChar;\n for (i = 0; i < len; i += 1) {\n newLineFlag = false;\n currentChar = documentData.finalText[i];\n charCode = currentChar.charCodeAt(0);\n if (charCode === 13 || charCode === 3) {\n uncollapsedSpaces = 0;\n lineWidths.push(lineWidth);\n maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;\n lineWidth = -2 * trackingOffset;\n val = '';\n newLineFlag = true;\n currentLine += 1;\n } else {\n val = currentChar;\n }\n if (fontManager.chars) {\n charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily);\n cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100;\n } else {\n // var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);\n // tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;\n cLength = fontManager.measureText(val, documentData.f, documentData.finalSize);\n } //\n\n if (currentChar === ' ') {\n uncollapsedSpaces += cLength + trackingOffset;\n } else {\n lineWidth += cLength + trackingOffset + uncollapsedSpaces;\n uncollapsedSpaces = 0;\n }\n letters.push({\n l: cLength,\n an: cLength,\n add: currentSize,\n n: newLineFlag,\n anIndexes: [],\n val: val,\n line: currentLine,\n animatorJustifyOffset: 0\n });\n if (anchorGrouping == 2) {\n // eslint-disable-line eqeqeq\n currentSize += cLength;\n if (val === '' || val === ' ' || i === len - 1) {\n if (val === '' || val === ' ') {\n currentSize -= cLength;\n }\n while (currentPos <= i) {\n letters[currentPos].an = currentSize;\n letters[currentPos].ind = index;\n letters[currentPos].extra = cLength;\n currentPos += 1;\n }\n index += 1;\n currentSize = 0;\n }\n } else if (anchorGrouping == 3) {\n // eslint-disable-line eqeqeq\n currentSize += cLength;\n if (val === '' || i === len - 1) {\n if (val === '') {\n currentSize -= cLength;\n }\n while (currentPos <= i) {\n letters[currentPos].an = currentSize;\n letters[currentPos].ind = index;\n letters[currentPos].extra = cLength;\n currentPos += 1;\n }\n currentSize = 0;\n index += 1;\n }\n } else {\n letters[index].ind = index;\n letters[index].extra = 0;\n index += 1;\n }\n }\n documentData.l = letters;\n maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;\n lineWidths.push(lineWidth);\n if (documentData.sz) {\n documentData.boxWidth = documentData.sz[0];\n documentData.justifyOffset = 0;\n } else {\n documentData.boxWidth = maxLineWidth;\n switch (documentData.j) {\n case 1:\n documentData.justifyOffset = -documentData.boxWidth;\n break;\n case 2:\n documentData.justifyOffset = -documentData.boxWidth / 2;\n break;\n default:\n documentData.justifyOffset = 0;\n }\n }\n documentData.lineWidths = lineWidths;\n var animators = data.a;\n var animatorData;\n var letterData;\n jLen = animators.length;\n var based;\n var ind;\n var indexes = [];\n for (j = 0; j < jLen; j += 1) {\n animatorData = animators[j];\n if (animatorData.a.sc) {\n documentData.strokeColorAnim = true;\n }\n if (animatorData.a.sw) {\n documentData.strokeWidthAnim = true;\n }\n if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) {\n documentData.fillColorAnim = true;\n }\n ind = 0;\n based = animatorData.s.b;\n for (i = 0; i < len; i += 1) {\n letterData = letters[i];\n letterData.anIndexes[j] = ind;\n if (based == 1 && letterData.val !== '' || based == 2 && letterData.val !== '' && letterData.val !== ' ' || based == 3 && (letterData.n || letterData.val == ' ' || i == len - 1) || based == 4 && (letterData.n || i == len - 1)) {\n // eslint-disable-line eqeqeq\n if (animatorData.s.rn === 1) {\n indexes.push(ind);\n }\n ind += 1;\n }\n }\n data.a[j].s.totalChars = ind;\n var currentInd = -1;\n var newInd;\n if (animatorData.s.rn === 1) {\n for (i = 0; i < len; i += 1) {\n letterData = letters[i];\n if (currentInd != letterData.anIndexes[j]) {\n // eslint-disable-line eqeqeq\n currentInd = letterData.anIndexes[j];\n newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0];\n }\n letterData.anIndexes[j] = newInd;\n }\n }\n }\n documentData.yOffset = documentData.finalLineHeight || documentData.finalSize * 1.2;\n documentData.ls = documentData.ls || 0;\n documentData.ascent = fontData.ascent * documentData.finalSize / 100;\n };\n TextProperty.prototype.updateDocumentData = function (newData, index) {\n index = index === undefined ? this.keysIndex : index;\n var dData = this.copyData({}, this.data.d.k[index].s);\n dData = this.copyData(dData, newData);\n this.data.d.k[index].s = dData;\n this.recalculate(index);\n this.setCurrentData(dData);\n this.elem.addDynamicProperty(this);\n };\n TextProperty.prototype.recalculate = function (index) {\n var dData = this.data.d.k[index].s;\n dData.__complete = false;\n this.keysIndex = 0;\n this._isFirstFrame = true;\n this.getValue(dData);\n };\n TextProperty.prototype.canResizeFont = function (_canResize) {\n this.canResize = _canResize;\n this.recalculate(this.keysIndex);\n this.elem.addDynamicProperty(this);\n };\n TextProperty.prototype.setMinimumFontSize = function (_fontValue) {\n this.minimumFontSize = Math.floor(_fontValue) || 1;\n this.recalculate(this.keysIndex);\n this.elem.addDynamicProperty(this);\n };\n var TextSelectorProp = function () {\n var max = Math.max;\n var min = Math.min;\n var floor = Math.floor;\n function TextSelectorPropFactory(elem, data) {\n this._currentTextLength = -1;\n this.k = false;\n this.data = data;\n this.elem = elem;\n this.comp = elem.comp;\n this.finalS = 0;\n this.finalE = 0;\n this.initDynamicPropertyContainer(elem);\n this.s = PropertyFactory.getProp(elem, data.s || {\n k: 0\n }, 0, 0, this);\n if ('e' in data) {\n this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this);\n } else {\n this.e = {\n v: 100\n };\n }\n this.o = PropertyFactory.getProp(elem, data.o || {\n k: 0\n }, 0, 0, this);\n this.xe = PropertyFactory.getProp(elem, data.xe || {\n k: 0\n }, 0, 0, this);\n this.ne = PropertyFactory.getProp(elem, data.ne || {\n k: 0\n }, 0, 0, this);\n this.sm = PropertyFactory.getProp(elem, data.sm || {\n k: 100\n }, 0, 0, this);\n this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this);\n if (!this.dynamicProperties.length) {\n this.getValue();\n }\n }\n TextSelectorPropFactory.prototype = {\n getMult: function getMult(ind) {\n if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) {\n this.getValue();\n }\n var x1 = 0;\n var y1 = 0;\n var x2 = 1;\n var y2 = 1;\n if (this.ne.v > 0) {\n x1 = this.ne.v / 100.0;\n } else {\n y1 = -this.ne.v / 100.0;\n }\n if (this.xe.v > 0) {\n x2 = 1.0 - this.xe.v / 100.0;\n } else {\n y2 = 1.0 + this.xe.v / 100.0;\n }\n var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get;\n var mult = 0;\n var s = this.finalS;\n var e = this.finalE;\n var type = this.data.sh;\n if (type === 2) {\n if (e === s) {\n mult = ind >= e ? 1 : 0;\n } else {\n mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\n }\n mult = easer(mult);\n } else if (type === 3) {\n if (e === s) {\n mult = ind >= e ? 0 : 1;\n } else {\n mult = 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\n }\n mult = easer(mult);\n } else if (type === 4) {\n if (e === s) {\n mult = 0;\n } else {\n mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\n if (mult < 0.5) {\n mult *= 2;\n } else {\n mult = 1 - 2 * (mult - 0.5);\n }\n }\n mult = easer(mult);\n } else if (type === 5) {\n if (e === s) {\n mult = 0;\n } else {\n var tot = e - s;\n /* ind += 0.5;\r\n mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind; */\n\n ind = min(max(0, ind + 0.5 - s), e - s);\n var x = -tot / 2 + ind;\n var a = tot / 2;\n mult = Math.sqrt(1 - x * x / (a * a));\n }\n mult = easer(mult);\n } else if (type === 6) {\n if (e === s) {\n mult = 0;\n } else {\n ind = min(max(0, ind + 0.5 - s), e - s);\n mult = (1 + Math.cos(Math.PI + Math.PI * 2 * ind / (e - s))) / 2; // eslint-disable-line\n }\n mult = easer(mult);\n } else {\n if (ind >= floor(s)) {\n if (ind - s < 0) {\n mult = max(0, min(min(e, 1) - (s - ind), 1));\n } else {\n mult = max(0, min(e - ind, 1));\n }\n }\n mult = easer(mult);\n } // Smoothness implementation.\n // The smoothness represents a reduced range of the original [0; 1] range.\n // if smoothness is 25%, the new range will be [0.375; 0.625]\n // Steps are:\n // - find the lower value of the new range (threshold)\n // - if multiplier is smaller than that value, floor it to 0\n // - if it is larger,\n // - subtract the threshold\n // - divide it by the smoothness (this will return the range to [0; 1])\n // Note: If it doesn't work on some scenarios, consider applying it before the easer.\n\n if (this.sm.v !== 100) {\n var smoothness = this.sm.v * 0.01;\n if (smoothness === 0) {\n smoothness = 0.00000001;\n }\n var threshold = 0.5 - smoothness * 0.5;\n if (mult < threshold) {\n mult = 0;\n } else {\n mult = (mult - threshold) / smoothness;\n if (mult > 1) {\n mult = 1;\n }\n }\n }\n return mult * this.a.v;\n },\n getValue: function getValue(newCharsFlag) {\n this.iterateDynamicProperties();\n this._mdf = newCharsFlag || this._mdf;\n this._currentTextLength = this.elem.textProperty.currentData.l.length || 0;\n if (newCharsFlag && this.data.r === 2) {\n this.e.v = this._currentTextLength;\n }\n var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars;\n var o = this.o.v / divisor;\n var s = this.s.v / divisor + o;\n var e = this.e.v / divisor + o;\n if (s > e) {\n var _s = s;\n s = e;\n e = _s;\n }\n this.finalS = s;\n this.finalE = e;\n }\n };\n extendPrototype([DynamicPropertyContainer], TextSelectorPropFactory);\n function getTextSelectorProp(elem, data, arr) {\n return new TextSelectorPropFactory(elem, data, arr);\n }\n return {\n getTextSelectorProp: getTextSelectorProp\n };\n }();\n function TextAnimatorDataProperty(elem, animatorProps, container) {\n var defaultData = {\n propType: false\n };\n var getProp = PropertyFactory.getProp;\n var textAnimatorAnimatables = animatorProps.a;\n this.a = {\n r: textAnimatorAnimatables.r ? getProp(elem, textAnimatorAnimatables.r, 0, degToRads, container) : defaultData,\n rx: textAnimatorAnimatables.rx ? getProp(elem, textAnimatorAnimatables.rx, 0, degToRads, container) : defaultData,\n ry: textAnimatorAnimatables.ry ? getProp(elem, textAnimatorAnimatables.ry, 0, degToRads, container) : defaultData,\n sk: textAnimatorAnimatables.sk ? getProp(elem, textAnimatorAnimatables.sk, 0, degToRads, container) : defaultData,\n sa: textAnimatorAnimatables.sa ? getProp(elem, textAnimatorAnimatables.sa, 0, degToRads, container) : defaultData,\n s: textAnimatorAnimatables.s ? getProp(elem, textAnimatorAnimatables.s, 1, 0.01, container) : defaultData,\n a: textAnimatorAnimatables.a ? getProp(elem, textAnimatorAnimatables.a, 1, 0, container) : defaultData,\n o: textAnimatorAnimatables.o ? getProp(elem, textAnimatorAnimatables.o, 0, 0.01, container) : defaultData,\n p: textAnimatorAnimatables.p ? getProp(elem, textAnimatorAnimatables.p, 1, 0, container) : defaultData,\n sw: textAnimatorAnimatables.sw ? getProp(elem, textAnimatorAnimatables.sw, 0, 0, container) : defaultData,\n sc: textAnimatorAnimatables.sc ? getProp(elem, textAnimatorAnimatables.sc, 1, 0, container) : defaultData,\n fc: textAnimatorAnimatables.fc ? getProp(elem, textAnimatorAnimatables.fc, 1, 0, container) : defaultData,\n fh: textAnimatorAnimatables.fh ? getProp(elem, textAnimatorAnimatables.fh, 0, 0, container) : defaultData,\n fs: textAnimatorAnimatables.fs ? getProp(elem, textAnimatorAnimatables.fs, 0, 0.01, container) : defaultData,\n fb: textAnimatorAnimatables.fb ? getProp(elem, textAnimatorAnimatables.fb, 0, 0.01, container) : defaultData,\n t: textAnimatorAnimatables.t ? getProp(elem, textAnimatorAnimatables.t, 0, 0, container) : defaultData\n };\n this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container);\n this.s.t = animatorProps.s.t;\n }\n function TextAnimatorProperty(textData, renderType, elem) {\n this._isFirstFrame = true;\n this._hasMaskedPath = false;\n this._frameId = -1;\n this._textData = textData;\n this._renderType = renderType;\n this._elem = elem;\n this._animatorsData = createSizedArray(this._textData.a.length);\n this._pathData = {};\n this._moreOptions = {\n alignment: {}\n };\n this.renderedLetters = [];\n this.lettersChangedFlag = false;\n this.initDynamicPropertyContainer(elem);\n }\n TextAnimatorProperty.prototype.searchProperties = function () {\n var i;\n var len = this._textData.a.length;\n var animatorProps;\n var getProp = PropertyFactory.getProp;\n for (i = 0; i < len; i += 1) {\n animatorProps = this._textData.a[i];\n this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this);\n }\n if (this._textData.p && 'm' in this._textData.p) {\n this._pathData = {\n a: getProp(this._elem, this._textData.p.a, 0, 0, this),\n f: getProp(this._elem, this._textData.p.f, 0, 0, this),\n l: getProp(this._elem, this._textData.p.l, 0, 0, this),\n r: getProp(this._elem, this._textData.p.r, 0, 0, this),\n p: getProp(this._elem, this._textData.p.p, 0, 0, this),\n m: this._elem.maskManager.getMaskProperty(this._textData.p.m)\n };\n this._hasMaskedPath = true;\n } else {\n this._hasMaskedPath = false;\n }\n this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this);\n };\n TextAnimatorProperty.prototype.getMeasures = function (documentData, lettersChangedFlag) {\n this.lettersChangedFlag = lettersChangedFlag;\n if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {\n return;\n }\n this._isFirstFrame = false;\n var alignment = this._moreOptions.alignment.v;\n var animators = this._animatorsData;\n var textData = this._textData;\n var matrixHelper = this.mHelper;\n var renderType = this._renderType;\n var renderedLettersCount = this.renderedLetters.length;\n var xPos;\n var yPos;\n var i;\n var len;\n var letters = documentData.l;\n var pathInfo;\n var currentLength;\n var currentPoint;\n var segmentLength;\n var flag;\n var pointInd;\n var segmentInd;\n var prevPoint;\n var points;\n var segments;\n var partialLength;\n var totalLength;\n var perc;\n var tanAngle;\n var mask;\n if (this._hasMaskedPath) {\n mask = this._pathData.m;\n if (!this._pathData.n || this._pathData._mdf) {\n var paths = mask.v;\n if (this._pathData.r.v) {\n paths = paths.reverse();\n } // TODO: release bezier data cached from previous pathInfo: this._pathData.pi\n\n pathInfo = {\n tLength: 0,\n segments: []\n };\n len = paths._length - 1;\n var bezierData;\n totalLength = 0;\n for (i = 0; i < len; i += 1) {\n bezierData = bez.buildBezierData(paths.v[i], paths.v[i + 1], [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]], [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]]);\n pathInfo.tLength += bezierData.segmentLength;\n pathInfo.segments.push(bezierData);\n totalLength += bezierData.segmentLength;\n }\n i = len;\n if (mask.v.c) {\n bezierData = bez.buildBezierData(paths.v[i], paths.v[0], [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]], [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]]);\n pathInfo.tLength += bezierData.segmentLength;\n pathInfo.segments.push(bezierData);\n totalLength += bezierData.segmentLength;\n }\n this._pathData.pi = pathInfo;\n }\n pathInfo = this._pathData.pi;\n currentLength = this._pathData.f.v;\n segmentInd = 0;\n pointInd = 1;\n segmentLength = 0;\n flag = true;\n segments = pathInfo.segments;\n if (currentLength < 0 && mask.v.c) {\n if (pathInfo.tLength < Math.abs(currentLength)) {\n currentLength = -Math.abs(currentLength) % pathInfo.tLength;\n }\n segmentInd = segments.length - 1;\n points = segments[segmentInd].points;\n pointInd = points.length - 1;\n while (currentLength < 0) {\n currentLength += points[pointInd].partialLength;\n pointInd -= 1;\n if (pointInd < 0) {\n segmentInd -= 1;\n points = segments[segmentInd].points;\n pointInd = points.length - 1;\n }\n }\n }\n points = segments[segmentInd].points;\n prevPoint = points[pointInd - 1];\n currentPoint = points[pointInd];\n partialLength = currentPoint.partialLength;\n }\n len = letters.length;\n xPos = 0;\n yPos = 0;\n var yOff = documentData.finalSize * 1.2 * 0.714;\n var firstLine = true;\n var animatorProps;\n var animatorSelector;\n var j;\n var jLen;\n var letterValue;\n jLen = animators.length;\n var mult;\n var ind = -1;\n var offf;\n var xPathPos;\n var yPathPos;\n var initPathPos = currentLength;\n var initSegmentInd = segmentInd;\n var initPointInd = pointInd;\n var currentLine = -1;\n var elemOpacity;\n var sc;\n var sw;\n var fc;\n var k;\n var letterSw;\n var letterSc;\n var letterFc;\n var letterM = '';\n var letterP = this.defaultPropsArray;\n var letterO; //\n\n if (documentData.j === 2 || documentData.j === 1) {\n var animatorJustifyOffset = 0;\n var animatorFirstCharOffset = 0;\n var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1;\n var lastIndex = 0;\n var isNewLine = true;\n for (i = 0; i < len; i += 1) {\n if (letters[i].n) {\n if (animatorJustifyOffset) {\n animatorJustifyOffset += animatorFirstCharOffset;\n }\n while (lastIndex < i) {\n letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;\n lastIndex += 1;\n }\n animatorJustifyOffset = 0;\n isNewLine = true;\n } else {\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.t.propType) {\n if (isNewLine && documentData.j === 2) {\n animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult;\n }\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (mult.length) {\n animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult;\n } else {\n animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult;\n }\n }\n }\n isNewLine = false;\n }\n }\n if (animatorJustifyOffset) {\n animatorJustifyOffset += animatorFirstCharOffset;\n }\n while (lastIndex < i) {\n letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;\n lastIndex += 1;\n }\n } //\n\n for (i = 0; i < len; i += 1) {\n matrixHelper.reset();\n elemOpacity = 1;\n if (letters[i].n) {\n xPos = 0;\n yPos += documentData.yOffset;\n yPos += firstLine ? 1 : 0;\n currentLength = initPathPos;\n firstLine = false;\n if (this._hasMaskedPath) {\n segmentInd = initSegmentInd;\n pointInd = initPointInd;\n points = segments[segmentInd].points;\n prevPoint = points[pointInd - 1];\n currentPoint = points[pointInd];\n partialLength = currentPoint.partialLength;\n segmentLength = 0;\n }\n letterM = '';\n letterFc = '';\n letterSw = '';\n letterO = '';\n letterP = this.defaultPropsArray;\n } else {\n if (this._hasMaskedPath) {\n if (currentLine !== letters[i].line) {\n switch (documentData.j) {\n case 1:\n currentLength += totalLength - documentData.lineWidths[letters[i].line];\n break;\n case 2:\n currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2;\n break;\n default:\n break;\n }\n currentLine = letters[i].line;\n }\n if (ind !== letters[i].ind) {\n if (letters[ind]) {\n currentLength += letters[ind].extra;\n }\n currentLength += letters[i].an / 2;\n ind = letters[i].ind;\n }\n currentLength += alignment[0] * letters[i].an * 0.005;\n var animatorOffset = 0;\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.p.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (mult.length) {\n animatorOffset += animatorProps.p.v[0] * mult[0];\n } else {\n animatorOffset += animatorProps.p.v[0] * mult;\n }\n }\n if (animatorProps.a.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (mult.length) {\n animatorOffset += animatorProps.a.v[0] * mult[0];\n } else {\n animatorOffset += animatorProps.a.v[0] * mult;\n }\n }\n }\n flag = true; // Force alignment only works with a single line for now\n\n if (this._pathData.a.v) {\n currentLength = letters[0].an * 0.5 + (totalLength - this._pathData.f.v - letters[0].an * 0.5 - letters[letters.length - 1].an * 0.5) * ind / (len - 1);\n currentLength += this._pathData.f.v;\n }\n while (flag) {\n if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {\n perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength;\n xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc;\n yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc;\n matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -(alignment[1] * yOff) * 0.01);\n flag = false;\n } else if (points) {\n segmentLength += currentPoint.partialLength;\n pointInd += 1;\n if (pointInd >= points.length) {\n pointInd = 0;\n segmentInd += 1;\n if (!segments[segmentInd]) {\n if (mask.v.c) {\n pointInd = 0;\n segmentInd = 0;\n points = segments[segmentInd].points;\n } else {\n segmentLength -= currentPoint.partialLength;\n points = null;\n }\n } else {\n points = segments[segmentInd].points;\n }\n }\n if (points) {\n prevPoint = currentPoint;\n currentPoint = points[pointInd];\n partialLength = currentPoint.partialLength;\n }\n }\n }\n offf = letters[i].an / 2 - letters[i].add;\n matrixHelper.translate(-offf, 0, 0);\n } else {\n offf = letters[i].an / 2 - letters[i].add;\n matrixHelper.translate(-offf, 0, 0); // Grouping alignment\n\n matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -alignment[1] * yOff * 0.01, 0);\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.t.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); // This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean \"isNewLine\"\n\n if (xPos !== 0 || documentData.j !== 0) {\n if (this._hasMaskedPath) {\n if (mult.length) {\n currentLength += animatorProps.t.v * mult[0];\n } else {\n currentLength += animatorProps.t.v * mult;\n }\n } else if (mult.length) {\n xPos += animatorProps.t.v * mult[0];\n } else {\n xPos += animatorProps.t.v * mult;\n }\n }\n }\n }\n if (documentData.strokeWidthAnim) {\n sw = documentData.sw || 0;\n }\n if (documentData.strokeColorAnim) {\n if (documentData.sc) {\n sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]];\n } else {\n sc = [0, 0, 0];\n }\n }\n if (documentData.fillColorAnim && documentData.fc) {\n fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]];\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.a.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (mult.length) {\n matrixHelper.translate(-animatorProps.a.v[0] * mult[0], -animatorProps.a.v[1] * mult[1], animatorProps.a.v[2] * mult[2]);\n } else {\n matrixHelper.translate(-animatorProps.a.v[0] * mult, -animatorProps.a.v[1] * mult, animatorProps.a.v[2] * mult);\n }\n }\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.s.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (mult.length) {\n matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult[0], 1 + (animatorProps.s.v[1] - 1) * mult[1], 1);\n } else {\n matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult, 1 + (animatorProps.s.v[1] - 1) * mult, 1);\n }\n }\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (animatorProps.sk.propType) {\n if (mult.length) {\n matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]);\n } else {\n matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult);\n }\n }\n if (animatorProps.r.propType) {\n if (mult.length) {\n matrixHelper.rotateZ(-animatorProps.r.v * mult[2]);\n } else {\n matrixHelper.rotateZ(-animatorProps.r.v * mult);\n }\n }\n if (animatorProps.ry.propType) {\n if (mult.length) {\n matrixHelper.rotateY(animatorProps.ry.v * mult[1]);\n } else {\n matrixHelper.rotateY(animatorProps.ry.v * mult);\n }\n }\n if (animatorProps.rx.propType) {\n if (mult.length) {\n matrixHelper.rotateX(animatorProps.rx.v * mult[0]);\n } else {\n matrixHelper.rotateX(animatorProps.rx.v * mult);\n }\n }\n if (animatorProps.o.propType) {\n if (mult.length) {\n elemOpacity += (animatorProps.o.v * mult[0] - elemOpacity) * mult[0];\n } else {\n elemOpacity += (animatorProps.o.v * mult - elemOpacity) * mult;\n }\n }\n if (documentData.strokeWidthAnim && animatorProps.sw.propType) {\n if (mult.length) {\n sw += animatorProps.sw.v * mult[0];\n } else {\n sw += animatorProps.sw.v * mult;\n }\n }\n if (documentData.strokeColorAnim && animatorProps.sc.propType) {\n for (k = 0; k < 3; k += 1) {\n if (mult.length) {\n sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult[0];\n } else {\n sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult;\n }\n }\n }\n if (documentData.fillColorAnim && documentData.fc) {\n if (animatorProps.fc.propType) {\n for (k = 0; k < 3; k += 1) {\n if (mult.length) {\n fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult[0];\n } else {\n fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult;\n }\n }\n }\n if (animatorProps.fh.propType) {\n if (mult.length) {\n fc = addHueToRGB(fc, animatorProps.fh.v * mult[0]);\n } else {\n fc = addHueToRGB(fc, animatorProps.fh.v * mult);\n }\n }\n if (animatorProps.fs.propType) {\n if (mult.length) {\n fc = addSaturationToRGB(fc, animatorProps.fs.v * mult[0]);\n } else {\n fc = addSaturationToRGB(fc, animatorProps.fs.v * mult);\n }\n }\n if (animatorProps.fb.propType) {\n if (mult.length) {\n fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult[0]);\n } else {\n fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult);\n }\n }\n }\n }\n for (j = 0; j < jLen; j += 1) {\n animatorProps = animators[j].a;\n if (animatorProps.p.propType) {\n animatorSelector = animators[j].s;\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\n if (this._hasMaskedPath) {\n if (mult.length) {\n matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]);\n } else {\n matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);\n }\n } else if (mult.length) {\n matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]);\n } else {\n matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);\n }\n }\n }\n if (documentData.strokeWidthAnim) {\n letterSw = sw < 0 ? 0 : sw;\n }\n if (documentData.strokeColorAnim) {\n letterSc = 'rgb(' + Math.round(sc[0] * 255) + ',' + Math.round(sc[1] * 255) + ',' + Math.round(sc[2] * 255) + ')';\n }\n if (documentData.fillColorAnim && documentData.fc) {\n letterFc = 'rgb(' + Math.round(fc[0] * 255) + ',' + Math.round(fc[1] * 255) + ',' + Math.round(fc[2] * 255) + ')';\n }\n if (this._hasMaskedPath) {\n matrixHelper.translate(0, -documentData.ls);\n matrixHelper.translate(0, alignment[1] * yOff * 0.01 + yPos, 0);\n if (this._pathData.p.v) {\n tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]);\n var rot = Math.atan(tanAngle) * 180 / Math.PI;\n if (currentPoint.point[0] < prevPoint.point[0]) {\n rot += 180;\n }\n matrixHelper.rotate(-rot * Math.PI / 180);\n }\n matrixHelper.translate(xPathPos, yPathPos, 0);\n currentLength -= alignment[0] * letters[i].an * 0.005;\n if (letters[i + 1] && ind !== letters[i + 1].ind) {\n currentLength += letters[i].an / 2;\n currentLength += documentData.tr * 0.001 * documentData.finalSize;\n }\n } else {\n matrixHelper.translate(xPos, yPos, 0);\n if (documentData.ps) {\n // matrixHelper.translate(documentData.ps[0],documentData.ps[1],0);\n matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);\n }\n switch (documentData.j) {\n case 1:\n matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]), 0, 0);\n break;\n case 2:\n matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2, 0, 0);\n break;\n default:\n break;\n }\n matrixHelper.translate(0, -documentData.ls);\n matrixHelper.translate(offf, 0, 0);\n matrixHelper.translate(alignment[0] * letters[i].an * 0.005, alignment[1] * yOff * 0.01, 0);\n xPos += letters[i].l + documentData.tr * 0.001 * documentData.finalSize;\n }\n if (renderType === 'html') {\n letterM = matrixHelper.toCSS();\n } else if (renderType === 'svg') {\n letterM = matrixHelper.to2dCSS();\n } else {\n letterP = [matrixHelper.props[0], matrixHelper.props[1], matrixHelper.props[2], matrixHelper.props[3], matrixHelper.props[4], matrixHelper.props[5], matrixHelper.props[6], matrixHelper.props[7], matrixHelper.props[8], matrixHelper.props[9], matrixHelper.props[10], matrixHelper.props[11], matrixHelper.props[12], matrixHelper.props[13], matrixHelper.props[14], matrixHelper.props[15]];\n }\n letterO = elemOpacity;\n }\n if (renderedLettersCount <= i) {\n letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP);\n this.renderedLetters.push(letterValue);\n renderedLettersCount += 1;\n this.lettersChangedFlag = true;\n } else {\n letterValue = this.renderedLetters[i];\n this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag;\n }\n }\n };\n TextAnimatorProperty.prototype.getValue = function () {\n if (this._elem.globalData.frameId === this._frameId) {\n return;\n }\n this._frameId = this._elem.globalData.frameId;\n this.iterateDynamicProperties();\n };\n TextAnimatorProperty.prototype.mHelper = new Matrix();\n TextAnimatorProperty.prototype.defaultPropsArray = [];\n extendPrototype([DynamicPropertyContainer], TextAnimatorProperty);\n function ITextElement() {}\n ITextElement.prototype.initElement = function (data, globalData, comp) {\n this.lettersChangedFlag = true;\n this.initFrame();\n this.initBaseData(data, globalData, comp);\n this.textProperty = new TextProperty(this, data.t, this.dynamicProperties);\n this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this);\n this.initTransform(data, globalData, comp);\n this.initHierarchy();\n this.initRenderable();\n this.initRendererElement();\n this.createContainerElements();\n this.createRenderableComponents();\n this.createContent();\n this.hide();\n this.textAnimator.searchProperties(this.dynamicProperties);\n };\n ITextElement.prototype.prepareFrame = function (num) {\n this._mdf = false;\n this.prepareRenderableFrame(num);\n this.prepareProperties(num, this.isInRange);\n };\n ITextElement.prototype.createPathShape = function (matrixHelper, shapes) {\n var j;\n var jLen = shapes.length;\n var pathNodes;\n var shapeStr = '';\n for (j = 0; j < jLen; j += 1) {\n if (shapes[j].ty === 'sh') {\n pathNodes = shapes[j].ks.k;\n shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper);\n }\n }\n return shapeStr;\n };\n ITextElement.prototype.updateDocumentData = function (newData, index) {\n this.textProperty.updateDocumentData(newData, index);\n };\n ITextElement.prototype.canResizeFont = function (_canResize) {\n this.textProperty.canResizeFont(_canResize);\n };\n ITextElement.prototype.setMinimumFontSize = function (_fontSize) {\n this.textProperty.setMinimumFontSize(_fontSize);\n };\n ITextElement.prototype.applyTextPropertiesToMatrix = function (documentData, matrixHelper, lineNumber, xPos, yPos) {\n if (documentData.ps) {\n matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);\n }\n matrixHelper.translate(0, -documentData.ls, 0);\n switch (documentData.j) {\n case 1:\n matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]), 0, 0);\n break;\n case 2:\n matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2, 0, 0);\n break;\n default:\n break;\n }\n matrixHelper.translate(xPos, yPos, 0);\n };\n ITextElement.prototype.buildColor = function (colorData) {\n return 'rgb(' + Math.round(colorData[0] * 255) + ',' + Math.round(colorData[1] * 255) + ',' + Math.round(colorData[2] * 255) + ')';\n };\n ITextElement.prototype.emptyProp = new LetterProps();\n ITextElement.prototype.destroy = function () {};\n ITextElement.prototype.validateText = function () {\n if (this.textProperty._mdf || this.textProperty._isFirstFrame) {\n this.buildNewText();\n this.textProperty._isFirstFrame = false;\n this.textProperty._mdf = false;\n }\n };\n var emptyShapeData = {\n shapes: []\n };\n function SVGTextLottieElement(data, globalData, comp) {\n this.textSpans = [];\n this.renderType = 'svg';\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], SVGTextLottieElement);\n SVGTextLottieElement.prototype.createContent = function () {\n if (this.data.singleShape && !this.globalData.fontManager.chars) {\n this.textContainer = createNS('text');\n }\n };\n SVGTextLottieElement.prototype.buildTextContents = function (textArray) {\n var i = 0;\n var len = textArray.length;\n var textContents = [];\n var currentTextContent = '';\n while (i < len) {\n if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {\n textContents.push(currentTextContent);\n currentTextContent = '';\n } else {\n currentTextContent += textArray[i];\n }\n i += 1;\n }\n textContents.push(currentTextContent);\n return textContents;\n };\n SVGTextLottieElement.prototype.buildShapeData = function (data, scale) {\n // data should probably be cloned to apply scale separately to each instance of a text on different layers\n // but since text internal content gets only rendered once and then it's never rerendered,\n // it's probably safe not to clone data and reuse always the same instance even if the object is mutated.\n // Avoiding cloning is preferred since cloning each character shape data is expensive\n if (data.shapes && data.shapes.length) {\n var shape = data.shapes[0];\n if (shape.it) {\n var shapeItem = shape.it[shape.it.length - 1];\n if (shapeItem.s) {\n shapeItem.s.k[0] = scale;\n shapeItem.s.k[1] = scale;\n }\n }\n }\n return data;\n };\n SVGTextLottieElement.prototype.buildNewText = function () {\n this.addDynamicProperty(this);\n var i;\n var len;\n var documentData = this.textProperty.currentData;\n this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0);\n if (documentData.fc) {\n this.layerElement.setAttribute('fill', this.buildColor(documentData.fc));\n } else {\n this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)');\n }\n if (documentData.sc) {\n this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc));\n this.layerElement.setAttribute('stroke-width', documentData.sw);\n }\n this.layerElement.setAttribute('font-size', documentData.finalSize);\n var fontData = this.globalData.fontManager.getFontByName(documentData.f);\n if (fontData.fClass) {\n this.layerElement.setAttribute('class', fontData.fClass);\n } else {\n this.layerElement.setAttribute('font-family', fontData.fFamily);\n var fWeight = documentData.fWeight;\n var fStyle = documentData.fStyle;\n this.layerElement.setAttribute('font-style', fStyle);\n this.layerElement.setAttribute('font-weight', fWeight);\n }\n this.layerElement.setAttribute('aria-label', documentData.t);\n var letters = documentData.l || [];\n var usesGlyphs = !!this.globalData.fontManager.chars;\n len = letters.length;\n var tSpan;\n var matrixHelper = this.mHelper;\n var shapeStr = '';\n var singleShape = this.data.singleShape;\n var xPos = 0;\n var yPos = 0;\n var firstLine = true;\n var trackingOffset = documentData.tr * 0.001 * documentData.finalSize;\n if (singleShape && !usesGlyphs && !documentData.sz) {\n var tElement = this.textContainer;\n var justify = 'start';\n switch (documentData.j) {\n case 1:\n justify = 'end';\n break;\n case 2:\n justify = 'middle';\n break;\n default:\n justify = 'start';\n break;\n }\n tElement.setAttribute('text-anchor', justify);\n tElement.setAttribute('letter-spacing', trackingOffset);\n var textContent = this.buildTextContents(documentData.finalText);\n len = textContent.length;\n yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0;\n for (i = 0; i < len; i += 1) {\n tSpan = this.textSpans[i].span || createNS('tspan');\n tSpan.textContent = textContent[i];\n tSpan.setAttribute('x', 0);\n tSpan.setAttribute('y', yPos);\n tSpan.style.display = 'inherit';\n tElement.appendChild(tSpan);\n if (!this.textSpans[i]) {\n this.textSpans[i] = {\n span: null,\n glyph: null\n };\n }\n this.textSpans[i].span = tSpan;\n yPos += documentData.finalLineHeight;\n }\n this.layerElement.appendChild(tElement);\n } else {\n var cachedSpansLength = this.textSpans.length;\n var charData;\n for (i = 0; i < len; i += 1) {\n if (!this.textSpans[i]) {\n this.textSpans[i] = {\n span: null,\n childSpan: null,\n glyph: null\n };\n }\n if (!usesGlyphs || !singleShape || i === 0) {\n tSpan = cachedSpansLength > i ? this.textSpans[i].span : createNS(usesGlyphs ? 'g' : 'text');\n if (cachedSpansLength <= i) {\n tSpan.setAttribute('stroke-linecap', 'butt');\n tSpan.setAttribute('stroke-linejoin', 'round');\n tSpan.setAttribute('stroke-miterlimit', '4');\n this.textSpans[i].span = tSpan;\n if (usesGlyphs) {\n var childSpan = createNS('g');\n tSpan.appendChild(childSpan);\n this.textSpans[i].childSpan = childSpan;\n }\n this.textSpans[i].span = tSpan;\n this.layerElement.appendChild(tSpan);\n }\n tSpan.style.display = 'inherit';\n }\n matrixHelper.reset();\n if (singleShape) {\n if (letters[i].n) {\n xPos = -trackingOffset;\n yPos += documentData.yOffset;\n yPos += firstLine ? 1 : 0;\n firstLine = false;\n }\n this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);\n xPos += letters[i].l || 0; // xPos += letters[i].val === ' ' ? 0 : trackingOffset;\n\n xPos += trackingOffset;\n }\n if (usesGlyphs) {\n charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\n var glyphElement; // t === 1 means the character has been replaced with an animated shaped\n\n if (charData.t === 1) {\n glyphElement = new SVGCompElement(charData.data, this.globalData, this);\n } else {\n var data = emptyShapeData;\n if (charData.data && charData.data.shapes) {\n data = this.buildShapeData(charData.data, documentData.finalSize);\n }\n glyphElement = new SVGShapeElement(data, this.globalData, this);\n }\n if (this.textSpans[i].glyph) {\n var glyph = this.textSpans[i].glyph;\n this.textSpans[i].childSpan.removeChild(glyph.layerElement);\n glyph.destroy();\n }\n this.textSpans[i].glyph = glyphElement;\n glyphElement._debug = true;\n glyphElement.prepareFrame(0);\n glyphElement.renderFrame();\n this.textSpans[i].childSpan.appendChild(glyphElement.layerElement); // when using animated shapes, the layer will be scaled instead of replacing the internal scale\n // this might have issues with strokes and might need a different solution\n\n if (charData.t === 1) {\n this.textSpans[i].childSpan.setAttribute('transform', 'scale(' + documentData.finalSize / 100 + ',' + documentData.finalSize / 100 + ')');\n }\n } else {\n if (singleShape) {\n tSpan.setAttribute('transform', 'translate(' + matrixHelper.props[12] + ',' + matrixHelper.props[13] + ')');\n }\n tSpan.textContent = letters[i].val;\n tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\n } //\n }\n if (singleShape && tSpan) {\n tSpan.setAttribute('d', shapeStr);\n }\n }\n while (i < this.textSpans.length) {\n this.textSpans[i].span.style.display = 'none';\n i += 1;\n }\n this._sizeChanged = true;\n };\n SVGTextLottieElement.prototype.sourceRectAtTime = function () {\n this.prepareFrame(this.comp.renderedFrame - this.data.st);\n this.renderInnerContent();\n if (this._sizeChanged) {\n this._sizeChanged = false;\n var textBox = this.layerElement.getBBox();\n this.bbox = {\n top: textBox.y,\n left: textBox.x,\n width: textBox.width,\n height: textBox.height\n };\n }\n return this.bbox;\n };\n SVGTextLottieElement.prototype.getValue = function () {\n var i;\n var len = this.textSpans.length;\n var glyphElement;\n this.renderedFrame = this.comp.renderedFrame;\n for (i = 0; i < len; i += 1) {\n glyphElement = this.textSpans[i].glyph;\n if (glyphElement) {\n glyphElement.prepareFrame(this.comp.renderedFrame - this.data.st);\n if (glyphElement._mdf) {\n this._mdf = true;\n }\n }\n }\n };\n SVGTextLottieElement.prototype.renderInnerContent = function () {\n this.validateText();\n if (!this.data.singleShape || this._mdf) {\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\n if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) {\n this._sizeChanged = true;\n var i;\n var len;\n var renderedLetters = this.textAnimator.renderedLetters;\n var letters = this.textProperty.currentData.l;\n len = letters.length;\n var renderedLetter;\n var textSpan;\n var glyphElement;\n for (i = 0; i < len; i += 1) {\n if (!letters[i].n) {\n renderedLetter = renderedLetters[i];\n textSpan = this.textSpans[i].span;\n glyphElement = this.textSpans[i].glyph;\n if (glyphElement) {\n glyphElement.renderFrame();\n }\n if (renderedLetter._mdf.m) {\n textSpan.setAttribute('transform', renderedLetter.m);\n }\n if (renderedLetter._mdf.o) {\n textSpan.setAttribute('opacity', renderedLetter.o);\n }\n if (renderedLetter._mdf.sw) {\n textSpan.setAttribute('stroke-width', renderedLetter.sw);\n }\n if (renderedLetter._mdf.sc) {\n textSpan.setAttribute('stroke', renderedLetter.sc);\n }\n if (renderedLetter._mdf.fc) {\n textSpan.setAttribute('fill', renderedLetter.fc);\n }\n }\n }\n }\n }\n };\n function ISolidElement(data, globalData, comp) {\n this.initElement(data, globalData, comp);\n }\n extendPrototype([IImageElement], ISolidElement);\n ISolidElement.prototype.createContent = function () {\n var rect = createNS('rect'); /// /rect.style.width = this.data.sw;\n /// /rect.style.height = this.data.sh;\n /// /rect.style.fill = this.data.sc;\n\n rect.setAttribute('width', this.data.sw);\n rect.setAttribute('height', this.data.sh);\n rect.setAttribute('fill', this.data.sc);\n this.layerElement.appendChild(rect);\n };\n function NullElement(data, globalData, comp) {\n this.initFrame();\n this.initBaseData(data, globalData, comp);\n this.initFrame();\n this.initTransform(data, globalData, comp);\n this.initHierarchy();\n }\n NullElement.prototype.prepareFrame = function (num) {\n this.prepareProperties(num, true);\n };\n NullElement.prototype.renderFrame = function () {};\n NullElement.prototype.getBaseElement = function () {\n return null;\n };\n NullElement.prototype.destroy = function () {};\n NullElement.prototype.sourceRectAtTime = function () {};\n NullElement.prototype.hide = function () {};\n extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement);\n function SVGRendererBase() {}\n extendPrototype([BaseRenderer], SVGRendererBase);\n SVGRendererBase.prototype.createNull = function (data) {\n return new NullElement(data, this.globalData, this);\n };\n SVGRendererBase.prototype.createShape = function (data) {\n return new SVGShapeElement(data, this.globalData, this);\n };\n SVGRendererBase.prototype.createText = function (data) {\n return new SVGTextLottieElement(data, this.globalData, this);\n };\n SVGRendererBase.prototype.createImage = function (data) {\n return new IImageElement(data, this.globalData, this);\n };\n SVGRendererBase.prototype.createSolid = function (data) {\n return new ISolidElement(data, this.globalData, this);\n };\n SVGRendererBase.prototype.configAnimation = function (animData) {\n this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');\n this.svgElement.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');\n if (this.renderConfig.viewBoxSize) {\n this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize);\n } else {\n this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h);\n }\n if (!this.renderConfig.viewBoxOnly) {\n this.svgElement.setAttribute('width', animData.w);\n this.svgElement.setAttribute('height', animData.h);\n this.svgElement.style.width = '100%';\n this.svgElement.style.height = '100%';\n this.svgElement.style.transform = 'translate3d(0,0,0)';\n this.svgElement.style.contentVisibility = this.renderConfig.contentVisibility;\n }\n if (this.renderConfig.width) {\n this.svgElement.setAttribute('width', this.renderConfig.width);\n }\n if (this.renderConfig.height) {\n this.svgElement.setAttribute('height', this.renderConfig.height);\n }\n if (this.renderConfig.className) {\n this.svgElement.setAttribute('class', this.renderConfig.className);\n }\n if (this.renderConfig.id) {\n this.svgElement.setAttribute('id', this.renderConfig.id);\n }\n if (this.renderConfig.focusable !== undefined) {\n this.svgElement.setAttribute('focusable', this.renderConfig.focusable);\n }\n this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio); // this.layerElement.style.transform = 'translate3d(0,0,0)';\n // this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = \"0px 0px 0px\";\n\n this.animationItem.wrapper.appendChild(this.svgElement); // Mask animation\n\n var defs = this.globalData.defs;\n this.setupGlobalData(animData, defs);\n this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;\n this.data = animData;\n var maskElement = createNS('clipPath');\n var rect = createNS('rect');\n rect.setAttribute('width', animData.w);\n rect.setAttribute('height', animData.h);\n rect.setAttribute('x', 0);\n rect.setAttribute('y', 0);\n var maskId = createElementID();\n maskElement.setAttribute('id', maskId);\n maskElement.appendChild(rect);\n this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + maskId + ')');\n defs.appendChild(maskElement);\n this.layers = animData.layers;\n this.elements = createSizedArray(animData.layers.length);\n };\n SVGRendererBase.prototype.destroy = function () {\n if (this.animationItem.wrapper) {\n this.animationItem.wrapper.innerText = '';\n }\n this.layerElement = null;\n this.globalData.defs = null;\n var i;\n var len = this.layers ? this.layers.length : 0;\n for (i = 0; i < len; i += 1) {\n if (this.elements[i] && this.elements[i].destroy) {\n this.elements[i].destroy();\n }\n }\n this.elements.length = 0;\n this.destroyed = true;\n this.animationItem = null;\n };\n SVGRendererBase.prototype.updateContainerSize = function () {};\n SVGRendererBase.prototype.findIndexByInd = function (ind) {\n var i = 0;\n var len = this.layers.length;\n for (i = 0; i < len; i += 1) {\n if (this.layers[i].ind === ind) {\n return i;\n }\n }\n return -1;\n };\n SVGRendererBase.prototype.buildItem = function (pos) {\n var elements = this.elements;\n if (elements[pos] || this.layers[pos].ty === 99) {\n return;\n }\n elements[pos] = true;\n var element = this.createItem(this.layers[pos]);\n elements[pos] = element;\n if (getExpressionsPlugin()) {\n if (this.layers[pos].ty === 0) {\n this.globalData.projectInterface.registerComposition(element);\n }\n element.initExpressions();\n }\n this.appendElementInPos(element, pos);\n if (this.layers[pos].tt) {\n var elementIndex = 'tp' in this.layers[pos] ? this.findIndexByInd(this.layers[pos].tp) : pos - 1;\n if (elementIndex === -1) {\n return;\n }\n if (!this.elements[elementIndex] || this.elements[elementIndex] === true) {\n this.buildItem(elementIndex);\n this.addPendingElement(element);\n } else {\n var matteElement = elements[elementIndex];\n var matteMask = matteElement.getMatte(this.layers[pos].tt);\n element.setMatte(matteMask);\n }\n }\n };\n SVGRendererBase.prototype.checkPendingElements = function () {\n while (this.pendingElements.length) {\n var element = this.pendingElements.pop();\n element.checkParenting();\n if (element.data.tt) {\n var i = 0;\n var len = this.elements.length;\n while (i < len) {\n if (this.elements[i] === element) {\n var elementIndex = 'tp' in element.data ? this.findIndexByInd(element.data.tp) : i - 1;\n var matteElement = this.elements[elementIndex];\n var matteMask = matteElement.getMatte(this.layers[i].tt);\n element.setMatte(matteMask);\n break;\n }\n i += 1;\n }\n }\n }\n };\n SVGRendererBase.prototype.renderFrame = function (num) {\n if (this.renderedFrame === num || this.destroyed) {\n return;\n }\n if (num === null) {\n num = this.renderedFrame;\n } else {\n this.renderedFrame = num;\n } // console.log('-------');\n // console.log('FRAME ',num);\n\n this.globalData.frameNum = num;\n this.globalData.frameId += 1;\n this.globalData.projectInterface.currentFrame = num;\n this.globalData._mdf = false;\n var i;\n var len = this.layers.length;\n if (!this.completeLayers) {\n this.checkLayers(num);\n }\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(num - this.layers[i].st);\n }\n }\n if (this.globalData._mdf) {\n for (i = 0; i < len; i += 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame();\n }\n }\n }\n };\n SVGRendererBase.prototype.appendElementInPos = function (element, pos) {\n var newElement = element.getBaseElement();\n if (!newElement) {\n return;\n }\n var i = 0;\n var nextElement;\n while (i < pos) {\n if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement()) {\n nextElement = this.elements[i].getBaseElement();\n }\n i += 1;\n }\n if (nextElement) {\n this.layerElement.insertBefore(newElement, nextElement);\n } else {\n this.layerElement.appendChild(newElement);\n }\n };\n SVGRendererBase.prototype.hide = function () {\n this.layerElement.style.display = 'none';\n };\n SVGRendererBase.prototype.show = function () {\n this.layerElement.style.display = 'block';\n };\n function ICompElement() {}\n extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement);\n ICompElement.prototype.initElement = function (data, globalData, comp) {\n this.initFrame();\n this.initBaseData(data, globalData, comp);\n this.initTransform(data, globalData, comp);\n this.initRenderable();\n this.initHierarchy();\n this.initRendererElement();\n this.createContainerElements();\n this.createRenderableComponents();\n if (this.data.xt || !globalData.progressiveLoad) {\n this.buildAllItems();\n }\n this.hide();\n };\n /* ICompElement.prototype.hide = function(){\r\n if(!this.hidden){\r\n this.hideElement();\r\n var i,len = this.elements.length;\r\n for( i = 0; i < len; i+=1 ){\r\n if(this.elements[i]){\r\n this.elements[i].hide();\r\n }\r\n }\r\n }\r\n }; */\n\n ICompElement.prototype.prepareFrame = function (num) {\n this._mdf = false;\n this.prepareRenderableFrame(num);\n this.prepareProperties(num, this.isInRange);\n if (!this.isInRange && !this.data.xt) {\n return;\n }\n if (!this.tm._placeholder) {\n var timeRemapped = this.tm.v;\n if (timeRemapped === this.data.op) {\n timeRemapped = this.data.op - 1;\n }\n this.renderedFrame = timeRemapped;\n } else {\n this.renderedFrame = num / this.data.sr;\n }\n var i;\n var len = this.elements.length;\n if (!this.completeLayers) {\n this.checkLayers(this.renderedFrame);\n } // This iteration needs to be backwards because of how expressions connect between each other\n\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st);\n if (this.elements[i]._mdf) {\n this._mdf = true;\n }\n }\n }\n };\n ICompElement.prototype.renderInnerContent = function () {\n var i;\n var len = this.layers.length;\n for (i = 0; i < len; i += 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame();\n }\n }\n };\n ICompElement.prototype.setElements = function (elems) {\n this.elements = elems;\n };\n ICompElement.prototype.getElements = function () {\n return this.elements;\n };\n ICompElement.prototype.destroyElements = function () {\n var i;\n var len = this.layers.length;\n for (i = 0; i < len; i += 1) {\n if (this.elements[i]) {\n this.elements[i].destroy();\n }\n }\n };\n ICompElement.prototype.destroy = function () {\n this.destroyElements();\n this.destroyBaseElement();\n };\n function SVGCompElement(data, globalData, comp) {\n this.layers = data.layers;\n this.supports3d = true;\n this.completeLayers = false;\n this.pendingElements = [];\n this.elements = this.layers ? createSizedArray(this.layers.length) : [];\n this.initElement(data, globalData, comp);\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\n _placeholder: true\n };\n }\n extendPrototype([SVGRendererBase, ICompElement, SVGBaseElement], SVGCompElement);\n SVGCompElement.prototype.createComp = function (data) {\n return new SVGCompElement(data, this.globalData, this);\n };\n function SVGRenderer(animationItem, config) {\n this.animationItem = animationItem;\n this.layers = null;\n this.renderedFrame = -1;\n this.svgElement = createNS('svg');\n var ariaLabel = '';\n if (config && config.title) {\n var titleElement = createNS('title');\n var titleId = createElementID();\n titleElement.setAttribute('id', titleId);\n titleElement.textContent = config.title;\n this.svgElement.appendChild(titleElement);\n ariaLabel += titleId;\n }\n if (config && config.description) {\n var descElement = createNS('desc');\n var descId = createElementID();\n descElement.setAttribute('id', descId);\n descElement.textContent = config.description;\n this.svgElement.appendChild(descElement);\n ariaLabel += ' ' + descId;\n }\n if (ariaLabel) {\n this.svgElement.setAttribute('aria-labelledby', ariaLabel);\n }\n var defs = createNS('defs');\n this.svgElement.appendChild(defs);\n var maskElement = createNS('g');\n this.svgElement.appendChild(maskElement);\n this.layerElement = maskElement;\n this.renderConfig = {\n preserveAspectRatio: config && config.preserveAspectRatio || 'xMidYMid meet',\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\n contentVisibility: config && config.contentVisibility || 'visible',\n progressiveLoad: config && config.progressiveLoad || false,\n hideOnTransparent: !(config && config.hideOnTransparent === false),\n viewBoxOnly: config && config.viewBoxOnly || false,\n viewBoxSize: config && config.viewBoxSize || false,\n className: config && config.className || '',\n id: config && config.id || '',\n focusable: config && config.focusable,\n filterSize: {\n width: config && config.filterSize && config.filterSize.width || '100%',\n height: config && config.filterSize && config.filterSize.height || '100%',\n x: config && config.filterSize && config.filterSize.x || '0%',\n y: config && config.filterSize && config.filterSize.y || '0%'\n },\n width: config && config.width,\n height: config && config.height,\n runExpressions: !config || config.runExpressions === undefined || config.runExpressions\n };\n this.globalData = {\n _mdf: false,\n frameNum: -1,\n defs: defs,\n renderConfig: this.renderConfig\n };\n this.elements = [];\n this.pendingElements = [];\n this.destroyed = false;\n this.rendererType = 'svg';\n }\n extendPrototype([SVGRendererBase], SVGRenderer);\n SVGRenderer.prototype.createComp = function (data) {\n return new SVGCompElement(data, this.globalData, this);\n };\n function ShapeTransformManager() {\n this.sequences = {};\n this.sequenceList = [];\n this.transform_key_count = 0;\n }\n ShapeTransformManager.prototype = {\n addTransformSequence: function addTransformSequence(transforms) {\n var i;\n var len = transforms.length;\n var key = '_';\n for (i = 0; i < len; i += 1) {\n key += transforms[i].transform.key + '_';\n }\n var sequence = this.sequences[key];\n if (!sequence) {\n sequence = {\n transforms: [].concat(transforms),\n finalTransform: new Matrix(),\n _mdf: false\n };\n this.sequences[key] = sequence;\n this.sequenceList.push(sequence);\n }\n return sequence;\n },\n processSequence: function processSequence(sequence, isFirstFrame) {\n var i = 0;\n var len = sequence.transforms.length;\n var _mdf = isFirstFrame;\n while (i < len && !isFirstFrame) {\n if (sequence.transforms[i].transform.mProps._mdf) {\n _mdf = true;\n break;\n }\n i += 1;\n }\n if (_mdf) {\n sequence.finalTransform.reset();\n for (i = len - 1; i >= 0; i -= 1) {\n sequence.finalTransform.multiply(sequence.transforms[i].transform.mProps.v);\n }\n }\n sequence._mdf = _mdf;\n },\n processSequences: function processSequences(isFirstFrame) {\n var i;\n var len = this.sequenceList.length;\n for (i = 0; i < len; i += 1) {\n this.processSequence(this.sequenceList[i], isFirstFrame);\n }\n },\n getNewKey: function getNewKey() {\n this.transform_key_count += 1;\n return '_' + this.transform_key_count;\n }\n };\n var lumaLoader = function lumaLoader() {\n var id = '__lottie_element_luma_buffer';\n var lumaBuffer = null;\n var lumaBufferCtx = null;\n var svg = null; // This alternate solution has a slight delay before the filter is applied, resulting in a flicker on the first frame.\n // Keeping this here for reference, and in the future, if offscreen canvas supports url filters, this can be used.\n // For now, neither of them work for offscreen canvas, so canvas workers can't support the luma track matte mask.\n // Naming it solution 2 to mark the extra comment lines.\n\n /*\r\n var svgString = [\r\n '',\r\n '',\r\n '',\r\n '',\r\n '',\r\n ].join('');\r\n var blob = new Blob([svgString], { type: 'image/svg+xml' });\r\n var url = URL.createObjectURL(blob);\r\n */\n\n function createLumaSvgFilter() {\n var _svg = createNS('svg');\n var fil = createNS('filter');\n var matrix = createNS('feColorMatrix');\n fil.setAttribute('id', id);\n matrix.setAttribute('type', 'matrix');\n matrix.setAttribute('color-interpolation-filters', 'sRGB');\n matrix.setAttribute('values', '0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0');\n fil.appendChild(matrix);\n _svg.appendChild(fil);\n _svg.setAttribute('id', id + '_svg');\n if (featureSupport.svgLumaHidden) {\n _svg.style.display = 'none';\n }\n return _svg;\n }\n function loadLuma() {\n if (!lumaBuffer) {\n svg = createLumaSvgFilter();\n document.body.appendChild(svg);\n lumaBuffer = createTag('canvas');\n lumaBufferCtx = lumaBuffer.getContext('2d'); // lumaBufferCtx.filter = `url('${url}#__lottie_element_luma_buffer')`; // part of solution 2\n\n lumaBufferCtx.filter = 'url(#' + id + ')';\n lumaBufferCtx.fillStyle = 'rgba(0,0,0,0)';\n lumaBufferCtx.fillRect(0, 0, 1, 1);\n }\n }\n function getLuma(canvas) {\n if (!lumaBuffer) {\n loadLuma();\n }\n lumaBuffer.width = canvas.width;\n lumaBuffer.height = canvas.height; // lumaBufferCtx.filter = `url('${url}#__lottie_element_luma_buffer')`; // part of solution 2\n\n lumaBufferCtx.filter = 'url(#' + id + ')';\n return lumaBuffer;\n }\n return {\n load: loadLuma,\n get: getLuma\n };\n };\n function createCanvas(width, height) {\n if (featureSupport.offscreenCanvas) {\n return new OffscreenCanvas(width, height);\n }\n var canvas = createTag('canvas');\n canvas.width = width;\n canvas.height = height;\n return canvas;\n }\n var assetLoader = function () {\n return {\n loadLumaCanvas: lumaLoader.load,\n getLumaCanvas: lumaLoader.get,\n createCanvas: createCanvas\n };\n }();\n var registeredEffects = {};\n function CVEffects(elem) {\n var i;\n var len = elem.data.ef ? elem.data.ef.length : 0;\n this.filters = [];\n var filterManager;\n for (i = 0; i < len; i += 1) {\n filterManager = null;\n var type = elem.data.ef[i].ty;\n if (registeredEffects[type]) {\n var Effect = registeredEffects[type].effect;\n filterManager = new Effect(elem.effectsManager.effectElements[i], elem);\n }\n if (filterManager) {\n this.filters.push(filterManager);\n }\n }\n if (this.filters.length) {\n elem.addRenderableComponent(this);\n }\n }\n CVEffects.prototype.renderFrame = function (_isFirstFrame) {\n var i;\n var len = this.filters.length;\n for (i = 0; i < len; i += 1) {\n this.filters[i].renderFrame(_isFirstFrame);\n }\n };\n CVEffects.prototype.getEffects = function (type) {\n var i;\n var len = this.filters.length;\n var effects = [];\n for (i = 0; i < len; i += 1) {\n if (this.filters[i].type === type) {\n effects.push(this.filters[i]);\n }\n }\n return effects;\n };\n function registerEffect(id, effect) {\n registeredEffects[id] = {\n effect: effect\n };\n }\n function CVMaskElement(data, element) {\n this.data = data;\n this.element = element;\n this.masksProperties = this.data.masksProperties || [];\n this.viewData = createSizedArray(this.masksProperties.length);\n var i;\n var len = this.masksProperties.length;\n var hasMasks = false;\n for (i = 0; i < len; i += 1) {\n if (this.masksProperties[i].mode !== 'n') {\n hasMasks = true;\n }\n this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3);\n }\n this.hasMasks = hasMasks;\n if (hasMasks) {\n this.element.addRenderableComponent(this);\n }\n }\n CVMaskElement.prototype.renderFrame = function () {\n if (!this.hasMasks) {\n return;\n }\n var transform = this.element.finalTransform.mat;\n var ctx = this.element.canvasContext;\n var i;\n var len = this.masksProperties.length;\n var pt;\n var pts;\n var data;\n ctx.beginPath();\n for (i = 0; i < len; i += 1) {\n if (this.masksProperties[i].mode !== 'n') {\n if (this.masksProperties[i].inv) {\n ctx.moveTo(0, 0);\n ctx.lineTo(this.element.globalData.compSize.w, 0);\n ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h);\n ctx.lineTo(0, this.element.globalData.compSize.h);\n ctx.lineTo(0, 0);\n }\n data = this.viewData[i].v;\n pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0);\n ctx.moveTo(pt[0], pt[1]);\n var j;\n var jLen = data._length;\n for (j = 1; j < jLen; j += 1) {\n pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]);\n ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);\n }\n pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]);\n ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);\n }\n }\n this.element.globalData.renderer.save(true);\n ctx.clip();\n };\n CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty;\n CVMaskElement.prototype.destroy = function () {\n this.element = null;\n };\n function CVBaseElement() {}\n var operationsMap = {\n 1: 'source-in',\n 2: 'source-out',\n 3: 'source-in',\n 4: 'source-out'\n };\n CVBaseElement.prototype = {\n createElements: function createElements() {},\n initRendererElement: function initRendererElement() {},\n createContainerElements: function createContainerElements() {\n // If the layer is masked we will use two buffers to store each different states of the drawing\n // This solution is not ideal for several reason. But unfortunately, because of the recursive\n // nature of the render tree, it's the only simple way to make sure one inner mask doesn't override an outer mask.\n // TODO: try to reduce the size of these buffers to the size of the composition contaning the layer\n // It might be challenging because the layer most likely is transformed in some way\n if (this.data.tt >= 1) {\n this.buffers = [];\n var canvasContext = this.globalData.canvasContext;\n var bufferCanvas = assetLoader.createCanvas(canvasContext.canvas.width, canvasContext.canvas.height);\n this.buffers.push(bufferCanvas);\n var bufferCanvas2 = assetLoader.createCanvas(canvasContext.canvas.width, canvasContext.canvas.height);\n this.buffers.push(bufferCanvas2);\n if (this.data.tt >= 3 && !document._isProxy) {\n assetLoader.loadLumaCanvas();\n }\n }\n this.canvasContext = this.globalData.canvasContext;\n this.transformCanvas = this.globalData.transformCanvas;\n this.renderableEffectsManager = new CVEffects(this);\n this.searchEffectTransforms();\n },\n createContent: function createContent() {},\n setBlendMode: function setBlendMode() {\n var globalData = this.globalData;\n if (globalData.blendMode !== this.data.bm) {\n globalData.blendMode = this.data.bm;\n var blendModeValue = getBlendMode(this.data.bm);\n globalData.canvasContext.globalCompositeOperation = blendModeValue;\n }\n },\n createRenderableComponents: function createRenderableComponents() {\n this.maskManager = new CVMaskElement(this.data, this);\n this.transformEffects = this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT);\n },\n hideElement: function hideElement() {\n if (!this.hidden && (!this.isInRange || this.isTransparent)) {\n this.hidden = true;\n }\n },\n showElement: function showElement() {\n if (this.isInRange && !this.isTransparent) {\n this.hidden = false;\n this._isFirstFrame = true;\n this.maskManager._isFirstFrame = true;\n }\n },\n clearCanvas: function clearCanvas(canvasContext) {\n canvasContext.clearRect(this.transformCanvas.tx, this.transformCanvas.ty, this.transformCanvas.w * this.transformCanvas.sx, this.transformCanvas.h * this.transformCanvas.sy);\n },\n prepareLayer: function prepareLayer() {\n if (this.data.tt >= 1) {\n var buffer = this.buffers[0];\n var bufferCtx = buffer.getContext('2d');\n this.clearCanvas(bufferCtx); // on the first buffer we store the current state of the global drawing\n\n bufferCtx.drawImage(this.canvasContext.canvas, 0, 0); // The next four lines are to clear the canvas\n // TODO: Check if there is a way to clear the canvas without resetting the transform\n\n this.currentTransform = this.canvasContext.getTransform();\n this.canvasContext.setTransform(1, 0, 0, 1, 0, 0);\n this.clearCanvas(this.canvasContext);\n this.canvasContext.setTransform(this.currentTransform);\n }\n },\n exitLayer: function exitLayer() {\n if (this.data.tt >= 1) {\n var buffer = this.buffers[1]; // On the second buffer we store the current state of the global drawing\n // that only contains the content of this layer\n // (if it is a composition, it also includes the nested layers)\n\n var bufferCtx = buffer.getContext('2d');\n this.clearCanvas(bufferCtx);\n bufferCtx.drawImage(this.canvasContext.canvas, 0, 0); // We clear the canvas again\n\n this.canvasContext.setTransform(1, 0, 0, 1, 0, 0);\n this.clearCanvas(this.canvasContext);\n this.canvasContext.setTransform(this.currentTransform); // We draw the mask\n\n var mask = this.comp.getElementById('tp' in this.data ? this.data.tp : this.data.ind - 1);\n mask.renderFrame(true); // We draw the second buffer (that contains the content of this layer)\n\n this.canvasContext.setTransform(1, 0, 0, 1, 0, 0); // If the mask is a Luma matte, we need to do two extra painting operations\n // the _isProxy check is to avoid drawing a fake canvas in workers that will throw an error\n\n if (this.data.tt >= 3 && !document._isProxy) {\n // We copy the painted mask to a buffer that has a color matrix filter applied to it\n // that applies the rgb values to the alpha channel\n var lumaBuffer = assetLoader.getLumaCanvas(this.canvasContext.canvas);\n var lumaBufferCtx = lumaBuffer.getContext('2d');\n lumaBufferCtx.drawImage(this.canvasContext.canvas, 0, 0);\n this.clearCanvas(this.canvasContext); // we repaint the context with the mask applied to it\n\n this.canvasContext.drawImage(lumaBuffer, 0, 0);\n }\n this.canvasContext.globalCompositeOperation = operationsMap[this.data.tt];\n this.canvasContext.drawImage(buffer, 0, 0); // We finally draw the first buffer (that contains the content of the global drawing)\n // We use destination-over to draw the global drawing below the current layer\n\n this.canvasContext.globalCompositeOperation = 'destination-over';\n this.canvasContext.drawImage(this.buffers[0], 0, 0);\n this.canvasContext.setTransform(this.currentTransform); // We reset the globalCompositeOperation to source-over, the standard type of operation\n\n this.canvasContext.globalCompositeOperation = 'source-over';\n }\n },\n renderFrame: function renderFrame(forceRender) {\n if (this.hidden || this.data.hd) {\n return;\n }\n if (this.data.td === 1 && !forceRender) {\n return;\n }\n this.renderTransform();\n this.renderRenderable();\n this.renderLocalTransform();\n this.setBlendMode();\n var forceRealStack = this.data.ty === 0;\n this.prepareLayer();\n this.globalData.renderer.save(forceRealStack);\n this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props);\n this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity);\n this.renderInnerContent();\n this.globalData.renderer.restore(forceRealStack);\n this.exitLayer();\n if (this.maskManager.hasMasks) {\n this.globalData.renderer.restore(true);\n }\n if (this._isFirstFrame) {\n this._isFirstFrame = false;\n }\n },\n destroy: function destroy() {\n this.canvasContext = null;\n this.data = null;\n this.globalData = null;\n this.maskManager.destroy();\n },\n mHelper: new Matrix()\n };\n CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement;\n CVBaseElement.prototype.show = CVBaseElement.prototype.showElement;\n function CVShapeData(element, data, styles, transformsManager) {\n this.styledShapes = [];\n this.tr = [0, 0, 0, 0, 0, 0];\n var ty = 4;\n if (data.ty === 'rc') {\n ty = 5;\n } else if (data.ty === 'el') {\n ty = 6;\n } else if (data.ty === 'sr') {\n ty = 7;\n }\n this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element);\n var i;\n var len = styles.length;\n var styledShape;\n for (i = 0; i < len; i += 1) {\n if (!styles[i].closed) {\n styledShape = {\n transforms: transformsManager.addTransformSequence(styles[i].transforms),\n trNodes: []\n };\n this.styledShapes.push(styledShape);\n styles[i].elements.push(styledShape);\n }\n }\n }\n CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated;\n function CVShapeElement(data, globalData, comp) {\n this.shapes = [];\n this.shapesData = data.shapes;\n this.stylesList = [];\n this.itemsData = [];\n this.prevViewData = [];\n this.shapeModifiers = [];\n this.processedElements = [];\n this.transformsManager = new ShapeTransformManager();\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement], CVShapeElement);\n CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement;\n CVShapeElement.prototype.transformHelper = {\n opacity: 1,\n _opMdf: false\n };\n CVShapeElement.prototype.dashResetter = [];\n CVShapeElement.prototype.createContent = function () {\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);\n };\n CVShapeElement.prototype.createStyleElement = function (data, transforms) {\n var styleElem = {\n data: data,\n type: data.ty,\n preTransforms: this.transformsManager.addTransformSequence(transforms),\n transforms: [],\n elements: [],\n closed: data.hd === true\n };\n var elementData = {};\n if (data.ty === 'fl' || data.ty === 'st') {\n elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this);\n if (!elementData.c.k) {\n styleElem.co = 'rgb(' + bmFloor(elementData.c.v[0]) + ',' + bmFloor(elementData.c.v[1]) + ',' + bmFloor(elementData.c.v[2]) + ')';\n }\n } else if (data.ty === 'gf' || data.ty === 'gs') {\n elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this);\n elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this);\n elementData.h = PropertyFactory.getProp(this, data.h || {\n k: 0\n }, 0, 0.01, this);\n elementData.a = PropertyFactory.getProp(this, data.a || {\n k: 0\n }, 0, degToRads, this);\n elementData.g = new GradientProperty(this, data.g, this);\n }\n elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this);\n if (data.ty === 'st' || data.ty === 'gs') {\n styleElem.lc = lineCapEnum[data.lc || 2];\n styleElem.lj = lineJoinEnum[data.lj || 2];\n if (data.lj == 1) {\n // eslint-disable-line eqeqeq\n styleElem.ml = data.ml;\n }\n elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this);\n if (!elementData.w.k) {\n styleElem.wi = elementData.w.v;\n }\n if (data.d) {\n var d = new DashProperty(this, data.d, 'canvas', this);\n elementData.d = d;\n if (!elementData.d.k) {\n styleElem.da = elementData.d.dashArray;\n styleElem[\"do\"] = elementData.d.dashoffset[0];\n }\n }\n } else {\n styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero';\n }\n this.stylesList.push(styleElem);\n elementData.style = styleElem;\n return elementData;\n };\n CVShapeElement.prototype.createGroupElement = function () {\n var elementData = {\n it: [],\n prevViewData: []\n };\n return elementData;\n };\n CVShapeElement.prototype.createTransformElement = function (data) {\n var elementData = {\n transform: {\n opacity: 1,\n _opMdf: false,\n key: this.transformsManager.getNewKey(),\n op: PropertyFactory.getProp(this, data.o, 0, 0.01, this),\n mProps: TransformPropertyFactory.getTransformProperty(this, data, this)\n }\n };\n return elementData;\n };\n CVShapeElement.prototype.createShapeElement = function (data) {\n var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager);\n this.shapes.push(elementData);\n this.addShapeToModifiers(elementData);\n return elementData;\n };\n CVShapeElement.prototype.reloadShapes = function () {\n this._isFirstFrame = true;\n var i;\n var len = this.itemsData.length;\n for (i = 0; i < len; i += 1) {\n this.prevViewData[i] = this.itemsData[i];\n }\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);\n len = this.dynamicProperties.length;\n for (i = 0; i < len; i += 1) {\n this.dynamicProperties[i].getValue();\n }\n this.renderModifiers();\n this.transformsManager.processSequences(this._isFirstFrame);\n };\n CVShapeElement.prototype.addTransformToStyleList = function (transform) {\n var i;\n var len = this.stylesList.length;\n for (i = 0; i < len; i += 1) {\n if (!this.stylesList[i].closed) {\n this.stylesList[i].transforms.push(transform);\n }\n }\n };\n CVShapeElement.prototype.removeTransformFromStyleList = function () {\n var i;\n var len = this.stylesList.length;\n for (i = 0; i < len; i += 1) {\n if (!this.stylesList[i].closed) {\n this.stylesList[i].transforms.pop();\n }\n }\n };\n CVShapeElement.prototype.closeStyles = function (styles) {\n var i;\n var len = styles.length;\n for (i = 0; i < len; i += 1) {\n styles[i].closed = true;\n }\n };\n CVShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, shouldRender, transforms) {\n var i;\n var len = arr.length - 1;\n var j;\n var jLen;\n var ownStyles = [];\n var ownModifiers = [];\n var processedPos;\n var modifier;\n var currentTransform;\n var ownTransforms = [].concat(transforms);\n for (i = len; i >= 0; i -= 1) {\n processedPos = this.searchProcessedElement(arr[i]);\n if (!processedPos) {\n arr[i]._shouldRender = shouldRender;\n } else {\n itemsData[i] = prevViewData[processedPos - 1];\n }\n if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs') {\n if (!processedPos) {\n itemsData[i] = this.createStyleElement(arr[i], ownTransforms);\n } else {\n itemsData[i].style.closed = false;\n }\n ownStyles.push(itemsData[i].style);\n } else if (arr[i].ty === 'gr') {\n if (!processedPos) {\n itemsData[i] = this.createGroupElement(arr[i]);\n } else {\n jLen = itemsData[i].it.length;\n for (j = 0; j < jLen; j += 1) {\n itemsData[i].prevViewData[j] = itemsData[i].it[j];\n }\n }\n this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms);\n } else if (arr[i].ty === 'tr') {\n if (!processedPos) {\n currentTransform = this.createTransformElement(arr[i]);\n itemsData[i] = currentTransform;\n }\n ownTransforms.push(itemsData[i]);\n this.addTransformToStyleList(itemsData[i]);\n } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\n if (!processedPos) {\n itemsData[i] = this.createShapeElement(arr[i]);\n }\n } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'pb' || arr[i].ty === 'zz' || arr[i].ty === 'op') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty);\n modifier.init(this, arr[i]);\n itemsData[i] = modifier;\n this.shapeModifiers.push(modifier);\n } else {\n modifier = itemsData[i];\n modifier.closed = false;\n }\n ownModifiers.push(modifier);\n } else if (arr[i].ty === 'rp') {\n if (!processedPos) {\n modifier = ShapeModifiers.getModifier(arr[i].ty);\n itemsData[i] = modifier;\n modifier.init(this, arr, i, itemsData);\n this.shapeModifiers.push(modifier);\n shouldRender = false;\n } else {\n modifier = itemsData[i];\n modifier.closed = true;\n }\n ownModifiers.push(modifier);\n }\n this.addProcessedElement(arr[i], i + 1);\n }\n this.removeTransformFromStyleList();\n this.closeStyles(ownStyles);\n len = ownModifiers.length;\n for (i = 0; i < len; i += 1) {\n ownModifiers[i].closed = true;\n }\n };\n CVShapeElement.prototype.renderInnerContent = function () {\n this.transformHelper.opacity = 1;\n this.transformHelper._opMdf = false;\n this.renderModifiers();\n this.transformsManager.processSequences(this._isFirstFrame);\n this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true);\n };\n CVShapeElement.prototype.renderShapeTransform = function (parentTransform, groupTransform) {\n if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {\n groupTransform.opacity = parentTransform.opacity;\n groupTransform.opacity *= groupTransform.op.v;\n groupTransform._opMdf = true;\n }\n };\n CVShapeElement.prototype.drawLayer = function () {\n var i;\n var len = this.stylesList.length;\n var j;\n var jLen;\n var k;\n var kLen;\n var elems;\n var nodes;\n var renderer = this.globalData.renderer;\n var ctx = this.globalData.canvasContext;\n var type;\n var currentStyle;\n for (i = 0; i < len; i += 1) {\n currentStyle = this.stylesList[i];\n type = currentStyle.type; // Skipping style when\n // Stroke width equals 0\n // style should not be rendered (extra unused repeaters)\n // current opacity equals 0\n // global opacity equals 0\n\n if (!((type === 'st' || type === 'gs') && currentStyle.wi === 0 || !currentStyle.data._shouldRender || currentStyle.coOp === 0 || this.globalData.currentGlobalAlpha === 0)) {\n renderer.save();\n elems = currentStyle.elements;\n if (type === 'st' || type === 'gs') {\n renderer.ctxStrokeStyle(type === 'st' ? currentStyle.co : currentStyle.grd); // ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd;\n\n renderer.ctxLineWidth(currentStyle.wi); // ctx.lineWidth = currentStyle.wi;\n\n renderer.ctxLineCap(currentStyle.lc); // ctx.lineCap = currentStyle.lc;\n\n renderer.ctxLineJoin(currentStyle.lj); // ctx.lineJoin = currentStyle.lj;\n\n renderer.ctxMiterLimit(currentStyle.ml || 0); // ctx.miterLimit = currentStyle.ml || 0;\n } else {\n renderer.ctxFillStyle(type === 'fl' ? currentStyle.co : currentStyle.grd); // ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd;\n }\n renderer.ctxOpacity(currentStyle.coOp);\n if (type !== 'st' && type !== 'gs') {\n ctx.beginPath();\n }\n renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props);\n jLen = elems.length;\n for (j = 0; j < jLen; j += 1) {\n if (type === 'st' || type === 'gs') {\n ctx.beginPath();\n if (currentStyle.da) {\n ctx.setLineDash(currentStyle.da);\n ctx.lineDashOffset = currentStyle[\"do\"];\n }\n }\n nodes = elems[j].trNodes;\n kLen = nodes.length;\n for (k = 0; k < kLen; k += 1) {\n if (nodes[k].t === 'm') {\n ctx.moveTo(nodes[k].p[0], nodes[k].p[1]);\n } else if (nodes[k].t === 'c') {\n ctx.bezierCurveTo(nodes[k].pts[0], nodes[k].pts[1], nodes[k].pts[2], nodes[k].pts[3], nodes[k].pts[4], nodes[k].pts[5]);\n } else {\n ctx.closePath();\n }\n }\n if (type === 'st' || type === 'gs') {\n // ctx.stroke();\n renderer.ctxStroke();\n if (currentStyle.da) {\n ctx.setLineDash(this.dashResetter);\n }\n }\n }\n if (type !== 'st' && type !== 'gs') {\n // ctx.fill(currentStyle.r);\n this.globalData.renderer.ctxFill(currentStyle.r);\n }\n renderer.restore();\n }\n }\n };\n CVShapeElement.prototype.renderShape = function (parentTransform, items, data, isMain) {\n var i;\n var len = items.length - 1;\n var groupTransform;\n groupTransform = parentTransform;\n for (i = len; i >= 0; i -= 1) {\n if (items[i].ty === 'tr') {\n groupTransform = data[i].transform;\n this.renderShapeTransform(parentTransform, groupTransform);\n } else if (items[i].ty === 'sh' || items[i].ty === 'el' || items[i].ty === 'rc' || items[i].ty === 'sr') {\n this.renderPath(items[i], data[i]);\n } else if (items[i].ty === 'fl') {\n this.renderFill(items[i], data[i], groupTransform);\n } else if (items[i].ty === 'st') {\n this.renderStroke(items[i], data[i], groupTransform);\n } else if (items[i].ty === 'gf' || items[i].ty === 'gs') {\n this.renderGradientFill(items[i], data[i], groupTransform);\n } else if (items[i].ty === 'gr') {\n this.renderShape(groupTransform, items[i].it, data[i].it);\n } else if (items[i].ty === 'tm') {//\n }\n }\n if (isMain) {\n this.drawLayer();\n }\n };\n CVShapeElement.prototype.renderStyledShape = function (styledShape, shape) {\n if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {\n var shapeNodes = styledShape.trNodes;\n var paths = shape.paths;\n var i;\n var len;\n var j;\n var jLen = paths._length;\n shapeNodes.length = 0;\n var groupTransformMat = styledShape.transforms.finalTransform;\n for (j = 0; j < jLen; j += 1) {\n var pathNodes = paths.shapes[j];\n if (pathNodes && pathNodes.v) {\n len = pathNodes._length;\n for (i = 1; i < len; i += 1) {\n if (i === 1) {\n shapeNodes.push({\n t: 'm',\n p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)\n });\n }\n shapeNodes.push({\n t: 'c',\n pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i])\n });\n }\n if (len === 1) {\n shapeNodes.push({\n t: 'm',\n p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)\n });\n }\n if (pathNodes.c && len) {\n shapeNodes.push({\n t: 'c',\n pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0])\n });\n shapeNodes.push({\n t: 'z'\n });\n }\n }\n }\n styledShape.trNodes = shapeNodes;\n }\n };\n CVShapeElement.prototype.renderPath = function (pathData, itemData) {\n if (pathData.hd !== true && pathData._shouldRender) {\n var i;\n var len = itemData.styledShapes.length;\n for (i = 0; i < len; i += 1) {\n this.renderStyledShape(itemData.styledShapes[i], itemData.sh);\n }\n }\n };\n CVShapeElement.prototype.renderFill = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style;\n if (itemData.c._mdf || this._isFirstFrame) {\n styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')';\n }\n if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\n styleElem.coOp = itemData.o.v * groupTransform.opacity;\n }\n };\n CVShapeElement.prototype.renderGradientFill = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style;\n var grd;\n if (!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf)) {\n var ctx = this.globalData.canvasContext;\n var pt1 = itemData.s.v;\n var pt2 = itemData.e.v;\n if (styleData.t === 1) {\n grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]);\n } else {\n var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\n var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);\n var percent = itemData.h.v;\n if (percent >= 1) {\n percent = 0.99;\n } else if (percent <= -1) {\n percent = -0.99;\n }\n var dist = rad * percent;\n var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];\n var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];\n grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad);\n }\n var i;\n var len = styleData.g.p;\n var cValues = itemData.g.c;\n var opacity = 1;\n for (i = 0; i < len; i += 1) {\n if (itemData.g._hasOpacity && itemData.g._collapsable) {\n opacity = itemData.g.o[i * 2 + 1];\n }\n grd.addColorStop(cValues[i * 4] / 100, 'rgba(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ',' + opacity + ')');\n }\n styleElem.grd = grd;\n }\n styleElem.coOp = itemData.o.v * groupTransform.opacity;\n };\n CVShapeElement.prototype.renderStroke = function (styleData, itemData, groupTransform) {\n var styleElem = itemData.style;\n var d = itemData.d;\n if (d && (d._mdf || this._isFirstFrame)) {\n styleElem.da = d.dashArray;\n styleElem[\"do\"] = d.dashoffset[0];\n }\n if (itemData.c._mdf || this._isFirstFrame) {\n styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')';\n }\n if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\n styleElem.coOp = itemData.o.v * groupTransform.opacity;\n }\n if (itemData.w._mdf || this._isFirstFrame) {\n styleElem.wi = itemData.w.v;\n }\n };\n CVShapeElement.prototype.destroy = function () {\n this.shapesData = null;\n this.globalData = null;\n this.canvasContext = null;\n this.stylesList.length = 0;\n this.itemsData.length = 0;\n };\n function CVTextElement(data, globalData, comp) {\n this.textSpans = [];\n this.yOffset = 0;\n this.fillColorAnim = false;\n this.strokeColorAnim = false;\n this.strokeWidthAnim = false;\n this.stroke = false;\n this.fill = false;\n this.justifyOffset = 0;\n this.currentRender = null;\n this.renderType = 'canvas';\n this.values = {\n fill: 'rgba(0,0,0,0)',\n stroke: 'rgba(0,0,0,0)',\n sWidth: 0,\n fValue: ''\n };\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement], CVTextElement);\n CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d');\n CVTextElement.prototype.buildNewText = function () {\n var documentData = this.textProperty.currentData;\n this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);\n var hasFill = false;\n if (documentData.fc) {\n hasFill = true;\n this.values.fill = this.buildColor(documentData.fc);\n } else {\n this.values.fill = 'rgba(0,0,0,0)';\n }\n this.fill = hasFill;\n var hasStroke = false;\n if (documentData.sc) {\n hasStroke = true;\n this.values.stroke = this.buildColor(documentData.sc);\n this.values.sWidth = documentData.sw;\n }\n var fontData = this.globalData.fontManager.getFontByName(documentData.f);\n var i;\n var len;\n var letters = documentData.l;\n var matrixHelper = this.mHelper;\n this.stroke = hasStroke;\n this.values.fValue = documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(documentData.f).fFamily;\n len = documentData.finalText.length; // this.tHelper.font = this.values.fValue;\n\n var charData;\n var shapeData;\n var k;\n var kLen;\n var shapes;\n var j;\n var jLen;\n var pathNodes;\n var commands;\n var pathArr;\n var singleShape = this.data.singleShape;\n var trackingOffset = documentData.tr * 0.001 * documentData.finalSize;\n var xPos = 0;\n var yPos = 0;\n var firstLine = true;\n var cnt = 0;\n for (i = 0; i < len; i += 1) {\n charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\n shapeData = charData && charData.data || {};\n matrixHelper.reset();\n if (singleShape && letters[i].n) {\n xPos = -trackingOffset;\n yPos += documentData.yOffset;\n yPos += firstLine ? 1 : 0;\n firstLine = false;\n }\n shapes = shapeData.shapes ? shapeData.shapes[0].it : [];\n jLen = shapes.length;\n matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);\n if (singleShape) {\n this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);\n }\n commands = createSizedArray(jLen - 1);\n var commandsCounter = 0;\n for (j = 0; j < jLen; j += 1) {\n if (shapes[j].ty === 'sh') {\n kLen = shapes[j].ks.k.i.length;\n pathNodes = shapes[j].ks.k;\n pathArr = [];\n for (k = 1; k < kLen; k += 1) {\n if (k === 1) {\n pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));\n }\n pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0), matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0));\n }\n pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));\n commands[commandsCounter] = pathArr;\n commandsCounter += 1;\n }\n }\n if (singleShape) {\n xPos += letters[i].l;\n xPos += trackingOffset;\n }\n if (this.textSpans[cnt]) {\n this.textSpans[cnt].elem = commands;\n } else {\n this.textSpans[cnt] = {\n elem: commands\n };\n }\n cnt += 1;\n }\n };\n CVTextElement.prototype.renderInnerContent = function () {\n this.validateText();\n var ctx = this.canvasContext;\n ctx.font = this.values.fValue;\n this.globalData.renderer.ctxLineCap('butt'); // ctx.lineCap = 'butt';\n\n this.globalData.renderer.ctxLineJoin('miter'); // ctx.lineJoin = 'miter';\n\n this.globalData.renderer.ctxMiterLimit(4); // ctx.miterLimit = 4;\n\n if (!this.data.singleShape) {\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\n }\n var i;\n var len;\n var j;\n var jLen;\n var k;\n var kLen;\n var renderedLetters = this.textAnimator.renderedLetters;\n var letters = this.textProperty.currentData.l;\n len = letters.length;\n var renderedLetter;\n var lastFill = null;\n var lastStroke = null;\n var lastStrokeW = null;\n var commands;\n var pathArr;\n var renderer = this.globalData.renderer;\n for (i = 0; i < len; i += 1) {\n if (!letters[i].n) {\n renderedLetter = renderedLetters[i];\n if (renderedLetter) {\n renderer.save();\n renderer.ctxTransform(renderedLetter.p);\n renderer.ctxOpacity(renderedLetter.o);\n }\n if (this.fill) {\n if (renderedLetter && renderedLetter.fc) {\n if (lastFill !== renderedLetter.fc) {\n renderer.ctxFillStyle(renderedLetter.fc);\n lastFill = renderedLetter.fc; // ctx.fillStyle = renderedLetter.fc;\n }\n } else if (lastFill !== this.values.fill) {\n lastFill = this.values.fill;\n renderer.ctxFillStyle(this.values.fill); // ctx.fillStyle = this.values.fill;\n }\n commands = this.textSpans[i].elem;\n jLen = commands.length;\n this.globalData.canvasContext.beginPath();\n for (j = 0; j < jLen; j += 1) {\n pathArr = commands[j];\n kLen = pathArr.length;\n this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);\n for (k = 2; k < kLen; k += 6) {\n this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);\n }\n }\n this.globalData.canvasContext.closePath();\n renderer.ctxFill(); // this.globalData.canvasContext.fill();\n /// ctx.fillText(this.textSpans[i].val,0,0);\n }\n if (this.stroke) {\n if (renderedLetter && renderedLetter.sw) {\n if (lastStrokeW !== renderedLetter.sw) {\n lastStrokeW = renderedLetter.sw;\n renderer.ctxLineWidth(renderedLetter.sw); // ctx.lineWidth = renderedLetter.sw;\n }\n } else if (lastStrokeW !== this.values.sWidth) {\n lastStrokeW = this.values.sWidth;\n renderer.ctxLineWidth(this.values.sWidth); // ctx.lineWidth = this.values.sWidth;\n }\n if (renderedLetter && renderedLetter.sc) {\n if (lastStroke !== renderedLetter.sc) {\n lastStroke = renderedLetter.sc;\n renderer.ctxStrokeStyle(renderedLetter.sc); // ctx.strokeStyle = renderedLetter.sc;\n }\n } else if (lastStroke !== this.values.stroke) {\n lastStroke = this.values.stroke;\n renderer.ctxStrokeStyle(this.values.stroke); // ctx.strokeStyle = this.values.stroke;\n }\n commands = this.textSpans[i].elem;\n jLen = commands.length;\n this.globalData.canvasContext.beginPath();\n for (j = 0; j < jLen; j += 1) {\n pathArr = commands[j];\n kLen = pathArr.length;\n this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);\n for (k = 2; k < kLen; k += 6) {\n this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);\n }\n }\n this.globalData.canvasContext.closePath();\n renderer.ctxStroke(); // this.globalData.canvasContext.stroke();\n /// ctx.strokeText(letters[i].val,0,0);\n }\n if (renderedLetter) {\n this.globalData.renderer.restore();\n }\n }\n }\n };\n function CVImageElement(data, globalData, comp) {\n this.assetData = globalData.getAssetData(data.refId);\n this.img = globalData.imageLoader.getAsset(this.assetData);\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement);\n CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement;\n CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;\n CVImageElement.prototype.createContent = function () {\n if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {\n var canvas = createTag('canvas');\n canvas.width = this.assetData.w;\n canvas.height = this.assetData.h;\n var ctx = canvas.getContext('2d');\n var imgW = this.img.width;\n var imgH = this.img.height;\n var imgRel = imgW / imgH;\n var canvasRel = this.assetData.w / this.assetData.h;\n var widthCrop;\n var heightCrop;\n var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio;\n if (imgRel > canvasRel && par === 'xMidYMid slice' || imgRel < canvasRel && par !== 'xMidYMid slice') {\n heightCrop = imgH;\n widthCrop = heightCrop * canvasRel;\n } else {\n widthCrop = imgW;\n heightCrop = widthCrop / canvasRel;\n }\n ctx.drawImage(this.img, (imgW - widthCrop) / 2, (imgH - heightCrop) / 2, widthCrop, heightCrop, 0, 0, this.assetData.w, this.assetData.h);\n this.img = canvas;\n }\n };\n CVImageElement.prototype.renderInnerContent = function () {\n this.canvasContext.drawImage(this.img, 0, 0);\n };\n CVImageElement.prototype.destroy = function () {\n this.img = null;\n };\n function CVSolidElement(data, globalData, comp) {\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement);\n CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement;\n CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;\n CVSolidElement.prototype.renderInnerContent = function () {\n // var ctx = this.canvasContext;\n this.globalData.renderer.ctxFillStyle(this.data.sc); // ctx.fillStyle = this.data.sc;\n\n this.globalData.renderer.ctxFillRect(0, 0, this.data.sw, this.data.sh); // ctx.fillRect(0, 0, this.data.sw, this.data.sh);\n //\n };\n function CanvasRendererBase() {}\n extendPrototype([BaseRenderer], CanvasRendererBase);\n CanvasRendererBase.prototype.createShape = function (data) {\n return new CVShapeElement(data, this.globalData, this);\n };\n CanvasRendererBase.prototype.createText = function (data) {\n return new CVTextElement(data, this.globalData, this);\n };\n CanvasRendererBase.prototype.createImage = function (data) {\n return new CVImageElement(data, this.globalData, this);\n };\n CanvasRendererBase.prototype.createSolid = function (data) {\n return new CVSolidElement(data, this.globalData, this);\n };\n CanvasRendererBase.prototype.createNull = SVGRenderer.prototype.createNull;\n CanvasRendererBase.prototype.ctxTransform = function (props) {\n if (props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0) {\n return;\n }\n this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13]);\n };\n CanvasRendererBase.prototype.ctxOpacity = function (op) {\n this.canvasContext.globalAlpha *= op < 0 ? 0 : op;\n };\n CanvasRendererBase.prototype.ctxFillStyle = function (value) {\n this.canvasContext.fillStyle = value;\n };\n CanvasRendererBase.prototype.ctxStrokeStyle = function (value) {\n this.canvasContext.strokeStyle = value;\n };\n CanvasRendererBase.prototype.ctxLineWidth = function (value) {\n this.canvasContext.lineWidth = value;\n };\n CanvasRendererBase.prototype.ctxLineCap = function (value) {\n this.canvasContext.lineCap = value;\n };\n CanvasRendererBase.prototype.ctxLineJoin = function (value) {\n this.canvasContext.lineJoin = value;\n };\n CanvasRendererBase.prototype.ctxMiterLimit = function (value) {\n this.canvasContext.miterLimit = value;\n };\n CanvasRendererBase.prototype.ctxFill = function (rule) {\n this.canvasContext.fill(rule);\n };\n CanvasRendererBase.prototype.ctxFillRect = function (x, y, w, h) {\n this.canvasContext.fillRect(x, y, w, h);\n };\n CanvasRendererBase.prototype.ctxStroke = function () {\n this.canvasContext.stroke();\n };\n CanvasRendererBase.prototype.reset = function () {\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.restore();\n return;\n }\n this.contextData.reset();\n };\n CanvasRendererBase.prototype.save = function () {\n this.canvasContext.save();\n };\n CanvasRendererBase.prototype.restore = function (actionFlag) {\n if (!this.renderConfig.clearCanvas) {\n this.canvasContext.restore();\n return;\n }\n if (actionFlag) {\n this.globalData.blendMode = 'source-over';\n }\n this.contextData.restore(actionFlag);\n };\n CanvasRendererBase.prototype.configAnimation = function (animData) {\n if (this.animationItem.wrapper) {\n this.animationItem.container = createTag('canvas');\n var containerStyle = this.animationItem.container.style;\n containerStyle.width = '100%';\n containerStyle.height = '100%';\n var origin = '0px 0px 0px';\n containerStyle.transformOrigin = origin;\n containerStyle.mozTransformOrigin = origin;\n containerStyle.webkitTransformOrigin = origin;\n containerStyle['-webkit-transform'] = origin;\n containerStyle.contentVisibility = this.renderConfig.contentVisibility;\n this.animationItem.wrapper.appendChild(this.animationItem.container);\n this.canvasContext = this.animationItem.container.getContext('2d');\n if (this.renderConfig.className) {\n this.animationItem.container.setAttribute('class', this.renderConfig.className);\n }\n if (this.renderConfig.id) {\n this.animationItem.container.setAttribute('id', this.renderConfig.id);\n }\n } else {\n this.canvasContext = this.renderConfig.context;\n }\n this.contextData.setContext(this.canvasContext);\n this.data = animData;\n this.layers = animData.layers;\n this.transformCanvas = {\n w: animData.w,\n h: animData.h,\n sx: 0,\n sy: 0,\n tx: 0,\n ty: 0\n };\n this.setupGlobalData(animData, document.body);\n this.globalData.canvasContext = this.canvasContext;\n this.globalData.renderer = this;\n this.globalData.isDashed = false;\n this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;\n this.globalData.transformCanvas = this.transformCanvas;\n this.elements = createSizedArray(animData.layers.length);\n this.updateContainerSize();\n };\n CanvasRendererBase.prototype.updateContainerSize = function (width, height) {\n this.reset();\n var elementWidth;\n var elementHeight;\n if (width) {\n elementWidth = width;\n elementHeight = height;\n this.canvasContext.canvas.width = elementWidth;\n this.canvasContext.canvas.height = elementHeight;\n } else {\n if (this.animationItem.wrapper && this.animationItem.container) {\n elementWidth = this.animationItem.wrapper.offsetWidth;\n elementHeight = this.animationItem.wrapper.offsetHeight;\n } else {\n elementWidth = this.canvasContext.canvas.width;\n elementHeight = this.canvasContext.canvas.height;\n }\n this.canvasContext.canvas.width = elementWidth * this.renderConfig.dpr;\n this.canvasContext.canvas.height = elementHeight * this.renderConfig.dpr;\n }\n var elementRel;\n var animationRel;\n if (this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1) {\n var par = this.renderConfig.preserveAspectRatio.split(' ');\n var fillType = par[1] || 'meet';\n var pos = par[0] || 'xMidYMid';\n var xPos = pos.substr(0, 4);\n var yPos = pos.substr(4);\n elementRel = elementWidth / elementHeight;\n animationRel = this.transformCanvas.w / this.transformCanvas.h;\n if (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice') {\n this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\n this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\n } else {\n this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\n this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\n }\n if (xPos === 'xMid' && (animationRel < elementRel && fillType === 'meet' || animationRel > elementRel && fillType === 'slice')) {\n this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2 * this.renderConfig.dpr;\n } else if (xPos === 'xMax' && (animationRel < elementRel && fillType === 'meet' || animationRel > elementRel && fillType === 'slice')) {\n this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr;\n } else {\n this.transformCanvas.tx = 0;\n }\n if (yPos === 'YMid' && (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice')) {\n this.transformCanvas.ty = (elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2 * this.renderConfig.dpr;\n } else if (yPos === 'YMax' && (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice')) {\n this.transformCanvas.ty = (elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) * this.renderConfig.dpr;\n } else {\n this.transformCanvas.ty = 0;\n }\n } else if (this.renderConfig.preserveAspectRatio === 'none') {\n this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\n this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\n this.transformCanvas.tx = 0;\n this.transformCanvas.ty = 0;\n } else {\n this.transformCanvas.sx = this.renderConfig.dpr;\n this.transformCanvas.sy = this.renderConfig.dpr;\n this.transformCanvas.tx = 0;\n this.transformCanvas.ty = 0;\n }\n this.transformCanvas.props = [this.transformCanvas.sx, 0, 0, 0, 0, this.transformCanvas.sy, 0, 0, 0, 0, 1, 0, this.transformCanvas.tx, this.transformCanvas.ty, 0, 1];\n /* var i, len = this.elements.length;\r\n for(i=0;i= 0; i -= 1) {\n if (this.elements[i] && this.elements[i].destroy) {\n this.elements[i].destroy();\n }\n }\n this.elements.length = 0;\n this.globalData.canvasContext = null;\n this.animationItem.container = null;\n this.destroyed = true;\n };\n CanvasRendererBase.prototype.renderFrame = function (num, forceRender) {\n if (this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender || this.destroyed || num === -1) {\n return;\n }\n this.renderedFrame = num;\n this.globalData.frameNum = num - this.animationItem._isFirstFrame;\n this.globalData.frameId += 1;\n this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender;\n this.globalData.projectInterface.currentFrame = num; // console.log('--------');\n // console.log('NEW: ',num);\n\n var i;\n var len = this.layers.length;\n if (!this.completeLayers) {\n this.checkLayers(num);\n }\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].prepareFrame(num - this.layers[i].st);\n }\n }\n if (this.globalData._mdf) {\n if (this.renderConfig.clearCanvas === true) {\n this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h);\n } else {\n this.save();\n }\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame();\n }\n }\n if (this.renderConfig.clearCanvas !== true) {\n this.restore();\n }\n }\n };\n CanvasRendererBase.prototype.buildItem = function (pos) {\n var elements = this.elements;\n if (elements[pos] || this.layers[pos].ty === 99) {\n return;\n }\n var element = this.createItem(this.layers[pos], this, this.globalData);\n elements[pos] = element;\n element.initExpressions();\n /* if(this.layers[pos].ty === 0){\r\n element.resize(this.globalData.transformCanvas);\r\n } */\n };\n CanvasRendererBase.prototype.checkPendingElements = function () {\n while (this.pendingElements.length) {\n var element = this.pendingElements.pop();\n element.checkParenting();\n }\n };\n CanvasRendererBase.prototype.hide = function () {\n this.animationItem.container.style.display = 'none';\n };\n CanvasRendererBase.prototype.show = function () {\n this.animationItem.container.style.display = 'block';\n };\n function CanvasContext() {\n this.opacity = -1;\n this.transform = createTypedArray('float32', 16);\n this.fillStyle = '';\n this.strokeStyle = '';\n this.lineWidth = '';\n this.lineCap = '';\n this.lineJoin = '';\n this.miterLimit = '';\n this.id = Math.random();\n }\n function CVContextData() {\n this.stack = [];\n this.cArrPos = 0;\n this.cTr = new Matrix();\n var i;\n var len = 15;\n for (i = 0; i < len; i += 1) {\n var canvasContext = new CanvasContext();\n this.stack[i] = canvasContext;\n }\n this._length = len;\n this.nativeContext = null;\n this.transformMat = new Matrix();\n this.currentOpacity = 1; //\n\n this.currentFillStyle = '';\n this.appliedFillStyle = ''; //\n\n this.currentStrokeStyle = '';\n this.appliedStrokeStyle = ''; //\n\n this.currentLineWidth = '';\n this.appliedLineWidth = ''; //\n\n this.currentLineCap = '';\n this.appliedLineCap = ''; //\n\n this.currentLineJoin = '';\n this.appliedLineJoin = ''; //\n\n this.appliedMiterLimit = '';\n this.currentMiterLimit = '';\n }\n CVContextData.prototype.duplicate = function () {\n var newLength = this._length * 2;\n var i = 0;\n for (i = this._length; i < newLength; i += 1) {\n this.stack[i] = new CanvasContext();\n }\n this._length = newLength;\n };\n CVContextData.prototype.reset = function () {\n this.cArrPos = 0;\n this.cTr.reset();\n this.stack[this.cArrPos].opacity = 1;\n };\n CVContextData.prototype.restore = function (forceRestore) {\n this.cArrPos -= 1;\n var currentContext = this.stack[this.cArrPos];\n var transform = currentContext.transform;\n var i;\n var arr = this.cTr.props;\n for (i = 0; i < 16; i += 1) {\n arr[i] = transform[i];\n }\n if (forceRestore) {\n this.nativeContext.restore();\n var prevStack = this.stack[this.cArrPos + 1];\n this.appliedFillStyle = prevStack.fillStyle;\n this.appliedStrokeStyle = prevStack.strokeStyle;\n this.appliedLineWidth = prevStack.lineWidth;\n this.appliedLineCap = prevStack.lineCap;\n this.appliedLineJoin = prevStack.lineJoin;\n this.appliedMiterLimit = prevStack.miterLimit;\n }\n this.nativeContext.setTransform(transform[0], transform[1], transform[4], transform[5], transform[12], transform[13]);\n if (forceRestore || currentContext.opacity !== -1 && this.currentOpacity !== currentContext.opacity) {\n this.nativeContext.globalAlpha = currentContext.opacity;\n this.currentOpacity = currentContext.opacity;\n }\n this.currentFillStyle = currentContext.fillStyle;\n this.currentStrokeStyle = currentContext.strokeStyle;\n this.currentLineWidth = currentContext.lineWidth;\n this.currentLineCap = currentContext.lineCap;\n this.currentLineJoin = currentContext.lineJoin;\n this.currentMiterLimit = currentContext.miterLimit;\n };\n CVContextData.prototype.save = function (saveOnNativeFlag) {\n if (saveOnNativeFlag) {\n this.nativeContext.save();\n }\n var props = this.cTr.props;\n if (this._length <= this.cArrPos) {\n this.duplicate();\n }\n var currentStack = this.stack[this.cArrPos];\n var i;\n for (i = 0; i < 16; i += 1) {\n currentStack.transform[i] = props[i];\n }\n this.cArrPos += 1;\n var newStack = this.stack[this.cArrPos];\n newStack.opacity = currentStack.opacity;\n newStack.fillStyle = currentStack.fillStyle;\n newStack.strokeStyle = currentStack.strokeStyle;\n newStack.lineWidth = currentStack.lineWidth;\n newStack.lineCap = currentStack.lineCap;\n newStack.lineJoin = currentStack.lineJoin;\n newStack.miterLimit = currentStack.miterLimit;\n };\n CVContextData.prototype.setOpacity = function (value) {\n this.stack[this.cArrPos].opacity = value;\n };\n CVContextData.prototype.setContext = function (value) {\n this.nativeContext = value;\n };\n CVContextData.prototype.fillStyle = function (value) {\n if (this.stack[this.cArrPos].fillStyle !== value) {\n this.currentFillStyle = value;\n this.stack[this.cArrPos].fillStyle = value;\n }\n };\n CVContextData.prototype.strokeStyle = function (value) {\n if (this.stack[this.cArrPos].strokeStyle !== value) {\n this.currentStrokeStyle = value;\n this.stack[this.cArrPos].strokeStyle = value;\n }\n };\n CVContextData.prototype.lineWidth = function (value) {\n if (this.stack[this.cArrPos].lineWidth !== value) {\n this.currentLineWidth = value;\n this.stack[this.cArrPos].lineWidth = value;\n }\n };\n CVContextData.prototype.lineCap = function (value) {\n if (this.stack[this.cArrPos].lineCap !== value) {\n this.currentLineCap = value;\n this.stack[this.cArrPos].lineCap = value;\n }\n };\n CVContextData.prototype.lineJoin = function (value) {\n if (this.stack[this.cArrPos].lineJoin !== value) {\n this.currentLineJoin = value;\n this.stack[this.cArrPos].lineJoin = value;\n }\n };\n CVContextData.prototype.miterLimit = function (value) {\n if (this.stack[this.cArrPos].miterLimit !== value) {\n this.currentMiterLimit = value;\n this.stack[this.cArrPos].miterLimit = value;\n }\n };\n CVContextData.prototype.transform = function (props) {\n this.transformMat.cloneFromProps(props); // Taking the last transform value from the stored stack of transforms\n\n var currentTransform = this.cTr; // Applying the last transform value after the new transform to respect the order of transformations\n\n this.transformMat.multiply(currentTransform); // Storing the new transformed value in the stored transform\n\n currentTransform.cloneFromProps(this.transformMat.props);\n var trProps = currentTransform.props; // Applying the new transform to the canvas\n\n this.nativeContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13]);\n };\n CVContextData.prototype.opacity = function (op) {\n var currentOpacity = this.stack[this.cArrPos].opacity;\n currentOpacity *= op < 0 ? 0 : op;\n if (this.stack[this.cArrPos].opacity !== currentOpacity) {\n if (this.currentOpacity !== op) {\n this.nativeContext.globalAlpha = op;\n this.currentOpacity = op;\n }\n this.stack[this.cArrPos].opacity = currentOpacity;\n }\n };\n CVContextData.prototype.fill = function (rule) {\n if (this.appliedFillStyle !== this.currentFillStyle) {\n this.appliedFillStyle = this.currentFillStyle;\n this.nativeContext.fillStyle = this.appliedFillStyle;\n }\n this.nativeContext.fill(rule);\n };\n CVContextData.prototype.fillRect = function (x, y, w, h) {\n if (this.appliedFillStyle !== this.currentFillStyle) {\n this.appliedFillStyle = this.currentFillStyle;\n this.nativeContext.fillStyle = this.appliedFillStyle;\n }\n this.nativeContext.fillRect(x, y, w, h);\n };\n CVContextData.prototype.stroke = function () {\n if (this.appliedStrokeStyle !== this.currentStrokeStyle) {\n this.appliedStrokeStyle = this.currentStrokeStyle;\n this.nativeContext.strokeStyle = this.appliedStrokeStyle;\n }\n if (this.appliedLineWidth !== this.currentLineWidth) {\n this.appliedLineWidth = this.currentLineWidth;\n this.nativeContext.lineWidth = this.appliedLineWidth;\n }\n if (this.appliedLineCap !== this.currentLineCap) {\n this.appliedLineCap = this.currentLineCap;\n this.nativeContext.lineCap = this.appliedLineCap;\n }\n if (this.appliedLineJoin !== this.currentLineJoin) {\n this.appliedLineJoin = this.currentLineJoin;\n this.nativeContext.lineJoin = this.appliedLineJoin;\n }\n if (this.appliedMiterLimit !== this.currentMiterLimit) {\n this.appliedMiterLimit = this.currentMiterLimit;\n this.nativeContext.miterLimit = this.appliedMiterLimit;\n }\n this.nativeContext.stroke();\n };\n function CVCompElement(data, globalData, comp) {\n this.completeLayers = false;\n this.layers = data.layers;\n this.pendingElements = [];\n this.elements = createSizedArray(this.layers.length);\n this.initElement(data, globalData, comp);\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\n _placeholder: true\n };\n }\n extendPrototype([CanvasRendererBase, ICompElement, CVBaseElement], CVCompElement);\n CVCompElement.prototype.renderInnerContent = function () {\n var ctx = this.canvasContext;\n ctx.beginPath();\n ctx.moveTo(0, 0);\n ctx.lineTo(this.data.w, 0);\n ctx.lineTo(this.data.w, this.data.h);\n ctx.lineTo(0, this.data.h);\n ctx.lineTo(0, 0);\n ctx.clip();\n var i;\n var len = this.layers.length;\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.completeLayers || this.elements[i]) {\n this.elements[i].renderFrame();\n }\n }\n };\n CVCompElement.prototype.destroy = function () {\n var i;\n var len = this.layers.length;\n for (i = len - 1; i >= 0; i -= 1) {\n if (this.elements[i]) {\n this.elements[i].destroy();\n }\n }\n this.layers = null;\n this.elements = null;\n };\n CVCompElement.prototype.createComp = function (data) {\n return new CVCompElement(data, this.globalData, this);\n };\n function CanvasRenderer(animationItem, config) {\n this.animationItem = animationItem;\n this.renderConfig = {\n clearCanvas: config && config.clearCanvas !== undefined ? config.clearCanvas : true,\n context: config && config.context || null,\n progressiveLoad: config && config.progressiveLoad || false,\n preserveAspectRatio: config && config.preserveAspectRatio || 'xMidYMid meet',\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\n contentVisibility: config && config.contentVisibility || 'visible',\n className: config && config.className || '',\n id: config && config.id || '',\n runExpressions: !config || config.runExpressions === undefined || config.runExpressions\n };\n this.renderConfig.dpr = config && config.dpr || 1;\n if (this.animationItem.wrapper) {\n this.renderConfig.dpr = config && config.dpr || window.devicePixelRatio || 1;\n }\n this.renderedFrame = -1;\n this.globalData = {\n frameNum: -1,\n _mdf: false,\n renderConfig: this.renderConfig,\n currentGlobalAlpha: -1\n };\n this.contextData = new CVContextData();\n this.elements = [];\n this.pendingElements = [];\n this.transformMat = new Matrix();\n this.completeLayers = false;\n this.rendererType = 'canvas';\n if (this.renderConfig.clearCanvas) {\n this.ctxTransform = this.contextData.transform.bind(this.contextData);\n this.ctxOpacity = this.contextData.opacity.bind(this.contextData);\n this.ctxFillStyle = this.contextData.fillStyle.bind(this.contextData);\n this.ctxStrokeStyle = this.contextData.strokeStyle.bind(this.contextData);\n this.ctxLineWidth = this.contextData.lineWidth.bind(this.contextData);\n this.ctxLineCap = this.contextData.lineCap.bind(this.contextData);\n this.ctxLineJoin = this.contextData.lineJoin.bind(this.contextData);\n this.ctxMiterLimit = this.contextData.miterLimit.bind(this.contextData);\n this.ctxFill = this.contextData.fill.bind(this.contextData);\n this.ctxFillRect = this.contextData.fillRect.bind(this.contextData);\n this.ctxStroke = this.contextData.stroke.bind(this.contextData);\n this.save = this.contextData.save.bind(this.contextData);\n }\n }\n extendPrototype([CanvasRendererBase], CanvasRenderer);\n CanvasRenderer.prototype.createComp = function (data) {\n return new CVCompElement(data, this.globalData, this);\n };\n function HBaseElement() {}\n HBaseElement.prototype = {\n checkBlendMode: function checkBlendMode() {},\n initRendererElement: function initRendererElement() {\n this.baseElement = createTag(this.data.tg || 'div');\n if (this.data.hasMask) {\n this.svgElement = createNS('svg');\n this.layerElement = createNS('g');\n this.maskedElement = this.layerElement;\n this.svgElement.appendChild(this.layerElement);\n this.baseElement.appendChild(this.svgElement);\n } else {\n this.layerElement = this.baseElement;\n }\n styleDiv(this.baseElement);\n },\n createContainerElements: function createContainerElements() {\n this.renderableEffectsManager = new CVEffects(this);\n this.transformedElement = this.baseElement;\n this.maskedElement = this.layerElement;\n if (this.data.ln) {\n this.layerElement.setAttribute('id', this.data.ln);\n }\n if (this.data.cl) {\n this.layerElement.setAttribute('class', this.data.cl);\n }\n if (this.data.bm !== 0) {\n this.setBlendMode();\n }\n },\n renderElement: function renderElement() {\n var transformedElementStyle = this.transformedElement ? this.transformedElement.style : {};\n if (this.finalTransform._matMdf) {\n var matrixValue = this.finalTransform.mat.toCSS();\n transformedElementStyle.transform = matrixValue;\n transformedElementStyle.webkitTransform = matrixValue;\n }\n if (this.finalTransform._opMdf) {\n transformedElementStyle.opacity = this.finalTransform.mProp.o.v;\n }\n },\n renderFrame: function renderFrame() {\n // If it is exported as hidden (data.hd === true) no need to render\n // If it is not visible no need to render\n if (this.data.hd || this.hidden) {\n return;\n }\n this.renderTransform();\n this.renderRenderable();\n this.renderElement();\n this.renderInnerContent();\n if (this._isFirstFrame) {\n this._isFirstFrame = false;\n }\n },\n destroy: function destroy() {\n this.layerElement = null;\n this.transformedElement = null;\n if (this.matteElement) {\n this.matteElement = null;\n }\n if (this.maskManager) {\n this.maskManager.destroy();\n this.maskManager = null;\n }\n },\n createRenderableComponents: function createRenderableComponents() {\n this.maskManager = new MaskElement(this.data, this, this.globalData);\n },\n addEffects: function addEffects() {},\n setMatte: function setMatte() {}\n };\n HBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement;\n HBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy;\n HBaseElement.prototype.buildElementParenting = BaseRenderer.prototype.buildElementParenting;\n function HSolidElement(data, globalData, comp) {\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], HSolidElement);\n HSolidElement.prototype.createContent = function () {\n var rect;\n if (this.data.hasMask) {\n rect = createNS('rect');\n rect.setAttribute('width', this.data.sw);\n rect.setAttribute('height', this.data.sh);\n rect.setAttribute('fill', this.data.sc);\n this.svgElement.setAttribute('width', this.data.sw);\n this.svgElement.setAttribute('height', this.data.sh);\n } else {\n rect = createTag('div');\n rect.style.width = this.data.sw + 'px';\n rect.style.height = this.data.sh + 'px';\n rect.style.backgroundColor = this.data.sc;\n }\n this.layerElement.appendChild(rect);\n };\n function HShapeElement(data, globalData, comp) {\n // List of drawable elements\n this.shapes = []; // Full shape data\n\n this.shapesData = data.shapes; // List of styles that will be applied to shapes\n\n this.stylesList = []; // List of modifiers that will be applied to shapes\n\n this.shapeModifiers = []; // List of items in shape tree\n\n this.itemsData = []; // List of items in previous shape tree\n\n this.processedElements = []; // List of animated components\n\n this.animatedContents = [];\n this.shapesContainer = createNS('g');\n this.initElement(data, globalData, comp); // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\n // List of elements that have been created\n\n this.prevViewData = [];\n this.currentBBox = {\n x: 999999,\n y: -999999,\n h: 0,\n w: 0\n };\n }\n extendPrototype([BaseElement, TransformElement, HSolidElement, SVGShapeElement, HBaseElement, HierarchyElement, FrameElement, RenderableElement], HShapeElement);\n HShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent;\n HShapeElement.prototype.createContent = function () {\n var cont;\n this.baseElement.style.fontSize = 0;\n if (this.data.hasMask) {\n this.layerElement.appendChild(this.shapesContainer);\n cont = this.svgElement;\n } else {\n cont = createNS('svg');\n var size = this.comp.data ? this.comp.data : this.globalData.compSize;\n cont.setAttribute('width', size.w);\n cont.setAttribute('height', size.h);\n cont.appendChild(this.shapesContainer);\n this.layerElement.appendChild(cont);\n }\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.shapesContainer, 0, [], true);\n this.filterUniqueShapes();\n this.shapeCont = cont;\n };\n HShapeElement.prototype.getTransformedPoint = function (transformers, point) {\n var i;\n var len = transformers.length;\n for (i = 0; i < len; i += 1) {\n point = transformers[i].mProps.v.applyToPointArray(point[0], point[1], 0);\n }\n return point;\n };\n HShapeElement.prototype.calculateShapeBoundingBox = function (item, boundingBox) {\n var shape = item.sh.v;\n var transformers = item.transformers;\n var i;\n var len = shape._length;\n var vPoint;\n var oPoint;\n var nextIPoint;\n var nextVPoint;\n if (len <= 1) {\n return;\n }\n for (i = 0; i < len - 1; i += 1) {\n vPoint = this.getTransformedPoint(transformers, shape.v[i]);\n oPoint = this.getTransformedPoint(transformers, shape.o[i]);\n nextIPoint = this.getTransformedPoint(transformers, shape.i[i + 1]);\n nextVPoint = this.getTransformedPoint(transformers, shape.v[i + 1]);\n this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);\n }\n if (shape.c) {\n vPoint = this.getTransformedPoint(transformers, shape.v[i]);\n oPoint = this.getTransformedPoint(transformers, shape.o[i]);\n nextIPoint = this.getTransformedPoint(transformers, shape.i[0]);\n nextVPoint = this.getTransformedPoint(transformers, shape.v[0]);\n this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);\n }\n };\n HShapeElement.prototype.checkBounds = function (vPoint, oPoint, nextIPoint, nextVPoint, boundingBox) {\n this.getBoundsOfCurve(vPoint, oPoint, nextIPoint, nextVPoint);\n var bounds = this.shapeBoundingBox;\n boundingBox.x = bmMin(bounds.left, boundingBox.x);\n boundingBox.xMax = bmMax(bounds.right, boundingBox.xMax);\n boundingBox.y = bmMin(bounds.top, boundingBox.y);\n boundingBox.yMax = bmMax(bounds.bottom, boundingBox.yMax);\n };\n HShapeElement.prototype.shapeBoundingBox = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n };\n HShapeElement.prototype.tempBoundingBox = {\n x: 0,\n xMax: 0,\n y: 0,\n yMax: 0,\n width: 0,\n height: 0\n };\n HShapeElement.prototype.getBoundsOfCurve = function (p0, p1, p2, p3) {\n var bounds = [[p0[0], p3[0]], [p0[1], p3[1]]];\n for (var a, b, c, t, b2ac, t1, t2, i = 0; i < 2; ++i) {\n // eslint-disable-line no-plusplus\n b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];\n a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];\n c = 3 * p1[i] - 3 * p0[i];\n b |= 0; // eslint-disable-line no-bitwise\n\n a |= 0; // eslint-disable-line no-bitwise\n\n c |= 0; // eslint-disable-line no-bitwise\n\n if (a === 0 && b === 0) {//\n } else if (a === 0) {\n t = -c / b;\n if (t > 0 && t < 1) {\n bounds[i].push(this.calculateF(t, p0, p1, p2, p3, i));\n }\n } else {\n b2ac = b * b - 4 * c * a;\n if (b2ac >= 0) {\n t1 = (-b + bmSqrt(b2ac)) / (2 * a);\n if (t1 > 0 && t1 < 1) bounds[i].push(this.calculateF(t1, p0, p1, p2, p3, i));\n t2 = (-b - bmSqrt(b2ac)) / (2 * a);\n if (t2 > 0 && t2 < 1) bounds[i].push(this.calculateF(t2, p0, p1, p2, p3, i));\n }\n }\n }\n this.shapeBoundingBox.left = bmMin.apply(null, bounds[0]);\n this.shapeBoundingBox.top = bmMin.apply(null, bounds[1]);\n this.shapeBoundingBox.right = bmMax.apply(null, bounds[0]);\n this.shapeBoundingBox.bottom = bmMax.apply(null, bounds[1]);\n };\n HShapeElement.prototype.calculateF = function (t, p0, p1, p2, p3, i) {\n return bmPow(1 - t, 3) * p0[i] + 3 * bmPow(1 - t, 2) * t * p1[i] + 3 * (1 - t) * bmPow(t, 2) * p2[i] + bmPow(t, 3) * p3[i];\n };\n HShapeElement.prototype.calculateBoundingBox = function (itemsData, boundingBox) {\n var i;\n var len = itemsData.length;\n for (i = 0; i < len; i += 1) {\n if (itemsData[i] && itemsData[i].sh) {\n this.calculateShapeBoundingBox(itemsData[i], boundingBox);\n } else if (itemsData[i] && itemsData[i].it) {\n this.calculateBoundingBox(itemsData[i].it, boundingBox);\n } else if (itemsData[i] && itemsData[i].style && itemsData[i].w) {\n this.expandStrokeBoundingBox(itemsData[i].w, boundingBox);\n }\n }\n };\n HShapeElement.prototype.expandStrokeBoundingBox = function (widthProperty, boundingBox) {\n var width = 0;\n if (widthProperty.keyframes) {\n for (var i = 0; i < widthProperty.keyframes.length; i += 1) {\n var kfw = widthProperty.keyframes[i].s;\n if (kfw > width) {\n width = kfw;\n }\n }\n width *= widthProperty.mult;\n } else {\n width = widthProperty.v * widthProperty.mult;\n }\n boundingBox.x -= width;\n boundingBox.xMax += width;\n boundingBox.y -= width;\n boundingBox.yMax += width;\n };\n HShapeElement.prototype.currentBoxContains = function (box) {\n return this.currentBBox.x <= box.x && this.currentBBox.y <= box.y && this.currentBBox.width + this.currentBBox.x >= box.x + box.width && this.currentBBox.height + this.currentBBox.y >= box.y + box.height;\n };\n HShapeElement.prototype.renderInnerContent = function () {\n this._renderShapeFrame();\n if (!this.hidden && (this._isFirstFrame || this._mdf)) {\n var tempBoundingBox = this.tempBoundingBox;\n var max = 999999;\n tempBoundingBox.x = max;\n tempBoundingBox.xMax = -max;\n tempBoundingBox.y = max;\n tempBoundingBox.yMax = -max;\n this.calculateBoundingBox(this.itemsData, tempBoundingBox);\n tempBoundingBox.width = tempBoundingBox.xMax < tempBoundingBox.x ? 0 : tempBoundingBox.xMax - tempBoundingBox.x;\n tempBoundingBox.height = tempBoundingBox.yMax < tempBoundingBox.y ? 0 : tempBoundingBox.yMax - tempBoundingBox.y; // var tempBoundingBox = this.shapeCont.getBBox();\n\n if (this.currentBoxContains(tempBoundingBox)) {\n return;\n }\n var changed = false;\n if (this.currentBBox.w !== tempBoundingBox.width) {\n this.currentBBox.w = tempBoundingBox.width;\n this.shapeCont.setAttribute('width', tempBoundingBox.width);\n changed = true;\n }\n if (this.currentBBox.h !== tempBoundingBox.height) {\n this.currentBBox.h = tempBoundingBox.height;\n this.shapeCont.setAttribute('height', tempBoundingBox.height);\n changed = true;\n }\n if (changed || this.currentBBox.x !== tempBoundingBox.x || this.currentBBox.y !== tempBoundingBox.y) {\n this.currentBBox.w = tempBoundingBox.width;\n this.currentBBox.h = tempBoundingBox.height;\n this.currentBBox.x = tempBoundingBox.x;\n this.currentBBox.y = tempBoundingBox.y;\n this.shapeCont.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);\n var shapeStyle = this.shapeCont.style;\n var shapeTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';\n shapeStyle.transform = shapeTransform;\n shapeStyle.webkitTransform = shapeTransform;\n }\n }\n };\n function HTextElement(data, globalData, comp) {\n this.textSpans = [];\n this.textPaths = [];\n this.currentBBox = {\n x: 999999,\n y: -999999,\n h: 0,\n w: 0\n };\n this.renderType = 'svg';\n this.isMasked = false;\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], HTextElement);\n HTextElement.prototype.createContent = function () {\n this.isMasked = this.checkMasks();\n if (this.isMasked) {\n this.renderType = 'svg';\n this.compW = this.comp.data.w;\n this.compH = this.comp.data.h;\n this.svgElement.setAttribute('width', this.compW);\n this.svgElement.setAttribute('height', this.compH);\n var g = createNS('g');\n this.maskedElement.appendChild(g);\n this.innerElem = g;\n } else {\n this.renderType = 'html';\n this.innerElem = this.layerElement;\n }\n this.checkParenting();\n };\n HTextElement.prototype.buildNewText = function () {\n var documentData = this.textProperty.currentData;\n this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);\n var innerElemStyle = this.innerElem.style;\n var textColor = documentData.fc ? this.buildColor(documentData.fc) : 'rgba(0,0,0,0)';\n innerElemStyle.fill = textColor;\n innerElemStyle.color = textColor;\n if (documentData.sc) {\n innerElemStyle.stroke = this.buildColor(documentData.sc);\n innerElemStyle.strokeWidth = documentData.sw + 'px';\n }\n var fontData = this.globalData.fontManager.getFontByName(documentData.f);\n if (!this.globalData.fontManager.chars) {\n innerElemStyle.fontSize = documentData.finalSize + 'px';\n innerElemStyle.lineHeight = documentData.finalSize + 'px';\n if (fontData.fClass) {\n this.innerElem.className = fontData.fClass;\n } else {\n innerElemStyle.fontFamily = fontData.fFamily;\n var fWeight = documentData.fWeight;\n var fStyle = documentData.fStyle;\n innerElemStyle.fontStyle = fStyle;\n innerElemStyle.fontWeight = fWeight;\n }\n }\n var i;\n var len;\n var letters = documentData.l;\n len = letters.length;\n var tSpan;\n var tParent;\n var tCont;\n var matrixHelper = this.mHelper;\n var shapes;\n var shapeStr = '';\n var cnt = 0;\n for (i = 0; i < len; i += 1) {\n if (this.globalData.fontManager.chars) {\n if (!this.textPaths[cnt]) {\n tSpan = createNS('path');\n tSpan.setAttribute('stroke-linecap', lineCapEnum[1]);\n tSpan.setAttribute('stroke-linejoin', lineJoinEnum[2]);\n tSpan.setAttribute('stroke-miterlimit', '4');\n } else {\n tSpan = this.textPaths[cnt];\n }\n if (!this.isMasked) {\n if (this.textSpans[cnt]) {\n tParent = this.textSpans[cnt];\n tCont = tParent.children[0];\n } else {\n tParent = createTag('div');\n tParent.style.lineHeight = 0;\n tCont = createNS('svg');\n tCont.appendChild(tSpan);\n styleDiv(tParent);\n }\n }\n } else if (!this.isMasked) {\n if (this.textSpans[cnt]) {\n tParent = this.textSpans[cnt];\n tSpan = this.textPaths[cnt];\n } else {\n tParent = createTag('span');\n styleDiv(tParent);\n tSpan = createTag('span');\n styleDiv(tSpan);\n tParent.appendChild(tSpan);\n }\n } else {\n tSpan = this.textPaths[cnt] ? this.textPaths[cnt] : createNS('text');\n } // tSpan.setAttribute('visibility', 'hidden');\n\n if (this.globalData.fontManager.chars) {\n var charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\n var shapeData;\n if (charData) {\n shapeData = charData.data;\n } else {\n shapeData = null;\n }\n matrixHelper.reset();\n if (shapeData && shapeData.shapes && shapeData.shapes.length) {\n shapes = shapeData.shapes[0].it;\n matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);\n shapeStr = this.createPathShape(matrixHelper, shapes);\n tSpan.setAttribute('d', shapeStr);\n }\n if (!this.isMasked) {\n this.innerElem.appendChild(tParent);\n if (shapeData && shapeData.shapes) {\n // document.body.appendChild is needed to get exact measure of shape\n document.body.appendChild(tCont);\n var boundingBox = tCont.getBBox();\n tCont.setAttribute('width', boundingBox.width + 2);\n tCont.setAttribute('height', boundingBox.height + 2);\n tCont.setAttribute('viewBox', boundingBox.x - 1 + ' ' + (boundingBox.y - 1) + ' ' + (boundingBox.width + 2) + ' ' + (boundingBox.height + 2));\n var tContStyle = tCont.style;\n var tContTranslation = 'translate(' + (boundingBox.x - 1) + 'px,' + (boundingBox.y - 1) + 'px)';\n tContStyle.transform = tContTranslation;\n tContStyle.webkitTransform = tContTranslation;\n letters[i].yOffset = boundingBox.y - 1;\n } else {\n tCont.setAttribute('width', 1);\n tCont.setAttribute('height', 1);\n }\n tParent.appendChild(tCont);\n } else {\n this.innerElem.appendChild(tSpan);\n }\n } else {\n tSpan.textContent = letters[i].val;\n tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\n if (!this.isMasked) {\n this.innerElem.appendChild(tParent); //\n\n var tStyle = tSpan.style;\n var tSpanTranslation = 'translate3d(0,' + -documentData.finalSize / 1.2 + 'px,0)';\n tStyle.transform = tSpanTranslation;\n tStyle.webkitTransform = tSpanTranslation;\n } else {\n this.innerElem.appendChild(tSpan);\n }\n } //\n\n if (!this.isMasked) {\n this.textSpans[cnt] = tParent;\n } else {\n this.textSpans[cnt] = tSpan;\n }\n this.textSpans[cnt].style.display = 'block';\n this.textPaths[cnt] = tSpan;\n cnt += 1;\n }\n while (cnt < this.textSpans.length) {\n this.textSpans[cnt].style.display = 'none';\n cnt += 1;\n }\n };\n HTextElement.prototype.renderInnerContent = function () {\n this.validateText();\n var svgStyle;\n if (this.data.singleShape) {\n if (!this._isFirstFrame && !this.lettersChangedFlag) {\n return;\n }\n if (this.isMasked && this.finalTransform._matMdf) {\n // Todo Benchmark if using this is better than getBBox\n this.svgElement.setAttribute('viewBox', -this.finalTransform.mProp.p.v[0] + ' ' + -this.finalTransform.mProp.p.v[1] + ' ' + this.compW + ' ' + this.compH);\n svgStyle = this.svgElement.style;\n var translation = 'translate(' + -this.finalTransform.mProp.p.v[0] + 'px,' + -this.finalTransform.mProp.p.v[1] + 'px)';\n svgStyle.transform = translation;\n svgStyle.webkitTransform = translation;\n }\n }\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\n if (!this.lettersChangedFlag && !this.textAnimator.lettersChangedFlag) {\n return;\n }\n var i;\n var len;\n var count = 0;\n var renderedLetters = this.textAnimator.renderedLetters;\n var letters = this.textProperty.currentData.l;\n len = letters.length;\n var renderedLetter;\n var textSpan;\n var textPath;\n for (i = 0; i < len; i += 1) {\n if (letters[i].n) {\n count += 1;\n } else {\n textSpan = this.textSpans[i];\n textPath = this.textPaths[i];\n renderedLetter = renderedLetters[count];\n count += 1;\n if (renderedLetter._mdf.m) {\n if (!this.isMasked) {\n textSpan.style.webkitTransform = renderedLetter.m;\n textSpan.style.transform = renderedLetter.m;\n } else {\n textSpan.setAttribute('transform', renderedLetter.m);\n }\n } /// /textSpan.setAttribute('opacity',renderedLetter.o);\n\n textSpan.style.opacity = renderedLetter.o;\n if (renderedLetter.sw && renderedLetter._mdf.sw) {\n textPath.setAttribute('stroke-width', renderedLetter.sw);\n }\n if (renderedLetter.sc && renderedLetter._mdf.sc) {\n textPath.setAttribute('stroke', renderedLetter.sc);\n }\n if (renderedLetter.fc && renderedLetter._mdf.fc) {\n textPath.setAttribute('fill', renderedLetter.fc);\n textPath.style.color = renderedLetter.fc;\n }\n }\n }\n if (this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)) {\n var boundingBox = this.innerElem.getBBox();\n if (this.currentBBox.w !== boundingBox.width) {\n this.currentBBox.w = boundingBox.width;\n this.svgElement.setAttribute('width', boundingBox.width);\n }\n if (this.currentBBox.h !== boundingBox.height) {\n this.currentBBox.h = boundingBox.height;\n this.svgElement.setAttribute('height', boundingBox.height);\n }\n var margin = 1;\n if (this.currentBBox.w !== boundingBox.width + margin * 2 || this.currentBBox.h !== boundingBox.height + margin * 2 || this.currentBBox.x !== boundingBox.x - margin || this.currentBBox.y !== boundingBox.y - margin) {\n this.currentBBox.w = boundingBox.width + margin * 2;\n this.currentBBox.h = boundingBox.height + margin * 2;\n this.currentBBox.x = boundingBox.x - margin;\n this.currentBBox.y = boundingBox.y - margin;\n this.svgElement.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);\n svgStyle = this.svgElement.style;\n var svgTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';\n svgStyle.transform = svgTransform;\n svgStyle.webkitTransform = svgTransform;\n }\n }\n };\n function HCameraElement(data, globalData, comp) {\n this.initFrame();\n this.initBaseData(data, globalData, comp);\n this.initHierarchy();\n var getProp = PropertyFactory.getProp;\n this.pe = getProp(this, data.pe, 0, 0, this);\n if (data.ks.p.s) {\n this.px = getProp(this, data.ks.p.x, 1, 0, this);\n this.py = getProp(this, data.ks.p.y, 1, 0, this);\n this.pz = getProp(this, data.ks.p.z, 1, 0, this);\n } else {\n this.p = getProp(this, data.ks.p, 1, 0, this);\n }\n if (data.ks.a) {\n this.a = getProp(this, data.ks.a, 1, 0, this);\n }\n if (data.ks.or.k.length && data.ks.or.k[0].to) {\n var i;\n var len = data.ks.or.k.length;\n for (i = 0; i < len; i += 1) {\n data.ks.or.k[i].to = null;\n data.ks.or.k[i].ti = null;\n }\n }\n this.or = getProp(this, data.ks.or, 1, degToRads, this);\n this.or.sh = true;\n this.rx = getProp(this, data.ks.rx, 0, degToRads, this);\n this.ry = getProp(this, data.ks.ry, 0, degToRads, this);\n this.rz = getProp(this, data.ks.rz, 0, degToRads, this);\n this.mat = new Matrix();\n this._prevMat = new Matrix();\n this._isFirstFrame = true; // TODO: find a better way to make the HCamera element to be compatible with the LayerInterface and TransformInterface.\n\n this.finalTransform = {\n mProp: this\n };\n }\n extendPrototype([BaseElement, FrameElement, HierarchyElement], HCameraElement);\n HCameraElement.prototype.setup = function () {\n var i;\n var len = this.comp.threeDElements.length;\n var comp;\n var perspectiveStyle;\n var containerStyle;\n for (i = 0; i < len; i += 1) {\n // [perspectiveElem,container]\n comp = this.comp.threeDElements[i];\n if (comp.type === '3d') {\n perspectiveStyle = comp.perspectiveElem.style;\n containerStyle = comp.container.style;\n var perspective = this.pe.v + 'px';\n var origin = '0px 0px 0px';\n var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';\n perspectiveStyle.perspective = perspective;\n perspectiveStyle.webkitPerspective = perspective;\n containerStyle.transformOrigin = origin;\n containerStyle.mozTransformOrigin = origin;\n containerStyle.webkitTransformOrigin = origin;\n perspectiveStyle.transform = matrix;\n perspectiveStyle.webkitTransform = matrix;\n }\n }\n };\n HCameraElement.prototype.createElements = function () {};\n HCameraElement.prototype.hide = function () {};\n HCameraElement.prototype.renderFrame = function () {\n var _mdf = this._isFirstFrame;\n var i;\n var len;\n if (this.hierarchy) {\n len = this.hierarchy.length;\n for (i = 0; i < len; i += 1) {\n _mdf = this.hierarchy[i].finalTransform.mProp._mdf || _mdf;\n }\n }\n if (_mdf || this.pe._mdf || this.p && this.p._mdf || this.px && (this.px._mdf || this.py._mdf || this.pz._mdf) || this.rx._mdf || this.ry._mdf || this.rz._mdf || this.or._mdf || this.a && this.a._mdf) {\n this.mat.reset();\n if (this.hierarchy) {\n len = this.hierarchy.length - 1;\n for (i = len; i >= 0; i -= 1) {\n var mTransf = this.hierarchy[i].finalTransform.mProp;\n this.mat.translate(-mTransf.p.v[0], -mTransf.p.v[1], mTransf.p.v[2]);\n this.mat.rotateX(-mTransf.or.v[0]).rotateY(-mTransf.or.v[1]).rotateZ(mTransf.or.v[2]);\n this.mat.rotateX(-mTransf.rx.v).rotateY(-mTransf.ry.v).rotateZ(mTransf.rz.v);\n this.mat.scale(1 / mTransf.s.v[0], 1 / mTransf.s.v[1], 1 / mTransf.s.v[2]);\n this.mat.translate(mTransf.a.v[0], mTransf.a.v[1], mTransf.a.v[2]);\n }\n }\n if (this.p) {\n this.mat.translate(-this.p.v[0], -this.p.v[1], this.p.v[2]);\n } else {\n this.mat.translate(-this.px.v, -this.py.v, this.pz.v);\n }\n if (this.a) {\n var diffVector;\n if (this.p) {\n diffVector = [this.p.v[0] - this.a.v[0], this.p.v[1] - this.a.v[1], this.p.v[2] - this.a.v[2]];\n } else {\n diffVector = [this.px.v - this.a.v[0], this.py.v - this.a.v[1], this.pz.v - this.a.v[2]];\n }\n var mag = Math.sqrt(Math.pow(diffVector[0], 2) + Math.pow(diffVector[1], 2) + Math.pow(diffVector[2], 2)); // var lookDir = getNormalizedPoint(getDiffVector(this.a.v,this.p.v));\n\n var lookDir = [diffVector[0] / mag, diffVector[1] / mag, diffVector[2] / mag];\n var lookLengthOnXZ = Math.sqrt(lookDir[2] * lookDir[2] + lookDir[0] * lookDir[0]);\n var mRotationX = Math.atan2(lookDir[1], lookLengthOnXZ);\n var mRotationY = Math.atan2(lookDir[0], -lookDir[2]);\n this.mat.rotateY(mRotationY).rotateX(-mRotationX);\n }\n this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v);\n this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]);\n this.mat.translate(this.globalData.compSize.w / 2, this.globalData.compSize.h / 2, 0);\n this.mat.translate(0, 0, this.pe.v);\n var hasMatrixChanged = !this._prevMat.equals(this.mat);\n if ((hasMatrixChanged || this.pe._mdf) && this.comp.threeDElements) {\n len = this.comp.threeDElements.length;\n var comp;\n var perspectiveStyle;\n var containerStyle;\n for (i = 0; i < len; i += 1) {\n comp = this.comp.threeDElements[i];\n if (comp.type === '3d') {\n if (hasMatrixChanged) {\n var matValue = this.mat.toCSS();\n containerStyle = comp.container.style;\n containerStyle.transform = matValue;\n containerStyle.webkitTransform = matValue;\n }\n if (this.pe._mdf) {\n perspectiveStyle = comp.perspectiveElem.style;\n perspectiveStyle.perspective = this.pe.v + 'px';\n perspectiveStyle.webkitPerspective = this.pe.v + 'px';\n }\n }\n }\n this.mat.clone(this._prevMat);\n }\n }\n this._isFirstFrame = false;\n };\n HCameraElement.prototype.prepareFrame = function (num) {\n this.prepareProperties(num, true);\n };\n HCameraElement.prototype.destroy = function () {};\n HCameraElement.prototype.getBaseElement = function () {\n return null;\n };\n function HImageElement(data, globalData, comp) {\n this.assetData = globalData.getAssetData(data.refId);\n this.initElement(data, globalData, comp);\n }\n extendPrototype([BaseElement, TransformElement, HBaseElement, HSolidElement, HierarchyElement, FrameElement, RenderableElement], HImageElement);\n HImageElement.prototype.createContent = function () {\n var assetPath = this.globalData.getAssetsPath(this.assetData);\n var img = new Image();\n if (this.data.hasMask) {\n this.imageElem = createNS('image');\n this.imageElem.setAttribute('width', this.assetData.w + 'px');\n this.imageElem.setAttribute('height', this.assetData.h + 'px');\n this.imageElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);\n this.layerElement.appendChild(this.imageElem);\n this.baseElement.setAttribute('width', this.assetData.w);\n this.baseElement.setAttribute('height', this.assetData.h);\n } else {\n this.layerElement.appendChild(img);\n }\n img.crossOrigin = 'anonymous';\n img.src = assetPath;\n if (this.data.ln) {\n this.baseElement.setAttribute('id', this.data.ln);\n }\n };\n function HybridRendererBase(animationItem, config) {\n this.animationItem = animationItem;\n this.layers = null;\n this.renderedFrame = -1;\n this.renderConfig = {\n className: config && config.className || '',\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\n hideOnTransparent: !(config && config.hideOnTransparent === false),\n filterSize: {\n width: config && config.filterSize && config.filterSize.width || '400%',\n height: config && config.filterSize && config.filterSize.height || '400%',\n x: config && config.filterSize && config.filterSize.x || '-100%',\n y: config && config.filterSize && config.filterSize.y || '-100%'\n }\n };\n this.globalData = {\n _mdf: false,\n frameNum: -1,\n renderConfig: this.renderConfig\n };\n this.pendingElements = [];\n this.elements = [];\n this.threeDElements = [];\n this.destroyed = false;\n this.camera = null;\n this.supports3d = true;\n this.rendererType = 'html';\n }\n extendPrototype([BaseRenderer], HybridRendererBase);\n HybridRendererBase.prototype.buildItem = SVGRenderer.prototype.buildItem;\n HybridRendererBase.prototype.checkPendingElements = function () {\n while (this.pendingElements.length) {\n var element = this.pendingElements.pop();\n element.checkParenting();\n }\n };\n HybridRendererBase.prototype.appendElementInPos = function (element, pos) {\n var newDOMElement = element.getBaseElement();\n if (!newDOMElement) {\n return;\n }\n var layer = this.layers[pos];\n if (!layer.ddd || !this.supports3d) {\n if (this.threeDElements) {\n this.addTo3dContainer(newDOMElement, pos);\n } else {\n var i = 0;\n var nextDOMElement;\n var nextLayer;\n var tmpDOMElement;\n while (i < pos) {\n if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement) {\n nextLayer = this.elements[i];\n tmpDOMElement = this.layers[i].ddd ? this.getThreeDContainerByPos(i) : nextLayer.getBaseElement();\n nextDOMElement = tmpDOMElement || nextDOMElement;\n }\n i += 1;\n }\n if (nextDOMElement) {\n if (!layer.ddd || !this.supports3d) {\n this.layerElement.insertBefore(newDOMElement, nextDOMElement);\n }\n } else if (!layer.ddd || !this.supports3d) {\n this.layerElement.appendChild(newDOMElement);\n }\n }\n } else {\n this.addTo3dContainer(newDOMElement, pos);\n }\n };\n HybridRendererBase.prototype.createShape = function (data) {\n if (!this.supports3d) {\n return new SVGShapeElement(data, this.globalData, this);\n }\n return new HShapeElement(data, this.globalData, this);\n };\n HybridRendererBase.prototype.createText = function (data) {\n if (!this.supports3d) {\n return new SVGTextLottieElement(data, this.globalData, this);\n }\n return new HTextElement(data, this.globalData, this);\n };\n HybridRendererBase.prototype.createCamera = function (data) {\n this.camera = new HCameraElement(data, this.globalData, this);\n return this.camera;\n };\n HybridRendererBase.prototype.createImage = function (data) {\n if (!this.supports3d) {\n return new IImageElement(data, this.globalData, this);\n }\n return new HImageElement(data, this.globalData, this);\n };\n HybridRendererBase.prototype.createSolid = function (data) {\n if (!this.supports3d) {\n return new ISolidElement(data, this.globalData, this);\n }\n return new HSolidElement(data, this.globalData, this);\n };\n HybridRendererBase.prototype.createNull = SVGRenderer.prototype.createNull;\n HybridRendererBase.prototype.getThreeDContainerByPos = function (pos) {\n var i = 0;\n var len = this.threeDElements.length;\n while (i < len) {\n if (this.threeDElements[i].startPos <= pos && this.threeDElements[i].endPos >= pos) {\n return this.threeDElements[i].perspectiveElem;\n }\n i += 1;\n }\n return null;\n };\n HybridRendererBase.prototype.createThreeDContainer = function (pos, type) {\n var perspectiveElem = createTag('div');\n var style;\n var containerStyle;\n styleDiv(perspectiveElem);\n var container = createTag('div');\n styleDiv(container);\n if (type === '3d') {\n style = perspectiveElem.style;\n style.width = this.globalData.compSize.w + 'px';\n style.height = this.globalData.compSize.h + 'px';\n var center = '50% 50%';\n style.webkitTransformOrigin = center;\n style.mozTransformOrigin = center;\n style.transformOrigin = center;\n containerStyle = container.style;\n var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';\n containerStyle.transform = matrix;\n containerStyle.webkitTransform = matrix;\n }\n perspectiveElem.appendChild(container); // this.resizerElem.appendChild(perspectiveElem);\n\n var threeDContainerData = {\n container: container,\n perspectiveElem: perspectiveElem,\n startPos: pos,\n endPos: pos,\n type: type\n };\n this.threeDElements.push(threeDContainerData);\n return threeDContainerData;\n };\n HybridRendererBase.prototype.build3dContainers = function () {\n var i;\n var len = this.layers.length;\n var lastThreeDContainerData;\n var currentContainer = '';\n for (i = 0; i < len; i += 1) {\n if (this.layers[i].ddd && this.layers[i].ty !== 3) {\n if (currentContainer !== '3d') {\n currentContainer = '3d';\n lastThreeDContainerData = this.createThreeDContainer(i, '3d');\n }\n lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);\n } else {\n if (currentContainer !== '2d') {\n currentContainer = '2d';\n lastThreeDContainerData = this.createThreeDContainer(i, '2d');\n }\n lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);\n }\n }\n len = this.threeDElements.length;\n for (i = len - 1; i >= 0; i -= 1) {\n this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem);\n }\n };\n HybridRendererBase.prototype.addTo3dContainer = function (elem, pos) {\n var i = 0;\n var len = this.threeDElements.length;\n while (i < len) {\n if (pos <= this.threeDElements[i].endPos) {\n var j = this.threeDElements[i].startPos;\n var nextElement;\n while (j < pos) {\n if (this.elements[j] && this.elements[j].getBaseElement) {\n nextElement = this.elements[j].getBaseElement();\n }\n j += 1;\n }\n if (nextElement) {\n this.threeDElements[i].container.insertBefore(elem, nextElement);\n } else {\n this.threeDElements[i].container.appendChild(elem);\n }\n break;\n }\n i += 1;\n }\n };\n HybridRendererBase.prototype.configAnimation = function (animData) {\n var resizerElem = createTag('div');\n var wrapper = this.animationItem.wrapper;\n var style = resizerElem.style;\n style.width = animData.w + 'px';\n style.height = animData.h + 'px';\n this.resizerElem = resizerElem;\n styleDiv(resizerElem);\n style.transformStyle = 'flat';\n style.mozTransformStyle = 'flat';\n style.webkitTransformStyle = 'flat';\n if (this.renderConfig.className) {\n resizerElem.setAttribute('class', this.renderConfig.className);\n }\n wrapper.appendChild(resizerElem);\n style.overflow = 'hidden';\n var svg = createNS('svg');\n svg.setAttribute('width', '1');\n svg.setAttribute('height', '1');\n styleDiv(svg);\n this.resizerElem.appendChild(svg);\n var defs = createNS('defs');\n svg.appendChild(defs);\n this.data = animData; // Mask animation\n\n this.setupGlobalData(animData, svg);\n this.globalData.defs = defs;\n this.layers = animData.layers;\n this.layerElement = this.resizerElem;\n this.build3dContainers();\n this.updateContainerSize();\n };\n HybridRendererBase.prototype.destroy = function () {\n if (this.animationItem.wrapper) {\n this.animationItem.wrapper.innerText = '';\n }\n this.animationItem.container = null;\n this.globalData.defs = null;\n var i;\n var len = this.layers ? this.layers.length : 0;\n for (i = 0; i < len; i += 1) {\n if (this.elements[i] && this.elements[i].destroy) {\n this.elements[i].destroy();\n }\n }\n this.elements.length = 0;\n this.destroyed = true;\n this.animationItem = null;\n };\n HybridRendererBase.prototype.updateContainerSize = function () {\n var elementWidth = this.animationItem.wrapper.offsetWidth;\n var elementHeight = this.animationItem.wrapper.offsetHeight;\n var elementRel = elementWidth / elementHeight;\n var animationRel = this.globalData.compSize.w / this.globalData.compSize.h;\n var sx;\n var sy;\n var tx;\n var ty;\n if (animationRel > elementRel) {\n sx = elementWidth / this.globalData.compSize.w;\n sy = elementWidth / this.globalData.compSize.w;\n tx = 0;\n ty = (elementHeight - this.globalData.compSize.h * (elementWidth / this.globalData.compSize.w)) / 2;\n } else {\n sx = elementHeight / this.globalData.compSize.h;\n sy = elementHeight / this.globalData.compSize.h;\n tx = (elementWidth - this.globalData.compSize.w * (elementHeight / this.globalData.compSize.h)) / 2;\n ty = 0;\n }\n var style = this.resizerElem.style;\n style.webkitTransform = 'matrix3d(' + sx + ',0,0,0,0,' + sy + ',0,0,0,0,1,0,' + tx + ',' + ty + ',0,1)';\n style.transform = style.webkitTransform;\n };\n HybridRendererBase.prototype.renderFrame = SVGRenderer.prototype.renderFrame;\n HybridRendererBase.prototype.hide = function () {\n this.resizerElem.style.display = 'none';\n };\n HybridRendererBase.prototype.show = function () {\n this.resizerElem.style.display = 'block';\n };\n HybridRendererBase.prototype.initItems = function () {\n this.buildAllItems();\n if (this.camera) {\n this.camera.setup();\n } else {\n var cWidth = this.globalData.compSize.w;\n var cHeight = this.globalData.compSize.h;\n var i;\n var len = this.threeDElements.length;\n for (i = 0; i < len; i += 1) {\n var style = this.threeDElements[i].perspectiveElem.style;\n style.webkitPerspective = Math.sqrt(Math.pow(cWidth, 2) + Math.pow(cHeight, 2)) + 'px';\n style.perspective = style.webkitPerspective;\n }\n }\n };\n HybridRendererBase.prototype.searchExtraCompositions = function (assets) {\n var i;\n var len = assets.length;\n var floatingContainer = createTag('div');\n for (i = 0; i < len; i += 1) {\n if (assets[i].xt) {\n var comp = this.createComp(assets[i], floatingContainer, this.globalData.comp, null);\n comp.initExpressions();\n this.globalData.projectInterface.registerComposition(comp);\n }\n }\n };\n function HCompElement(data, globalData, comp) {\n this.layers = data.layers;\n this.supports3d = !data.hasMask;\n this.completeLayers = false;\n this.pendingElements = [];\n this.elements = this.layers ? createSizedArray(this.layers.length) : [];\n this.initElement(data, globalData, comp);\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\n _placeholder: true\n };\n }\n extendPrototype([HybridRendererBase, ICompElement, HBaseElement], HCompElement);\n HCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements;\n HCompElement.prototype.createContainerElements = function () {\n this._createBaseContainerElements(); // divElement.style.clip = 'rect(0px, '+this.data.w+'px, '+this.data.h+'px, 0px)';\n\n if (this.data.hasMask) {\n this.svgElement.setAttribute('width', this.data.w);\n this.svgElement.setAttribute('height', this.data.h);\n this.transformedElement = this.baseElement;\n } else {\n this.transformedElement = this.layerElement;\n }\n };\n HCompElement.prototype.addTo3dContainer = function (elem, pos) {\n var j = 0;\n var nextElement;\n while (j < pos) {\n if (this.elements[j] && this.elements[j].getBaseElement) {\n nextElement = this.elements[j].getBaseElement();\n }\n j += 1;\n }\n if (nextElement) {\n this.layerElement.insertBefore(elem, nextElement);\n } else {\n this.layerElement.appendChild(elem);\n }\n };\n HCompElement.prototype.createComp = function (data) {\n if (!this.supports3d) {\n return new SVGCompElement(data, this.globalData, this);\n }\n return new HCompElement(data, this.globalData, this);\n };\n function HybridRenderer(animationItem, config) {\n this.animationItem = animationItem;\n this.layers = null;\n this.renderedFrame = -1;\n this.renderConfig = {\n className: config && config.className || '',\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\n hideOnTransparent: !(config && config.hideOnTransparent === false),\n filterSize: {\n width: config && config.filterSize && config.filterSize.width || '400%',\n height: config && config.filterSize && config.filterSize.height || '400%',\n x: config && config.filterSize && config.filterSize.x || '-100%',\n y: config && config.filterSize && config.filterSize.y || '-100%'\n },\n runExpressions: !config || config.runExpressions === undefined || config.runExpressions\n };\n this.globalData = {\n _mdf: false,\n frameNum: -1,\n renderConfig: this.renderConfig\n };\n this.pendingElements = [];\n this.elements = [];\n this.threeDElements = [];\n this.destroyed = false;\n this.camera = null;\n this.supports3d = true;\n this.rendererType = 'html';\n }\n extendPrototype([HybridRendererBase], HybridRenderer);\n HybridRenderer.prototype.createComp = function (data) {\n if (!this.supports3d) {\n return new SVGCompElement(data, this.globalData, this);\n }\n return new HCompElement(data, this.globalData, this);\n };\n var CompExpressionInterface = function () {\n return function (comp) {\n function _thisLayerFunction(name) {\n var i = 0;\n var len = comp.layers.length;\n while (i < len) {\n if (comp.layers[i].nm === name || comp.layers[i].ind === name) {\n return comp.elements[i].layerInterface;\n }\n i += 1;\n }\n return null; // return {active:false};\n }\n Object.defineProperty(_thisLayerFunction, '_name', {\n value: comp.data.nm\n });\n _thisLayerFunction.layer = _thisLayerFunction;\n _thisLayerFunction.pixelAspect = 1;\n _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h;\n _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w;\n _thisLayerFunction.pixelAspect = 1;\n _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate;\n _thisLayerFunction.displayStartTime = 0;\n _thisLayerFunction.numLayers = comp.layers.length;\n return _thisLayerFunction;\n };\n }();\n function _typeof$2(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof$2 = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof$2 = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof$2(obj);\n }\n\n /* eslint-disable */\n\n /*\r\n Copyright 2014 David Bau.\r\n Permission is hereby granted, free of charge, to any person obtaining\r\n a copy of this software and associated documentation files (the\r\n \"Software\"), to deal in the Software without restriction, including\r\n without limitation the rights to use, copy, modify, merge, publish,\r\n distribute, sublicense, and/or sell copies of the Software, and to\r\n permit persons to whom the Software is furnished to do so, subject to\r\n the following conditions:\r\n The above copyright notice and this permission notice shall be\r\n included in all copies or substantial portions of the Software.\r\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\n function seedRandom(pool, math) {\n //\n // The following constants are related to IEEE 754 limits.\n //\n var global = this,\n width = 256,\n // each RC4 output is 0 <= x < 256\n chunks = 6,\n // at least six RC4 outputs for each double\n digits = 52,\n // there are 52 significant digits in a double\n rngname = 'random',\n // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n //\n // seedrandom()\n // This is the seedrandom function described above.\n //\n\n function seedrandom(seed, options, callback) {\n var key = [];\n options = options === true ? {\n entropy: true\n } : options || {}; // Flatten the seed string or build one from local entropy if needed.\n\n var shortseed = mixkey(flatten(options.entropy ? [seed, tostring(pool)] : seed === null ? autoseed() : seed, 3), key); // Use the seed to initialize an ARC4 generator.\n\n var arc4 = new ARC4(key); // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n\n var prng = function prng() {\n var n = arc4.g(chunks),\n // Start with a numerator n < 2 ^ 48\n d = startdenom,\n // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n\n while (n < significance) {\n // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n\n d *= width; // denominator and generating a\n\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) {\n // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n\n d /= 2; // right using integer math until\n\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n prng.int32 = function () {\n return arc4.g(4) | 0;\n };\n prng.quick = function () {\n return arc4.g(4) / 0x100000000;\n };\n prng[\"double\"] = prng; // Mix the randomness into accumulated entropy.\n\n mixkey(tostring(arc4.S), pool); // Calling convention: what to return as a function of prng, seed, is_math.\n\n return (options.pass || callback || function (prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) {\n copy(state, arc4);\n } // Only provide the .state method if requested via options.state.\n\n prng.state = function () {\n return copy(arc4, {});\n };\n } // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n\n if (is_math_call) {\n math[rngname] = prng;\n return seed;\n } // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(prng, shortseed, 'global' in options ? options.global : this == math, options.state);\n }\n math['seed' + rngname] = seedrandom; //\n // ARC4\n //\n // An ARC4 implementation. The constructor takes a key in the form of\n // an array of at most (width) integers that should be 0 <= x < (width).\n //\n // The g(count) method returns a pseudorandom integer that concatenates\n // the next (count) outputs from ARC4. Its return value is a number x\n // that is in the range 0 <= x < (width ^ count).\n //\n\n function ARC4(key) {\n var t,\n keylen = key.length,\n me = this,\n i = 0,\n j = me.i = me.j = 0,\n s = me.S = []; // The empty key [] is treated as [0].\n\n if (!keylen) {\n key = [keylen++];\n } // Set up S using the standard key scheduling algorithm.\n\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & j + key[i % keylen] + (t = s[i])];\n s[j] = t;\n } // The \"g\" method returns the next (count) outputs as one number.\n\n me.g = function (count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t,\n r = 0,\n i = me.i,\n j = me.j,\n s = me.S;\n while (count--) {\n t = s[i = mask & i + 1];\n r = r * width + s[mask & (s[i] = s[j = mask & j + t]) + (s[j] = t)];\n }\n me.i = i;\n me.j = j;\n return r; // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n };\n } //\n // copy()\n // Copies internal state of ARC4 to or from a plain object.\n //\n\n function copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n } //\n // flatten()\n // Converts an object tree to nested arrays of strings.\n //\n\n function flatten(obj, depth) {\n var result = [],\n typ = _typeof$2(obj),\n prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try {\n result.push(flatten(obj[prop], depth - 1));\n } catch (e) {}\n }\n }\n return result.length ? result : typ == 'string' ? obj : obj + '\\0';\n } //\n // mixkey()\n // Mixes a string seed into a key that is an array of integers, and\n // returns a shortened string seed that is equivalent to the result key.\n //\n\n function mixkey(seed, key) {\n var stringseed = seed + '',\n smear,\n j = 0;\n while (j < stringseed.length) {\n key[mask & j] = mask & (smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++);\n }\n return tostring(key);\n } //\n // autoseed()\n // Returns an object for autoseeding, using window.crypto and Node crypto\n // module if available.\n //\n\n function autoseed() {\n try {\n if (nodecrypto) {\n return tostring(nodecrypto.randomBytes(width));\n }\n var out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date(), global, plugins, global.screen, tostring(pool)];\n }\n } //\n // tostring()\n // Converts an array of charcodes to a string\n //\n\n function tostring(a) {\n return String.fromCharCode.apply(0, a);\n } //\n // When seedrandom.js is loaded, we immediately mix a few bits\n // from the built-in RNG into the entropy pool. Because we do\n // not want to interfere with deterministic PRNG state later,\n // seedrandom will not call math.random on its own again after\n // initialization.\n //\n\n mixkey(math.random(), pool); //\n // Nodejs and AMD support: export the implementation as a module using\n // either convention.\n //\n // End anonymous scope, and pass initial values.\n }\n ;\n function initialize$2(BMMath) {\n seedRandom([], BMMath);\n }\n var propTypes = {\n SHAPE: 'shape'\n };\n function _typeof$1(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof$1 = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof$1 = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof$1(obj);\n }\n var ExpressionManager = function () {\n 'use strict';\n\n var ob = {};\n var Math = BMMath;\n var window = null;\n var document = null;\n var XMLHttpRequest = null;\n var fetch = null;\n var frames = null;\n var _lottieGlobal = {};\n initialize$2(BMMath);\n function resetFrame() {\n _lottieGlobal = {};\n }\n function $bm_isInstanceOfArray(arr) {\n return arr.constructor === Array || arr.constructor === Float32Array;\n }\n function isNumerable(tOfV, v) {\n return tOfV === 'number' || v instanceof Number || tOfV === 'boolean' || tOfV === 'string';\n }\n function $bm_neg(a) {\n var tOfA = _typeof$1(a);\n if (tOfA === 'number' || a instanceof Number || tOfA === 'boolean') {\n return -a;\n }\n if ($bm_isInstanceOfArray(a)) {\n var i;\n var lenA = a.length;\n var retArr = [];\n for (i = 0; i < lenA; i += 1) {\n retArr[i] = -a[i];\n }\n return retArr;\n }\n if (a.propType) {\n return a.v;\n }\n return -a;\n }\n var easeInBez = BezierFactory.getBezierEasing(0.333, 0, 0.833, 0.833, 'easeIn').get;\n var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, 0.667, 1, 'easeOut').get;\n var easeInOutBez = BezierFactory.getBezierEasing(0.33, 0, 0.667, 1, 'easeInOut').get;\n function sum(a, b) {\n var tOfA = _typeof$1(a);\n var tOfB = _typeof$1(b);\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b) || tOfA === 'string' || tOfB === 'string') {\n return a + b;\n }\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n a = a.slice(0);\n a[0] += b;\n return a;\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n b = b.slice(0);\n b[0] = a + b[0];\n return b;\n }\n if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\n var i = 0;\n var lenA = a.length;\n var lenB = b.length;\n var retArr = [];\n while (i < lenA || i < lenB) {\n if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {\n retArr[i] = a[i] + b[i];\n } else {\n retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];\n }\n i += 1;\n }\n return retArr;\n }\n return 0;\n }\n var add = sum;\n function sub(a, b) {\n var tOfA = _typeof$1(a);\n var tOfB = _typeof$1(b);\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n if (tOfA === 'string') {\n a = parseInt(a, 10);\n }\n if (tOfB === 'string') {\n b = parseInt(b, 10);\n }\n return a - b;\n }\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n a = a.slice(0);\n a[0] -= b;\n return a;\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n b = b.slice(0);\n b[0] = a - b[0];\n return b;\n }\n if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\n var i = 0;\n var lenA = a.length;\n var lenB = b.length;\n var retArr = [];\n while (i < lenA || i < lenB) {\n if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {\n retArr[i] = a[i] - b[i];\n } else {\n retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];\n }\n i += 1;\n }\n return retArr;\n }\n return 0;\n }\n function mul(a, b) {\n var tOfA = _typeof$1(a);\n var tOfB = _typeof$1(b);\n var arr;\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n return a * b;\n }\n var i;\n var len;\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n len = a.length;\n arr = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n arr[i] = a[i] * b;\n }\n return arr;\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n len = b.length;\n arr = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n arr[i] = a * b[i];\n }\n return arr;\n }\n return 0;\n }\n function div(a, b) {\n var tOfA = _typeof$1(a);\n var tOfB = _typeof$1(b);\n var arr;\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\n return a / b;\n }\n var i;\n var len;\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\n len = a.length;\n arr = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n arr[i] = a[i] / b;\n }\n return arr;\n }\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\n len = b.length;\n arr = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n arr[i] = a / b[i];\n }\n return arr;\n }\n return 0;\n }\n function mod(a, b) {\n if (typeof a === 'string') {\n a = parseInt(a, 10);\n }\n if (typeof b === 'string') {\n b = parseInt(b, 10);\n }\n return a % b;\n }\n var $bm_sum = sum;\n var $bm_sub = sub;\n var $bm_mul = mul;\n var $bm_div = div;\n var $bm_mod = mod;\n function clamp(num, min, max) {\n if (min > max) {\n var mm = max;\n max = min;\n min = mm;\n }\n return Math.min(Math.max(num, min), max);\n }\n function radiansToDegrees(val) {\n return val / degToRads;\n }\n var radians_to_degrees = radiansToDegrees;\n function degreesToRadians(val) {\n return val * degToRads;\n }\n var degrees_to_radians = radiansToDegrees;\n var helperLengthArray = [0, 0, 0, 0, 0, 0];\n function length(arr1, arr2) {\n if (typeof arr1 === 'number' || arr1 instanceof Number) {\n arr2 = arr2 || 0;\n return Math.abs(arr1 - arr2);\n }\n if (!arr2) {\n arr2 = helperLengthArray;\n }\n var i;\n var len = Math.min(arr1.length, arr2.length);\n var addedLength = 0;\n for (i = 0; i < len; i += 1) {\n addedLength += Math.pow(arr2[i] - arr1[i], 2);\n }\n return Math.sqrt(addedLength);\n }\n function normalize(vec) {\n return div(vec, length(vec));\n }\n function rgbToHsl(val) {\n var r = val[0];\n var g = val[1];\n var b = val[2];\n var max = Math.max(r, g, b);\n var min = Math.min(r, g, b);\n var h;\n var s;\n var l = (max + min) / 2;\n if (max === min) {\n h = 0; // achromatic\n\n s = 0; // achromatic\n } else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n default:\n break;\n }\n h /= 6;\n }\n return [h, s, l, val[3]];\n }\n function hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n }\n function hslToRgb(val) {\n var h = val[0];\n var s = val[1];\n var l = val[2];\n var r;\n var g;\n var b;\n if (s === 0) {\n r = l; // achromatic\n\n b = l; // achromatic\n\n g = l; // achromatic\n } else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n return [r, g, b, val[3]];\n }\n function linear(t, tMin, tMax, value1, value2) {\n if (value1 === undefined || value2 === undefined) {\n value1 = tMin;\n value2 = tMax;\n tMin = 0;\n tMax = 1;\n }\n if (tMax < tMin) {\n var _tMin = tMax;\n tMax = tMin;\n tMin = _tMin;\n }\n if (t <= tMin) {\n return value1;\n }\n if (t >= tMax) {\n return value2;\n }\n var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin);\n if (!value1.length) {\n return value1 + (value2 - value1) * perc;\n }\n var i;\n var len = value1.length;\n var arr = createTypedArray('float32', len);\n for (i = 0; i < len; i += 1) {\n arr[i] = value1[i] + (value2[i] - value1[i]) * perc;\n }\n return arr;\n }\n function random(min, max) {\n if (max === undefined) {\n if (min === undefined) {\n min = 0;\n max = 1;\n } else {\n max = min;\n min = undefined;\n }\n }\n if (max.length) {\n var i;\n var len = max.length;\n if (!min) {\n min = createTypedArray('float32', len);\n }\n var arr = createTypedArray('float32', len);\n var rnd = BMMath.random();\n for (i = 0; i < len; i += 1) {\n arr[i] = min[i] + rnd * (max[i] - min[i]);\n }\n return arr;\n }\n if (min === undefined) {\n min = 0;\n }\n var rndm = BMMath.random();\n return min + rndm * (max - min);\n }\n function createPath(points, inTangents, outTangents, closed) {\n var i;\n var len = points.length;\n var path = shapePool.newElement();\n path.setPathData(!!closed, len);\n var arrPlaceholder = [0, 0];\n var inVertexPoint;\n var outVertexPoint;\n for (i = 0; i < len; i += 1) {\n inVertexPoint = inTangents && inTangents[i] ? inTangents[i] : arrPlaceholder;\n outVertexPoint = outTangents && outTangents[i] ? outTangents[i] : arrPlaceholder;\n path.setTripleAt(points[i][0], points[i][1], outVertexPoint[0] + points[i][0], outVertexPoint[1] + points[i][1], inVertexPoint[0] + points[i][0], inVertexPoint[1] + points[i][1], i, true);\n }\n return path;\n }\n function initiateExpression(elem, data, property) {\n // Bail out if we don't want expressions\n function noOp(_value) {\n return _value;\n }\n if (!elem.globalData.renderConfig.runExpressions) {\n return noOp;\n }\n var val = data.x;\n var needsVelocity = /velocity(?![\\w\\d])/.test(val);\n var _needsRandom = val.indexOf('random') !== -1;\n var elemType = elem.data.ty;\n var transform;\n var $bm_transform;\n var content;\n var effect;\n var thisProperty = property;\n thisProperty.valueAtTime = thisProperty.getValueAtTime;\n Object.defineProperty(thisProperty, 'value', {\n get: function get() {\n return thisProperty.v;\n }\n });\n elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate;\n elem.comp.displayStartTime = 0;\n var inPoint = elem.data.ip / elem.comp.globalData.frameRate;\n var outPoint = elem.data.op / elem.comp.globalData.frameRate;\n var width = elem.data.sw ? elem.data.sw : 0;\n var height = elem.data.sh ? elem.data.sh : 0;\n var name = elem.data.nm;\n var loopIn;\n var loop_in;\n var loopOut;\n var loop_out;\n var smooth;\n var toWorld;\n var fromWorld;\n var fromComp;\n var toComp;\n var fromCompToSurface;\n var position;\n var rotation;\n var anchorPoint;\n var scale;\n var thisLayer;\n var thisComp;\n var mask;\n var valueAtTime;\n var velocityAtTime;\n var scoped_bm_rt; // val = val.replace(/(\\\\?\"|')((http)(s)?(:\\/))?\\/.*?(\\\\?\"|')/g, \"\\\"\\\"\"); // deter potential network calls\n\n var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}]')[0]; // eslint-disable-line no-eval\n\n var numKeys = property.kf ? data.k.length : 0;\n var active = !this.data || this.data.hd !== true;\n var wiggle = function wiggle(freq, amp) {\n var iWiggle;\n var j;\n var lenWiggle = this.pv.length ? this.pv.length : 1;\n var addedAmps = createTypedArray('float32', lenWiggle);\n freq = 5;\n var iterations = Math.floor(time * freq);\n iWiggle = 0;\n j = 0;\n while (iWiggle < iterations) {\n // var rnd = BMMath.random();\n for (j = 0; j < lenWiggle; j += 1) {\n addedAmps[j] += -amp + amp * 2 * BMMath.random(); // addedAmps[j] += -amp + amp*2*rnd;\n }\n iWiggle += 1;\n } // var rnd2 = BMMath.random();\n\n var periods = time * freq;\n var perc = periods - Math.floor(periods);\n var arr = createTypedArray('float32', lenWiggle);\n if (lenWiggle > 1) {\n for (j = 0; j < lenWiggle; j += 1) {\n arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp * 2 * BMMath.random()) * perc; // arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;\n // arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);\n }\n return arr;\n }\n return this.pv + addedAmps[0] + (-amp + amp * 2 * BMMath.random()) * perc;\n }.bind(this);\n if (thisProperty.loopIn) {\n loopIn = thisProperty.loopIn.bind(thisProperty);\n loop_in = loopIn;\n }\n if (thisProperty.loopOut) {\n loopOut = thisProperty.loopOut.bind(thisProperty);\n loop_out = loopOut;\n }\n if (thisProperty.smooth) {\n smooth = thisProperty.smooth.bind(thisProperty);\n }\n function loopInDuration(type, duration) {\n return loopIn(type, duration, true);\n }\n function loopOutDuration(type, duration) {\n return loopOut(type, duration, true);\n }\n if (this.getValueAtTime) {\n valueAtTime = this.getValueAtTime.bind(this);\n }\n if (this.getVelocityAtTime) {\n velocityAtTime = this.getVelocityAtTime.bind(this);\n }\n var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);\n function lookAt(elem1, elem2) {\n var fVec = [elem2[0] - elem1[0], elem2[1] - elem1[1], elem2[2] - elem1[2]];\n var pitch = Math.atan2(fVec[0], Math.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads;\n var yaw = -Math.atan2(fVec[1], fVec[2]) / degToRads;\n return [yaw, pitch, 0];\n }\n function easeOut(t, tMin, tMax, val1, val2) {\n return applyEase(easeOutBez, t, tMin, tMax, val1, val2);\n }\n function easeIn(t, tMin, tMax, val1, val2) {\n return applyEase(easeInBez, t, tMin, tMax, val1, val2);\n }\n function ease(t, tMin, tMax, val1, val2) {\n return applyEase(easeInOutBez, t, tMin, tMax, val1, val2);\n }\n function applyEase(fn, t, tMin, tMax, val1, val2) {\n if (val1 === undefined) {\n val1 = tMin;\n val2 = tMax;\n } else {\n t = (t - tMin) / (tMax - tMin);\n }\n if (t > 1) {\n t = 1;\n } else if (t < 0) {\n t = 0;\n }\n var mult = fn(t);\n if ($bm_isInstanceOfArray(val1)) {\n var iKey;\n var lenKey = val1.length;\n var arr = createTypedArray('float32', lenKey);\n for (iKey = 0; iKey < lenKey; iKey += 1) {\n arr[iKey] = (val2[iKey] - val1[iKey]) * mult + val1[iKey];\n }\n return arr;\n }\n return (val2 - val1) * mult + val1;\n }\n function nearestKey(time) {\n var iKey;\n var lenKey = data.k.length;\n var index;\n var keyTime;\n if (!data.k.length || typeof data.k[0] === 'number') {\n index = 0;\n keyTime = 0;\n } else {\n index = -1;\n time *= elem.comp.globalData.frameRate;\n if (time < data.k[0].t) {\n index = 1;\n keyTime = data.k[0].t;\n } else {\n for (iKey = 0; iKey < lenKey - 1; iKey += 1) {\n if (time === data.k[iKey].t) {\n index = iKey + 1;\n keyTime = data.k[iKey].t;\n break;\n } else if (time > data.k[iKey].t && time < data.k[iKey + 1].t) {\n if (time - data.k[iKey].t > data.k[iKey + 1].t - time) {\n index = iKey + 2;\n keyTime = data.k[iKey + 1].t;\n } else {\n index = iKey + 1;\n keyTime = data.k[iKey].t;\n }\n break;\n }\n }\n if (index === -1) {\n index = iKey + 1;\n keyTime = data.k[iKey].t;\n }\n }\n }\n var obKey = {};\n obKey.index = index;\n obKey.time = keyTime / elem.comp.globalData.frameRate;\n return obKey;\n }\n function key(ind) {\n var obKey;\n var iKey;\n var lenKey;\n if (!data.k.length || typeof data.k[0] === 'number') {\n throw new Error('The property has no keyframe at index ' + ind);\n }\n ind -= 1;\n obKey = {\n time: data.k[ind].t / elem.comp.globalData.frameRate,\n value: []\n };\n var arr = Object.prototype.hasOwnProperty.call(data.k[ind], 's') ? data.k[ind].s : data.k[ind - 1].e;\n lenKey = arr.length;\n for (iKey = 0; iKey < lenKey; iKey += 1) {\n obKey[iKey] = arr[iKey];\n obKey.value[iKey] = arr[iKey];\n }\n return obKey;\n }\n function framesToTime(fr, fps) {\n if (!fps) {\n fps = elem.comp.globalData.frameRate;\n }\n return fr / fps;\n }\n function timeToFrames(t, fps) {\n if (!t && t !== 0) {\n t = time;\n }\n if (!fps) {\n fps = elem.comp.globalData.frameRate;\n }\n return t * fps;\n }\n function seedRandom(seed) {\n BMMath.seedrandom(randSeed + seed);\n }\n function sourceRectAtTime() {\n return elem.sourceRectAtTime();\n }\n function substring(init, end) {\n if (typeof value === 'string') {\n if (end === undefined) {\n return value.substring(init);\n }\n return value.substring(init, end);\n }\n return '';\n }\n function substr(init, end) {\n if (typeof value === 'string') {\n if (end === undefined) {\n return value.substr(init);\n }\n return value.substr(init, end);\n }\n return '';\n }\n function posterizeTime(framesPerSecond) {\n time = framesPerSecond === 0 ? 0 : Math.floor(time * framesPerSecond) / framesPerSecond;\n value = valueAtTime(time);\n }\n var time;\n var velocity;\n var value;\n var text;\n var textIndex;\n var textTotal;\n var selectorValue;\n var index = elem.data.ind;\n var hasParent = !!(elem.hierarchy && elem.hierarchy.length);\n var parent;\n var randSeed = Math.floor(Math.random() * 1000000);\n var globalData = elem.globalData;\n function executeExpression(_value) {\n // globalData.pushExpression();\n value = _value;\n if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {\n return value;\n }\n if (this.propType === 'textSelector') {\n textIndex = this.textIndex;\n textTotal = this.textTotal;\n selectorValue = this.selectorValue;\n }\n if (!thisLayer) {\n text = elem.layerInterface.text;\n thisLayer = elem.layerInterface;\n thisComp = elem.comp.compInterface;\n toWorld = thisLayer.toWorld.bind(thisLayer);\n fromWorld = thisLayer.fromWorld.bind(thisLayer);\n fromComp = thisLayer.fromComp.bind(thisLayer);\n toComp = thisLayer.toComp.bind(thisLayer);\n mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null;\n fromCompToSurface = fromComp;\n }\n if (!transform) {\n transform = elem.layerInterface('ADBE Transform Group');\n $bm_transform = transform;\n if (transform) {\n anchorPoint = transform.anchorPoint;\n /* position = transform.position;\r\n rotation = transform.rotation;\r\n scale = transform.scale; */\n }\n }\n if (elemType === 4 && !content) {\n content = thisLayer('ADBE Root Vectors Group');\n }\n if (!effect) {\n effect = thisLayer(4);\n }\n hasParent = !!(elem.hierarchy && elem.hierarchy.length);\n if (hasParent && !parent) {\n parent = elem.hierarchy[0].layerInterface;\n }\n time = this.comp.renderedFrame / this.comp.globalData.frameRate;\n if (_needsRandom) {\n seedRandom(randSeed + time);\n }\n if (needsVelocity) {\n velocity = velocityAtTime(time);\n }\n expression_function();\n this.frameExpressionId = elem.globalData.frameId; // TODO: Check if it's possible to return on ShapeInterface the .v value\n // Changed this to a ternary operation because Rollup failed compiling it correctly\n\n scoped_bm_rt = scoped_bm_rt.propType === propTypes.SHAPE ? scoped_bm_rt.v : scoped_bm_rt;\n return scoped_bm_rt;\n } // Bundlers will see these as dead code and unless we reference them\n\n executeExpression.__preventDeadCodeRemoval = [$bm_transform, anchorPoint, time, velocity, inPoint, outPoint, width, height, name, loop_in, loop_out, smooth, toComp, fromCompToSurface, toWorld, fromWorld, mask, position, rotation, scale, thisComp, numKeys, active, wiggle, loopInDuration, loopOutDuration, comp, lookAt, easeOut, easeIn, ease, nearestKey, key, text, textIndex, textTotal, selectorValue, framesToTime, timeToFrames, sourceRectAtTime, substring, substr, posterizeTime, index, globalData];\n return executeExpression;\n }\n ob.initiateExpression = initiateExpression;\n ob.__preventDeadCodeRemoval = [window, document, XMLHttpRequest, fetch, frames, $bm_neg, add, $bm_sum, $bm_sub, $bm_mul, $bm_div, $bm_mod, clamp, radians_to_degrees, degreesToRadians, degrees_to_radians, normalize, rgbToHsl, hslToRgb, linear, random, createPath, _lottieGlobal];\n ob.resetFrame = resetFrame;\n return ob;\n }();\n var Expressions = function () {\n var ob = {};\n ob.initExpressions = initExpressions;\n ob.resetFrame = ExpressionManager.resetFrame;\n function initExpressions(animation) {\n var stackCount = 0;\n var registers = [];\n function pushExpression() {\n stackCount += 1;\n }\n function popExpression() {\n stackCount -= 1;\n if (stackCount === 0) {\n releaseInstances();\n }\n }\n function registerExpressionProperty(expression) {\n if (registers.indexOf(expression) === -1) {\n registers.push(expression);\n }\n }\n function releaseInstances() {\n var i;\n var len = registers.length;\n for (i = 0; i < len; i += 1) {\n registers[i].release();\n }\n registers.length = 0;\n }\n animation.renderer.compInterface = CompExpressionInterface(animation.renderer);\n animation.renderer.globalData.projectInterface.registerComposition(animation.renderer);\n animation.renderer.globalData.pushExpression = pushExpression;\n animation.renderer.globalData.popExpression = popExpression;\n animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty;\n }\n return ob;\n }();\n var MaskManagerInterface = function () {\n function MaskInterface(mask, data) {\n this._mask = mask;\n this._data = data;\n }\n Object.defineProperty(MaskInterface.prototype, 'maskPath', {\n get: function get() {\n if (this._mask.prop.k) {\n this._mask.prop.getValue();\n }\n return this._mask.prop;\n }\n });\n Object.defineProperty(MaskInterface.prototype, 'maskOpacity', {\n get: function get() {\n if (this._mask.op.k) {\n this._mask.op.getValue();\n }\n return this._mask.op.v * 100;\n }\n });\n var MaskManager = function MaskManager(maskManager) {\n var _masksInterfaces = createSizedArray(maskManager.viewData.length);\n var i;\n var len = maskManager.viewData.length;\n for (i = 0; i < len; i += 1) {\n _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]);\n }\n var maskFunction = function maskFunction(name) {\n i = 0;\n while (i < len) {\n if (maskManager.masksProperties[i].nm === name) {\n return _masksInterfaces[i];\n }\n i += 1;\n }\n return null;\n };\n return maskFunction;\n };\n return MaskManager;\n }();\n var ExpressionPropertyInterface = function () {\n var defaultUnidimensionalValue = {\n pv: 0,\n v: 0,\n mult: 1\n };\n var defaultMultidimensionalValue = {\n pv: [0, 0, 0],\n v: [0, 0, 0],\n mult: 1\n };\n function completeProperty(expressionValue, property, type) {\n Object.defineProperty(expressionValue, 'velocity', {\n get: function get() {\n return property.getVelocityAtTime(property.comp.currentFrame);\n }\n });\n expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0;\n expressionValue.key = function (pos) {\n if (!expressionValue.numKeys) {\n return 0;\n }\n var value = '';\n if ('s' in property.keyframes[pos - 1]) {\n value = property.keyframes[pos - 1].s;\n } else if ('e' in property.keyframes[pos - 2]) {\n value = property.keyframes[pos - 2].e;\n } else {\n value = property.keyframes[pos - 2].s;\n }\n var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value); // eslint-disable-line no-new-wrappers\n\n valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate;\n valueProp.value = type === 'unidimensional' ? value[0] : value;\n return valueProp;\n };\n expressionValue.valueAtTime = property.getValueAtTime;\n expressionValue.speedAtTime = property.getSpeedAtTime;\n expressionValue.velocityAtTime = property.getVelocityAtTime;\n expressionValue.propertyGroup = property.propertyGroup;\n }\n function UnidimensionalPropertyInterface(property) {\n if (!property || !('pv' in property)) {\n property = defaultUnidimensionalValue;\n }\n var mult = 1 / property.mult;\n var val = property.pv * mult;\n var expressionValue = new Number(val); // eslint-disable-line no-new-wrappers\n\n expressionValue.value = val;\n completeProperty(expressionValue, property, 'unidimensional');\n return function () {\n if (property.k) {\n property.getValue();\n }\n val = property.v * mult;\n if (expressionValue.value !== val) {\n expressionValue = new Number(val); // eslint-disable-line no-new-wrappers\n\n expressionValue.value = val;\n completeProperty(expressionValue, property, 'unidimensional');\n }\n return expressionValue;\n };\n }\n function MultidimensionalPropertyInterface(property) {\n if (!property || !('pv' in property)) {\n property = defaultMultidimensionalValue;\n }\n var mult = 1 / property.mult;\n var len = property.data && property.data.l || property.pv.length;\n var expressionValue = createTypedArray('float32', len);\n var arrValue = createTypedArray('float32', len);\n expressionValue.value = arrValue;\n completeProperty(expressionValue, property, 'multidimensional');\n return function () {\n if (property.k) {\n property.getValue();\n }\n for (var i = 0; i < len; i += 1) {\n arrValue[i] = property.v[i] * mult;\n expressionValue[i] = arrValue[i];\n }\n return expressionValue;\n };\n } // TODO: try to avoid using this getter\n\n function defaultGetter() {\n return defaultUnidimensionalValue;\n }\n return function (property) {\n if (!property) {\n return defaultGetter;\n }\n if (property.propType === 'unidimensional') {\n return UnidimensionalPropertyInterface(property);\n }\n return MultidimensionalPropertyInterface(property);\n };\n }();\n var TransformExpressionInterface = function () {\n return function (transform) {\n function _thisFunction(name) {\n switch (name) {\n case 'scale':\n case 'Scale':\n case 'ADBE Scale':\n case 6:\n return _thisFunction.scale;\n case 'rotation':\n case 'Rotation':\n case 'ADBE Rotation':\n case 'ADBE Rotate Z':\n case 10:\n return _thisFunction.rotation;\n case 'ADBE Rotate X':\n return _thisFunction.xRotation;\n case 'ADBE Rotate Y':\n return _thisFunction.yRotation;\n case 'position':\n case 'Position':\n case 'ADBE Position':\n case 2:\n return _thisFunction.position;\n case 'ADBE Position_0':\n return _thisFunction.xPosition;\n case 'ADBE Position_1':\n return _thisFunction.yPosition;\n case 'ADBE Position_2':\n return _thisFunction.zPosition;\n case 'anchorPoint':\n case 'AnchorPoint':\n case 'Anchor Point':\n case 'ADBE AnchorPoint':\n case 1:\n return _thisFunction.anchorPoint;\n case 'opacity':\n case 'Opacity':\n case 11:\n return _thisFunction.opacity;\n default:\n return null;\n }\n }\n Object.defineProperty(_thisFunction, 'rotation', {\n get: ExpressionPropertyInterface(transform.r || transform.rz)\n });\n Object.defineProperty(_thisFunction, 'zRotation', {\n get: ExpressionPropertyInterface(transform.rz || transform.r)\n });\n Object.defineProperty(_thisFunction, 'xRotation', {\n get: ExpressionPropertyInterface(transform.rx)\n });\n Object.defineProperty(_thisFunction, 'yRotation', {\n get: ExpressionPropertyInterface(transform.ry)\n });\n Object.defineProperty(_thisFunction, 'scale', {\n get: ExpressionPropertyInterface(transform.s)\n });\n var _px;\n var _py;\n var _pz;\n var _transformFactory;\n if (transform.p) {\n _transformFactory = ExpressionPropertyInterface(transform.p);\n } else {\n _px = ExpressionPropertyInterface(transform.px);\n _py = ExpressionPropertyInterface(transform.py);\n if (transform.pz) {\n _pz = ExpressionPropertyInterface(transform.pz);\n }\n }\n Object.defineProperty(_thisFunction, 'position', {\n get: function get() {\n if (transform.p) {\n return _transformFactory();\n }\n return [_px(), _py(), _pz ? _pz() : 0];\n }\n });\n Object.defineProperty(_thisFunction, 'xPosition', {\n get: ExpressionPropertyInterface(transform.px)\n });\n Object.defineProperty(_thisFunction, 'yPosition', {\n get: ExpressionPropertyInterface(transform.py)\n });\n Object.defineProperty(_thisFunction, 'zPosition', {\n get: ExpressionPropertyInterface(transform.pz)\n });\n Object.defineProperty(_thisFunction, 'anchorPoint', {\n get: ExpressionPropertyInterface(transform.a)\n });\n Object.defineProperty(_thisFunction, 'opacity', {\n get: ExpressionPropertyInterface(transform.o)\n });\n Object.defineProperty(_thisFunction, 'skew', {\n get: ExpressionPropertyInterface(transform.sk)\n });\n Object.defineProperty(_thisFunction, 'skewAxis', {\n get: ExpressionPropertyInterface(transform.sa)\n });\n Object.defineProperty(_thisFunction, 'orientation', {\n get: ExpressionPropertyInterface(transform.or)\n });\n return _thisFunction;\n };\n }();\n var LayerExpressionInterface = function () {\n function getMatrix(time) {\n var toWorldMat = new Matrix();\n if (time !== undefined) {\n var propMatrix = this._elem.finalTransform.mProp.getValueAtTime(time);\n propMatrix.clone(toWorldMat);\n } else {\n var transformMat = this._elem.finalTransform.mProp;\n transformMat.applyToMatrix(toWorldMat);\n }\n return toWorldMat;\n }\n function toWorldVec(arr, time) {\n var toWorldMat = this.getMatrix(time);\n toWorldMat.props[12] = 0;\n toWorldMat.props[13] = 0;\n toWorldMat.props[14] = 0;\n return this.applyPoint(toWorldMat, arr);\n }\n function toWorld(arr, time) {\n var toWorldMat = this.getMatrix(time);\n return this.applyPoint(toWorldMat, arr);\n }\n function fromWorldVec(arr, time) {\n var toWorldMat = this.getMatrix(time);\n toWorldMat.props[12] = 0;\n toWorldMat.props[13] = 0;\n toWorldMat.props[14] = 0;\n return this.invertPoint(toWorldMat, arr);\n }\n function fromWorld(arr, time) {\n var toWorldMat = this.getMatrix(time);\n return this.invertPoint(toWorldMat, arr);\n }\n function applyPoint(matrix, arr) {\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i;\n var len = this._elem.hierarchy.length;\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix);\n }\n }\n return matrix.applyToPointArray(arr[0], arr[1], arr[2] || 0);\n }\n function invertPoint(matrix, arr) {\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i;\n var len = this._elem.hierarchy.length;\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix);\n }\n }\n return matrix.inversePoint(arr);\n }\n function fromComp(arr) {\n var toWorldMat = new Matrix();\n toWorldMat.reset();\n this._elem.finalTransform.mProp.applyToMatrix(toWorldMat);\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\n var i;\n var len = this._elem.hierarchy.length;\n for (i = 0; i < len; i += 1) {\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);\n }\n return toWorldMat.inversePoint(arr);\n }\n return toWorldMat.inversePoint(arr);\n }\n function sampleImage() {\n return [1, 1, 1, 1];\n }\n return function (elem) {\n var transformInterface;\n function _registerMaskInterface(maskManager) {\n _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem);\n }\n function _registerEffectsInterface(effects) {\n _thisLayerFunction.effect = effects;\n }\n function _thisLayerFunction(name) {\n switch (name) {\n case 'ADBE Root Vectors Group':\n case 'Contents':\n case 2:\n return _thisLayerFunction.shapeInterface;\n case 1:\n case 6:\n case 'Transform':\n case 'transform':\n case 'ADBE Transform Group':\n return transformInterface;\n case 4:\n case 'ADBE Effect Parade':\n case 'effects':\n case 'Effects':\n return _thisLayerFunction.effect;\n case 'ADBE Text Properties':\n return _thisLayerFunction.textInterface;\n default:\n return null;\n }\n }\n _thisLayerFunction.getMatrix = getMatrix;\n _thisLayerFunction.invertPoint = invertPoint;\n _thisLayerFunction.applyPoint = applyPoint;\n _thisLayerFunction.toWorld = toWorld;\n _thisLayerFunction.toWorldVec = toWorldVec;\n _thisLayerFunction.fromWorld = fromWorld;\n _thisLayerFunction.fromWorldVec = fromWorldVec;\n _thisLayerFunction.toComp = toWorld;\n _thisLayerFunction.fromComp = fromComp;\n _thisLayerFunction.sampleImage = sampleImage;\n _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem);\n _thisLayerFunction._elem = elem;\n transformInterface = TransformExpressionInterface(elem.finalTransform.mProp);\n var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint');\n Object.defineProperties(_thisLayerFunction, {\n hasParent: {\n get: function get() {\n return elem.hierarchy.length;\n }\n },\n parent: {\n get: function get() {\n return elem.hierarchy[0].layerInterface;\n }\n },\n rotation: getDescriptor(transformInterface, 'rotation'),\n scale: getDescriptor(transformInterface, 'scale'),\n position: getDescriptor(transformInterface, 'position'),\n opacity: getDescriptor(transformInterface, 'opacity'),\n anchorPoint: anchorPointDescriptor,\n anchor_point: anchorPointDescriptor,\n transform: {\n get: function get() {\n return transformInterface;\n }\n },\n active: {\n get: function get() {\n return elem.isInRange;\n }\n }\n });\n _thisLayerFunction.startTime = elem.data.st;\n _thisLayerFunction.index = elem.data.ind;\n _thisLayerFunction.source = elem.data.refId;\n _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100;\n _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100;\n _thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate;\n _thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate;\n _thisLayerFunction._name = elem.data.nm;\n _thisLayerFunction.registerMaskInterface = _registerMaskInterface;\n _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface;\n return _thisLayerFunction;\n };\n }();\n var propertyGroupFactory = function () {\n return function (interfaceFunction, parentPropertyGroup) {\n return function (val) {\n val = val === undefined ? 1 : val;\n if (val <= 0) {\n return interfaceFunction;\n }\n return parentPropertyGroup(val - 1);\n };\n };\n }();\n var PropertyInterface = function () {\n return function (propertyName, propertyGroup) {\n var interfaceFunction = {\n _name: propertyName\n };\n function _propertyGroup(val) {\n val = val === undefined ? 1 : val;\n if (val <= 0) {\n return interfaceFunction;\n }\n return propertyGroup(val - 1);\n }\n return _propertyGroup;\n };\n }();\n var EffectsExpressionInterface = function () {\n var ob = {\n createEffectsInterface: createEffectsInterface\n };\n function createEffectsInterface(elem, propertyGroup) {\n if (elem.effectsManager) {\n var effectElements = [];\n var effectsData = elem.data.ef;\n var i;\n var len = elem.effectsManager.effectElements.length;\n for (i = 0; i < len; i += 1) {\n effectElements.push(createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem));\n }\n var effects = elem.data.ef || [];\n var groupInterface = function groupInterface(name) {\n i = 0;\n len = effects.length;\n while (i < len) {\n if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\n return effectElements[i];\n }\n i += 1;\n }\n return null;\n };\n Object.defineProperty(groupInterface, 'numProperties', {\n get: function get() {\n return effects.length;\n }\n });\n return groupInterface;\n }\n return null;\n }\n function createGroupInterface(data, elements, propertyGroup, elem) {\n function groupInterface(name) {\n var effects = data.ef;\n var i = 0;\n var len = effects.length;\n while (i < len) {\n if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\n if (effects[i].ty === 5) {\n return effectElements[i];\n }\n return effectElements[i]();\n }\n i += 1;\n }\n throw new Error();\n }\n var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup);\n var effectElements = [];\n var i;\n var len = data.ef.length;\n for (i = 0; i < len; i += 1) {\n if (data.ef[i].ty === 5) {\n effectElements.push(createGroupInterface(data.ef[i], elements.effectElements[i], elements.effectElements[i].propertyGroup, elem));\n } else {\n effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup));\n }\n }\n if (data.mn === 'ADBE Color Control') {\n Object.defineProperty(groupInterface, 'color', {\n get: function get() {\n return effectElements[0]();\n }\n });\n }\n Object.defineProperties(groupInterface, {\n numProperties: {\n get: function get() {\n return data.np;\n }\n },\n _name: {\n value: data.nm\n },\n propertyGroup: {\n value: _propertyGroup\n }\n });\n groupInterface.enabled = data.en !== 0;\n groupInterface.active = groupInterface.enabled;\n return groupInterface;\n }\n function createValueInterface(element, type, elem, propertyGroup) {\n var expressionProperty = ExpressionPropertyInterface(element.p);\n function interfaceFunction() {\n if (type === 10) {\n return elem.comp.compInterface(element.p.v);\n }\n return expressionProperty();\n }\n if (element.p.setGroupProperty) {\n element.p.setGroupProperty(PropertyInterface('', propertyGroup));\n }\n return interfaceFunction;\n }\n return ob;\n }();\n var ShapePathInterface = function () {\n return function pathInterfaceFactory(shape, view, propertyGroup) {\n var prop = view.sh;\n function interfaceFunction(val) {\n if (val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2) {\n return interfaceFunction.path;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n prop.setGroupProperty(PropertyInterface('Path', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n path: {\n get: function get() {\n if (prop.k) {\n prop.getValue();\n }\n return prop;\n }\n },\n shape: {\n get: function get() {\n if (prop.k) {\n prop.getValue();\n }\n return prop;\n }\n },\n _name: {\n value: shape.nm\n },\n ix: {\n value: shape.ix\n },\n propertyIndex: {\n value: shape.ix\n },\n mn: {\n value: shape.mn\n },\n propertyGroup: {\n value: propertyGroup\n }\n });\n return interfaceFunction;\n };\n }();\n var ShapeExpressionInterface = function () {\n function iterateElements(shapes, view, propertyGroup) {\n var arr = [];\n var i;\n var len = shapes ? shapes.length : 0;\n for (i = 0; i < len; i += 1) {\n if (shapes[i].ty === 'gr') {\n arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'fl') {\n arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'st') {\n arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'tm') {\n arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'tr') {// arr.push(transformInterfaceFactory(shapes[i],view[i],propertyGroup));\n } else if (shapes[i].ty === 'el') {\n arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'sr') {\n arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'sh') {\n arr.push(ShapePathInterface(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'rc') {\n arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'rd') {\n arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'rp') {\n arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else if (shapes[i].ty === 'gf') {\n arr.push(gradientFillInterfaceFactory(shapes[i], view[i], propertyGroup));\n } else {\n arr.push(defaultInterfaceFactory(shapes[i], view[i], propertyGroup));\n }\n }\n return arr;\n }\n function contentsInterfaceFactory(shape, view, propertyGroup) {\n var interfaces;\n var interfaceFunction = function _interfaceFunction(value) {\n var i = 0;\n var len = interfaces.length;\n while (i < len) {\n if (interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value) {\n return interfaces[i];\n }\n i += 1;\n }\n if (typeof value === 'number') {\n return interfaces[value - 1];\n }\n return null;\n };\n interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup);\n interfaceFunction.numProperties = interfaces.length;\n var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);\n interfaceFunction.transform = transformInterface;\n interfaceFunction.propertyIndex = shape.cix;\n interfaceFunction._name = shape.nm;\n return interfaceFunction;\n }\n function groupInterfaceFactory(shape, view, propertyGroup) {\n var interfaceFunction = function _interfaceFunction(value) {\n switch (value) {\n case 'ADBE Vectors Group':\n case 'Contents':\n case 2:\n return interfaceFunction.content;\n // Not necessary for now. Keeping them here in case a new case appears\n // case 'ADBE Vector Transform Group':\n // case 3:\n\n default:\n return interfaceFunction.transform;\n }\n };\n interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup);\n var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);\n interfaceFunction.content = content;\n interfaceFunction.transform = transformInterface;\n Object.defineProperty(interfaceFunction, '_name', {\n get: function get() {\n return shape.nm;\n }\n }); // interfaceFunction.content = interfaceFunction;\n\n interfaceFunction.numProperties = shape.np;\n interfaceFunction.propertyIndex = shape.ix;\n interfaceFunction.nm = shape.nm;\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function fillInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === 'Color' || val === 'color') {\n return interfaceFunction.color;\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity;\n }\n return null;\n }\n Object.defineProperties(interfaceFunction, {\n color: {\n get: ExpressionPropertyInterface(view.c)\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o)\n },\n _name: {\n value: shape.nm\n },\n mn: {\n value: shape.mn\n }\n });\n view.c.setGroupProperty(PropertyInterface('Color', propertyGroup));\n view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));\n return interfaceFunction;\n }\n function gradientFillInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === 'Start Point' || val === 'start point') {\n return interfaceFunction.startPoint;\n }\n if (val === 'End Point' || val === 'end point') {\n return interfaceFunction.endPoint;\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity;\n }\n return null;\n }\n Object.defineProperties(interfaceFunction, {\n startPoint: {\n get: ExpressionPropertyInterface(view.s)\n },\n endPoint: {\n get: ExpressionPropertyInterface(view.e)\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o)\n },\n type: {\n get: function get() {\n return 'a';\n }\n },\n _name: {\n value: shape.nm\n },\n mn: {\n value: shape.mn\n }\n });\n view.s.setGroupProperty(PropertyInterface('Start Point', propertyGroup));\n view.e.setGroupProperty(PropertyInterface('End Point', propertyGroup));\n view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));\n return interfaceFunction;\n }\n function defaultInterfaceFactory() {\n function interfaceFunction() {\n return null;\n }\n return interfaceFunction;\n }\n function strokeInterfaceFactory(shape, view, propertyGroup) {\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var _dashPropertyGroup = propertyGroupFactory(dashOb, _propertyGroup);\n function addPropertyToDashOb(i) {\n Object.defineProperty(dashOb, shape.d[i].nm, {\n get: ExpressionPropertyInterface(view.d.dataProps[i].p)\n });\n }\n var i;\n var len = shape.d ? shape.d.length : 0;\n var dashOb = {};\n for (i = 0; i < len; i += 1) {\n addPropertyToDashOb(i);\n view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup);\n }\n function interfaceFunction(val) {\n if (val === 'Color' || val === 'color') {\n return interfaceFunction.color;\n }\n if (val === 'Opacity' || val === 'opacity') {\n return interfaceFunction.opacity;\n }\n if (val === 'Stroke Width' || val === 'stroke width') {\n return interfaceFunction.strokeWidth;\n }\n return null;\n }\n Object.defineProperties(interfaceFunction, {\n color: {\n get: ExpressionPropertyInterface(view.c)\n },\n opacity: {\n get: ExpressionPropertyInterface(view.o)\n },\n strokeWidth: {\n get: ExpressionPropertyInterface(view.w)\n },\n dash: {\n get: function get() {\n return dashOb;\n }\n },\n _name: {\n value: shape.nm\n },\n mn: {\n value: shape.mn\n }\n });\n view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup));\n view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\n view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup));\n return interfaceFunction;\n }\n function trimInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(val) {\n if (val === shape.e.ix || val === 'End' || val === 'end') {\n return interfaceFunction.end;\n }\n if (val === shape.s.ix) {\n return interfaceFunction.start;\n }\n if (val === shape.o.ix) {\n return interfaceFunction.offset;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n interfaceFunction.propertyIndex = shape.ix;\n view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup));\n view.e.setGroupProperty(PropertyInterface('End', _propertyGroup));\n view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));\n interfaceFunction.propertyIndex = shape.ix;\n interfaceFunction.propertyGroup = propertyGroup;\n Object.defineProperties(interfaceFunction, {\n start: {\n get: ExpressionPropertyInterface(view.s)\n },\n end: {\n get: ExpressionPropertyInterface(view.e)\n },\n offset: {\n get: ExpressionPropertyInterface(view.o)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function transformInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.a.ix === value || value === 'Anchor Point') {\n return interfaceFunction.anchorPoint;\n }\n if (shape.o.ix === value || value === 'Opacity') {\n return interfaceFunction.opacity;\n }\n if (shape.p.ix === value || value === 'Position') {\n return interfaceFunction.position;\n }\n if (shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation') {\n return interfaceFunction.rotation;\n }\n if (shape.s.ix === value || value === 'Scale') {\n return interfaceFunction.scale;\n }\n if (shape.sk && shape.sk.ix === value || value === 'Skew') {\n return interfaceFunction.skew;\n }\n if (shape.sa && shape.sa.ix === value || value === 'Skew Axis') {\n return interfaceFunction.skewAxis;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\n view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\n view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup));\n view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup));\n view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\n if (view.transform.mProps.sk) {\n view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup));\n view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup));\n }\n view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n opacity: {\n get: ExpressionPropertyInterface(view.transform.mProps.o)\n },\n position: {\n get: ExpressionPropertyInterface(view.transform.mProps.p)\n },\n anchorPoint: {\n get: ExpressionPropertyInterface(view.transform.mProps.a)\n },\n scale: {\n get: ExpressionPropertyInterface(view.transform.mProps.s)\n },\n rotation: {\n get: ExpressionPropertyInterface(view.transform.mProps.r)\n },\n skew: {\n get: ExpressionPropertyInterface(view.transform.mProps.sk)\n },\n skewAxis: {\n get: ExpressionPropertyInterface(view.transform.mProps.sa)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.ty = 'tr';\n interfaceFunction.mn = shape.mn;\n interfaceFunction.propertyGroup = propertyGroup;\n return interfaceFunction;\n }\n function ellipseInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position;\n }\n if (shape.s.ix === value) {\n return interfaceFunction.size;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n interfaceFunction.propertyIndex = shape.ix;\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\n prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n size: {\n get: ExpressionPropertyInterface(prop.s)\n },\n position: {\n get: ExpressionPropertyInterface(prop.p)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function starInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position;\n }\n if (shape.r.ix === value) {\n return interfaceFunction.rotation;\n }\n if (shape.pt.ix === value) {\n return interfaceFunction.points;\n }\n if (shape.or.ix === value || value === 'ADBE Vector Star Outer Radius') {\n return interfaceFunction.outerRadius;\n }\n if (shape.os.ix === value) {\n return interfaceFunction.outerRoundness;\n }\n if (shape.ir && (shape.ir.ix === value || value === 'ADBE Vector Star Inner Radius')) {\n return interfaceFunction.innerRadius;\n }\n if (shape.is && shape.is.ix === value) {\n return interfaceFunction.innerRoundness;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\n interfaceFunction.propertyIndex = shape.ix;\n prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup));\n prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup));\n prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup));\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\n prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\n if (shape.ir) {\n prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup));\n prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup));\n }\n Object.defineProperties(interfaceFunction, {\n position: {\n get: ExpressionPropertyInterface(prop.p)\n },\n rotation: {\n get: ExpressionPropertyInterface(prop.r)\n },\n points: {\n get: ExpressionPropertyInterface(prop.pt)\n },\n outerRadius: {\n get: ExpressionPropertyInterface(prop.or)\n },\n outerRoundness: {\n get: ExpressionPropertyInterface(prop.os)\n },\n innerRadius: {\n get: ExpressionPropertyInterface(prop.ir)\n },\n innerRoundness: {\n get: ExpressionPropertyInterface(prop.is)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function rectInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.p.ix === value) {\n return interfaceFunction.position;\n }\n if (shape.r.ix === value) {\n return interfaceFunction.roundness;\n }\n if (shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size') {\n return interfaceFunction.size;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\n interfaceFunction.propertyIndex = shape.ix;\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\n prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));\n prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n position: {\n get: ExpressionPropertyInterface(prop.p)\n },\n roundness: {\n get: ExpressionPropertyInterface(prop.r)\n },\n size: {\n get: ExpressionPropertyInterface(prop.s)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function roundedInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.r.ix === value || value === 'Round Corners 1') {\n return interfaceFunction.radius;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var prop = view;\n interfaceFunction.propertyIndex = shape.ix;\n prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n radius: {\n get: ExpressionPropertyInterface(prop.rd)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n function repeaterInterfaceFactory(shape, view, propertyGroup) {\n function interfaceFunction(value) {\n if (shape.c.ix === value || value === 'Copies') {\n return interfaceFunction.copies;\n }\n if (shape.o.ix === value || value === 'Offset') {\n return interfaceFunction.offset;\n }\n return null;\n }\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\n var prop = view;\n interfaceFunction.propertyIndex = shape.ix;\n prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup));\n prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));\n Object.defineProperties(interfaceFunction, {\n copies: {\n get: ExpressionPropertyInterface(prop.c)\n },\n offset: {\n get: ExpressionPropertyInterface(prop.o)\n },\n _name: {\n value: shape.nm\n }\n });\n interfaceFunction.mn = shape.mn;\n return interfaceFunction;\n }\n return function (shapes, view, propertyGroup) {\n var interfaces;\n function _interfaceFunction(value) {\n if (typeof value === 'number') {\n value = value === undefined ? 1 : value;\n if (value === 0) {\n return propertyGroup;\n }\n return interfaces[value - 1];\n }\n var i = 0;\n var len = interfaces.length;\n while (i < len) {\n if (interfaces[i]._name === value) {\n return interfaces[i];\n }\n i += 1;\n }\n return null;\n }\n function parentGroupWrapper() {\n return propertyGroup;\n }\n _interfaceFunction.propertyGroup = propertyGroupFactory(_interfaceFunction, parentGroupWrapper);\n interfaces = iterateElements(shapes, view, _interfaceFunction.propertyGroup);\n _interfaceFunction.numProperties = interfaces.length;\n _interfaceFunction._name = 'Contents';\n return _interfaceFunction;\n };\n }();\n var TextExpressionInterface = function () {\n return function (elem) {\n var _sourceText;\n function _thisLayerFunction(name) {\n switch (name) {\n case 'ADBE Text Document':\n return _thisLayerFunction.sourceText;\n default:\n return null;\n }\n }\n Object.defineProperty(_thisLayerFunction, 'sourceText', {\n get: function get() {\n elem.textProperty.getValue();\n var stringValue = elem.textProperty.currentData.t;\n if (!_sourceText || stringValue !== _sourceText.value) {\n _sourceText = new String(stringValue); // eslint-disable-line no-new-wrappers\n // If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive\n\n _sourceText.value = stringValue || new String(stringValue); // eslint-disable-line no-new-wrappers\n\n Object.defineProperty(_sourceText, 'style', {\n get: function get() {\n return {\n fillColor: elem.textProperty.currentData.fc\n };\n }\n });\n }\n return _sourceText;\n }\n });\n return _thisLayerFunction;\n };\n }();\n function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof(obj);\n }\n var FootageInterface = function () {\n var outlineInterfaceFactory = function outlineInterfaceFactory(elem) {\n var currentPropertyName = '';\n var currentProperty = elem.getFootageData();\n function init() {\n currentPropertyName = '';\n currentProperty = elem.getFootageData();\n return searchProperty;\n }\n function searchProperty(value) {\n if (currentProperty[value]) {\n currentPropertyName = value;\n currentProperty = currentProperty[value];\n if (_typeof(currentProperty) === 'object') {\n return searchProperty;\n }\n return currentProperty;\n }\n var propertyNameIndex = value.indexOf(currentPropertyName);\n if (propertyNameIndex !== -1) {\n var index = parseInt(value.substr(propertyNameIndex + currentPropertyName.length), 10);\n currentProperty = currentProperty[index];\n if (_typeof(currentProperty) === 'object') {\n return searchProperty;\n }\n return currentProperty;\n }\n return '';\n }\n return init;\n };\n var dataInterfaceFactory = function dataInterfaceFactory(elem) {\n function interfaceFunction(value) {\n if (value === 'Outline') {\n return interfaceFunction.outlineInterface();\n }\n return null;\n }\n interfaceFunction._name = 'Outline';\n interfaceFunction.outlineInterface = outlineInterfaceFactory(elem);\n return interfaceFunction;\n };\n return function (elem) {\n function _interfaceFunction(value) {\n if (value === 'Data') {\n return _interfaceFunction.dataInterface;\n }\n return null;\n }\n _interfaceFunction._name = 'Data';\n _interfaceFunction.dataInterface = dataInterfaceFactory(elem);\n return _interfaceFunction;\n };\n }();\n var interfaces = {\n layer: LayerExpressionInterface,\n effects: EffectsExpressionInterface,\n comp: CompExpressionInterface,\n shape: ShapeExpressionInterface,\n text: TextExpressionInterface,\n footage: FootageInterface\n };\n function getInterface(type) {\n return interfaces[type] || null;\n }\n var expressionHelpers = function () {\n function searchExpressions(elem, data, prop) {\n if (data.x) {\n prop.k = true;\n prop.x = true;\n prop.initiateExpression = ExpressionManager.initiateExpression;\n prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop));\n }\n }\n function getValueAtTime(frameNum) {\n frameNum *= this.elem.globalData.frameRate;\n frameNum -= this.offsetTime;\n if (frameNum !== this._cachingAtTime.lastFrame) {\n this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;\n this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);\n this._cachingAtTime.lastFrame = frameNum;\n }\n return this._cachingAtTime.value;\n }\n function getSpeedAtTime(frameNum) {\n var delta = -0.01;\n var v1 = this.getValueAtTime(frameNum);\n var v2 = this.getValueAtTime(frameNum + delta);\n var speed = 0;\n if (v1.length) {\n var i;\n for (i = 0; i < v1.length; i += 1) {\n speed += Math.pow(v2[i] - v1[i], 2);\n }\n speed = Math.sqrt(speed) * 100;\n } else {\n speed = 0;\n }\n return speed;\n }\n function getVelocityAtTime(frameNum) {\n if (this.vel !== undefined) {\n return this.vel;\n }\n var delta = -0.001; // frameNum += this.elem.data.st;\n\n var v1 = this.getValueAtTime(frameNum);\n var v2 = this.getValueAtTime(frameNum + delta);\n var velocity;\n if (v1.length) {\n velocity = createTypedArray('float32', v1.length);\n var i;\n for (i = 0; i < v1.length; i += 1) {\n // removing frameRate\n // if needed, don't add it here\n // velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);\n velocity[i] = (v2[i] - v1[i]) / delta;\n }\n } else {\n velocity = (v2 - v1) / delta;\n }\n return velocity;\n }\n function getStaticValueAtTime() {\n return this.pv;\n }\n function setGroupProperty(propertyGroup) {\n this.propertyGroup = propertyGroup;\n }\n return {\n searchExpressions: searchExpressions,\n getSpeedAtTime: getSpeedAtTime,\n getVelocityAtTime: getVelocityAtTime,\n getValueAtTime: getValueAtTime,\n getStaticValueAtTime: getStaticValueAtTime,\n setGroupProperty: setGroupProperty\n };\n }();\n function addPropertyDecorator() {\n function loopOut(type, duration, durationFlag) {\n if (!this.k || !this.keyframes) {\n return this.pv;\n }\n type = type ? type.toLowerCase() : '';\n var currentFrame = this.comp.renderedFrame;\n var keyframes = this.keyframes;\n var lastKeyFrame = keyframes[keyframes.length - 1].t;\n if (currentFrame <= lastKeyFrame) {\n return this.pv;\n }\n var cycleDuration;\n var firstKeyFrame;\n if (!durationFlag) {\n if (!duration || duration > keyframes.length - 1) {\n duration = keyframes.length - 1;\n }\n firstKeyFrame = keyframes[keyframes.length - 1 - duration].t;\n cycleDuration = lastKeyFrame - firstKeyFrame;\n } else {\n if (!duration) {\n cycleDuration = Math.max(0, lastKeyFrame - this.elem.data.ip);\n } else {\n cycleDuration = Math.abs(lastKeyFrame - this.elem.comp.globalData.frameRate * duration);\n }\n firstKeyFrame = lastKeyFrame - cycleDuration;\n }\n var i;\n var len;\n var ret;\n if (type === 'pingpong') {\n var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);\n if (iterations % 2 !== 0) {\n return this.getValueAtTime((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\n }\n } else if (type === 'offset') {\n var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\n var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\n var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\n\n var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);\n if (this.pv.length) {\n ret = new Array(initV.length);\n len = ret.length;\n for (i = 0; i < len; i += 1) {\n ret[i] = (endV[i] - initV[i]) * repeats + current[i];\n }\n return ret;\n }\n return (endV - initV) * repeats + current;\n } else if (type === 'continue') {\n var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\n var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0);\n if (this.pv.length) {\n ret = new Array(lastValue.length);\n len = ret.length;\n for (i = 0; i < len; i += 1) {\n ret[i] = lastValue[i] + (lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate) / 0.0005; // eslint-disable-line\n }\n return ret;\n }\n return lastValue + (lastValue - nextLastValue) * ((currentFrame - lastKeyFrame) / 0.001);\n }\n return this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\n }\n function loopIn(type, duration, durationFlag) {\n if (!this.k) {\n return this.pv;\n }\n type = type ? type.toLowerCase() : '';\n var currentFrame = this.comp.renderedFrame;\n var keyframes = this.keyframes;\n var firstKeyFrame = keyframes[0].t;\n if (currentFrame >= firstKeyFrame) {\n return this.pv;\n }\n var cycleDuration;\n var lastKeyFrame;\n if (!durationFlag) {\n if (!duration || duration > keyframes.length - 1) {\n duration = keyframes.length - 1;\n }\n lastKeyFrame = keyframes[duration].t;\n cycleDuration = lastKeyFrame - firstKeyFrame;\n } else {\n if (!duration) {\n cycleDuration = Math.max(0, this.elem.data.op - firstKeyFrame);\n } else {\n cycleDuration = Math.abs(this.elem.comp.globalData.frameRate * duration);\n }\n lastKeyFrame = firstKeyFrame + cycleDuration;\n }\n var i;\n var len;\n var ret;\n if (type === 'pingpong') {\n var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration);\n if (iterations % 2 === 0) {\n return this.getValueAtTime(((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\n }\n } else if (type === 'offset') {\n var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\n var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\n var current = this.getValueAtTime((cycleDuration - (firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);\n var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1;\n if (this.pv.length) {\n ret = new Array(initV.length);\n len = ret.length;\n for (i = 0; i < len; i += 1) {\n ret[i] = current[i] - (endV[i] - initV[i]) * repeats;\n }\n return ret;\n }\n return current - (endV - initV) * repeats;\n } else if (type === 'continue') {\n var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\n var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0);\n if (this.pv.length) {\n ret = new Array(firstValue.length);\n len = ret.length;\n for (i = 0; i < len; i += 1) {\n ret[i] = firstValue[i] + (firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame) / 0.001;\n }\n return ret;\n }\n return firstValue + (firstValue - nextFirstValue) * (firstKeyFrame - currentFrame) / 0.001;\n }\n return this.getValueAtTime((cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line\n }\n function smooth(width, samples) {\n if (!this.k) {\n return this.pv;\n }\n width = (width || 0.4) * 0.5;\n samples = Math.floor(samples || 5);\n if (samples <= 1) {\n return this.pv;\n }\n var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate;\n var initFrame = currentTime - width;\n var endFrame = currentTime + width;\n var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1;\n var i = 0;\n var j = 0;\n var value;\n if (this.pv.length) {\n value = createTypedArray('float32', this.pv.length);\n } else {\n value = 0;\n }\n var sampleValue;\n while (i < samples) {\n sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency);\n if (this.pv.length) {\n for (j = 0; j < this.pv.length; j += 1) {\n value[j] += sampleValue[j];\n }\n } else {\n value += sampleValue;\n }\n i += 1;\n }\n if (this.pv.length) {\n for (j = 0; j < this.pv.length; j += 1) {\n value[j] /= samples;\n }\n } else {\n value /= samples;\n }\n return value;\n }\n function getTransformValueAtTime(time) {\n if (!this._transformCachingAtTime) {\n this._transformCachingAtTime = {\n v: new Matrix()\n };\n } /// /\n\n var matrix = this._transformCachingAtTime.v;\n matrix.cloneFromProps(this.pre.props);\n if (this.appliedTransformations < 1) {\n var anchor = this.a.getValueAtTime(time);\n matrix.translate(-anchor[0] * this.a.mult, -anchor[1] * this.a.mult, anchor[2] * this.a.mult);\n }\n if (this.appliedTransformations < 2) {\n var scale = this.s.getValueAtTime(time);\n matrix.scale(scale[0] * this.s.mult, scale[1] * this.s.mult, scale[2] * this.s.mult);\n }\n if (this.sk && this.appliedTransformations < 3) {\n var skew = this.sk.getValueAtTime(time);\n var skewAxis = this.sa.getValueAtTime(time);\n matrix.skewFromAxis(-skew * this.sk.mult, skewAxis * this.sa.mult);\n }\n if (this.r && this.appliedTransformations < 4) {\n var rotation = this.r.getValueAtTime(time);\n matrix.rotate(-rotation * this.r.mult);\n } else if (!this.r && this.appliedTransformations < 4) {\n var rotationZ = this.rz.getValueAtTime(time);\n var rotationY = this.ry.getValueAtTime(time);\n var rotationX = this.rx.getValueAtTime(time);\n var orientation = this.or.getValueAtTime(time);\n matrix.rotateZ(-rotationZ * this.rz.mult).rotateY(rotationY * this.ry.mult).rotateX(rotationX * this.rx.mult).rotateZ(-orientation[2] * this.or.mult).rotateY(orientation[1] * this.or.mult).rotateX(orientation[0] * this.or.mult);\n }\n if (this.data.p && this.data.p.s) {\n var positionX = this.px.getValueAtTime(time);\n var positionY = this.py.getValueAtTime(time);\n if (this.data.p.z) {\n var positionZ = this.pz.getValueAtTime(time);\n matrix.translate(positionX * this.px.mult, positionY * this.py.mult, -positionZ * this.pz.mult);\n } else {\n matrix.translate(positionX * this.px.mult, positionY * this.py.mult, 0);\n }\n } else {\n var position = this.p.getValueAtTime(time);\n matrix.translate(position[0] * this.p.mult, position[1] * this.p.mult, -position[2] * this.p.mult);\n }\n return matrix; /// /\n }\n function getTransformStaticValueAtTime() {\n return this.v.clone(new Matrix());\n }\n var getTransformProperty = TransformPropertyFactory.getTransformProperty;\n TransformPropertyFactory.getTransformProperty = function (elem, data, container) {\n var prop = getTransformProperty(elem, data, container);\n if (prop.dynamicProperties.length) {\n prop.getValueAtTime = getTransformValueAtTime.bind(prop);\n } else {\n prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop);\n }\n prop.setGroupProperty = expressionHelpers.setGroupProperty;\n return prop;\n };\n var propertyGetProp = PropertyFactory.getProp;\n PropertyFactory.getProp = function (elem, data, type, mult, container) {\n var prop = propertyGetProp(elem, data, type, mult, container); // prop.getVelocityAtTime = getVelocityAtTime;\n // prop.loopOut = loopOut;\n // prop.loopIn = loopIn;\n\n if (prop.kf) {\n prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop);\n } else {\n prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop);\n }\n prop.setGroupProperty = expressionHelpers.setGroupProperty;\n prop.loopOut = loopOut;\n prop.loopIn = loopIn;\n prop.smooth = smooth;\n prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop);\n prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop);\n prop.numKeys = data.a === 1 ? data.k.length : 0;\n prop.propertyIndex = data.ix;\n var value = 0;\n if (type !== 0) {\n value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length);\n }\n prop._cachingAtTime = {\n lastFrame: initialDefaultFrame,\n lastIndex: 0,\n value: value\n };\n expressionHelpers.searchExpressions(elem, data, prop);\n if (prop.k) {\n container.addDynamicProperty(prop);\n }\n return prop;\n };\n function getShapeValueAtTime(frameNum) {\n // For now this caching object is created only when needed instead of creating it when the shape is initialized.\n if (!this._cachingAtTime) {\n this._cachingAtTime = {\n shapeValue: shapePool.clone(this.pv),\n lastIndex: 0,\n lastTime: initialDefaultFrame\n };\n }\n frameNum *= this.elem.globalData.frameRate;\n frameNum -= this.offsetTime;\n if (frameNum !== this._cachingAtTime.lastTime) {\n this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0;\n this._cachingAtTime.lastTime = frameNum;\n this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime);\n }\n return this._cachingAtTime.shapeValue;\n }\n var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction();\n var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction();\n function ShapeExpressions() {}\n ShapeExpressions.prototype = {\n vertices: function vertices(prop, time) {\n if (this.k) {\n this.getValue();\n }\n var shapePath = this.v;\n if (time !== undefined) {\n shapePath = this.getValueAtTime(time, 0);\n }\n var i;\n var len = shapePath._length;\n var vertices = shapePath[prop];\n var points = shapePath.v;\n var arr = createSizedArray(len);\n for (i = 0; i < len; i += 1) {\n if (prop === 'i' || prop === 'o') {\n arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]];\n } else {\n arr[i] = [vertices[i][0], vertices[i][1]];\n }\n }\n return arr;\n },\n points: function points(time) {\n return this.vertices('v', time);\n },\n inTangents: function inTangents(time) {\n return this.vertices('i', time);\n },\n outTangents: function outTangents(time) {\n return this.vertices('o', time);\n },\n isClosed: function isClosed() {\n return this.v.c;\n },\n pointOnPath: function pointOnPath(perc, time) {\n var shapePath = this.v;\n if (time !== undefined) {\n shapePath = this.getValueAtTime(time, 0);\n }\n if (!this._segmentsLength) {\n this._segmentsLength = bez.getSegmentsLength(shapePath);\n }\n var segmentsLength = this._segmentsLength;\n var lengths = segmentsLength.lengths;\n var lengthPos = segmentsLength.totalLength * perc;\n var i = 0;\n var len = lengths.length;\n var accumulatedLength = 0;\n var pt;\n while (i < len) {\n if (accumulatedLength + lengths[i].addedLength > lengthPos) {\n var initIndex = i;\n var endIndex = shapePath.c && i === len - 1 ? 0 : i + 1;\n var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength;\n pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]);\n break;\n } else {\n accumulatedLength += lengths[i].addedLength;\n }\n i += 1;\n }\n if (!pt) {\n pt = shapePath.c ? [shapePath.v[0][0], shapePath.v[0][1]] : [shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1]];\n }\n return pt;\n },\n vectorOnPath: function vectorOnPath(perc, time, vectorType) {\n // perc doesn't use triple equality because it can be a Number object as well as a primitive.\n if (perc == 1) {\n // eslint-disable-line eqeqeq\n perc = this.v.c;\n } else if (perc == 0) {\n // eslint-disable-line eqeqeq\n perc = 0.999;\n }\n var pt1 = this.pointOnPath(perc, time);\n var pt2 = this.pointOnPath(perc + 0.001, time);\n var xLength = pt2[0] - pt1[0];\n var yLength = pt2[1] - pt1[1];\n var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2));\n if (magnitude === 0) {\n return [0, 0];\n }\n var unitVector = vectorType === 'tangent' ? [xLength / magnitude, yLength / magnitude] : [-yLength / magnitude, xLength / magnitude];\n return unitVector;\n },\n tangentOnPath: function tangentOnPath(perc, time) {\n return this.vectorOnPath(perc, time, 'tangent');\n },\n normalOnPath: function normalOnPath(perc, time) {\n return this.vectorOnPath(perc, time, 'normal');\n },\n setGroupProperty: expressionHelpers.setGroupProperty,\n getValueAtTime: expressionHelpers.getStaticValueAtTime\n };\n extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction);\n extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction);\n KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime;\n KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression;\n var propertyGetShapeProp = ShapePropertyFactory.getShapeProp;\n ShapePropertyFactory.getShapeProp = function (elem, data, type, arr, trims) {\n var prop = propertyGetShapeProp(elem, data, type, arr, trims);\n prop.propertyIndex = data.ix;\n prop.lock = false;\n if (type === 3) {\n expressionHelpers.searchExpressions(elem, data.pt, prop);\n } else if (type === 4) {\n expressionHelpers.searchExpressions(elem, data.ks, prop);\n }\n if (prop.k) {\n elem.addDynamicProperty(prop);\n }\n return prop;\n };\n }\n function initialize$1() {\n addPropertyDecorator();\n }\n function addDecorator() {\n function searchExpressions() {\n if (this.data.d.x) {\n this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this);\n this.addEffect(this.getExpressionValue.bind(this));\n return true;\n }\n return null;\n }\n TextProperty.prototype.getExpressionValue = function (currentValue, text) {\n var newValue = this.calculateExpression(text);\n if (currentValue.t !== newValue) {\n var newData = {};\n this.copyData(newData, currentValue);\n newData.t = newValue.toString();\n newData.__complete = false;\n return newData;\n }\n return currentValue;\n };\n TextProperty.prototype.searchProperty = function () {\n var isKeyframed = this.searchKeyframes();\n var hasExpressions = this.searchExpressions();\n this.kf = isKeyframed || hasExpressions;\n return this.kf;\n };\n TextProperty.prototype.searchExpressions = searchExpressions;\n }\n function initialize() {\n addDecorator();\n }\n function SVGComposableEffect() {}\n SVGComposableEffect.prototype = {\n createMergeNode: function createMergeNode(resultId, ins) {\n var feMerge = createNS('feMerge');\n feMerge.setAttribute('result', resultId);\n var feMergeNode;\n var i;\n for (i = 0; i < ins.length; i += 1) {\n feMergeNode = createNS('feMergeNode');\n feMergeNode.setAttribute('in', ins[i]);\n feMerge.appendChild(feMergeNode);\n feMerge.appendChild(feMergeNode);\n }\n return feMerge;\n }\n };\n var linearFilterValue = '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0';\n function SVGTintFilter(filter, filterManager, elem, id, source) {\n this.filterManager = filterManager;\n var feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');\n feColorMatrix.setAttribute('values', linearFilterValue + ' 1 0');\n this.linearFilter = feColorMatrix;\n feColorMatrix.setAttribute('result', id + '_tint_1');\n filter.appendChild(feColorMatrix);\n feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\n feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');\n feColorMatrix.setAttribute('result', id + '_tint_2');\n filter.appendChild(feColorMatrix);\n this.matrixFilter = feColorMatrix;\n var feMerge = this.createMergeNode(id, [source, id + '_tint_1', id + '_tint_2']);\n filter.appendChild(feMerge);\n }\n extendPrototype([SVGComposableEffect], SVGTintFilter);\n SVGTintFilter.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n var colorBlack = this.filterManager.effectElements[0].p.v;\n var colorWhite = this.filterManager.effectElements[1].p.v;\n var opacity = this.filterManager.effectElements[2].p.v / 100;\n this.linearFilter.setAttribute('values', linearFilterValue + ' ' + opacity + ' 0');\n this.matrixFilter.setAttribute('values', colorWhite[0] - colorBlack[0] + ' 0 0 0 ' + colorBlack[0] + ' ' + (colorWhite[1] - colorBlack[1]) + ' 0 0 0 ' + colorBlack[1] + ' ' + (colorWhite[2] - colorBlack[2]) + ' 0 0 0 ' + colorBlack[2] + ' 0 0 0 1 0');\n }\n };\n function SVGFillFilter(filter, filterManager, elem, id) {\n this.filterManager = filterManager;\n var feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\n feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');\n feColorMatrix.setAttribute('result', id);\n filter.appendChild(feColorMatrix);\n this.matrixFilter = feColorMatrix;\n }\n SVGFillFilter.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n var color = this.filterManager.effectElements[2].p.v;\n var opacity = this.filterManager.effectElements[6].p.v;\n this.matrixFilter.setAttribute('values', '0 0 0 0 ' + color[0] + ' 0 0 0 0 ' + color[1] + ' 0 0 0 0 ' + color[2] + ' 0 0 0 ' + opacity + ' 0');\n }\n };\n function SVGStrokeEffect(fil, filterManager, elem) {\n this.initialized = false;\n this.filterManager = filterManager;\n this.elem = elem;\n this.paths = [];\n }\n SVGStrokeEffect.prototype.initialize = function () {\n var elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;\n var path;\n var groupPath;\n var i;\n var len;\n if (this.filterManager.effectElements[1].p.v === 1) {\n len = this.elem.maskManager.masksProperties.length;\n i = 0;\n } else {\n i = this.filterManager.effectElements[0].p.v - 1;\n len = i + 1;\n }\n groupPath = createNS('g');\n groupPath.setAttribute('fill', 'none');\n groupPath.setAttribute('stroke-linecap', 'round');\n groupPath.setAttribute('stroke-dashoffset', 1);\n for (i; i < len; i += 1) {\n path = createNS('path');\n groupPath.appendChild(path);\n this.paths.push({\n p: path,\n m: i\n });\n }\n if (this.filterManager.effectElements[10].p.v === 3) {\n var mask = createNS('mask');\n var id = createElementID();\n mask.setAttribute('id', id);\n mask.setAttribute('mask-type', 'alpha');\n mask.appendChild(groupPath);\n this.elem.globalData.defs.appendChild(mask);\n var g = createNS('g');\n g.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')');\n while (elemChildren[0]) {\n g.appendChild(elemChildren[0]);\n }\n this.elem.layerElement.appendChild(g);\n this.masker = mask;\n groupPath.setAttribute('stroke', '#fff');\n } else if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {\n if (this.filterManager.effectElements[10].p.v === 2) {\n elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;\n while (elemChildren.length) {\n this.elem.layerElement.removeChild(elemChildren[0]);\n }\n }\n this.elem.layerElement.appendChild(groupPath);\n this.elem.layerElement.removeAttribute('mask');\n groupPath.setAttribute('stroke', '#fff');\n }\n this.initialized = true;\n this.pathMasker = groupPath;\n };\n SVGStrokeEffect.prototype.renderFrame = function (forceRender) {\n if (!this.initialized) {\n this.initialize();\n }\n var i;\n var len = this.paths.length;\n var mask;\n var path;\n for (i = 0; i < len; i += 1) {\n if (this.paths[i].m !== -1) {\n mask = this.elem.maskManager.viewData[this.paths[i].m];\n path = this.paths[i].p;\n if (forceRender || this.filterManager._mdf || mask.prop._mdf) {\n path.setAttribute('d', mask.lastPath);\n }\n if (forceRender || this.filterManager.effectElements[9].p._mdf || this.filterManager.effectElements[4].p._mdf || this.filterManager.effectElements[7].p._mdf || this.filterManager.effectElements[8].p._mdf || mask.prop._mdf) {\n var dasharrayValue;\n if (this.filterManager.effectElements[7].p.v !== 0 || this.filterManager.effectElements[8].p.v !== 100) {\n var s = Math.min(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) * 0.01;\n var e = Math.max(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) * 0.01;\n var l = path.getTotalLength();\n dasharrayValue = '0 0 0 ' + l * s + ' ';\n var lineLength = l * (e - s);\n var segment = 1 + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01;\n var units = Math.floor(lineLength / segment);\n var j;\n for (j = 0; j < units; j += 1) {\n dasharrayValue += '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01 + ' ';\n }\n dasharrayValue += '0 ' + l * 10 + ' 0 0';\n } else {\n dasharrayValue = '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01;\n }\n path.setAttribute('stroke-dasharray', dasharrayValue);\n }\n }\n }\n if (forceRender || this.filterManager.effectElements[4].p._mdf) {\n this.pathMasker.setAttribute('stroke-width', this.filterManager.effectElements[4].p.v * 2);\n }\n if (forceRender || this.filterManager.effectElements[6].p._mdf) {\n this.pathMasker.setAttribute('opacity', this.filterManager.effectElements[6].p.v);\n }\n if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {\n if (forceRender || this.filterManager.effectElements[3].p._mdf) {\n var color = this.filterManager.effectElements[3].p.v;\n this.pathMasker.setAttribute('stroke', 'rgb(' + bmFloor(color[0] * 255) + ',' + bmFloor(color[1] * 255) + ',' + bmFloor(color[2] * 255) + ')');\n }\n }\n };\n function SVGTritoneFilter(filter, filterManager, elem, id) {\n this.filterManager = filterManager;\n var feColorMatrix = createNS('feColorMatrix');\n feColorMatrix.setAttribute('type', 'matrix');\n feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');\n feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');\n filter.appendChild(feColorMatrix);\n var feComponentTransfer = createNS('feComponentTransfer');\n feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\n feComponentTransfer.setAttribute('result', id);\n this.matrixFilter = feComponentTransfer;\n var feFuncR = createNS('feFuncR');\n feFuncR.setAttribute('type', 'table');\n feComponentTransfer.appendChild(feFuncR);\n this.feFuncR = feFuncR;\n var feFuncG = createNS('feFuncG');\n feFuncG.setAttribute('type', 'table');\n feComponentTransfer.appendChild(feFuncG);\n this.feFuncG = feFuncG;\n var feFuncB = createNS('feFuncB');\n feFuncB.setAttribute('type', 'table');\n feComponentTransfer.appendChild(feFuncB);\n this.feFuncB = feFuncB;\n filter.appendChild(feComponentTransfer);\n }\n SVGTritoneFilter.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n var color1 = this.filterManager.effectElements[0].p.v;\n var color2 = this.filterManager.effectElements[1].p.v;\n var color3 = this.filterManager.effectElements[2].p.v;\n var tableR = color3[0] + ' ' + color2[0] + ' ' + color1[0];\n var tableG = color3[1] + ' ' + color2[1] + ' ' + color1[1];\n var tableB = color3[2] + ' ' + color2[2] + ' ' + color1[2];\n this.feFuncR.setAttribute('tableValues', tableR);\n this.feFuncG.setAttribute('tableValues', tableG);\n this.feFuncB.setAttribute('tableValues', tableB);\n }\n };\n function SVGProLevelsFilter(filter, filterManager, elem, id) {\n this.filterManager = filterManager;\n var effectElements = this.filterManager.effectElements;\n var feComponentTransfer = createNS('feComponentTransfer'); // Red\n\n if (effectElements[10].p.k || effectElements[10].p.v !== 0 || effectElements[11].p.k || effectElements[11].p.v !== 1 || effectElements[12].p.k || effectElements[12].p.v !== 1 || effectElements[13].p.k || effectElements[13].p.v !== 0 || effectElements[14].p.k || effectElements[14].p.v !== 1) {\n this.feFuncR = this.createFeFunc('feFuncR', feComponentTransfer);\n } // Green\n\n if (effectElements[17].p.k || effectElements[17].p.v !== 0 || effectElements[18].p.k || effectElements[18].p.v !== 1 || effectElements[19].p.k || effectElements[19].p.v !== 1 || effectElements[20].p.k || effectElements[20].p.v !== 0 || effectElements[21].p.k || effectElements[21].p.v !== 1) {\n this.feFuncG = this.createFeFunc('feFuncG', feComponentTransfer);\n } // Blue\n\n if (effectElements[24].p.k || effectElements[24].p.v !== 0 || effectElements[25].p.k || effectElements[25].p.v !== 1 || effectElements[26].p.k || effectElements[26].p.v !== 1 || effectElements[27].p.k || effectElements[27].p.v !== 0 || effectElements[28].p.k || effectElements[28].p.v !== 1) {\n this.feFuncB = this.createFeFunc('feFuncB', feComponentTransfer);\n } // Alpha\n\n if (effectElements[31].p.k || effectElements[31].p.v !== 0 || effectElements[32].p.k || effectElements[32].p.v !== 1 || effectElements[33].p.k || effectElements[33].p.v !== 1 || effectElements[34].p.k || effectElements[34].p.v !== 0 || effectElements[35].p.k || effectElements[35].p.v !== 1) {\n this.feFuncA = this.createFeFunc('feFuncA', feComponentTransfer);\n } // RGB\n\n if (this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA) {\n feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\n filter.appendChild(feComponentTransfer);\n }\n if (effectElements[3].p.k || effectElements[3].p.v !== 0 || effectElements[4].p.k || effectElements[4].p.v !== 1 || effectElements[5].p.k || effectElements[5].p.v !== 1 || effectElements[6].p.k || effectElements[6].p.v !== 0 || effectElements[7].p.k || effectElements[7].p.v !== 1) {\n feComponentTransfer = createNS('feComponentTransfer');\n feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\n feComponentTransfer.setAttribute('result', id);\n filter.appendChild(feComponentTransfer);\n this.feFuncRComposed = this.createFeFunc('feFuncR', feComponentTransfer);\n this.feFuncGComposed = this.createFeFunc('feFuncG', feComponentTransfer);\n this.feFuncBComposed = this.createFeFunc('feFuncB', feComponentTransfer);\n }\n }\n SVGProLevelsFilter.prototype.createFeFunc = function (type, feComponentTransfer) {\n var feFunc = createNS(type);\n feFunc.setAttribute('type', 'table');\n feComponentTransfer.appendChild(feFunc);\n return feFunc;\n };\n SVGProLevelsFilter.prototype.getTableValue = function (inputBlack, inputWhite, gamma, outputBlack, outputWhite) {\n var cnt = 0;\n var segments = 256;\n var perc;\n var min = Math.min(inputBlack, inputWhite);\n var max = Math.max(inputBlack, inputWhite);\n var table = Array.call(null, {\n length: segments\n });\n var colorValue;\n var pos = 0;\n var outputDelta = outputWhite - outputBlack;\n var inputDelta = inputWhite - inputBlack;\n while (cnt <= 256) {\n perc = cnt / 256;\n if (perc <= min) {\n colorValue = inputDelta < 0 ? outputWhite : outputBlack;\n } else if (perc >= max) {\n colorValue = inputDelta < 0 ? outputBlack : outputWhite;\n } else {\n colorValue = outputBlack + outputDelta * Math.pow((perc - inputBlack) / inputDelta, 1 / gamma);\n }\n table[pos] = colorValue;\n pos += 1;\n cnt += 256 / (segments - 1);\n }\n return table.join(' ');\n };\n SVGProLevelsFilter.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n var val;\n var effectElements = this.filterManager.effectElements;\n if (this.feFuncRComposed && (forceRender || effectElements[3].p._mdf || effectElements[4].p._mdf || effectElements[5].p._mdf || effectElements[6].p._mdf || effectElements[7].p._mdf)) {\n val = this.getTableValue(effectElements[3].p.v, effectElements[4].p.v, effectElements[5].p.v, effectElements[6].p.v, effectElements[7].p.v);\n this.feFuncRComposed.setAttribute('tableValues', val);\n this.feFuncGComposed.setAttribute('tableValues', val);\n this.feFuncBComposed.setAttribute('tableValues', val);\n }\n if (this.feFuncR && (forceRender || effectElements[10].p._mdf || effectElements[11].p._mdf || effectElements[12].p._mdf || effectElements[13].p._mdf || effectElements[14].p._mdf)) {\n val = this.getTableValue(effectElements[10].p.v, effectElements[11].p.v, effectElements[12].p.v, effectElements[13].p.v, effectElements[14].p.v);\n this.feFuncR.setAttribute('tableValues', val);\n }\n if (this.feFuncG && (forceRender || effectElements[17].p._mdf || effectElements[18].p._mdf || effectElements[19].p._mdf || effectElements[20].p._mdf || effectElements[21].p._mdf)) {\n val = this.getTableValue(effectElements[17].p.v, effectElements[18].p.v, effectElements[19].p.v, effectElements[20].p.v, effectElements[21].p.v);\n this.feFuncG.setAttribute('tableValues', val);\n }\n if (this.feFuncB && (forceRender || effectElements[24].p._mdf || effectElements[25].p._mdf || effectElements[26].p._mdf || effectElements[27].p._mdf || effectElements[28].p._mdf)) {\n val = this.getTableValue(effectElements[24].p.v, effectElements[25].p.v, effectElements[26].p.v, effectElements[27].p.v, effectElements[28].p.v);\n this.feFuncB.setAttribute('tableValues', val);\n }\n if (this.feFuncA && (forceRender || effectElements[31].p._mdf || effectElements[32].p._mdf || effectElements[33].p._mdf || effectElements[34].p._mdf || effectElements[35].p._mdf)) {\n val = this.getTableValue(effectElements[31].p.v, effectElements[32].p.v, effectElements[33].p.v, effectElements[34].p.v, effectElements[35].p.v);\n this.feFuncA.setAttribute('tableValues', val);\n }\n }\n };\n function SVGDropShadowEffect(filter, filterManager, elem, id, source) {\n var globalFilterSize = filterManager.container.globalData.renderConfig.filterSize;\n var filterSize = filterManager.data.fs || globalFilterSize;\n filter.setAttribute('x', filterSize.x || globalFilterSize.x);\n filter.setAttribute('y', filterSize.y || globalFilterSize.y);\n filter.setAttribute('width', filterSize.width || globalFilterSize.width);\n filter.setAttribute('height', filterSize.height || globalFilterSize.height);\n this.filterManager = filterManager;\n var feGaussianBlur = createNS('feGaussianBlur');\n feGaussianBlur.setAttribute('in', 'SourceAlpha');\n feGaussianBlur.setAttribute('result', id + '_drop_shadow_1');\n feGaussianBlur.setAttribute('stdDeviation', '0');\n this.feGaussianBlur = feGaussianBlur;\n filter.appendChild(feGaussianBlur);\n var feOffset = createNS('feOffset');\n feOffset.setAttribute('dx', '25');\n feOffset.setAttribute('dy', '0');\n feOffset.setAttribute('in', id + '_drop_shadow_1');\n feOffset.setAttribute('result', id + '_drop_shadow_2');\n this.feOffset = feOffset;\n filter.appendChild(feOffset);\n var feFlood = createNS('feFlood');\n feFlood.setAttribute('flood-color', '#00ff00');\n feFlood.setAttribute('flood-opacity', '1');\n feFlood.setAttribute('result', id + '_drop_shadow_3');\n this.feFlood = feFlood;\n filter.appendChild(feFlood);\n var feComposite = createNS('feComposite');\n feComposite.setAttribute('in', id + '_drop_shadow_3');\n feComposite.setAttribute('in2', id + '_drop_shadow_2');\n feComposite.setAttribute('operator', 'in');\n feComposite.setAttribute('result', id + '_drop_shadow_4');\n filter.appendChild(feComposite);\n var feMerge = this.createMergeNode(id, [id + '_drop_shadow_4', source]);\n filter.appendChild(feMerge); //\n }\n extendPrototype([SVGComposableEffect], SVGDropShadowEffect);\n SVGDropShadowEffect.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n if (forceRender || this.filterManager.effectElements[4].p._mdf) {\n this.feGaussianBlur.setAttribute('stdDeviation', this.filterManager.effectElements[4].p.v / 4);\n }\n if (forceRender || this.filterManager.effectElements[0].p._mdf) {\n var col = this.filterManager.effectElements[0].p.v;\n this.feFlood.setAttribute('flood-color', rgbToHex(Math.round(col[0] * 255), Math.round(col[1] * 255), Math.round(col[2] * 255)));\n }\n if (forceRender || this.filterManager.effectElements[1].p._mdf) {\n this.feFlood.setAttribute('flood-opacity', this.filterManager.effectElements[1].p.v / 255);\n }\n if (forceRender || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf) {\n var distance = this.filterManager.effectElements[3].p.v;\n var angle = (this.filterManager.effectElements[2].p.v - 90) * degToRads;\n var x = distance * Math.cos(angle);\n var y = distance * Math.sin(angle);\n this.feOffset.setAttribute('dx', x);\n this.feOffset.setAttribute('dy', y);\n }\n }\n };\n var _svgMatteSymbols = [];\n function SVGMatte3Effect(filterElem, filterManager, elem) {\n this.initialized = false;\n this.filterManager = filterManager;\n this.filterElem = filterElem;\n this.elem = elem;\n elem.matteElement = createNS('g');\n elem.matteElement.appendChild(elem.layerElement);\n elem.matteElement.appendChild(elem.transformedElement);\n elem.baseElement = elem.matteElement;\n }\n SVGMatte3Effect.prototype.findSymbol = function (mask) {\n var i = 0;\n var len = _svgMatteSymbols.length;\n while (i < len) {\n if (_svgMatteSymbols[i] === mask) {\n return _svgMatteSymbols[i];\n }\n i += 1;\n }\n return null;\n };\n SVGMatte3Effect.prototype.replaceInParent = function (mask, symbolId) {\n var parentNode = mask.layerElement.parentNode;\n if (!parentNode) {\n return;\n }\n var children = parentNode.children;\n var i = 0;\n var len = children.length;\n while (i < len) {\n if (children[i] === mask.layerElement) {\n break;\n }\n i += 1;\n }\n var nextChild;\n if (i <= len - 2) {\n nextChild = children[i + 1];\n }\n var useElem = createNS('use');\n useElem.setAttribute('href', '#' + symbolId);\n if (nextChild) {\n parentNode.insertBefore(useElem, nextChild);\n } else {\n parentNode.appendChild(useElem);\n }\n };\n SVGMatte3Effect.prototype.setElementAsMask = function (elem, mask) {\n if (!this.findSymbol(mask)) {\n var symbolId = createElementID();\n var masker = createNS('mask');\n masker.setAttribute('id', mask.layerId);\n masker.setAttribute('mask-type', 'alpha');\n _svgMatteSymbols.push(mask);\n var defs = elem.globalData.defs;\n defs.appendChild(masker);\n var symbol = createNS('symbol');\n symbol.setAttribute('id', symbolId);\n this.replaceInParent(mask, symbolId);\n symbol.appendChild(mask.layerElement);\n defs.appendChild(symbol);\n var useElem = createNS('use');\n useElem.setAttribute('href', '#' + symbolId);\n masker.appendChild(useElem);\n mask.data.hd = false;\n mask.show();\n }\n elem.setMatte(mask.layerId);\n };\n SVGMatte3Effect.prototype.initialize = function () {\n var ind = this.filterManager.effectElements[0].p.v;\n var elements = this.elem.comp.elements;\n var i = 0;\n var len = elements.length;\n while (i < len) {\n if (elements[i] && elements[i].data.ind === ind) {\n this.setElementAsMask(this.elem, elements[i]);\n }\n i += 1;\n }\n this.initialized = true;\n };\n SVGMatte3Effect.prototype.renderFrame = function () {\n if (!this.initialized) {\n this.initialize();\n }\n };\n function SVGGaussianBlurEffect(filter, filterManager, elem, id) {\n // Outset the filter region by 100% on all sides to accommodate blur expansion.\n filter.setAttribute('x', '-100%');\n filter.setAttribute('y', '-100%');\n filter.setAttribute('width', '300%');\n filter.setAttribute('height', '300%');\n this.filterManager = filterManager;\n var feGaussianBlur = createNS('feGaussianBlur');\n feGaussianBlur.setAttribute('result', id);\n filter.appendChild(feGaussianBlur);\n this.feGaussianBlur = feGaussianBlur;\n }\n SVGGaussianBlurEffect.prototype.renderFrame = function (forceRender) {\n if (forceRender || this.filterManager._mdf) {\n // Empirical value, matching AE's blur appearance.\n var kBlurrinessToSigma = 0.3;\n var sigma = this.filterManager.effectElements[0].p.v * kBlurrinessToSigma; // Dimensions mapping:\n //\n // 1 -> horizontal & vertical\n // 2 -> horizontal only\n // 3 -> vertical only\n //\n\n var dimensions = this.filterManager.effectElements[1].p.v;\n var sigmaX = dimensions == 3 ? 0 : sigma; // eslint-disable-line eqeqeq\n\n var sigmaY = dimensions == 2 ? 0 : sigma; // eslint-disable-line eqeqeq\n\n this.feGaussianBlur.setAttribute('stdDeviation', sigmaX + ' ' + sigmaY); // Repeat edges mapping:\n //\n // 0 -> off -> duplicate\n // 1 -> on -> wrap\n\n var edgeMode = this.filterManager.effectElements[2].p.v == 1 ? 'wrap' : 'duplicate'; // eslint-disable-line eqeqeq\n\n this.feGaussianBlur.setAttribute('edgeMode', edgeMode);\n }\n };\n function TransformEffect() {}\n TransformEffect.prototype.init = function (effectsManager) {\n this.effectsManager = effectsManager;\n this.type = effectTypes.TRANSFORM_EFFECT;\n this.matrix = new Matrix();\n this.opacity = -1;\n this._mdf = false;\n this._opMdf = false;\n };\n TransformEffect.prototype.renderFrame = function (forceFrame) {\n this._opMdf = false;\n this._mdf = false;\n if (forceFrame || this.effectsManager._mdf) {\n var effectElements = this.effectsManager.effectElements;\n var anchor = effectElements[0].p.v;\n var position = effectElements[1].p.v;\n var isUniformScale = effectElements[2].p.v === 1;\n var scaleHeight = effectElements[3].p.v;\n var scaleWidth = isUniformScale ? scaleHeight : effectElements[4].p.v;\n var skew = effectElements[5].p.v;\n var skewAxis = effectElements[6].p.v;\n var rotation = effectElements[7].p.v;\n this.matrix.reset();\n this.matrix.translate(-anchor[0], -anchor[1], anchor[2]);\n this.matrix.scale(scaleWidth * 0.01, scaleHeight * 0.01, 1);\n this.matrix.rotate(-rotation * degToRads);\n this.matrix.skewFromAxis(-skew * degToRads, (skewAxis + 90) * degToRads);\n this.matrix.translate(position[0], position[1], 0);\n this._mdf = true;\n if (this.opacity !== effectElements[8].p.v) {\n this.opacity = effectElements[8].p.v;\n this._opMdf = true;\n }\n }\n };\n function SVGTransformEffect(_, filterManager) {\n this.init(filterManager);\n }\n extendPrototype([TransformEffect], SVGTransformEffect);\n function CVTransformEffect(effectsManager) {\n this.init(effectsManager);\n }\n extendPrototype([TransformEffect], CVTransformEffect);\n registerRenderer('canvas', CanvasRenderer);\n registerRenderer('html', HybridRenderer);\n registerRenderer('svg', SVGRenderer); // Registering shape modifiers\n\n ShapeModifiers.registerModifier('tm', TrimModifier);\n ShapeModifiers.registerModifier('pb', PuckerAndBloatModifier);\n ShapeModifiers.registerModifier('rp', RepeaterModifier);\n ShapeModifiers.registerModifier('rd', RoundCornersModifier);\n ShapeModifiers.registerModifier('zz', ZigZagModifier);\n ShapeModifiers.registerModifier('op', OffsetPathModifier); // Registering expression plugin\n\n setExpressionsPlugin(Expressions);\n setExpressionInterfaces(getInterface);\n initialize$1();\n initialize(); // Registering svg effects\n\n registerEffect$1(20, SVGTintFilter, true);\n registerEffect$1(21, SVGFillFilter, true);\n registerEffect$1(22, SVGStrokeEffect, false);\n registerEffect$1(23, SVGTritoneFilter, true);\n registerEffect$1(24, SVGProLevelsFilter, true);\n registerEffect$1(25, SVGDropShadowEffect, true);\n registerEffect$1(28, SVGMatte3Effect, false);\n registerEffect$1(29, SVGGaussianBlurEffect, true);\n registerEffect$1(35, SVGTransformEffect, false);\n registerEffect(35, CVTransformEffect);\n return lottie;\n});","/**\n * @license Angular v17.3.12\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\n/**\n * The default equality function used for `signal` and `computed`, which uses referential equality.\n */\nfunction defaultEquals(a, b) {\n return Object.is(a, b);\n}\n\n/**\n * The currently active consumer `ReactiveNode`, if running code in a reactive context.\n *\n * Change this via `setActiveConsumer`.\n */\nlet activeConsumer = null;\nlet inNotificationPhase = false;\n/**\n * Global epoch counter. Incremented whenever a source signal is set.\n */\nlet epoch = 1;\n/**\n * Symbol used to tell `Signal`s apart from other functions.\n *\n * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.\n */\nconst SIGNAL = /* @__PURE__ */Symbol('SIGNAL');\nfunction setActiveConsumer(consumer) {\n const prev = activeConsumer;\n activeConsumer = consumer;\n return prev;\n}\nfunction getActiveConsumer() {\n return activeConsumer;\n}\nfunction isInNotificationPhase() {\n return inNotificationPhase;\n}\nfunction isReactive(value) {\n return value[SIGNAL] !== undefined;\n}\nconst REACTIVE_NODE = {\n version: 0,\n lastCleanEpoch: 0,\n dirty: false,\n producerNode: undefined,\n producerLastReadVersion: undefined,\n producerIndexOfThis: undefined,\n nextProducerIndex: 0,\n liveConsumerNode: undefined,\n liveConsumerIndexOfThis: undefined,\n consumerAllowSignalWrites: false,\n consumerIsAlwaysLive: false,\n producerMustRecompute: () => false,\n producerRecomputeValue: () => {},\n consumerMarkedDirty: () => {},\n consumerOnSignalRead: () => {}\n};\n/**\n * Called by implementations when a producer's signal is read.\n */\nfunction producerAccessed(node) {\n if (inNotificationPhase) {\n throw new Error(typeof ngDevMode !== 'undefined' && ngDevMode ? `Assertion error: signal read during notification phase` : '');\n }\n if (activeConsumer === null) {\n // Accessed outside of a reactive context, so nothing to record.\n return;\n }\n activeConsumer.consumerOnSignalRead(node);\n // This producer is the `idx`th dependency of `activeConsumer`.\n const idx = activeConsumer.nextProducerIndex++;\n assertConsumerNode(activeConsumer);\n if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {\n // There's been a change in producers since the last execution of `activeConsumer`.\n // `activeConsumer.producerNode[idx]` holds a stale dependency which will be be removed and\n // replaced with `this`.\n //\n // If `activeConsumer` isn't live, then this is a no-op, since we can replace the producer in\n // `activeConsumer.producerNode` directly. However, if `activeConsumer` is live, then we need\n // to remove it from the stale producer's `liveConsumer`s.\n if (consumerIsLive(activeConsumer)) {\n const staleProducer = activeConsumer.producerNode[idx];\n producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);\n // At this point, the only record of `staleProducer` is the reference at\n // `activeConsumer.producerNode[idx]` which will be overwritten below.\n }\n }\n if (activeConsumer.producerNode[idx] !== node) {\n // We're a new dependency of the consumer (at `idx`).\n activeConsumer.producerNode[idx] = node;\n // If the active consumer is live, then add it as a live consumer. If not, then use 0 as a\n // placeholder value.\n activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0;\n }\n activeConsumer.producerLastReadVersion[idx] = node.version;\n}\n/**\n * Increment the global epoch counter.\n *\n * Called by source producers (that is, not computeds) whenever their values change.\n */\nfunction producerIncrementEpoch() {\n epoch++;\n}\n/**\n * Ensure this producer's `version` is up-to-date.\n */\nfunction producerUpdateValueVersion(node) {\n if (consumerIsLive(node) && !node.dirty) {\n // A live consumer will be marked dirty by producers, so a clean state means that its version\n // is guaranteed to be up-to-date.\n return;\n }\n if (!node.dirty && node.lastCleanEpoch === epoch) {\n // Even non-live consumers can skip polling if they previously found themselves to be clean at\n // the current epoch, since their dependencies could not possibly have changed (such a change\n // would've increased the epoch).\n return;\n }\n if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {\n // None of our producers report a change since the last time they were read, so no\n // recomputation of our value is necessary, and we can consider ourselves clean.\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n return;\n }\n node.producerRecomputeValue(node);\n // After recomputing the value, we're no longer dirty.\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n}\n/**\n * Propagate a dirty notification to live consumers of this producer.\n */\nfunction producerNotifyConsumers(node) {\n if (node.liveConsumerNode === undefined) {\n return;\n }\n // Prevent signal reads when we're updating the graph\n const prev = inNotificationPhase;\n inNotificationPhase = true;\n try {\n for (const consumer of node.liveConsumerNode) {\n if (!consumer.dirty) {\n consumerMarkDirty(consumer);\n }\n }\n } finally {\n inNotificationPhase = prev;\n }\n}\n/**\n * Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,\n * based on the current consumer context.\n */\nfunction producerUpdatesAllowed() {\n return activeConsumer?.consumerAllowSignalWrites !== false;\n}\nfunction consumerMarkDirty(node) {\n node.dirty = true;\n producerNotifyConsumers(node);\n node.consumerMarkedDirty?.(node);\n}\n/**\n * Prepare this consumer to run a computation in its reactive context.\n *\n * Must be called by subclasses which represent reactive computations, before those computations\n * begin.\n */\nfunction consumerBeforeComputation(node) {\n node && (node.nextProducerIndex = 0);\n return setActiveConsumer(node);\n}\n/**\n * Finalize this consumer's state after a reactive computation has run.\n *\n * Must be called by subclasses which represent reactive computations, after those computations\n * have finished.\n */\nfunction consumerAfterComputation(node, prevConsumer) {\n setActiveConsumer(prevConsumer);\n if (!node || node.producerNode === undefined || node.producerIndexOfThis === undefined || node.producerLastReadVersion === undefined) {\n return;\n }\n if (consumerIsLive(node)) {\n // For live consumers, we need to remove the producer -> consumer edge for any stale producers\n // which weren't dependencies after the recomputation.\n for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n // Truncate the producer tracking arrays.\n // Perf note: this is essentially truncating the length to `node.nextProducerIndex`, but\n // benchmarking has shown that individual pop operations are faster.\n while (node.producerNode.length > node.nextProducerIndex) {\n node.producerNode.pop();\n node.producerLastReadVersion.pop();\n node.producerIndexOfThis.pop();\n }\n}\n/**\n * Determine whether this consumer has any dependencies which have changed since the last time\n * they were read.\n */\nfunction consumerPollProducersForChange(node) {\n assertConsumerNode(node);\n // Poll producers for change.\n for (let i = 0; i < node.producerNode.length; i++) {\n const producer = node.producerNode[i];\n const seenVersion = node.producerLastReadVersion[i];\n // First check the versions. A mismatch means that the producer's value is known to have\n // changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n // The producer's version is the same as the last time we read it, but it might itself be\n // stale. Force the producer to recompute its version (calculating a new value if necessary).\n producerUpdateValueVersion(producer);\n // Now when we do this check, `producer.version` is guaranteed to be up to date, so if the\n // versions still match then it has not changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n }\n return false;\n}\n/**\n * Disconnect this consumer from the graph.\n */\nfunction consumerDestroy(node) {\n assertConsumerNode(node);\n if (consumerIsLive(node)) {\n // Drop all connections from the graph to this node.\n for (let i = 0; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n // Truncate all the arrays to drop all connection from this node to the graph.\n node.producerNode.length = node.producerLastReadVersion.length = node.producerIndexOfThis.length = 0;\n if (node.liveConsumerNode) {\n node.liveConsumerNode.length = node.liveConsumerIndexOfThis.length = 0;\n }\n}\n/**\n * Add `consumer` as a live consumer of this node.\n *\n * Note that this operation is potentially transitive. If this node becomes live, then it becomes\n * a live consumer of all of its current producers.\n */\nfunction producerAddLiveConsumer(node, consumer, indexOfThis) {\n assertProducerNode(node);\n assertConsumerNode(node);\n if (node.liveConsumerNode.length === 0) {\n // When going from 0 to 1 live consumers, we become a live consumer to our producers.\n for (let i = 0; i < node.producerNode.length; i++) {\n node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i);\n }\n }\n node.liveConsumerIndexOfThis.push(indexOfThis);\n return node.liveConsumerNode.push(consumer) - 1;\n}\n/**\n * Remove the live consumer at `idx`.\n */\nfunction producerRemoveLiveConsumerAtIndex(node, idx) {\n assertProducerNode(node);\n assertConsumerNode(node);\n if (typeof ngDevMode !== 'undefined' && ngDevMode && idx >= node.liveConsumerNode.length) {\n throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`);\n }\n if (node.liveConsumerNode.length === 1) {\n // When removing the last live consumer, we will no longer be live. We need to remove\n // ourselves from our producers' tracking (which may cause consumer-producers to lose\n // liveness as well).\n for (let i = 0; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n // Move the last value of `liveConsumers` into `idx`. Note that if there's only a single\n // live consumer, this is a no-op.\n const lastIdx = node.liveConsumerNode.length - 1;\n node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];\n node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];\n // Truncate the array.\n node.liveConsumerNode.length--;\n node.liveConsumerIndexOfThis.length--;\n // If the index is still valid, then we need to fix the index pointer from the producer to this\n // consumer, and update it from `lastIdx` to `idx` (accounting for the move above).\n if (idx < node.liveConsumerNode.length) {\n const idxProducer = node.liveConsumerIndexOfThis[idx];\n const consumer = node.liveConsumerNode[idx];\n assertConsumerNode(consumer);\n consumer.producerIndexOfThis[idxProducer] = idx;\n }\n}\nfunction consumerIsLive(node) {\n return node.consumerIsAlwaysLive || (node?.liveConsumerNode?.length ?? 0) > 0;\n}\nfunction assertConsumerNode(node) {\n node.producerNode ??= [];\n node.producerIndexOfThis ??= [];\n node.producerLastReadVersion ??= [];\n}\nfunction assertProducerNode(node) {\n node.liveConsumerNode ??= [];\n node.liveConsumerIndexOfThis ??= [];\n}\n\n/**\n * Create a computed signal which derives a reactive value from an expression.\n */\nfunction createComputed(computation) {\n const node = Object.create(COMPUTED_NODE);\n node.computation = computation;\n const computed = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n // Record that someone looked at this signal.\n producerAccessed(node);\n if (node.value === ERRORED) {\n throw node.error;\n }\n return node.value;\n };\n computed[SIGNAL] = node;\n return computed;\n}\n/**\n * A dedicated symbol used before a computed value has been calculated for the first time.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst UNSET = /* @__PURE__ */Symbol('UNSET');\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * is in progress. Used to detect cycles in computation chains.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst COMPUTING = /* @__PURE__ */Symbol('COMPUTING');\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * failed. The thrown error is cached until the computation gets dirty again.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst ERRORED = /* @__PURE__ */Symbol('ERRORED');\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst COMPUTED_NODE = /* @__PURE__ */(() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n producerMustRecompute(node) {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n producerRecomputeValue(node) {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error('Detected cycle in computations.');\n }\n const oldValue = node.value;\n node.value = COMPUTING;\n const prevConsumer = consumerBeforeComputation(node);\n let newValue;\n try {\n newValue = node.computation();\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n if (oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED && node.equal(oldValue, newValue)) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n node.value = newValue;\n node.version++;\n }\n };\n})();\nfunction defaultThrowError() {\n throw new Error();\n}\nlet throwInvalidWriteToSignalErrorFn = defaultThrowError;\nfunction throwInvalidWriteToSignalError() {\n throwInvalidWriteToSignalErrorFn();\n}\nfunction setThrowInvalidWriteToSignalError(fn) {\n throwInvalidWriteToSignalErrorFn = fn;\n}\n\n/**\n * If set, called after `WritableSignal`s are updated.\n *\n * This hook can be used to achieve various effects, such as running effects synchronously as part\n * of setting a signal.\n */\nlet postSignalSetFn = null;\n/**\n * Create a `Signal` that can be set or updated directly.\n */\nfunction createSignal(initialValue) {\n const node = Object.create(SIGNAL_NODE);\n node.value = initialValue;\n const getter = () => {\n producerAccessed(node);\n return node.value;\n };\n getter[SIGNAL] = node;\n return getter;\n}\nfunction setPostSignalSetFn(fn) {\n const prev = postSignalSetFn;\n postSignalSetFn = fn;\n return prev;\n}\nfunction signalGetFn() {\n producerAccessed(this);\n return this.value;\n}\nfunction signalSetFn(node, newValue) {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError();\n }\n if (!node.equal(node.value, newValue)) {\n node.value = newValue;\n signalValueChanged(node);\n }\n}\nfunction signalUpdateFn(node, updater) {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError();\n }\n signalSetFn(node, updater(node.value));\n}\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst SIGNAL_NODE = /* @__PURE__ */(() => {\n return {\n ...REACTIVE_NODE,\n equal: defaultEquals,\n value: undefined\n };\n})();\nfunction signalValueChanged(node) {\n node.version++;\n producerIncrementEpoch();\n producerNotifyConsumers(node);\n postSignalSetFn?.();\n}\nfunction createWatch(fn, schedule, allowSignalWrites) {\n const node = Object.create(WATCH_NODE);\n if (allowSignalWrites) {\n node.consumerAllowSignalWrites = true;\n }\n node.fn = fn;\n node.schedule = schedule;\n const registerOnCleanup = cleanupFn => {\n node.cleanupFn = cleanupFn;\n };\n function isWatchNodeDestroyed(node) {\n return node.fn === null && node.schedule === null;\n }\n function destroyWatchNode(node) {\n if (!isWatchNodeDestroyed(node)) {\n consumerDestroy(node); // disconnect watcher from the reactive graph\n node.cleanupFn();\n // nullify references to the integration functions to mark node as destroyed\n node.fn = null;\n node.schedule = null;\n node.cleanupFn = NOOP_CLEANUP_FN;\n }\n }\n const run = () => {\n if (node.fn === null) {\n // trying to run a destroyed watch is noop\n return;\n }\n if (isInNotificationPhase()) {\n throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);\n }\n node.dirty = false;\n if (node.hasRun && !consumerPollProducersForChange(node)) {\n return;\n }\n node.hasRun = true;\n const prevConsumer = consumerBeforeComputation(node);\n try {\n node.cleanupFn();\n node.cleanupFn = NOOP_CLEANUP_FN;\n node.fn(registerOnCleanup);\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n };\n node.ref = {\n notify: () => consumerMarkDirty(node),\n run,\n cleanup: () => node.cleanupFn(),\n destroy: () => destroyWatchNode(node),\n [SIGNAL]: node\n };\n return node.ref;\n}\nconst NOOP_CLEANUP_FN = () => {};\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst WATCH_NODE = /* @__PURE__ */(() => {\n return {\n ...REACTIVE_NODE,\n consumerIsAlwaysLive: true,\n consumerAllowSignalWrites: false,\n consumerMarkedDirty: node => {\n if (node.schedule !== null) {\n node.schedule(node.ref);\n }\n },\n hasRun: false,\n cleanupFn: NOOP_CLEANUP_FN\n };\n})();\nfunction setAlternateWeakRefImpl(impl) {\n // TODO: remove this function\n}\nexport { REACTIVE_NODE, SIGNAL, SIGNAL_NODE, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerMarkDirty, consumerPollProducersForChange, createComputed, createSignal, createWatch, defaultEquals, getActiveConsumer, isInNotificationPhase, isReactive, producerAccessed, producerNotifyConsumers, producerUpdateValueVersion, producerUpdatesAllowed, setActiveConsumer, setAlternateWeakRefImpl, setPostSignalSetFn, setThrowInvalidWriteToSignalError, signalSetFn, signalUpdateFn };\n","export function isFunction(value) {\n return typeof value === 'function';\n}\n","export function createErrorClass(createImpl) {\n const _super = instance => {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n const ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n","import { createErrorClass } from './createErrorClass';\nexport const UnsubscriptionError = createErrorClass(_super => function UnsubscriptionErrorImpl(errors) {\n _super(this);\n this.message = errors ? `${errors.length} errors occurred during unsubscription:\n${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\\n ')}` : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n});\n","export function arrRemove(arr, item) {\n if (arr) {\n const index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { arrRemove } from './util/arrRemove';\nexport class Subscription {\n constructor(initialTeardown) {\n this.initialTeardown = initialTeardown;\n this.closed = false;\n this._parentage = null;\n this._finalizers = null;\n }\n unsubscribe() {\n let errors;\n if (!this.closed) {\n this.closed = true;\n const {\n _parentage\n } = this;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n for (const parent of _parentage) {\n parent.remove(this);\n }\n } else {\n _parentage.remove(this);\n }\n }\n const {\n initialTeardown: initialFinalizer\n } = this;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n } catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n const {\n _finalizers\n } = this;\n if (_finalizers) {\n this._finalizers = null;\n for (const finalizer of _finalizers) {\n try {\n execFinalizer(finalizer);\n } catch (err) {\n errors = errors !== null && errors !== void 0 ? errors : [];\n if (err instanceof UnsubscriptionError) {\n errors = [...errors, ...err.errors];\n } else {\n errors.push(err);\n }\n }\n }\n }\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n }\n add(teardown) {\n var _a;\n if (teardown && teardown !== this) {\n if (this.closed) {\n execFinalizer(teardown);\n } else {\n if (teardown instanceof Subscription) {\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);\n }\n }\n }\n _hasParent(parent) {\n const {\n _parentage\n } = this;\n return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);\n }\n _addParent(parent) {\n const {\n _parentage\n } = this;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n }\n _removeParent(parent) {\n const {\n _parentage\n } = this;\n if (_parentage === parent) {\n this._parentage = null;\n } else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n }\n remove(teardown) {\n const {\n _finalizers\n } = this;\n _finalizers && arrRemove(_finalizers, teardown);\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n }\n}\nSubscription.EMPTY = (() => {\n const empty = new Subscription();\n empty.closed = true;\n return empty;\n})();\nexport const EMPTY_SUBSCRIPTION = Subscription.EMPTY;\nexport function isSubscription(value) {\n return value instanceof Subscription || value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);\n}\nfunction execFinalizer(finalizer) {\n if (isFunction(finalizer)) {\n finalizer();\n } else {\n finalizer.unsubscribe();\n }\n}\n","export const config = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false\n};\n","export const timeoutProvider = {\n setTimeout(handler, timeout, ...args) {\n const {\n delegate\n } = timeoutProvider;\n if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {\n return delegate.setTimeout(handler, timeout, ...args);\n }\n return setTimeout(handler, timeout, ...args);\n },\n clearTimeout(handle) {\n const {\n delegate\n } = timeoutProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);\n },\n delegate: undefined\n};\n","import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\nexport function reportUnhandledError(err) {\n timeoutProvider.setTimeout(() => {\n const {\n onUnhandledError\n } = config;\n if (onUnhandledError) {\n onUnhandledError(err);\n } else {\n throw err;\n }\n });\n}\n","export function noop() {}\n","export const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined))();\nexport function errorNotification(error) {\n return createNotification('E', undefined, error);\n}\nexport function nextNotification(value) {\n return createNotification('N', value, undefined);\n}\nexport function createNotification(kind, value, error) {\n return {\n kind,\n value,\n error\n };\n}\n","import { config } from '../config';\nlet context = null;\nexport function errorContext(cb) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n const isRoot = !context;\n if (isRoot) {\n context = {\n errorThrown: false,\n error: null\n };\n }\n cb();\n if (isRoot) {\n const {\n errorThrown,\n error\n } = context;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n } else {\n cb();\n }\n}\nexport function captureError(err) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\nexport class Subscriber extends Subscription {\n constructor(destination) {\n super();\n this.isStopped = false;\n if (destination) {\n this.destination = destination;\n if (isSubscription(destination)) {\n destination.add(this);\n }\n } else {\n this.destination = EMPTY_OBSERVER;\n }\n }\n static create(next, error, complete) {\n return new SafeSubscriber(next, error, complete);\n }\n next(value) {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n } else {\n this._next(value);\n }\n }\n error(err) {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n } else {\n this.isStopped = true;\n this._error(err);\n }\n }\n complete() {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n } else {\n this.isStopped = true;\n this._complete();\n }\n }\n unsubscribe() {\n if (!this.closed) {\n this.isStopped = true;\n super.unsubscribe();\n this.destination = null;\n }\n }\n _next(value) {\n this.destination.next(value);\n }\n _error(err) {\n try {\n this.destination.error(err);\n } finally {\n this.unsubscribe();\n }\n }\n _complete() {\n try {\n this.destination.complete();\n } finally {\n this.unsubscribe();\n }\n }\n}\nconst _bind = Function.prototype.bind;\nfunction bind(fn, thisArg) {\n return _bind.call(fn, thisArg);\n}\nclass ConsumerObserver {\n constructor(partialObserver) {\n this.partialObserver = partialObserver;\n }\n next(value) {\n const {\n partialObserver\n } = this;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n error(err) {\n const {\n partialObserver\n } = this;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n } catch (error) {\n handleUnhandledError(error);\n }\n } else {\n handleUnhandledError(err);\n }\n }\n complete() {\n const {\n partialObserver\n } = this;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n}\nexport class SafeSubscriber extends Subscriber {\n constructor(observerOrNext, error, complete) {\n super();\n let partialObserver;\n if (isFunction(observerOrNext) || !observerOrNext) {\n partialObserver = {\n next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,\n error: error !== null && error !== void 0 ? error : undefined,\n complete: complete !== null && complete !== void 0 ? complete : undefined\n };\n } else {\n let context;\n if (this && config.useDeprecatedNextContext) {\n context = Object.create(observerOrNext);\n context.unsubscribe = () => this.unsubscribe();\n partialObserver = {\n next: observerOrNext.next && bind(observerOrNext.next, context),\n error: observerOrNext.error && bind(observerOrNext.error, context),\n complete: observerOrNext.complete && bind(observerOrNext.complete, context)\n };\n } else {\n partialObserver = observerOrNext;\n }\n }\n this.destination = new ConsumerObserver(partialObserver);\n }\n}\nfunction handleUnhandledError(error) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n } else {\n reportUnhandledError(error);\n }\n}\nfunction defaultErrorHandler(err) {\n throw err;\n}\nfunction handleStoppedNotification(notification, subscriber) {\n const {\n onStoppedNotification\n } = config;\n onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));\n}\nexport const EMPTY_OBSERVER = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop\n};\n","export const observable = (() => typeof Symbol === 'function' && Symbol.observable || '@@observable')();\n","export function identity(x) {\n return x;\n}\n","import { identity } from './identity';\nexport function pipe(...fns) {\n return pipeFromArray(fns);\n}\nexport function pipeFromArray(fns) {\n if (fns.length === 0) {\n return identity;\n }\n if (fns.length === 1) {\n return fns[0];\n }\n return function piped(input) {\n return fns.reduce((prev, fn) => fn(prev), input);\n };\n}\n","import { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription } from './Subscription';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nimport { isFunction } from './util/isFunction';\nimport { errorContext } from './util/errorContext';\nexport let Observable = /*#__PURE__*/(() => {\n class Observable {\n constructor(subscribe) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n lift(operator) {\n const observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n }\n subscribe(observerOrNext, error, complete) {\n const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n errorContext(() => {\n const {\n operator,\n source\n } = this;\n subscriber.add(operator ? operator.call(subscriber, source) : source ? this._subscribe(subscriber) : this._trySubscribe(subscriber));\n });\n return subscriber;\n }\n _trySubscribe(sink) {\n try {\n return this._subscribe(sink);\n } catch (err) {\n sink.error(err);\n }\n }\n forEach(next, promiseCtor) {\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor((resolve, reject) => {\n const subscriber = new SafeSubscriber({\n next: value => {\n try {\n next(value);\n } catch (err) {\n reject(err);\n subscriber.unsubscribe();\n }\n },\n error: reject,\n complete: resolve\n });\n this.subscribe(subscriber);\n });\n }\n _subscribe(subscriber) {\n var _a;\n return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);\n }\n [Symbol_observable]() {\n return this;\n }\n pipe(...operations) {\n return pipeFromArray(operations)(this);\n }\n toPromise(promiseCtor) {\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor((resolve, reject) => {\n let value;\n this.subscribe(x => value = x, err => reject(err), () => resolve(value));\n });\n }\n }\n Observable.create = subscribe => {\n return new Observable(subscribe);\n };\n return Observable;\n})();\nfunction getPromiseCtor(promiseCtor) {\n var _a;\n return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;\n}\nfunction isObserver(value) {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\nfunction isSubscriber(value) {\n return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);\n}\n","import { isFunction } from './isFunction';\nexport function hasLift(source) {\n return isFunction(source === null || source === void 0 ? void 0 : source.lift);\n}\nexport function operate(init) {\n return source => {\n if (hasLift(source)) {\n return source.lift(function (liftedSource) {\n try {\n return init(liftedSource, this);\n } catch (err) {\n this.error(err);\n }\n });\n }\n throw new TypeError('Unable to lift unknown Observable type');\n };\n}\n","import { Subscriber } from '../Subscriber';\nexport function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {\n return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);\n}\nexport class OperatorSubscriber extends Subscriber {\n constructor(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {\n super(destination);\n this.onFinalize = onFinalize;\n this.shouldUnsubscribe = shouldUnsubscribe;\n this._next = onNext ? function (value) {\n try {\n onNext(value);\n } catch (err) {\n destination.error(err);\n }\n } : super._next;\n this._error = onError ? function (err) {\n try {\n onError(err);\n } catch (err) {\n destination.error(err);\n } finally {\n this.unsubscribe();\n }\n } : super._error;\n this._complete = onComplete ? function () {\n try {\n onComplete();\n } catch (err) {\n destination.error(err);\n } finally {\n this.unsubscribe();\n }\n } : super._complete;\n }\n unsubscribe() {\n var _a;\n if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {\n const {\n closed\n } = this;\n super.unsubscribe();\n !closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));\n }\n }\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function refCount() {\n return operate((source, subscriber) => {\n let connection = null;\n source._refCount++;\n const refCounter = createOperatorSubscriber(subscriber, undefined, undefined, undefined, () => {\n if (!source || source._refCount <= 0 || 0 < --source._refCount) {\n connection = null;\n return;\n }\n const sharedConnection = source._connection;\n const conn = connection;\n connection = null;\n if (sharedConnection && (!conn || sharedConnection === conn)) {\n sharedConnection.unsubscribe();\n }\n subscriber.unsubscribe();\n });\n source.subscribe(refCounter);\n if (!refCounter.closed) {\n connection = source.connect();\n }\n });\n}\n","import { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nimport { refCount as higherOrderRefCount } from '../operators/refCount';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { hasLift } from '../util/lift';\nexport class ConnectableObservable extends Observable {\n constructor(source, subjectFactory) {\n super();\n this.source = source;\n this.subjectFactory = subjectFactory;\n this._subject = null;\n this._refCount = 0;\n this._connection = null;\n if (hasLift(source)) {\n this.lift = source.lift;\n }\n }\n _subscribe(subscriber) {\n return this.getSubject().subscribe(subscriber);\n }\n getSubject() {\n const subject = this._subject;\n if (!subject || subject.isStopped) {\n this._subject = this.subjectFactory();\n }\n return this._subject;\n }\n _teardown() {\n this._refCount = 0;\n const {\n _connection\n } = this;\n this._subject = this._connection = null;\n _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe();\n }\n connect() {\n let connection = this._connection;\n if (!connection) {\n connection = this._connection = new Subscription();\n const subject = this.getSubject();\n connection.add(this.source.subscribe(createOperatorSubscriber(subject, undefined, () => {\n this._teardown();\n subject.complete();\n }, err => {\n this._teardown();\n subject.error(err);\n }, () => this._teardown())));\n if (connection.closed) {\n this._connection = null;\n connection = Subscription.EMPTY;\n }\n }\n return connection;\n }\n refCount() {\n return higherOrderRefCount()(this);\n }\n}\n","import { Subscription } from '../Subscription';\nexport const animationFrameProvider = {\n schedule(callback) {\n let request = requestAnimationFrame;\n let cancel = cancelAnimationFrame;\n const {\n delegate\n } = animationFrameProvider;\n if (delegate) {\n request = delegate.requestAnimationFrame;\n cancel = delegate.cancelAnimationFrame;\n }\n const handle = request(timestamp => {\n cancel = undefined;\n callback(timestamp);\n });\n return new Subscription(() => cancel === null || cancel === void 0 ? void 0 : cancel(handle));\n },\n requestAnimationFrame(...args) {\n const {\n delegate\n } = animationFrameProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame)(...args);\n },\n cancelAnimationFrame(...args) {\n const {\n delegate\n } = animationFrameProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame)(...args);\n },\n delegate: undefined\n};\n","import { createErrorClass } from './createErrorClass';\nexport const ObjectUnsubscribedError = createErrorClass(_super => function ObjectUnsubscribedErrorImpl() {\n _super(this);\n this.name = 'ObjectUnsubscribedError';\n this.message = 'object unsubscribed';\n});\n","import { Observable } from './Observable';\nimport { Subscription, EMPTY_SUBSCRIPTION } from './Subscription';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { arrRemove } from './util/arrRemove';\nimport { errorContext } from './util/errorContext';\nexport let Subject = /*#__PURE__*/(() => {\n class Subject extends Observable {\n constructor() {\n super();\n this.closed = false;\n this.currentObservers = null;\n this.observers = [];\n this.isStopped = false;\n this.hasError = false;\n this.thrownError = null;\n }\n lift(operator) {\n const subject = new AnonymousSubject(this, this);\n subject.operator = operator;\n return subject;\n }\n _throwIfClosed() {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n }\n next(value) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n if (!this.currentObservers) {\n this.currentObservers = Array.from(this.observers);\n }\n for (const observer of this.currentObservers) {\n observer.next(value);\n }\n }\n });\n }\n error(err) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.hasError = this.isStopped = true;\n this.thrownError = err;\n const {\n observers\n } = this;\n while (observers.length) {\n observers.shift().error(err);\n }\n }\n });\n }\n complete() {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.isStopped = true;\n const {\n observers\n } = this;\n while (observers.length) {\n observers.shift().complete();\n }\n }\n });\n }\n unsubscribe() {\n this.isStopped = this.closed = true;\n this.observers = this.currentObservers = null;\n }\n get observed() {\n var _a;\n return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;\n }\n _trySubscribe(subscriber) {\n this._throwIfClosed();\n return super._trySubscribe(subscriber);\n }\n _subscribe(subscriber) {\n this._throwIfClosed();\n this._checkFinalizedStatuses(subscriber);\n return this._innerSubscribe(subscriber);\n }\n _innerSubscribe(subscriber) {\n const {\n hasError,\n isStopped,\n observers\n } = this;\n if (hasError || isStopped) {\n return EMPTY_SUBSCRIPTION;\n }\n this.currentObservers = null;\n observers.push(subscriber);\n return new Subscription(() => {\n this.currentObservers = null;\n arrRemove(observers, subscriber);\n });\n }\n _checkFinalizedStatuses(subscriber) {\n const {\n hasError,\n thrownError,\n isStopped\n } = this;\n if (hasError) {\n subscriber.error(thrownError);\n } else if (isStopped) {\n subscriber.complete();\n }\n }\n asObservable() {\n const observable = new Observable();\n observable.source = this;\n return observable;\n }\n }\n Subject.create = (destination, source) => {\n return new AnonymousSubject(destination, source);\n };\n return Subject;\n})();\nexport class AnonymousSubject extends Subject {\n constructor(destination, source) {\n super();\n this.destination = destination;\n this.source = source;\n }\n next(value) {\n var _a, _b;\n (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);\n }\n error(err) {\n var _a, _b;\n (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);\n }\n complete() {\n var _a, _b;\n (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n _subscribe(subscriber) {\n var _a, _b;\n return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;\n }\n}\n","import { Subject } from './Subject';\nexport class BehaviorSubject extends Subject {\n constructor(_value) {\n super();\n this._value = _value;\n }\n get value() {\n return this.getValue();\n }\n _subscribe(subscriber) {\n const subscription = super._subscribe(subscriber);\n !subscription.closed && subscriber.next(this._value);\n return subscription;\n }\n getValue() {\n const {\n hasError,\n thrownError,\n _value\n } = this;\n if (hasError) {\n throw thrownError;\n }\n this._throwIfClosed();\n return _value;\n }\n next(value) {\n super.next(this._value = value);\n }\n}\n","export const dateTimestampProvider = {\n now() {\n return (dateTimestampProvider.delegate || Date).now();\n },\n delegate: undefined\n};\n","import { Subject } from './Subject';\nimport { dateTimestampProvider } from './scheduler/dateTimestampProvider';\nexport class ReplaySubject extends Subject {\n constructor(_bufferSize = Infinity, _windowTime = Infinity, _timestampProvider = dateTimestampProvider) {\n super();\n this._bufferSize = _bufferSize;\n this._windowTime = _windowTime;\n this._timestampProvider = _timestampProvider;\n this._buffer = [];\n this._infiniteTimeWindow = true;\n this._infiniteTimeWindow = _windowTime === Infinity;\n this._bufferSize = Math.max(1, _bufferSize);\n this._windowTime = Math.max(1, _windowTime);\n }\n next(value) {\n const {\n isStopped,\n _buffer,\n _infiniteTimeWindow,\n _timestampProvider,\n _windowTime\n } = this;\n if (!isStopped) {\n _buffer.push(value);\n !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);\n }\n this._trimBuffer();\n super.next(value);\n }\n _subscribe(subscriber) {\n this._throwIfClosed();\n this._trimBuffer();\n const subscription = this._innerSubscribe(subscriber);\n const {\n _infiniteTimeWindow,\n _buffer\n } = this;\n const copy = _buffer.slice();\n for (let i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {\n subscriber.next(copy[i]);\n }\n this._checkFinalizedStatuses(subscriber);\n return subscription;\n }\n _trimBuffer() {\n const {\n _bufferSize,\n _timestampProvider,\n _buffer,\n _infiniteTimeWindow\n } = this;\n const adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;\n _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);\n if (!_infiniteTimeWindow) {\n const now = _timestampProvider.now();\n let last = 0;\n for (let i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {\n last = i;\n }\n last && _buffer.splice(0, last + 1);\n }\n }\n}\n","import { Subscription } from '../Subscription';\nexport class Action extends Subscription {\n constructor(scheduler, work) {\n super();\n }\n schedule(state, delay = 0) {\n return this;\n }\n}\n","export const intervalProvider = {\n setInterval(handler, timeout, ...args) {\n const {\n delegate\n } = intervalProvider;\n if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {\n return delegate.setInterval(handler, timeout, ...args);\n }\n return setInterval(handler, timeout, ...args);\n },\n clearInterval(handle) {\n const {\n delegate\n } = intervalProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);\n },\n delegate: undefined\n};\n","import { Action } from './Action';\nimport { intervalProvider } from './intervalProvider';\nimport { arrRemove } from '../util/arrRemove';\nexport class AsyncAction extends Action {\n constructor(scheduler, work) {\n super(scheduler, work);\n this.scheduler = scheduler;\n this.work = work;\n this.pending = false;\n }\n schedule(state, delay = 0) {\n var _a;\n if (this.closed) {\n return this;\n }\n this.state = state;\n const id = this.id;\n const scheduler = this.scheduler;\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, delay);\n }\n this.pending = true;\n this.delay = delay;\n this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);\n return this;\n }\n requestAsyncId(scheduler, _id, delay = 0) {\n return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n recycleAsyncId(_scheduler, id, delay = 0) {\n if (delay != null && this.delay === delay && this.pending === false) {\n return id;\n }\n if (id != null) {\n intervalProvider.clearInterval(id);\n }\n return undefined;\n }\n execute(state, delay) {\n if (this.closed) {\n return new Error('executing a cancelled action');\n }\n this.pending = false;\n const error = this._execute(state, delay);\n if (error) {\n return error;\n } else if (this.pending === false && this.id != null) {\n this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n }\n }\n _execute(state, _delay) {\n let errored = false;\n let errorValue;\n try {\n this.work(state);\n } catch (e) {\n errored = true;\n errorValue = e ? e : new Error('Scheduled action threw falsy error');\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n }\n unsubscribe() {\n if (!this.closed) {\n const {\n id,\n scheduler\n } = this;\n const {\n actions\n } = scheduler;\n this.work = this.state = this.scheduler = null;\n this.pending = false;\n arrRemove(actions, this);\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n this.delay = null;\n super.unsubscribe();\n }\n }\n}\n","let nextHandle = 1;\nlet resolved;\nconst activeHandles = {};\nfunction findAndClearHandle(handle) {\n if (handle in activeHandles) {\n delete activeHandles[handle];\n return true;\n }\n return false;\n}\nexport const Immediate = {\n setImmediate(cb) {\n const handle = nextHandle++;\n activeHandles[handle] = true;\n if (!resolved) {\n resolved = Promise.resolve();\n }\n resolved.then(() => findAndClearHandle(handle) && cb());\n return handle;\n },\n clearImmediate(handle) {\n findAndClearHandle(handle);\n }\n};\nexport const TestTools = {\n pending() {\n return Object.keys(activeHandles).length;\n }\n};\n","import { Immediate } from '../util/Immediate';\nconst {\n setImmediate,\n clearImmediate\n} = Immediate;\nexport const immediateProvider = {\n setImmediate(...args) {\n const {\n delegate\n } = immediateProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.setImmediate) || setImmediate)(...args);\n },\n clearImmediate(handle) {\n const {\n delegate\n } = immediateProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearImmediate) || clearImmediate)(handle);\n },\n delegate: undefined\n};\n","import { AsyncAction } from './AsyncAction';\nimport { immediateProvider } from './immediateProvider';\nexport class AsapAction extends AsyncAction {\n constructor(scheduler, work) {\n super(scheduler, work);\n this.scheduler = scheduler;\n this.work = work;\n }\n requestAsyncId(scheduler, id, delay = 0) {\n if (delay !== null && delay > 0) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n scheduler.actions.push(this);\n return scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, undefined)));\n }\n recycleAsyncId(scheduler, id, delay = 0) {\n var _a;\n if (delay != null ? delay > 0 : this.delay > 0) {\n return super.recycleAsyncId(scheduler, id, delay);\n }\n const {\n actions\n } = scheduler;\n if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {\n immediateProvider.clearImmediate(id);\n if (scheduler._scheduled === id) {\n scheduler._scheduled = undefined;\n }\n }\n return undefined;\n }\n}\n","import { dateTimestampProvider } from './scheduler/dateTimestampProvider';\nexport class Scheduler {\n constructor(schedulerActionCtor, now = Scheduler.now) {\n this.schedulerActionCtor = schedulerActionCtor;\n this.now = now;\n }\n schedule(work, delay = 0, state) {\n return new this.schedulerActionCtor(this, work).schedule(state, delay);\n }\n}\nScheduler.now = dateTimestampProvider.now;\n","import { Scheduler } from '../Scheduler';\nexport class AsyncScheduler extends Scheduler {\n constructor(SchedulerAction, now = Scheduler.now) {\n super(SchedulerAction, now);\n this.actions = [];\n this._active = false;\n }\n flush(action) {\n const {\n actions\n } = this;\n if (this._active) {\n actions.push(action);\n return;\n }\n let error;\n this._active = true;\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while (action = actions.shift());\n this._active = false;\n if (error) {\n while (action = actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","import { AsyncScheduler } from './AsyncScheduler';\nexport class AsapScheduler extends AsyncScheduler {\n flush(action) {\n this._active = true;\n const flushId = this._scheduled;\n this._scheduled = undefined;\n const {\n actions\n } = this;\n let error;\n action = action || actions.shift();\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while ((action = actions[0]) && action.id === flushId && actions.shift());\n this._active = false;\n if (error) {\n while ((action = actions[0]) && action.id === flushId && actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","import { AsapAction } from './AsapAction';\nimport { AsapScheduler } from './AsapScheduler';\nexport const asapScheduler = new AsapScheduler(AsapAction);\nexport const asap = asapScheduler;\n","import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\nexport const asyncScheduler = new AsyncScheduler(AsyncAction);\nexport const async = asyncScheduler;\n","import { AsyncAction } from './AsyncAction';\nexport class QueueAction extends AsyncAction {\n constructor(scheduler, work) {\n super(scheduler, work);\n this.scheduler = scheduler;\n this.work = work;\n }\n schedule(state, delay = 0) {\n if (delay > 0) {\n return super.schedule(state, delay);\n }\n this.delay = delay;\n this.state = state;\n this.scheduler.flush(this);\n return this;\n }\n execute(state, delay) {\n return delay > 0 || this.closed ? super.execute(state, delay) : this._execute(state, delay);\n }\n requestAsyncId(scheduler, id, delay = 0) {\n if (delay != null && delay > 0 || delay == null && this.delay > 0) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n scheduler.flush(this);\n return 0;\n }\n}\n","import { AsyncScheduler } from './AsyncScheduler';\nexport class QueueScheduler extends AsyncScheduler {}\n","import { QueueAction } from './QueueAction';\nimport { QueueScheduler } from './QueueScheduler';\nexport const queueScheduler = new QueueScheduler(QueueAction);\nexport const queue = queueScheduler;\n","import { AsyncAction } from './AsyncAction';\nimport { animationFrameProvider } from './animationFrameProvider';\nexport class AnimationFrameAction extends AsyncAction {\n constructor(scheduler, work) {\n super(scheduler, work);\n this.scheduler = scheduler;\n this.work = work;\n }\n requestAsyncId(scheduler, id, delay = 0) {\n if (delay !== null && delay > 0) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n scheduler.actions.push(this);\n return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(() => scheduler.flush(undefined)));\n }\n recycleAsyncId(scheduler, id, delay = 0) {\n var _a;\n if (delay != null ? delay > 0 : this.delay > 0) {\n return super.recycleAsyncId(scheduler, id, delay);\n }\n const {\n actions\n } = scheduler;\n if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {\n animationFrameProvider.cancelAnimationFrame(id);\n scheduler._scheduled = undefined;\n }\n return undefined;\n }\n}\n","import { AsyncScheduler } from './AsyncScheduler';\nexport class AnimationFrameScheduler extends AsyncScheduler {\n flush(action) {\n this._active = true;\n const flushId = this._scheduled;\n this._scheduled = undefined;\n const {\n actions\n } = this;\n let error;\n action = action || actions.shift();\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while ((action = actions[0]) && action.id === flushId && actions.shift());\n this._active = false;\n if (error) {\n while ((action = actions[0]) && action.id === flushId && actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","import { AnimationFrameAction } from './AnimationFrameAction';\nimport { AnimationFrameScheduler } from './AnimationFrameScheduler';\nexport const animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);\nexport const animationFrame = animationFrameScheduler;\n","import { Observable } from '../Observable';\nexport const EMPTY = new Observable(subscriber => subscriber.complete());\nexport function empty(scheduler) {\n return scheduler ? emptyScheduled(scheduler) : EMPTY;\n}\nfunction emptyScheduled(scheduler) {\n return new Observable(subscriber => scheduler.schedule(() => subscriber.complete()));\n}\n","import { isFunction } from './isFunction';\nexport function isScheduler(value) {\n return value && isFunction(value.schedule);\n}\n","import { isFunction } from './isFunction';\nimport { isScheduler } from './isScheduler';\nfunction last(arr) {\n return arr[arr.length - 1];\n}\nexport function popResultSelector(args) {\n return isFunction(last(args)) ? args.pop() : undefined;\n}\nexport function popScheduler(args) {\n return isScheduler(last(args)) ? args.pop() : undefined;\n}\nexport function popNumber(args, defaultValue) {\n return typeof last(args) === 'number' ? args.pop() : defaultValue;\n}\n","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n };\n return extendStatics(d, b);\n};\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null) throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nexport var __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);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}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) {\n if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\");\n return f;\n }\n var kind = contextIn.kind,\n key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _,\n done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) {\n if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\");\n extraInitializers.push(accept(f || null));\n };\n var result = (0, decorators[i])(kind === \"accessor\" ? {\n get: descriptor.get,\n set: descriptor.set\n } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n } else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n}\n;\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n}\n;\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n}\n;\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", {\n configurable: true,\n value: prefix ? \"\".concat(prefix, \" \", name) : name\n });\n}\n;\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function () {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\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;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport var __createBinding = Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = {\n enumerable: true,\n get: function () {\n return m[k];\n }\n };\n }\n Object.defineProperty(o, k2, desc);\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n};\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n return r;\n}\nexport function __spreadArray(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}\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n function awaitReturn(f) {\n return function (v) {\n return Promise.resolve(v).then(f, reject);\n };\n }\n function verb(n, f) {\n if (g[n]) {\n i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n if (f) i[n] = f(i[n]);\n }\n }\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n function fulfill(value) {\n resume(\"next\", value);\n }\n function reject(value) {\n resume(\"throw\", value);\n }\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: false\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\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 () {\n return this;\n }, i);\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n return cooked;\n}\n;\nvar __setModuleDefault = Object.create ? function (o, v) {\n Object.defineProperty(o, \"default\", {\n enumerable: true,\n value: v\n });\n} : function (o, v) {\n o[\"default\"] = v;\n};\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\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\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\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\");\n return kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;\n}\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || typeof receiver !== \"object\" && typeof receiver !== \"function\") throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function () {\n try {\n inner.call(this);\n } catch (e) {\n return Promise.reject(e);\n }\n };\n env.stack.push({\n value: value,\n dispose: dispose,\n async: async\n });\n } else if (async) {\n env.stack.push({\n async: true\n });\n }\n return value;\n}\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n function next() {\n while (env.stack.length) {\n var rec = env.stack.pop();\n try {\n var result = rec.dispose && rec.dispose.call(rec.value);\n if (rec.async) return Promise.resolve(result).then(next, function (e) {\n fail(e);\n return next();\n });\n } catch (e) {\n fail(e);\n }\n }\n if (env.hasError) throw env.error;\n }\n return next();\n}\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources\n};","export const isArrayLike = x => x && typeof x.length === 'number' && typeof x !== 'function';\n","import { isFunction } from \"./isFunction\";\nexport function isPromise(value) {\n return isFunction(value === null || value === void 0 ? void 0 : value.then);\n}\n","import { observable as Symbol_observable } from '../symbol/observable';\nimport { isFunction } from './isFunction';\nexport function isInteropObservable(input) {\n return isFunction(input[Symbol_observable]);\n}\n","import { isFunction } from './isFunction';\nexport function isAsyncIterable(obj) {\n return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);\n}\n","export function createInvalidObservableTypeError(input) {\n return new TypeError(`You provided ${input !== null && typeof input === 'object' ? 'an invalid object' : `'${input}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`);\n}\n","export function getSymbolIterator() {\n if (typeof Symbol !== 'function' || !Symbol.iterator) {\n return '@@iterator';\n }\n return Symbol.iterator;\n}\nexport const iterator = getSymbolIterator();\n","import { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from './isFunction';\nexport function isIterable(input) {\n return isFunction(input === null || input === void 0 ? void 0 : input[Symbol_iterator]);\n}\n","import { __asyncGenerator, __await } from \"tslib\";\nimport { isFunction } from './isFunction';\nexport function readableStreamLikeToAsyncGenerator(readableStream) {\n return __asyncGenerator(this, arguments, function* readableStreamLikeToAsyncGenerator_1() {\n const reader = readableStream.getReader();\n try {\n while (true) {\n const {\n value,\n done\n } = yield __await(reader.read());\n if (done) {\n return yield __await(void 0);\n }\n yield yield __await(value);\n }\n } finally {\n reader.releaseLock();\n }\n });\n}\nexport function isReadableStreamLike(obj) {\n return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);\n}\n","import { __asyncValues, __awaiter } from \"tslib\";\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isPromise } from '../util/isPromise';\nimport { Observable } from '../Observable';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isAsyncIterable } from '../util/isAsyncIterable';\nimport { createInvalidObservableTypeError } from '../util/throwUnobservableError';\nimport { isIterable } from '../util/isIterable';\nimport { isReadableStreamLike, readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';\nimport { isFunction } from '../util/isFunction';\nimport { reportUnhandledError } from '../util/reportUnhandledError';\nimport { observable as Symbol_observable } from '../symbol/observable';\nexport function innerFrom(input) {\n if (input instanceof Observable) {\n return input;\n }\n if (input != null) {\n if (isInteropObservable(input)) {\n return fromInteropObservable(input);\n }\n if (isArrayLike(input)) {\n return fromArrayLike(input);\n }\n if (isPromise(input)) {\n return fromPromise(input);\n }\n if (isAsyncIterable(input)) {\n return fromAsyncIterable(input);\n }\n if (isIterable(input)) {\n return fromIterable(input);\n }\n if (isReadableStreamLike(input)) {\n return fromReadableStreamLike(input);\n }\n }\n throw createInvalidObservableTypeError(input);\n}\nexport function fromInteropObservable(obj) {\n return new Observable(subscriber => {\n const obs = obj[Symbol_observable]();\n if (isFunction(obs.subscribe)) {\n return obs.subscribe(subscriber);\n }\n throw new TypeError('Provided object does not correctly implement Symbol.observable');\n });\n}\nexport function fromArrayLike(array) {\n return new Observable(subscriber => {\n for (let i = 0; i < array.length && !subscriber.closed; i++) {\n subscriber.next(array[i]);\n }\n subscriber.complete();\n });\n}\nexport function fromPromise(promise) {\n return new Observable(subscriber => {\n promise.then(value => {\n if (!subscriber.closed) {\n subscriber.next(value);\n subscriber.complete();\n }\n }, err => subscriber.error(err)).then(null, reportUnhandledError);\n });\n}\nexport function fromIterable(iterable) {\n return new Observable(subscriber => {\n for (const value of iterable) {\n subscriber.next(value);\n if (subscriber.closed) {\n return;\n }\n }\n subscriber.complete();\n });\n}\nexport function fromAsyncIterable(asyncIterable) {\n return new Observable(subscriber => {\n process(asyncIterable, subscriber).catch(err => subscriber.error(err));\n });\n}\nexport function fromReadableStreamLike(readableStream) {\n return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));\n}\nfunction process(asyncIterable, subscriber) {\n var asyncIterable_1, asyncIterable_1_1;\n var e_1, _a;\n return __awaiter(this, void 0, void 0, function* () {\n try {\n for (asyncIterable_1 = __asyncValues(asyncIterable); asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done;) {\n const value = asyncIterable_1_1.value;\n subscriber.next(value);\n if (subscriber.closed) {\n return;\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)) yield _a.call(asyncIterable_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n subscriber.complete();\n });\n}\n","export function executeSchedule(parentSubscription, scheduler, work, delay = 0, repeat = false) {\n const scheduleSubscription = scheduler.schedule(function () {\n work();\n if (repeat) {\n parentSubscription.add(this.schedule(null, delay));\n } else {\n this.unsubscribe();\n }\n }, delay);\n parentSubscription.add(scheduleSubscription);\n if (!repeat) {\n return scheduleSubscription;\n }\n}\n","import { executeSchedule } from '../util/executeSchedule';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function observeOn(scheduler, delay = 0) {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, value => executeSchedule(subscriber, scheduler, () => subscriber.next(value), delay), () => executeSchedule(subscriber, scheduler, () => subscriber.complete(), delay), err => executeSchedule(subscriber, scheduler, () => subscriber.error(err), delay)));\n });\n}\n","import { operate } from '../util/lift';\nexport function subscribeOn(scheduler, delay = 0) {\n return operate((source, subscriber) => {\n subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay));\n });\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { observeOn } from '../operators/observeOn';\nimport { subscribeOn } from '../operators/subscribeOn';\nexport function scheduleObservable(input, scheduler) {\n return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { observeOn } from '../operators/observeOn';\nimport { subscribeOn } from '../operators/subscribeOn';\nexport function schedulePromise(input, scheduler) {\n return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));\n}\n","import { Observable } from '../Observable';\nexport function scheduleArray(input, scheduler) {\n return new Observable(subscriber => {\n let i = 0;\n return scheduler.schedule(function () {\n if (i === input.length) {\n subscriber.complete();\n } else {\n subscriber.next(input[i++]);\n if (!subscriber.closed) {\n this.schedule();\n }\n }\n });\n });\n}\n","import { Observable } from '../Observable';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from '../util/isFunction';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function scheduleIterable(input, scheduler) {\n return new Observable(subscriber => {\n let iterator;\n executeSchedule(subscriber, scheduler, () => {\n iterator = input[Symbol_iterator]();\n executeSchedule(subscriber, scheduler, () => {\n let value;\n let done;\n try {\n ({\n value,\n done\n } = iterator.next());\n } catch (err) {\n subscriber.error(err);\n return;\n }\n if (done) {\n subscriber.complete();\n } else {\n subscriber.next(value);\n }\n }, 0, true);\n });\n return () => isFunction(iterator === null || iterator === void 0 ? void 0 : iterator.return) && iterator.return();\n });\n}\n","import { Observable } from '../Observable';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function scheduleAsyncIterable(input, scheduler) {\n if (!input) {\n throw new Error('Iterable cannot be null');\n }\n return new Observable(subscriber => {\n executeSchedule(subscriber, scheduler, () => {\n const iterator = input[Symbol.asyncIterator]();\n executeSchedule(subscriber, scheduler, () => {\n iterator.next().then(result => {\n if (result.done) {\n subscriber.complete();\n } else {\n subscriber.next(result.value);\n }\n });\n }, 0, true);\n });\n });\n}\n","import { scheduleAsyncIterable } from './scheduleAsyncIterable';\nimport { readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';\nexport function scheduleReadableStreamLike(input, scheduler) {\n return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);\n}\n","import { scheduleObservable } from './scheduleObservable';\nimport { schedulePromise } from './schedulePromise';\nimport { scheduleArray } from './scheduleArray';\nimport { scheduleIterable } from './scheduleIterable';\nimport { scheduleAsyncIterable } from './scheduleAsyncIterable';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isPromise } from '../util/isPromise';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isIterable } from '../util/isIterable';\nimport { isAsyncIterable } from '../util/isAsyncIterable';\nimport { createInvalidObservableTypeError } from '../util/throwUnobservableError';\nimport { isReadableStreamLike } from '../util/isReadableStreamLike';\nimport { scheduleReadableStreamLike } from './scheduleReadableStreamLike';\nexport function scheduled(input, scheduler) {\n if (input != null) {\n if (isInteropObservable(input)) {\n return scheduleObservable(input, scheduler);\n }\n if (isArrayLike(input)) {\n return scheduleArray(input, scheduler);\n }\n if (isPromise(input)) {\n return schedulePromise(input, scheduler);\n }\n if (isAsyncIterable(input)) {\n return scheduleAsyncIterable(input, scheduler);\n }\n if (isIterable(input)) {\n return scheduleIterable(input, scheduler);\n }\n if (isReadableStreamLike(input)) {\n return scheduleReadableStreamLike(input, scheduler);\n }\n }\n throw createInvalidObservableTypeError(input);\n}\n","import { scheduled } from '../scheduled/scheduled';\nimport { innerFrom } from './innerFrom';\nexport function from(input, scheduler) {\n return scheduler ? scheduled(input, scheduler) : innerFrom(input);\n}\n","import { popScheduler } from '../util/args';\nimport { from } from './from';\nexport function of(...args) {\n const scheduler = popScheduler(args);\n return from(args, scheduler);\n}\n","import { Observable } from '../Observable';\nimport { isFunction } from '../util/isFunction';\nexport function throwError(errorOrErrorFactory, scheduler) {\n const errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : () => errorOrErrorFactory;\n const init = subscriber => subscriber.error(errorFactory());\n return new Observable(scheduler ? subscriber => scheduler.schedule(init, 0, subscriber) : init);\n}\n","import { EMPTY } from './observable/empty';\nimport { of } from './observable/of';\nimport { throwError } from './observable/throwError';\nimport { isFunction } from './util/isFunction';\nexport var NotificationKind = /*#__PURE__*/function (NotificationKind) {\n NotificationKind[\"NEXT\"] = \"N\";\n NotificationKind[\"ERROR\"] = \"E\";\n NotificationKind[\"COMPLETE\"] = \"C\";\n return NotificationKind;\n}(NotificationKind || {});\nexport class Notification {\n constructor(kind, value, error) {\n this.kind = kind;\n this.value = value;\n this.error = error;\n this.hasValue = kind === 'N';\n }\n observe(observer) {\n return observeNotification(this, observer);\n }\n do(nextHandler, errorHandler, completeHandler) {\n const {\n kind,\n value,\n error\n } = this;\n return kind === 'N' ? nextHandler === null || nextHandler === void 0 ? void 0 : nextHandler(value) : kind === 'E' ? errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler(error) : completeHandler === null || completeHandler === void 0 ? void 0 : completeHandler();\n }\n accept(nextOrObserver, error, complete) {\n var _a;\n return isFunction((_a = nextOrObserver) === null || _a === void 0 ? void 0 : _a.next) ? this.observe(nextOrObserver) : this.do(nextOrObserver, error, complete);\n }\n toObservable() {\n const {\n kind,\n value,\n error\n } = this;\n const result = kind === 'N' ? of(value) : kind === 'E' ? throwError(() => error) : kind === 'C' ? EMPTY : 0;\n if (!result) {\n throw new TypeError(`Unexpected notification kind ${kind}`);\n }\n return result;\n }\n static createNext(value) {\n return new Notification('N', value);\n }\n static createError(err) {\n return new Notification('E', undefined, err);\n }\n static createComplete() {\n return Notification.completeNotification;\n }\n}\nNotification.completeNotification = new Notification('C');\nexport function observeNotification(notification, observer) {\n var _a, _b, _c;\n const {\n kind,\n value,\n error\n } = notification;\n if (typeof kind !== 'string') {\n throw new TypeError('Invalid notification, missing \"kind\"');\n }\n kind === 'N' ? (_a = observer.next) === null || _a === void 0 ? void 0 : _a.call(observer, value) : kind === 'E' ? (_b = observer.error) === null || _b === void 0 ? void 0 : _b.call(observer, error) : (_c = observer.complete) === null || _c === void 0 ? void 0 : _c.call(observer);\n}\n","import { Observable } from '../Observable';\nimport { isFunction } from './isFunction';\nexport function isObservable(obj) {\n return !!obj && (obj instanceof Observable || isFunction(obj.lift) && isFunction(obj.subscribe));\n}\n","import { createErrorClass } from './createErrorClass';\nexport const EmptyError = createErrorClass(_super => function EmptyErrorImpl() {\n _super(this);\n this.name = 'EmptyError';\n this.message = 'no elements in sequence';\n});\n","import { EmptyError } from './util/EmptyError';\nexport function lastValueFrom(source, config) {\n const hasConfig = typeof config === 'object';\n return new Promise((resolve, reject) => {\n let _hasValue = false;\n let _value;\n source.subscribe({\n next: value => {\n _value = value;\n _hasValue = true;\n },\n error: reject,\n complete: () => {\n if (_hasValue) {\n resolve(_value);\n } else if (hasConfig) {\n resolve(config.defaultValue);\n } else {\n reject(new EmptyError());\n }\n }\n });\n });\n}\n","import { EmptyError } from './util/EmptyError';\nimport { SafeSubscriber } from './Subscriber';\nexport function firstValueFrom(source, config) {\n const hasConfig = typeof config === 'object';\n return new Promise((resolve, reject) => {\n const subscriber = new SafeSubscriber({\n next: value => {\n resolve(value);\n subscriber.unsubscribe();\n },\n error: reject,\n complete: () => {\n if (hasConfig) {\n resolve(config.defaultValue);\n } else {\n reject(new EmptyError());\n }\n }\n });\n source.subscribe(subscriber);\n });\n}\n","export function isValidDate(value) {\n return value instanceof Date && !isNaN(value);\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { isValidDate } from '../util/isDate';\nimport { operate } from '../util/lift';\nimport { innerFrom } from '../observable/innerFrom';\nimport { createErrorClass } from '../util/createErrorClass';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { executeSchedule } from '../util/executeSchedule';\nexport const TimeoutError = createErrorClass(_super => function TimeoutErrorImpl(info = null) {\n _super(this);\n this.message = 'Timeout has occurred';\n this.name = 'TimeoutError';\n this.info = info;\n});\nexport function timeout(config, schedulerArg) {\n const {\n first,\n each,\n with: _with = timeoutErrorFactory,\n scheduler = schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : asyncScheduler,\n meta = null\n } = isValidDate(config) ? {\n first: config\n } : typeof config === 'number' ? {\n each: config\n } : config;\n if (first == null && each == null) {\n throw new TypeError('No timeout provided.');\n }\n return operate((source, subscriber) => {\n let originalSourceSubscription;\n let timerSubscription;\n let lastValue = null;\n let seen = 0;\n const startTimer = delay => {\n timerSubscription = executeSchedule(subscriber, scheduler, () => {\n try {\n originalSourceSubscription.unsubscribe();\n innerFrom(_with({\n meta,\n lastValue,\n seen\n })).subscribe(subscriber);\n } catch (err) {\n subscriber.error(err);\n }\n }, delay);\n };\n originalSourceSubscription = source.subscribe(createOperatorSubscriber(subscriber, value => {\n timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();\n seen++;\n subscriber.next(lastValue = value);\n each > 0 && startTimer(each);\n }, undefined, undefined, () => {\n if (!(timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.closed)) {\n timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();\n }\n lastValue = null;\n }));\n !seen && startTimer(first != null ? typeof first === 'number' ? first : +first - scheduler.now() : each);\n });\n}\nfunction timeoutErrorFactory(info) {\n throw new TimeoutError(info);\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function map(project, thisArg) {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n subscriber.next(project.call(thisArg, value, index++));\n }));\n });\n}\n","import { map } from \"../operators/map\";\nconst {\n isArray\n} = Array;\nfunction callOrApply(fn, args) {\n return isArray(args) ? fn(...args) : fn(args);\n}\nexport function mapOneOrManyArgs(fn) {\n return map(args => callOrApply(fn, args));\n}\n","const {\n isArray\n} = Array;\nconst {\n getPrototypeOf,\n prototype: objectProto,\n keys: getKeys\n} = Object;\nexport function argsArgArrayOrObject(args) {\n if (args.length === 1) {\n const first = args[0];\n if (isArray(first)) {\n return {\n args: first,\n keys: null\n };\n }\n if (isPOJO(first)) {\n const keys = getKeys(first);\n return {\n args: keys.map(key => first[key]),\n keys\n };\n }\n }\n return {\n args: args,\n keys: null\n };\n}\nfunction isPOJO(obj) {\n return obj && typeof obj === 'object' && getPrototypeOf(obj) === objectProto;\n}\n","export function createObject(keys, values) {\n return keys.reduce((result, key, i) => (result[key] = values[i], result), {});\n}\n","import { Observable } from '../Observable';\nimport { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';\nimport { from } from './from';\nimport { identity } from '../util/identity';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { popResultSelector, popScheduler } from '../util/args';\nimport { createObject } from '../util/createObject';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function combineLatest(...args) {\n const scheduler = popScheduler(args);\n const resultSelector = popResultSelector(args);\n const {\n args: observables,\n keys\n } = argsArgArrayOrObject(args);\n if (observables.length === 0) {\n return from([], scheduler);\n }\n const result = new Observable(combineLatestInit(observables, scheduler, keys ? values => createObject(keys, values) : identity));\n return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;\n}\nexport function combineLatestInit(observables, scheduler, valueTransform = identity) {\n return subscriber => {\n maybeSchedule(scheduler, () => {\n const {\n length\n } = observables;\n const values = new Array(length);\n let active = length;\n let remainingFirstValues = length;\n for (let i = 0; i < length; i++) {\n maybeSchedule(scheduler, () => {\n const source = from(observables[i], scheduler);\n let hasFirstValue = false;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n values[i] = value;\n if (!hasFirstValue) {\n hasFirstValue = true;\n remainingFirstValues--;\n }\n if (!remainingFirstValues) {\n subscriber.next(valueTransform(values.slice()));\n }\n }, () => {\n if (! --active) {\n subscriber.complete();\n }\n }));\n }, subscriber);\n }\n }, subscriber);\n };\n}\nfunction maybeSchedule(scheduler, execute, subscription) {\n if (scheduler) {\n executeSchedule(subscription, scheduler, execute);\n } else {\n execute();\n }\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { executeSchedule } from '../util/executeSchedule';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {\n const buffer = [];\n let active = 0;\n let index = 0;\n let isComplete = false;\n const checkComplete = () => {\n if (isComplete && !buffer.length && !active) {\n subscriber.complete();\n }\n };\n const outerNext = value => active < concurrent ? doInnerSub(value) : buffer.push(value);\n const doInnerSub = value => {\n expand && subscriber.next(value);\n active++;\n let innerComplete = false;\n innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, innerValue => {\n onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);\n if (expand) {\n outerNext(innerValue);\n } else {\n subscriber.next(innerValue);\n }\n }, () => {\n innerComplete = true;\n }, undefined, () => {\n if (innerComplete) {\n try {\n active--;\n while (buffer.length && active < concurrent) {\n const bufferedValue = buffer.shift();\n if (innerSubScheduler) {\n executeSchedule(subscriber, innerSubScheduler, () => doInnerSub(bufferedValue));\n } else {\n doInnerSub(bufferedValue);\n }\n }\n checkComplete();\n } catch (err) {\n subscriber.error(err);\n }\n }\n }));\n };\n source.subscribe(createOperatorSubscriber(subscriber, outerNext, () => {\n isComplete = true;\n checkComplete();\n }));\n return () => {\n additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();\n };\n}\n","import { map } from './map';\nimport { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { mergeInternals } from './mergeInternals';\nimport { isFunction } from '../util/isFunction';\nexport function mergeMap(project, resultSelector, concurrent = Infinity) {\n if (isFunction(resultSelector)) {\n return mergeMap((a, i) => map((b, ii) => resultSelector(a, b, i, ii))(innerFrom(project(a, i))), concurrent);\n } else if (typeof resultSelector === 'number') {\n concurrent = resultSelector;\n }\n return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent));\n}\n","import { mergeMap } from './mergeMap';\nimport { identity } from '../util/identity';\nexport function mergeAll(concurrent = Infinity) {\n return mergeMap(identity, concurrent);\n}\n","import { mergeAll } from './mergeAll';\nexport function concatAll() {\n return mergeAll(1);\n}\n","import { concatAll } from '../operators/concatAll';\nimport { popScheduler } from '../util/args';\nimport { from } from './from';\nexport function concat(...args) {\n return concatAll()(from(args, popScheduler(args)));\n}\n","import { Observable } from '../Observable';\nimport { innerFrom } from './innerFrom';\nexport function defer(observableFactory) {\n return new Observable(subscriber => {\n innerFrom(observableFactory()).subscribe(subscriber);\n });\n}\n","import { Observable } from '../Observable';\nimport { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';\nimport { innerFrom } from './innerFrom';\nimport { popResultSelector } from '../util/args';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { createObject } from '../util/createObject';\nexport function forkJoin(...args) {\n const resultSelector = popResultSelector(args);\n const {\n args: sources,\n keys\n } = argsArgArrayOrObject(args);\n const result = new Observable(subscriber => {\n const {\n length\n } = sources;\n if (!length) {\n subscriber.complete();\n return;\n }\n const values = new Array(length);\n let remainingCompletions = length;\n let remainingEmissions = length;\n for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) {\n let hasValue = false;\n innerFrom(sources[sourceIndex]).subscribe(createOperatorSubscriber(subscriber, value => {\n if (!hasValue) {\n hasValue = true;\n remainingEmissions--;\n }\n values[sourceIndex] = value;\n }, () => remainingCompletions--, undefined, () => {\n if (!remainingCompletions || !hasValue) {\n if (!remainingEmissions) {\n subscriber.next(keys ? createObject(keys, values) : values);\n }\n subscriber.complete();\n }\n }));\n }\n });\n return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { Observable } from '../Observable';\nimport { mergeMap } from '../operators/mergeMap';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isFunction } from '../util/isFunction';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nconst nodeEventEmitterMethods = ['addListener', 'removeListener'];\nconst eventTargetMethods = ['addEventListener', 'removeEventListener'];\nconst jqueryMethods = ['on', 'off'];\nexport function fromEvent(target, eventName, options, resultSelector) {\n if (isFunction(options)) {\n resultSelector = options;\n options = undefined;\n }\n if (resultSelector) {\n return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs(resultSelector));\n }\n const [add, remove] = isEventTarget(target) ? eventTargetMethods.map(methodName => handler => target[methodName](eventName, handler, options)) : isNodeStyleEventEmitter(target) ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName)) : isJQueryStyleEventEmitter(target) ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName)) : [];\n if (!add) {\n if (isArrayLike(target)) {\n return mergeMap(subTarget => fromEvent(subTarget, eventName, options))(innerFrom(target));\n }\n }\n if (!add) {\n throw new TypeError('Invalid event target');\n }\n return new Observable(subscriber => {\n const handler = (...args) => subscriber.next(1 < args.length ? args : args[0]);\n add(handler);\n return () => remove(handler);\n });\n}\nfunction toCommonHandlerRegistry(target, eventName) {\n return methodName => handler => target[methodName](eventName, handler);\n}\nfunction isNodeStyleEventEmitter(target) {\n return isFunction(target.addListener) && isFunction(target.removeListener);\n}\nfunction isJQueryStyleEventEmitter(target) {\n return isFunction(target.on) && isFunction(target.off);\n}\nfunction isEventTarget(target) {\n return isFunction(target.addEventListener) && isFunction(target.removeEventListener);\n}\n","import { defer } from './defer';\nexport function iif(condition, trueResult, falseResult) {\n return defer(() => condition() ? trueResult : falseResult);\n}\n","import { Observable } from '../Observable';\nimport { async as asyncScheduler } from '../scheduler/async';\nimport { isScheduler } from '../util/isScheduler';\nimport { isValidDate } from '../util/isDate';\nexport function timer(dueTime = 0, intervalOrScheduler, scheduler = asyncScheduler) {\n let intervalDuration = -1;\n if (intervalOrScheduler != null) {\n if (isScheduler(intervalOrScheduler)) {\n scheduler = intervalOrScheduler;\n } else {\n intervalDuration = intervalOrScheduler;\n }\n }\n return new Observable(subscriber => {\n let due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;\n if (due < 0) {\n due = 0;\n }\n let n = 0;\n return scheduler.schedule(function () {\n if (!subscriber.closed) {\n subscriber.next(n++);\n if (0 <= intervalDuration) {\n this.schedule(undefined, intervalDuration);\n } else {\n subscriber.complete();\n }\n }\n }, due);\n });\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { timer } from './timer';\nexport function interval(period = 0, scheduler = asyncScheduler) {\n if (period < 0) {\n period = 0;\n }\n return timer(period, period, scheduler);\n}\n","import { mergeAll } from '../operators/mergeAll';\nimport { innerFrom } from './innerFrom';\nimport { EMPTY } from './empty';\nimport { popNumber, popScheduler } from '../util/args';\nimport { from } from './from';\nexport function merge(...args) {\n const scheduler = popScheduler(args);\n const concurrent = popNumber(args, Infinity);\n const sources = args;\n return !sources.length ? EMPTY : sources.length === 1 ? innerFrom(sources[0]) : mergeAll(concurrent)(from(sources, scheduler));\n}\n","const {\n isArray\n} = Array;\nexport function argsOrArgArray(args) {\n return args.length === 1 && isArray(args[0]) ? args[0] : args;\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function filter(predicate, thisArg) {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => predicate.call(thisArg, value, index++) && subscriber.next(value)));\n });\n}\n","import { Observable } from '../Observable';\nimport { innerFrom } from './innerFrom';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nexport function race(...sources) {\n sources = argsOrArgArray(sources);\n return sources.length === 1 ? innerFrom(sources[0]) : new Observable(raceInit(sources));\n}\nexport function raceInit(sources) {\n return subscriber => {\n let subscriptions = [];\n for (let i = 0; subscriptions && !subscriber.closed && i < sources.length; i++) {\n subscriptions.push(innerFrom(sources[i]).subscribe(createOperatorSubscriber(subscriber, value => {\n if (subscriptions) {\n for (let s = 0; s < subscriptions.length; s++) {\n s !== i && subscriptions[s].unsubscribe();\n }\n subscriptions = null;\n }\n subscriber.next(value);\n })));\n }\n };\n}\n","import { Observable } from '../Observable';\nimport { innerFrom } from './innerFrom';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { EMPTY } from './empty';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { popResultSelector } from '../util/args';\nexport function zip(...args) {\n const resultSelector = popResultSelector(args);\n const sources = argsOrArgArray(args);\n return sources.length ? new Observable(subscriber => {\n let buffers = sources.map(() => []);\n let completed = sources.map(() => false);\n subscriber.add(() => {\n buffers = completed = null;\n });\n for (let sourceIndex = 0; !subscriber.closed && sourceIndex < sources.length; sourceIndex++) {\n innerFrom(sources[sourceIndex]).subscribe(createOperatorSubscriber(subscriber, value => {\n buffers[sourceIndex].push(value);\n if (buffers.every(buffer => buffer.length)) {\n const result = buffers.map(buffer => buffer.shift());\n subscriber.next(resultSelector ? resultSelector(...result) : result);\n if (buffers.some((buffer, i) => !buffer.length && completed[i])) {\n subscriber.complete();\n }\n }\n }, () => {\n completed[sourceIndex] = true;\n !buffers[sourceIndex].length && subscriber.complete();\n }));\n }\n return () => {\n buffers = completed = null;\n };\n }) : EMPTY;\n}\n","import { operate } from '../util/lift';\nimport { innerFrom } from '../observable/innerFrom';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function audit(durationSelector) {\n return operate((source, subscriber) => {\n let hasValue = false;\n let lastValue = null;\n let durationSubscriber = null;\n let isComplete = false;\n const endDuration = () => {\n durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();\n durationSubscriber = null;\n if (hasValue) {\n hasValue = false;\n const value = lastValue;\n lastValue = null;\n subscriber.next(value);\n }\n isComplete && subscriber.complete();\n };\n const cleanupDuration = () => {\n durationSubscriber = null;\n isComplete && subscriber.complete();\n };\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n hasValue = true;\n lastValue = value;\n if (!durationSubscriber) {\n innerFrom(durationSelector(value)).subscribe(durationSubscriber = createOperatorSubscriber(subscriber, endDuration, cleanupDuration));\n }\n }, () => {\n isComplete = true;\n (!hasValue || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();\n }));\n });\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { audit } from './audit';\nimport { timer } from '../observable/timer';\nexport function auditTime(duration, scheduler = asyncScheduler) {\n return audit(() => timer(duration, scheduler));\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { operate } from '../util/lift';\nexport function catchError(selector) {\n return operate((source, subscriber) => {\n let innerSub = null;\n let syncUnsub = false;\n let handledResult;\n innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, err => {\n handledResult = innerFrom(selector(err, catchError(selector)(source)));\n if (innerSub) {\n innerSub.unsubscribe();\n innerSub = null;\n handledResult.subscribe(subscriber);\n } else {\n syncUnsub = true;\n }\n }));\n if (syncUnsub) {\n innerSub.unsubscribe();\n innerSub = null;\n handledResult.subscribe(subscriber);\n }\n });\n}\n","import { createOperatorSubscriber } from './OperatorSubscriber';\nexport function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {\n return (source, subscriber) => {\n let hasState = hasSeed;\n let state = seed;\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n const i = index++;\n state = hasState ? accumulator(state, value, i) : (hasState = true, value);\n emitOnNext && subscriber.next(state);\n }, emitBeforeComplete && (() => {\n hasState && subscriber.next(state);\n subscriber.complete();\n })));\n };\n}\n","import { combineLatestInit } from '../observable/combineLatest';\nimport { operate } from '../util/lift';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { pipe } from '../util/pipe';\nimport { popResultSelector } from '../util/args';\nexport function combineLatest(...args) {\n const resultSelector = popResultSelector(args);\n return resultSelector ? pipe(combineLatest(...args), mapOneOrManyArgs(resultSelector)) : operate((source, subscriber) => {\n combineLatestInit([source, ...argsOrArgArray(args)])(subscriber);\n });\n}\n","import { combineLatest } from './combineLatest';\nexport function combineLatestWith(...otherSources) {\n return combineLatest(...otherSources);\n}\n","import { mergeMap } from './mergeMap';\nimport { isFunction } from '../util/isFunction';\nexport function concatMap(project, resultSelector) {\n return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);\n}\n","import { Observable } from '../Observable';\nexport function fromSubscribable(subscribable) {\n return new Observable(subscriber => subscribable.subscribe(subscriber));\n}\n","import { Subject } from '../Subject';\nimport { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { fromSubscribable } from '../observable/fromSubscribable';\nconst DEFAULT_CONFIG = {\n connector: () => new Subject()\n};\nexport function connect(selector, config = DEFAULT_CONFIG) {\n const {\n connector\n } = config;\n return operate((source, subscriber) => {\n const subject = connector();\n innerFrom(selector(fromSubscribable(subject))).subscribe(subscriber);\n subscriber.add(source.subscribe(subject));\n });\n}\n","import { operate } from '../util/lift';\nimport { noop } from '../util/noop';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nexport function debounce(durationSelector) {\n return operate((source, subscriber) => {\n let hasValue = false;\n let lastValue = null;\n let durationSubscriber = null;\n const emit = () => {\n durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();\n durationSubscriber = null;\n if (hasValue) {\n hasValue = false;\n const value = lastValue;\n lastValue = null;\n subscriber.next(value);\n }\n };\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();\n hasValue = true;\n lastValue = value;\n durationSubscriber = createOperatorSubscriber(subscriber, emit, noop);\n innerFrom(durationSelector(value)).subscribe(durationSubscriber);\n }, () => {\n emit();\n subscriber.complete();\n }, undefined, () => {\n lastValue = durationSubscriber = null;\n }));\n });\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function debounceTime(dueTime, scheduler = asyncScheduler) {\n return operate((source, subscriber) => {\n let activeTask = null;\n let lastValue = null;\n let lastTime = null;\n const emit = () => {\n if (activeTask) {\n activeTask.unsubscribe();\n activeTask = null;\n const value = lastValue;\n lastValue = null;\n subscriber.next(value);\n }\n };\n function emitWhenIdle() {\n const targetTime = lastTime + dueTime;\n const now = scheduler.now();\n if (now < targetTime) {\n activeTask = this.schedule(undefined, targetTime - now);\n subscriber.add(activeTask);\n return;\n }\n emit();\n }\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n lastValue = value;\n lastTime = scheduler.now();\n if (!activeTask) {\n activeTask = scheduler.schedule(emitWhenIdle, dueTime);\n subscriber.add(activeTask);\n }\n }, () => {\n emit();\n subscriber.complete();\n }, undefined, () => {\n lastValue = activeTask = null;\n }));\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function defaultIfEmpty(defaultValue) {\n return operate((source, subscriber) => {\n let hasValue = false;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n hasValue = true;\n subscriber.next(value);\n }, () => {\n if (!hasValue) {\n subscriber.next(defaultValue);\n }\n subscriber.complete();\n }));\n });\n}\n","import { EMPTY } from '../observable/empty';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function take(count) {\n return count <= 0 ? () => EMPTY : operate((source, subscriber) => {\n let seen = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n if (++seen <= count) {\n subscriber.next(value);\n if (count <= seen) {\n subscriber.complete();\n }\n }\n }));\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { noop } from '../util/noop';\nexport function ignoreElements() {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, noop));\n });\n}\n","import { map } from './map';\nexport function mapTo(value) {\n return map(() => value);\n}\n","import { concat } from '../observable/concat';\nimport { take } from './take';\nimport { ignoreElements } from './ignoreElements';\nimport { mapTo } from './mapTo';\nimport { mergeMap } from './mergeMap';\nimport { innerFrom } from '../observable/innerFrom';\nexport function delayWhen(delayDurationSelector, subscriptionDelay) {\n if (subscriptionDelay) {\n return source => concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));\n }\n return mergeMap((value, index) => innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)));\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { delayWhen } from './delayWhen';\nimport { timer } from '../observable/timer';\nexport function delay(due, scheduler = asyncScheduler) {\n const duration = timer(due, scheduler);\n return delayWhen(() => duration);\n}\n","import { observeNotification } from '../Notification';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function dematerialize() {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, notification => observeNotification(notification, subscriber)));\n });\n}\n","import { identity } from '../util/identity';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function distinctUntilChanged(comparator, keySelector = identity) {\n comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;\n return operate((source, subscriber) => {\n let previousKey;\n let first = true;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n const currentKey = keySelector(value);\n if (first || !comparator(previousKey, currentKey)) {\n first = false;\n previousKey = currentKey;\n subscriber.next(value);\n }\n }));\n });\n}\nfunction defaultCompare(a, b) {\n return a === b;\n}\n","import { EmptyError } from '../util/EmptyError';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function throwIfEmpty(errorFactory = defaultErrorFactory) {\n return operate((source, subscriber) => {\n let hasValue = false;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n hasValue = true;\n subscriber.next(value);\n }, () => hasValue ? subscriber.complete() : subscriber.error(errorFactory())));\n });\n}\nfunction defaultErrorFactory() {\n return new EmptyError();\n}\n","import { map } from './map';\nimport { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function exhaustMap(project, resultSelector) {\n if (resultSelector) {\n return source => source.pipe(exhaustMap((a, i) => innerFrom(project(a, i)).pipe(map((b, ii) => resultSelector(a, b, i, ii)))));\n }\n return operate((source, subscriber) => {\n let index = 0;\n let innerSub = null;\n let isComplete = false;\n source.subscribe(createOperatorSubscriber(subscriber, outerValue => {\n if (!innerSub) {\n innerSub = createOperatorSubscriber(subscriber, undefined, () => {\n innerSub = null;\n isComplete && subscriber.complete();\n });\n innerFrom(project(outerValue, index++)).subscribe(innerSub);\n }\n }, () => {\n isComplete = true;\n !innerSub && subscriber.complete();\n }));\n });\n}\n","import { operate } from '../util/lift';\nimport { mergeInternals } from './mergeInternals';\nexport function expand(project, concurrent = Infinity, scheduler) {\n concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;\n return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent, undefined, true, scheduler));\n}\n","import { operate } from '../util/lift';\nexport function finalize(callback) {\n return operate((source, subscriber) => {\n try {\n source.subscribe(subscriber);\n } finally {\n subscriber.add(callback);\n }\n });\n}\n","import { EmptyError } from '../util/EmptyError';\nimport { filter } from './filter';\nimport { take } from './take';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { identity } from '../util/identity';\nexport function first(predicate, defaultValue) {\n const hasDefaultValue = arguments.length >= 2;\n return source => source.pipe(predicate ? filter((v, i) => predicate(v, i, source)) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError()));\n}\n","import { Observable } from '../Observable';\nimport { innerFrom } from '../observable/innerFrom';\nimport { Subject } from '../Subject';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber, OperatorSubscriber } from './OperatorSubscriber';\nexport function groupBy(keySelector, elementOrOptions, duration, connector) {\n return operate((source, subscriber) => {\n let element;\n if (!elementOrOptions || typeof elementOrOptions === 'function') {\n element = elementOrOptions;\n } else {\n ({\n duration,\n element,\n connector\n } = elementOrOptions);\n }\n const groups = new Map();\n const notify = cb => {\n groups.forEach(cb);\n cb(subscriber);\n };\n const handleError = err => notify(consumer => consumer.error(err));\n let activeGroups = 0;\n let teardownAttempted = false;\n const groupBySourceSubscriber = new OperatorSubscriber(subscriber, value => {\n try {\n const key = keySelector(value);\n let group = groups.get(key);\n if (!group) {\n groups.set(key, group = connector ? connector() : new Subject());\n const grouped = createGroupedObservable(key, group);\n subscriber.next(grouped);\n if (duration) {\n const durationSubscriber = createOperatorSubscriber(group, () => {\n group.complete();\n durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();\n }, undefined, undefined, () => groups.delete(key));\n groupBySourceSubscriber.add(innerFrom(duration(grouped)).subscribe(durationSubscriber));\n }\n }\n group.next(element ? element(value) : value);\n } catch (err) {\n handleError(err);\n }\n }, () => notify(consumer => consumer.complete()), handleError, () => groups.clear(), () => {\n teardownAttempted = true;\n return activeGroups === 0;\n });\n source.subscribe(groupBySourceSubscriber);\n function createGroupedObservable(key, groupSubject) {\n const result = new Observable(groupSubscriber => {\n activeGroups++;\n const innerSub = groupSubject.subscribe(groupSubscriber);\n return () => {\n innerSub.unsubscribe();\n --activeGroups === 0 && teardownAttempted && groupBySourceSubscriber.unsubscribe();\n };\n });\n result.key = key;\n return result;\n }\n });\n}\n","import { EMPTY } from '../observable/empty';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function takeLast(count) {\n return count <= 0 ? () => EMPTY : operate((source, subscriber) => {\n let buffer = [];\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n buffer.push(value);\n count < buffer.length && buffer.shift();\n }, () => {\n for (const value of buffer) {\n subscriber.next(value);\n }\n subscriber.complete();\n }, undefined, () => {\n buffer = null;\n }));\n });\n}\n","import { EmptyError } from '../util/EmptyError';\nimport { filter } from './filter';\nimport { takeLast } from './takeLast';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { identity } from '../util/identity';\nexport function last(predicate, defaultValue) {\n const hasDefaultValue = arguments.length >= 2;\n return source => source.pipe(predicate ? filter((v, i) => predicate(v, i, source)) : identity, takeLast(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError()));\n}\n","import { Notification } from '../Notification';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function materialize() {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n subscriber.next(Notification.createNext(value));\n }, () => {\n subscriber.next(Notification.createComplete());\n subscriber.complete();\n }, err => {\n subscriber.next(Notification.createError(err));\n subscriber.complete();\n }));\n });\n}\n","import { ConnectableObservable } from '../observable/ConnectableObservable';\nimport { isFunction } from '../util/isFunction';\nimport { connect } from './connect';\nexport function multicast(subjectOrSubjectFactory, selector) {\n const subjectFactory = isFunction(subjectOrSubjectFactory) ? subjectOrSubjectFactory : () => subjectOrSubjectFactory;\n if (isFunction(selector)) {\n return connect(selector, {\n connector: subjectFactory\n });\n }\n return source => new ConnectableObservable(source, subjectFactory);\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function pairwise() {\n return operate((source, subscriber) => {\n let prev;\n let hasPrev = false;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n const p = prev;\n prev = value;\n hasPrev && subscriber.next([p, value]);\n hasPrev = true;\n }));\n });\n}\n","import { map } from './map';\nexport function pluck(...properties) {\n const length = properties.length;\n if (length === 0) {\n throw new Error('list of properties cannot be empty.');\n }\n return map(x => {\n let currentProp = x;\n for (let i = 0; i < length; i++) {\n const p = currentProp === null || currentProp === void 0 ? void 0 : currentProp[properties[i]];\n if (typeof p !== 'undefined') {\n currentProp = p;\n } else {\n return undefined;\n }\n }\n return currentProp;\n });\n}\n","import { ReplaySubject } from '../ReplaySubject';\nimport { multicast } from './multicast';\nimport { isFunction } from '../util/isFunction';\nexport function publishReplay(bufferSize, windowTime, selectorOrScheduler, timestampProvider) {\n if (selectorOrScheduler && !isFunction(selectorOrScheduler)) {\n timestampProvider = selectorOrScheduler;\n }\n const selector = isFunction(selectorOrScheduler) ? selectorOrScheduler : undefined;\n return source => multicast(new ReplaySubject(bufferSize, windowTime, timestampProvider), selector)(source);\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\nimport { timer } from '../observable/timer';\nimport { innerFrom } from '../observable/innerFrom';\nexport function retry(configOrCount = Infinity) {\n let config;\n if (configOrCount && typeof configOrCount === 'object') {\n config = configOrCount;\n } else {\n config = {\n count: configOrCount\n };\n }\n const {\n count = Infinity,\n delay,\n resetOnSuccess = false\n } = config;\n return count <= 0 ? identity : operate((source, subscriber) => {\n let soFar = 0;\n let innerSub;\n const subscribeForRetry = () => {\n let syncUnsub = false;\n innerSub = source.subscribe(createOperatorSubscriber(subscriber, value => {\n if (resetOnSuccess) {\n soFar = 0;\n }\n subscriber.next(value);\n }, undefined, err => {\n if (soFar++ < count) {\n const resub = () => {\n if (innerSub) {\n innerSub.unsubscribe();\n innerSub = null;\n subscribeForRetry();\n } else {\n syncUnsub = true;\n }\n };\n if (delay != null) {\n const notifier = typeof delay === 'number' ? timer(delay) : innerFrom(delay(err, soFar));\n const notifierSubscriber = createOperatorSubscriber(subscriber, () => {\n notifierSubscriber.unsubscribe();\n resub();\n }, () => {\n subscriber.complete();\n });\n notifier.subscribe(notifierSubscriber);\n } else {\n resub();\n }\n } else {\n subscriber.error(err);\n }\n }));\n if (syncUnsub) {\n innerSub.unsubscribe();\n innerSub = null;\n subscribeForRetry();\n }\n };\n subscribeForRetry();\n });\n}\n","import { operate } from '../util/lift';\nimport { scanInternals } from './scanInternals';\nexport function scan(accumulator, seed) {\n return operate(scanInternals(accumulator, seed, arguments.length >= 2, true));\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { Subject } from '../Subject';\nimport { SafeSubscriber } from '../Subscriber';\nimport { operate } from '../util/lift';\nexport function share(options = {}) {\n const {\n connector = () => new Subject(),\n resetOnError = true,\n resetOnComplete = true,\n resetOnRefCountZero = true\n } = options;\n return wrapperSource => {\n let connection;\n let resetConnection;\n let subject;\n let refCount = 0;\n let hasCompleted = false;\n let hasErrored = false;\n const cancelReset = () => {\n resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();\n resetConnection = undefined;\n };\n const reset = () => {\n cancelReset();\n connection = subject = undefined;\n hasCompleted = hasErrored = false;\n };\n const resetAndUnsubscribe = () => {\n const conn = connection;\n reset();\n conn === null || conn === void 0 ? void 0 : conn.unsubscribe();\n };\n return operate((source, subscriber) => {\n refCount++;\n if (!hasErrored && !hasCompleted) {\n cancelReset();\n }\n const dest = subject = subject !== null && subject !== void 0 ? subject : connector();\n subscriber.add(() => {\n refCount--;\n if (refCount === 0 && !hasErrored && !hasCompleted) {\n resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);\n }\n });\n dest.subscribe(subscriber);\n if (!connection && refCount > 0) {\n connection = new SafeSubscriber({\n next: value => dest.next(value),\n error: err => {\n hasErrored = true;\n cancelReset();\n resetConnection = handleReset(reset, resetOnError, err);\n dest.error(err);\n },\n complete: () => {\n hasCompleted = true;\n cancelReset();\n resetConnection = handleReset(reset, resetOnComplete);\n dest.complete();\n }\n });\n innerFrom(source).subscribe(connection);\n }\n })(wrapperSource);\n };\n}\nfunction handleReset(reset, on, ...args) {\n if (on === true) {\n reset();\n return;\n }\n if (on === false) {\n return;\n }\n const onSubscriber = new SafeSubscriber({\n next: () => {\n onSubscriber.unsubscribe();\n reset();\n }\n });\n return innerFrom(on(...args)).subscribe(onSubscriber);\n}\n","import { ReplaySubject } from '../ReplaySubject';\nimport { share } from './share';\nexport function shareReplay(configOrBufferSize, windowTime, scheduler) {\n let bufferSize;\n let refCount = false;\n if (configOrBufferSize && typeof configOrBufferSize === 'object') {\n ({\n bufferSize = Infinity,\n windowTime = Infinity,\n refCount = false,\n scheduler\n } = configOrBufferSize);\n } else {\n bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;\n }\n return share({\n connector: () => new ReplaySubject(bufferSize, windowTime, scheduler),\n resetOnError: true,\n resetOnComplete: false,\n resetOnRefCountZero: refCount\n });\n}\n","import { filter } from './filter';\nexport function skip(count) {\n return filter((_, index) => count <= index);\n}\n","import { identity } from '../util/identity';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function skipLast(skipCount) {\n return skipCount <= 0 ? identity : operate((source, subscriber) => {\n let ring = new Array(skipCount);\n let seen = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n const valueIndex = seen++;\n if (valueIndex < skipCount) {\n ring[valueIndex] = value;\n } else {\n const index = valueIndex % skipCount;\n const oldValue = ring[index];\n ring[index] = value;\n subscriber.next(oldValue);\n }\n }));\n return () => {\n ring = null;\n };\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function skipWhile(predicate) {\n return operate((source, subscriber) => {\n let taking = false;\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => (taking || (taking = !predicate(value, index++))) && subscriber.next(value)));\n });\n}\n","import { concat } from '../observable/concat';\nimport { popScheduler } from '../util/args';\nimport { operate } from '../util/lift';\nexport function startWith(...values) {\n const scheduler = popScheduler(values);\n return operate((source, subscriber) => {\n (scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);\n });\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function switchMap(project, resultSelector) {\n return operate((source, subscriber) => {\n let innerSubscriber = null;\n let index = 0;\n let isComplete = false;\n const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();\n let innerIndex = 0;\n const outerIndex = index++;\n innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, innerValue => subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue), () => {\n innerSubscriber = null;\n checkComplete();\n }));\n }, () => {\n isComplete = true;\n checkComplete();\n }));\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nimport { noop } from '../util/noop';\nexport function takeUntil(notifier) {\n return operate((source, subscriber) => {\n innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, () => subscriber.complete(), noop));\n !subscriber.closed && source.subscribe(subscriber);\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function takeWhile(predicate, inclusive = false) {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n const result = predicate(value, index++);\n (result || inclusive) && subscriber.next(value);\n !result && subscriber.complete();\n }));\n });\n}\n","import { isFunction } from '../util/isFunction';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\nexport function tap(observerOrNext, error, complete) {\n const tapObserver = isFunction(observerOrNext) || error || complete ? {\n next: observerOrNext,\n error,\n complete\n } : observerOrNext;\n return tapObserver ? operate((source, subscriber) => {\n var _a;\n (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);\n let isUnsub = true;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n var _a;\n (_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);\n subscriber.next(value);\n }, () => {\n var _a;\n isUnsub = false;\n (_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);\n subscriber.complete();\n }, err => {\n var _a;\n isUnsub = false;\n (_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);\n subscriber.error(err);\n }, () => {\n var _a, _b;\n if (isUnsub) {\n (_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);\n }\n (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);\n }));\n }) : identity;\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nexport function throttle(durationSelector, config) {\n return operate((source, subscriber) => {\n const {\n leading = true,\n trailing = false\n } = config !== null && config !== void 0 ? config : {};\n let hasValue = false;\n let sendValue = null;\n let throttled = null;\n let isComplete = false;\n const endThrottling = () => {\n throttled === null || throttled === void 0 ? void 0 : throttled.unsubscribe();\n throttled = null;\n if (trailing) {\n send();\n isComplete && subscriber.complete();\n }\n };\n const cleanupThrottling = () => {\n throttled = null;\n isComplete && subscriber.complete();\n };\n const startThrottle = value => throttled = innerFrom(durationSelector(value)).subscribe(createOperatorSubscriber(subscriber, endThrottling, cleanupThrottling));\n const send = () => {\n if (hasValue) {\n hasValue = false;\n const value = sendValue;\n sendValue = null;\n subscriber.next(value);\n !isComplete && startThrottle(value);\n }\n };\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n hasValue = true;\n sendValue = value;\n !(throttled && !throttled.closed) && (leading ? send() : startThrottle(value));\n }, () => {\n isComplete = true;\n !(trailing && hasValue && throttled && !throttled.closed) && subscriber.complete();\n }));\n });\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { throttle } from './throttle';\nimport { timer } from '../observable/timer';\nexport function throttleTime(duration, scheduler = asyncScheduler, config) {\n const duration$ = timer(duration, scheduler);\n return throttle(() => duration$, config);\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nimport { identity } from '../util/identity';\nimport { noop } from '../util/noop';\nimport { popResultSelector } from '../util/args';\nexport function withLatestFrom(...inputs) {\n const project = popResultSelector(inputs);\n return operate((source, subscriber) => {\n const len = inputs.length;\n const otherValues = new Array(len);\n let hasValue = inputs.map(() => false);\n let ready = false;\n for (let i = 0; i < len; i++) {\n innerFrom(inputs[i]).subscribe(createOperatorSubscriber(subscriber, value => {\n otherValues[i] = value;\n if (!ready && !hasValue[i]) {\n hasValue[i] = true;\n (ready = hasValue.every(identity)) && (hasValue = null);\n }\n }, noop));\n }\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n if (ready) {\n const values = [value, ...otherValues];\n subscriber.next(project ? project(...values) : values);\n }\n }));\n });\n}\n","/**\n * @license Angular v17.3.12\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport { SIGNAL_NODE as SIGNAL_NODE$1, signalSetFn as signalSetFn$1, producerAccessed as producerAccessed$1, SIGNAL as SIGNAL$1, getActiveConsumer as getActiveConsumer$1, setActiveConsumer as setActiveConsumer$1, consumerDestroy as consumerDestroy$1, REACTIVE_NODE as REACTIVE_NODE$1, consumerBeforeComputation as consumerBeforeComputation$1, consumerAfterComputation as consumerAfterComputation$1, consumerPollProducersForChange as consumerPollProducersForChange$1, createSignal as createSignal$1, signalUpdateFn as signalUpdateFn$1, createComputed as createComputed$1, setThrowInvalidWriteToSignalError as setThrowInvalidWriteToSignalError$1, createWatch as createWatch$1 } from '@angular/core/primitives/signals';\nimport { Subject, Subscription, BehaviorSubject } from 'rxjs';\nimport { map, first } from 'rxjs/operators';\n\n/**\n * Base URL for the error details page.\n *\n * Keep this constant in sync across:\n * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts\n * - packages/core/src/error_details_base_url.ts\n */\nconst ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';\n/**\n * URL for the XSS security documentation.\n */\nconst XSS_SECURITY_URL = 'https://g.co/ng/security#xss';\n\n/**\n * Class that represents a runtime error.\n * Formats and outputs the error message in a consistent way.\n *\n * Example:\n * ```\n * throw new RuntimeError(\n * RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,\n * ngDevMode && 'Injector has already been destroyed.');\n * ```\n *\n * Note: the `message` argument contains a descriptive error message as a string in development\n * mode (when the `ngDevMode` is defined). In production mode (after tree-shaking pass), the\n * `message` argument becomes `false`, thus we account for it in the typings and the runtime\n * logic.\n */\nclass RuntimeError extends Error {\n constructor(code, message) {\n super(formatRuntimeError(code, message));\n this.code = code;\n }\n}\n/**\n * Called to format a runtime error.\n * See additional info on the `message` argument type in the `RuntimeError` class description.\n */\nfunction formatRuntimeError(code, message) {\n // Error code might be a negative number, which is a special marker that instructs the logic to\n // generate a link to the error details page on angular.io.\n // We also prepend `0` to non-compile-time errors.\n const fullCode = `NG0${Math.abs(code)}`;\n let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;\n if (ngDevMode && code < 0) {\n const addPeriodSeparator = !errorMessage.match(/[.,;!?\\n]$/);\n const separator = addPeriodSeparator ? '.' : '';\n errorMessage = `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;\n }\n return errorMessage;\n}\nconst REQUIRED_UNSET_VALUE = /* @__PURE__ */Symbol('InputSignalNode#UNSET');\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst INPUT_SIGNAL_NODE = /* @__PURE__ */(() => {\n return {\n ...SIGNAL_NODE$1,\n transformFn: undefined,\n applyValueToInputSignal(node, value) {\n signalSetFn$1(node, value);\n }\n };\n})();\nconst ɵINPUT_SIGNAL_BRAND_READ_TYPE = /* @__PURE__ */Symbol();\nconst ɵINPUT_SIGNAL_BRAND_WRITE_TYPE = /* @__PURE__ */Symbol();\n/**\n * Creates an input signal.\n *\n * @param initialValue The initial value.\n * Can be set to {@link REQUIRED_UNSET_VALUE} for required inputs.\n * @param options Additional options for the input. e.g. a transform, or an alias.\n */\nfunction createInputSignal(initialValue, options) {\n const node = Object.create(INPUT_SIGNAL_NODE);\n node.value = initialValue;\n // Perf note: Always set `transformFn` here to ensure that `node` always\n // has the same v8 class shape, allowing monomorphic reads on input signals.\n node.transformFn = options?.transform;\n function inputValueFn() {\n // Record that someone looked at this signal.\n producerAccessed$1(node);\n if (node.value === REQUIRED_UNSET_VALUE) {\n throw new RuntimeError(-950 /* RuntimeErrorCode.REQUIRED_INPUT_NO_VALUE */, ngDevMode && 'Input is required but no value is available yet.');\n }\n return node.value;\n }\n inputValueFn[SIGNAL$1] = node;\n if (ngDevMode) {\n inputValueFn.toString = () => `[Input Signal: ${inputValueFn()}]`;\n }\n return inputValueFn;\n}\n\n/**\n * Convince closure compiler that the wrapped function has no side-effects.\n *\n * Closure compiler always assumes that `toString` has no side-effects. We use this quirk to\n * allow us to execute a function but have closure compiler mark the call as no-side-effects.\n * It is important that the return value for the `noSideEffects` function be assigned\n * to something which is retained otherwise the call to `noSideEffects` will be removed by closure\n * compiler.\n */\nfunction noSideEffects(fn) {\n return {\n toString: fn\n }.toString();\n}\nconst ANNOTATIONS = '__annotations__';\nconst PARAMETERS = '__parameters__';\nconst PROP_METADATA = '__prop__metadata__';\n/**\n * @suppress {globalThis}\n */\nfunction makeDecorator(name, props, parentClass, additionalProcessing, typeFn) {\n return noSideEffects(() => {\n const metaCtor = makeMetadataCtor(props);\n function DecoratorFactory(...args) {\n if (this instanceof DecoratorFactory) {\n metaCtor.call(this, ...args);\n return this;\n }\n const annotationInstance = new DecoratorFactory(...args);\n return function TypeDecorator(cls) {\n if (typeFn) typeFn(cls, ...args);\n // Use of Object.defineProperty is important since it creates non-enumerable property which\n // prevents the property is copied during subclassing.\n const annotations = cls.hasOwnProperty(ANNOTATIONS) ? cls[ANNOTATIONS] : Object.defineProperty(cls, ANNOTATIONS, {\n value: []\n })[ANNOTATIONS];\n annotations.push(annotationInstance);\n if (additionalProcessing) additionalProcessing(cls);\n return cls;\n };\n }\n if (parentClass) {\n DecoratorFactory.prototype = Object.create(parentClass.prototype);\n }\n DecoratorFactory.prototype.ngMetadataName = name;\n DecoratorFactory.annotationCls = DecoratorFactory;\n return DecoratorFactory;\n });\n}\nfunction makeMetadataCtor(props) {\n return function ctor(...args) {\n if (props) {\n const values = props(...args);\n for (const propName in values) {\n this[propName] = values[propName];\n }\n }\n };\n}\nfunction makeParamDecorator(name, props, parentClass) {\n return noSideEffects(() => {\n const metaCtor = makeMetadataCtor(props);\n function ParamDecoratorFactory(...args) {\n if (this instanceof ParamDecoratorFactory) {\n metaCtor.apply(this, args);\n return this;\n }\n const annotationInstance = new ParamDecoratorFactory(...args);\n ParamDecorator.annotation = annotationInstance;\n return ParamDecorator;\n function ParamDecorator(cls, unusedKey, index) {\n // Use of Object.defineProperty is important since it creates non-enumerable property which\n // prevents the property is copied during subclassing.\n const parameters = cls.hasOwnProperty(PARAMETERS) ? cls[PARAMETERS] : Object.defineProperty(cls, PARAMETERS, {\n value: []\n })[PARAMETERS];\n // there might be gaps if some in between parameters do not have annotations.\n // we pad with nulls.\n while (parameters.length <= index) {\n parameters.push(null);\n }\n (parameters[index] = parameters[index] || []).push(annotationInstance);\n return cls;\n }\n }\n if (parentClass) {\n ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);\n }\n ParamDecoratorFactory.prototype.ngMetadataName = name;\n ParamDecoratorFactory.annotationCls = ParamDecoratorFactory;\n return ParamDecoratorFactory;\n });\n}\nfunction makePropDecorator(name, props, parentClass, additionalProcessing) {\n return noSideEffects(() => {\n const metaCtor = makeMetadataCtor(props);\n function PropDecoratorFactory(...args) {\n if (this instanceof PropDecoratorFactory) {\n metaCtor.apply(this, args);\n return this;\n }\n const decoratorInstance = new PropDecoratorFactory(...args);\n function PropDecorator(target, name) {\n // target is undefined with standard decorators. This case is not supported and will throw\n // if this decorator is used in JIT mode with standard decorators.\n if (target === undefined) {\n throw new Error('Standard Angular field decorators are not supported in JIT mode.');\n }\n const constructor = target.constructor;\n // Use of Object.defineProperty is important because it creates a non-enumerable property\n // which prevents the property from being copied during subclassing.\n const meta = constructor.hasOwnProperty(PROP_METADATA) ? constructor[PROP_METADATA] : Object.defineProperty(constructor, PROP_METADATA, {\n value: {}\n })[PROP_METADATA];\n meta[name] = meta.hasOwnProperty(name) && meta[name] || [];\n meta[name].unshift(decoratorInstance);\n if (additionalProcessing) additionalProcessing(target, name, ...args);\n }\n return PropDecorator;\n }\n if (parentClass) {\n PropDecoratorFactory.prototype = Object.create(parentClass.prototype);\n }\n PropDecoratorFactory.prototype.ngMetadataName = name;\n PropDecoratorFactory.annotationCls = PropDecoratorFactory;\n return PropDecoratorFactory;\n });\n}\nconst _global = globalThis;\nfunction ngDevModeResetPerfCounters() {\n const locationString = typeof location !== 'undefined' ? location.toString() : '';\n const newCounters = {\n namedConstructors: locationString.indexOf('ngDevMode=namedConstructors') != -1,\n firstCreatePass: 0,\n tNode: 0,\n tView: 0,\n rendererCreateTextNode: 0,\n rendererSetText: 0,\n rendererCreateElement: 0,\n rendererAddEventListener: 0,\n rendererSetAttribute: 0,\n rendererRemoveAttribute: 0,\n rendererSetProperty: 0,\n rendererSetClassName: 0,\n rendererAddClass: 0,\n rendererRemoveClass: 0,\n rendererSetStyle: 0,\n rendererRemoveStyle: 0,\n rendererDestroy: 0,\n rendererDestroyNode: 0,\n rendererMoveNode: 0,\n rendererRemoveNode: 0,\n rendererAppendChild: 0,\n rendererInsertBefore: 0,\n rendererCreateComment: 0,\n hydratedNodes: 0,\n hydratedComponents: 0,\n dehydratedViewsRemoved: 0,\n dehydratedViewsCleanupRuns: 0,\n componentsSkippedHydration: 0\n };\n // Make sure to refer to ngDevMode as ['ngDevMode'] for closure.\n const allowNgDevModeTrue = locationString.indexOf('ngDevMode=false') === -1;\n if (!allowNgDevModeTrue) {\n _global['ngDevMode'] = false;\n } else {\n if (typeof _global['ngDevMode'] !== 'object') {\n _global['ngDevMode'] = {};\n }\n Object.assign(_global['ngDevMode'], newCounters);\n }\n return newCounters;\n}\n/**\n * This function checks to see if the `ngDevMode` has been set. If yes,\n * then we honor it, otherwise we default to dev mode with additional checks.\n *\n * The idea is that unless we are doing production build where we explicitly\n * set `ngDevMode == false` we should be helping the developer by providing\n * as much early warning and errors as possible.\n *\n * `ɵɵdefineComponent` is guaranteed to have been called before any component template functions\n * (and thus Ivy instructions), so a single initialization there is sufficient to ensure ngDevMode\n * is defined for the entire instruction set.\n *\n * When checking `ngDevMode` on toplevel, always init it before referencing it\n * (e.g. `((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode())`), otherwise you can\n * get a `ReferenceError` like in https://github.com/angular/angular/issues/31595.\n *\n * Details on possible values for `ngDevMode` can be found on its docstring.\n *\n * NOTE:\n * - changes to the `ngDevMode` name must be synced with `compiler-cli/src/tooling.ts`.\n */\nfunction initNgDevMode() {\n // The below checks are to ensure that calling `initNgDevMode` multiple times does not\n // reset the counters.\n // If the `ngDevMode` is not an object, then it means we have not created the perf counters\n // yet.\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (typeof ngDevMode !== 'object' || Object.keys(ngDevMode).length === 0) {\n ngDevModeResetPerfCounters();\n }\n return typeof ngDevMode !== 'undefined' && !!ngDevMode;\n }\n return false;\n}\nfunction getClosureSafeProperty(objWithPropertyToExtract) {\n for (let key in objWithPropertyToExtract) {\n if (objWithPropertyToExtract[key] === getClosureSafeProperty) {\n return key;\n }\n }\n throw Error('Could not find renamed property on target object.');\n}\n/**\n * Sets properties on a target object from a source object, but only if\n * the property doesn't already exist on the target object.\n * @param target The target to set properties on\n * @param source The source of the property keys and values to set\n */\nfunction fillProperties(target, source) {\n for (const key in source) {\n if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) {\n target[key] = source[key];\n }\n }\n}\nfunction stringify(token) {\n if (typeof token === 'string') {\n return token;\n }\n if (Array.isArray(token)) {\n return '[' + token.map(stringify).join(', ') + ']';\n }\n if (token == null) {\n return '' + token;\n }\n if (token.overriddenName) {\n return `${token.overriddenName}`;\n }\n if (token.name) {\n return `${token.name}`;\n }\n const res = token.toString();\n if (res == null) {\n return '' + res;\n }\n const newLineIndex = res.indexOf('\\n');\n return newLineIndex === -1 ? res : res.substring(0, newLineIndex);\n}\n/**\n * Concatenates two strings with separator, allocating new strings only when necessary.\n *\n * @param before before string.\n * @param separator separator string.\n * @param after after string.\n * @returns concatenated string.\n */\nfunction concatStringsWithSpace(before, after) {\n return before == null || before === '' ? after === null ? '' : after : after == null || after === '' ? before : before + ' ' + after;\n}\n/**\n * Ellipses the string in the middle when longer than the max length\n *\n * @param string\n * @param maxLength of the output string\n * @returns ellipsed string with ... in the middle\n */\nfunction truncateMiddle(str, maxLength = 100) {\n if (!str || maxLength < 1 || str.length <= maxLength) return str;\n if (maxLength == 1) return str.substring(0, 1) + '...';\n const halfLimit = Math.round(maxLength / 2);\n return str.substring(0, halfLimit) + '...' + str.substring(str.length - halfLimit);\n}\nconst __forward_ref__ = /*#__PURE__*/getClosureSafeProperty({\n __forward_ref__: getClosureSafeProperty\n});\n/**\n * Allows to refer to references which are not yet defined.\n *\n * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of\n * DI is declared, but not yet defined. It is also used when the `token` which we use when creating\n * a query is not yet defined.\n *\n * `forwardRef` is also used to break circularities in standalone components imports.\n *\n * @usageNotes\n * ### Circular dependency example\n * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}\n *\n * ### Circular standalone reference import example\n * ```ts\n * @Component({\n * standalone: true,\n * imports: [ChildComponent],\n * selector: 'app-parent',\n * template: ``,\n * })\n * export class ParentComponent {\n * @Input() hideParent: boolean;\n * }\n *\n *\n * @Component({\n * standalone: true,\n * imports: [CommonModule, forwardRef(() => ParentComponent)],\n * selector: 'app-child',\n * template: ``,\n * })\n * export class ChildComponent {\n * @Input() hideParent: boolean;\n * }\n * ```\n *\n * @publicApi\n */\nfunction forwardRef(forwardRefFn) {\n forwardRefFn.__forward_ref__ = forwardRef;\n forwardRefFn.toString = function () {\n return stringify(this());\n };\n return forwardRefFn;\n}\n/**\n * Lazily retrieves the reference value from a forwardRef.\n *\n * Acts as the identity function when given a non-forward-ref value.\n *\n * @usageNotes\n * ### Example\n *\n * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}\n *\n * @see {@link forwardRef}\n * @publicApi\n */\nfunction resolveForwardRef(type) {\n return isForwardRef(type) ? type() : type;\n}\n/** Checks whether a function is wrapped by a `forwardRef`. */\nfunction isForwardRef(fn) {\n return typeof fn === 'function' && fn.hasOwnProperty(__forward_ref__) && fn.__forward_ref__ === forwardRef;\n}\n\n// The functions in this file verify that the assumptions we are making\nfunction assertNumber(actual, msg) {\n if (!(typeof actual === 'number')) {\n throwError(msg, typeof actual, 'number', '===');\n }\n}\nfunction assertNumberInRange(actual, minInclusive, maxInclusive) {\n assertNumber(actual, 'Expected a number');\n assertLessThanOrEqual(actual, maxInclusive, 'Expected number to be less than or equal to');\n assertGreaterThanOrEqual(actual, minInclusive, 'Expected number to be greater than or equal to');\n}\nfunction assertString(actual, msg) {\n if (!(typeof actual === 'string')) {\n throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');\n }\n}\nfunction assertFunction(actual, msg) {\n if (!(typeof actual === 'function')) {\n throwError(msg, actual === null ? 'null' : typeof actual, 'function', '===');\n }\n}\nfunction assertEqual(actual, expected, msg) {\n if (!(actual == expected)) {\n throwError(msg, actual, expected, '==');\n }\n}\nfunction assertNotEqual(actual, expected, msg) {\n if (!(actual != expected)) {\n throwError(msg, actual, expected, '!=');\n }\n}\nfunction assertSame(actual, expected, msg) {\n if (!(actual === expected)) {\n throwError(msg, actual, expected, '===');\n }\n}\nfunction assertNotSame(actual, expected, msg) {\n if (!(actual !== expected)) {\n throwError(msg, actual, expected, '!==');\n }\n}\nfunction assertLessThan(actual, expected, msg) {\n if (!(actual < expected)) {\n throwError(msg, actual, expected, '<');\n }\n}\nfunction assertLessThanOrEqual(actual, expected, msg) {\n if (!(actual <= expected)) {\n throwError(msg, actual, expected, '<=');\n }\n}\nfunction assertGreaterThan(actual, expected, msg) {\n if (!(actual > expected)) {\n throwError(msg, actual, expected, '>');\n }\n}\nfunction assertGreaterThanOrEqual(actual, expected, msg) {\n if (!(actual >= expected)) {\n throwError(msg, actual, expected, '>=');\n }\n}\nfunction assertNotDefined(actual, msg) {\n if (actual != null) {\n throwError(msg, actual, null, '==');\n }\n}\nfunction assertDefined(actual, msg) {\n if (actual == null) {\n throwError(msg, actual, null, '!=');\n }\n}\nfunction throwError(msg, actual, expected, comparison) {\n throw new Error(`ASSERTION ERROR: ${msg}` + (comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));\n}\nfunction assertDomNode(node) {\n if (!(node instanceof Node)) {\n throwError(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`);\n }\n}\nfunction assertElement(node) {\n if (!(node instanceof Element)) {\n throwError(`The provided value must be an element but got ${stringify(node)}`);\n }\n}\nfunction assertIndexInRange(arr, index) {\n assertDefined(arr, 'Array must be defined.');\n const maxLen = arr.length;\n if (index < 0 || index >= maxLen) {\n throwError(`Index expected to be less than ${maxLen} but got ${index}`);\n }\n}\nfunction assertOneOf(value, ...validValues) {\n if (validValues.indexOf(value) !== -1) return true;\n throwError(`Expected value to be one of ${JSON.stringify(validValues)} but was ${JSON.stringify(value)}.`);\n}\nfunction assertNotReactive(fn) {\n if (getActiveConsumer$1() !== null) {\n throwError(`${fn}() should never be called in a reactive context.`);\n }\n}\n\n/**\n * Construct an injectable definition which defines how a token will be constructed by the DI\n * system, and in which injectors (if any) it will be available.\n *\n * This should be assigned to a static `ɵprov` field on a type, which will then be an\n * `InjectableType`.\n *\n * Options:\n * * `providedIn` determines which injectors will include the injectable, by either associating it\n * with an `@NgModule` or other `InjectorType`, or by specifying that this injectable should be\n * provided in the `'root'` injector, which will be the application-level injector in most apps.\n * * `factory` gives the zero argument function which will create an instance of the injectable.\n * The factory can call [`inject`](api/core/inject) to access the `Injector` and request injection\n * of dependencies.\n *\n * @codeGenApi\n * @publicApi This instruction has been emitted by ViewEngine for some time and is deployed to npm.\n */\nfunction ɵɵdefineInjectable(opts) {\n return {\n token: opts.token,\n providedIn: opts.providedIn || null,\n factory: opts.factory,\n value: undefined\n };\n}\n/**\n * @deprecated in v8, delete after v10. This API should be used only by generated code, and that\n * code should now use ɵɵdefineInjectable instead.\n * @publicApi\n */\nconst defineInjectable = ɵɵdefineInjectable;\n/**\n * Construct an `InjectorDef` which configures an injector.\n *\n * This should be assigned to a static injector def (`ɵinj`) field on a type, which will then be an\n * `InjectorType`.\n *\n * Options:\n *\n * * `providers`: an optional array of providers to add to the injector. Each provider must\n * either have a factory or point to a type which has a `ɵprov` static property (the\n * type must be an `InjectableType`).\n * * `imports`: an optional array of imports of other `InjectorType`s or `InjectorTypeWithModule`s\n * whose providers will also be added to the injector. Locally provided types will override\n * providers from imports.\n *\n * @codeGenApi\n */\nfunction ɵɵdefineInjector(options) {\n return {\n providers: options.providers || [],\n imports: options.imports || []\n };\n}\n/**\n * Read the injectable def (`ɵprov`) for `type` in a way which is immune to accidentally reading\n * inherited value.\n *\n * @param type A type which may have its own (non-inherited) `ɵprov`.\n */\nfunction getInjectableDef(type) {\n return getOwnDefinition(type, NG_PROV_DEF) || getOwnDefinition(type, NG_INJECTABLE_DEF);\n}\nfunction isInjectable(type) {\n return getInjectableDef(type) !== null;\n}\n/**\n * Return definition only if it is defined directly on `type` and is not inherited from a base\n * class of `type`.\n */\nfunction getOwnDefinition(type, field) {\n return type.hasOwnProperty(field) ? type[field] : null;\n}\n/**\n * Read the injectable def (`ɵprov`) for `type` or read the `ɵprov` from one of its ancestors.\n *\n * @param type A type which may have `ɵprov`, via inheritance.\n *\n * @deprecated Will be removed in a future version of Angular, where an error will occur in the\n * scenario if we find the `ɵprov` on an ancestor only.\n */\nfunction getInheritedInjectableDef(type) {\n const def = type && (type[NG_PROV_DEF] || type[NG_INJECTABLE_DEF]);\n if (def) {\n ngDevMode && console.warn(`DEPRECATED: DI is instantiating a token \"${type.name}\" that inherits its @Injectable decorator but does not provide one itself.\\n` + `This will become an error in a future version of Angular. Please add @Injectable() to the \"${type.name}\" class.`);\n return def;\n } else {\n return null;\n }\n}\n/**\n * Read the injector def type in a way which is immune to accidentally reading inherited value.\n *\n * @param type type which may have an injector def (`ɵinj`)\n */\nfunction getInjectorDef(type) {\n return type && (type.hasOwnProperty(NG_INJ_DEF) || type.hasOwnProperty(NG_INJECTOR_DEF)) ? type[NG_INJ_DEF] : null;\n}\nconst NG_PROV_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵprov: getClosureSafeProperty\n});\nconst NG_INJ_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵinj: getClosureSafeProperty\n});\n// We need to keep these around so we can read off old defs if new defs are unavailable\nconst NG_INJECTABLE_DEF = /*#__PURE__*/getClosureSafeProperty({\n ngInjectableDef: getClosureSafeProperty\n});\nconst NG_INJECTOR_DEF = /*#__PURE__*/getClosureSafeProperty({\n ngInjectorDef: getClosureSafeProperty\n});\n\n/**\n * Creates a token that can be used in a DI Provider.\n *\n * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a\n * runtime representation) such as when injecting an interface, callable type, array or\n * parameterized type.\n *\n * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by\n * the `Injector`. This provides an additional level of type safety.\n *\n *
\n *\n * **Important Note**: Ensure that you use the same instance of the `InjectionToken` in both the\n * provider and the injection call. Creating a new instance of `InjectionToken` in different places,\n * even with the same description, will be treated as different tokens by Angular's DI system,\n * leading to a `NullInjectorError`.\n *\n *
\n *\n * \n *\n * When creating an `InjectionToken`, you can optionally specify a factory function which returns\n * (possibly by creating) a default value of the parameterized type `T`. This sets up the\n * `InjectionToken` using this factory as a provider as if it was defined explicitly in the\n * application's root injector. If the factory function, which takes zero arguments, needs to inject\n * dependencies, it can do so using the [`inject`](api/core/inject) function.\n * As you can see in the Tree-shakable InjectionToken example below.\n *\n * Additionally, if a `factory` is specified you can also specify the `providedIn` option, which\n * overrides the above behavior and marks the token as belonging to a particular `@NgModule` (note:\n * this option is now deprecated). As mentioned above, `'root'` is the default value for\n * `providedIn`.\n *\n * The `providedIn: NgModule` and `providedIn: 'any'` options are deprecated.\n *\n * @usageNotes\n * ### Basic Examples\n *\n * ### Plain InjectionToken\n *\n * {@example core/di/ts/injector_spec.ts region='InjectionToken'}\n *\n * ### Tree-shakable InjectionToken\n *\n * {@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'}\n *\n * @publicApi\n */\nclass InjectionToken {\n /**\n * @param _desc Description for the token,\n * used only for debugging purposes,\n * it should but does not need to be unique\n * @param options Options for the token's usage, as described above\n */\n constructor(_desc, options) {\n this._desc = _desc;\n /** @internal */\n this.ngMetadataName = 'InjectionToken';\n this.ɵprov = undefined;\n if (typeof options == 'number') {\n (typeof ngDevMode === 'undefined' || ngDevMode) && assertLessThan(options, 0, 'Only negative numbers are supported here');\n // This is a special hack to assign __NG_ELEMENT_ID__ to this instance.\n // See `InjectorMarkers`\n this.__NG_ELEMENT_ID__ = options;\n } else if (options !== undefined) {\n this.ɵprov = ɵɵdefineInjectable({\n token: this,\n providedIn: options.providedIn || 'root',\n factory: options.factory\n });\n }\n }\n /**\n * @internal\n */\n get multi() {\n return this;\n }\n toString() {\n return `InjectionToken ${this._desc}`;\n }\n}\nlet _injectorProfilerContext;\nfunction getInjectorProfilerContext() {\n !ngDevMode && throwError('getInjectorProfilerContext should never be called in production mode');\n return _injectorProfilerContext;\n}\nfunction setInjectorProfilerContext(context) {\n !ngDevMode && throwError('setInjectorProfilerContext should never be called in production mode');\n const previous = _injectorProfilerContext;\n _injectorProfilerContext = context;\n return previous;\n}\nlet injectorProfilerCallback = null;\n/**\n * Sets the callback function which will be invoked during certain DI events within the\n * runtime (for example: injecting services, creating injectable instances, configuring providers)\n *\n * Warning: this function is *INTERNAL* and should not be relied upon in application's code.\n * The contract of the function might be changed in any release and/or the function can be removed\n * completely.\n *\n * @param profiler function provided by the caller or null value to disable profiling.\n */\nconst setInjectorProfiler = injectorProfiler => {\n !ngDevMode && throwError('setInjectorProfiler should never be called in production mode');\n injectorProfilerCallback = injectorProfiler;\n};\n/**\n * Injector profiler function which emits on DI events executed by the runtime.\n *\n * @param event InjectorProfilerEvent corresponding to the DI event being emitted\n */\nfunction injectorProfiler(event) {\n !ngDevMode && throwError('Injector profiler should never be called in production mode');\n if (injectorProfilerCallback != null /* both `null` and `undefined` */) {\n injectorProfilerCallback(event);\n }\n}\n/**\n * Emits an InjectorProfilerEventType.ProviderConfigured to the injector profiler. The data in the\n * emitted event includes the raw provider, as well as the token that provider is providing.\n *\n * @param eventProvider A provider object\n */\nfunction emitProviderConfiguredEvent(eventProvider, isViewProvider = false) {\n !ngDevMode && throwError('Injector profiler should never be called in production mode');\n let token;\n // if the provider is a TypeProvider (typeof provider is function) then the token is the\n // provider itself\n if (typeof eventProvider === 'function') {\n token = eventProvider;\n }\n // if the provider is an injection token, then the token is the injection token.\n else if (eventProvider instanceof InjectionToken) {\n token = eventProvider;\n }\n // in all other cases we can access the token via the `provide` property of the provider\n else {\n token = resolveForwardRef(eventProvider.provide);\n }\n let provider = eventProvider;\n // Injection tokens may define their own default provider which gets attached to the token itself\n // as `ɵprov`. In this case, we want to emit the provider that is attached to the token, not the\n // token itself.\n if (eventProvider instanceof InjectionToken) {\n provider = eventProvider.ɵprov || eventProvider;\n }\n injectorProfiler({\n type: 2 /* InjectorProfilerEventType.ProviderConfigured */,\n context: getInjectorProfilerContext(),\n providerRecord: {\n token,\n provider,\n isViewProvider\n }\n });\n}\n/**\n * Emits an event to the injector profiler with the instance that was created. Note that\n * the injector associated with this emission can be accessed by using getDebugInjectContext()\n *\n * @param instance an object created by an injector\n */\nfunction emitInstanceCreatedByInjectorEvent(instance) {\n !ngDevMode && throwError('Injector profiler should never be called in production mode');\n injectorProfiler({\n type: 1 /* InjectorProfilerEventType.InstanceCreatedByInjector */,\n context: getInjectorProfilerContext(),\n instance: {\n value: instance\n }\n });\n}\n/**\n * @param token DI token associated with injected service\n * @param value the instance of the injected service (i.e the result of `inject(token)`)\n * @param flags the flags that the token was injected with\n */\nfunction emitInjectEvent(token, value, flags) {\n !ngDevMode && throwError('Injector profiler should never be called in production mode');\n injectorProfiler({\n type: 0 /* InjectorProfilerEventType.Inject */,\n context: getInjectorProfilerContext(),\n service: {\n token,\n value,\n flags\n }\n });\n}\nfunction runInInjectorProfilerContext(injector, token, callback) {\n !ngDevMode && throwError('runInInjectorProfilerContext should never be called in production mode');\n const prevInjectContext = setInjectorProfilerContext({\n injector,\n token\n });\n try {\n callback();\n } finally {\n setInjectorProfilerContext(prevInjectContext);\n }\n}\nfunction isEnvironmentProviders(value) {\n return value && !!value.ɵproviders;\n}\nconst NG_COMP_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵcmp: getClosureSafeProperty\n});\nconst NG_DIR_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵdir: getClosureSafeProperty\n});\nconst NG_PIPE_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵpipe: getClosureSafeProperty\n});\nconst NG_MOD_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵmod: getClosureSafeProperty\n});\nconst NG_FACTORY_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵfac: getClosureSafeProperty\n});\n/**\n * If a directive is diPublic, bloomAdd sets a property on the type with this constant as\n * the key and the directive's unique ID as the value. This allows us to map directives to their\n * bloom filter bit for DI.\n */\n// TODO(misko): This is wrong. The NG_ELEMENT_ID should never be minified.\nconst NG_ELEMENT_ID = /*#__PURE__*/getClosureSafeProperty({\n __NG_ELEMENT_ID__: getClosureSafeProperty\n});\n/**\n * The `NG_ENV_ID` field on a DI token indicates special processing in the `EnvironmentInjector`:\n * getting such tokens from the `EnvironmentInjector` will bypass the standard DI resolution\n * strategy and instead will return implementation produced by the `NG_ENV_ID` factory function.\n *\n * This particular retrieval of DI tokens is mostly done to eliminate circular dependencies and\n * improve tree-shaking.\n */\nconst NG_ENV_ID = /*#__PURE__*/getClosureSafeProperty({\n __NG_ENV_ID__: getClosureSafeProperty\n});\n\n/**\n * Used for stringify render output in Ivy.\n * Important! This function is very performance-sensitive and we should\n * be extra careful not to introduce megamorphic reads in it.\n * Check `core/test/render3/perf/render_stringify` for benchmarks and alternate implementations.\n */\nfunction renderStringify(value) {\n if (typeof value === 'string') return value;\n if (value == null) return '';\n // Use `String` so that it invokes the `toString` method of the value. Note that this\n // appears to be faster than calling `value.toString` (see `render_stringify` benchmark).\n return String(value);\n}\n/**\n * Used to stringify a value so that it can be displayed in an error message.\n *\n * Important! This function contains a megamorphic read and should only be\n * used for error messages.\n */\nfunction stringifyForError(value) {\n if (typeof value === 'function') return value.name || value.toString();\n if (typeof value === 'object' && value != null && typeof value.type === 'function') {\n return value.type.name || value.type.toString();\n }\n return renderStringify(value);\n}\n/**\n * Used to stringify a `Type` and including the file path and line number in which it is defined, if\n * possible, for better debugging experience.\n *\n * Important! This function contains a megamorphic read and should only be used for error messages.\n */\nfunction debugStringifyTypeForError(type) {\n // TODO(pmvald): Do some refactoring so that we can use getComponentDef here without creating\n // circular deps.\n let componentDef = type[NG_COMP_DEF] || null;\n if (componentDef !== null && componentDef.debugInfo) {\n return stringifyTypeFromDebugInfo(componentDef.debugInfo);\n }\n return stringifyForError(type);\n}\n// TODO(pmvald): Do some refactoring so that we can use the type ClassDebugInfo for the param\n// debugInfo here without creating circular deps.\nfunction stringifyTypeFromDebugInfo(debugInfo) {\n if (!debugInfo.filePath || !debugInfo.lineNumber) {\n return debugInfo.className;\n } else {\n return `${debugInfo.className} (at ${debugInfo.filePath}:${debugInfo.lineNumber})`;\n }\n}\n\n/** Called when directives inject each other (creating a circular dependency) */\nfunction throwCyclicDependencyError(token, path) {\n const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : '';\n throw new RuntimeError(-200 /* RuntimeErrorCode.CYCLIC_DI_DEPENDENCY */, ngDevMode ? `Circular dependency in DI detected for ${token}${depPath}` : token);\n}\nfunction throwMixedMultiProviderError() {\n throw new Error(`Cannot mix multi providers and regular providers`);\n}\nfunction throwInvalidProviderError(ngModuleType, providers, provider) {\n if (ngModuleType && providers) {\n const providerDetail = providers.map(v => v == provider ? '?' + provider + '?' : '...');\n throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}' - only instances of Provider and Type are allowed, got: [${providerDetail.join(', ')}]`);\n } else if (isEnvironmentProviders(provider)) {\n if (provider.ɵfromNgModule) {\n throw new RuntimeError(207 /* RuntimeErrorCode.PROVIDER_IN_WRONG_CONTEXT */, `Invalid providers from 'importProvidersFrom' present in a non-environment injector. 'importProvidersFrom' can't be used for component providers.`);\n } else {\n throw new RuntimeError(207 /* RuntimeErrorCode.PROVIDER_IN_WRONG_CONTEXT */, `Invalid providers present in a non-environment injector. 'EnvironmentProviders' can't be used for component providers.`);\n }\n } else {\n throw new Error('Invalid provider');\n }\n}\n/** Throws an error when a token is not found in DI. */\nfunction throwProviderNotFoundError(token, injectorName) {\n const errorMessage = ngDevMode && `No provider for ${stringifyForError(token)} found${injectorName ? ` in ${injectorName}` : ''}`;\n throw new RuntimeError(-201 /* RuntimeErrorCode.PROVIDER_NOT_FOUND */, errorMessage);\n}\n\n/**\n * Injection flags for DI.\n *\n * @publicApi\n * @deprecated use an options object for [`inject`](api/core/inject) instead.\n */\nvar InjectFlags = /*#__PURE__*/function (InjectFlags) {\n // TODO(alxhub): make this 'const' (and remove `InternalInjectFlags` enum) when ngc no longer\n // writes exports of it into ngfactory files.\n /** Check self and check parent injector if needed */\n InjectFlags[InjectFlags[\"Default\"] = 0] = \"Default\";\n /**\n * Specifies that an injector should retrieve a dependency from any injector until reaching the\n * host element of the current component. (Only used with Element Injector)\n */\n InjectFlags[InjectFlags[\"Host\"] = 1] = \"Host\";\n /** Don't ascend to ancestors of the node requesting injection. */\n InjectFlags[InjectFlags[\"Self\"] = 2] = \"Self\";\n /** Skip the node that is requesting injection. */\n InjectFlags[InjectFlags[\"SkipSelf\"] = 4] = \"SkipSelf\";\n /** Inject `defaultValue` instead if token not found. */\n InjectFlags[InjectFlags[\"Optional\"] = 8] = \"Optional\";\n return InjectFlags;\n}(InjectFlags || {});\n/**\n * Current implementation of inject.\n *\n * By default, it is `injectInjectorOnly`, which makes it `Injector`-only aware. It can be changed\n * to `directiveInject`, which brings in the `NodeInjector` system of ivy. It is designed this\n * way for two reasons:\n * 1. `Injector` should not depend on ivy logic.\n * 2. To maintain tree shake-ability we don't want to bring in unnecessary code.\n */\nlet _injectImplementation;\nfunction getInjectImplementation() {\n return _injectImplementation;\n}\n/**\n * Sets the current inject implementation.\n */\nfunction setInjectImplementation(impl) {\n const previous = _injectImplementation;\n _injectImplementation = impl;\n return previous;\n}\n/**\n * Injects `root` tokens in limp mode.\n *\n * If no injector exists, we can still inject tree-shakable providers which have `providedIn` set to\n * `\"root\"`. This is known as the limp mode injection. In such case the value is stored in the\n * injectable definition.\n */\nfunction injectRootLimpMode(token, notFoundValue, flags) {\n const injectableDef = getInjectableDef(token);\n if (injectableDef && injectableDef.providedIn == 'root') {\n return injectableDef.value === undefined ? injectableDef.value = injectableDef.factory() : injectableDef.value;\n }\n if (flags & InjectFlags.Optional) return null;\n if (notFoundValue !== undefined) return notFoundValue;\n throwProviderNotFoundError(token, 'Injector');\n}\n/**\n * Assert that `_injectImplementation` is not `fn`.\n *\n * This is useful, to prevent infinite recursion.\n *\n * @param fn Function which it should not equal to\n */\nfunction assertInjectImplementationNotEqual(fn) {\n ngDevMode && assertNotEqual(_injectImplementation, fn, 'Calling ɵɵinject would cause infinite recursion');\n}\nconst _THROW_IF_NOT_FOUND = {};\nconst THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;\n/*\n * Name of a property (that we patch onto DI decorator), which is used as an annotation of which\n * InjectFlag this decorator represents. This allows to avoid direct references to the DI decorators\n * in the code, thus making them tree-shakable.\n */\nconst DI_DECORATOR_FLAG = '__NG_DI_FLAG__';\nconst NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';\nconst NG_TOKEN_PATH = 'ngTokenPath';\nconst NEW_LINE = /\\n/gm;\nconst NO_NEW_LINE = 'ɵ';\nconst SOURCE = '__source';\n/**\n * Current injector value used by `inject`.\n * - `undefined`: it is an error to call `inject`\n * - `null`: `inject` can be called but there is no injector (limp-mode).\n * - Injector instance: Use the injector for resolution.\n */\nlet _currentInjector = undefined;\nfunction getCurrentInjector() {\n return _currentInjector;\n}\nfunction setCurrentInjector(injector) {\n const former = _currentInjector;\n _currentInjector = injector;\n return former;\n}\nfunction injectInjectorOnly(token, flags = InjectFlags.Default) {\n if (_currentInjector === undefined) {\n throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode && `inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \\`runInInjectionContext\\`.`);\n } else if (_currentInjector === null) {\n return injectRootLimpMode(token, undefined, flags);\n } else {\n const value = _currentInjector.get(token, flags & InjectFlags.Optional ? null : undefined, flags);\n ngDevMode && emitInjectEvent(token, value, flags);\n return value;\n }\n}\nfunction ɵɵinject(token, flags = InjectFlags.Default) {\n return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags);\n}\n/**\n * Throws an error indicating that a factory function could not be generated by the compiler for a\n * particular class.\n *\n * The name of the class is not mentioned here, but will be in the generated factory function name\n * and thus in the stack trace.\n *\n * @codeGenApi\n */\nfunction ɵɵinvalidFactoryDep(index) {\n throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode && `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.\nThis can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.\n\nPlease check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);\n}\n/**\n * Injects a token from the currently active injector.\n * `inject` is only supported in an [injection context](/guide/dependency-injection-context). It can\n * be used during:\n * - Construction (via the `constructor`) of a class being instantiated by the DI system, such\n * as an `@Injectable` or `@Component`.\n * - In the initializer for fields of such classes.\n * - In the factory function specified for `useFactory` of a `Provider` or an `@Injectable`.\n * - In the `factory` function specified for an `InjectionToken`.\n * - In a stackframe of a function call in a DI context\n *\n * @param token A token that represents a dependency that should be injected.\n * @param flags Optional flags that control how injection is executed.\n * The flags correspond to injection strategies that can be specified with\n * parameter decorators `@Host`, `@Self`, `@SkipSelf`, and `@Optional`.\n * @returns the injected value if operation is successful, `null` otherwise.\n * @throws if called outside of a supported context.\n *\n * @usageNotes\n * In practice the `inject()` calls are allowed in a constructor, a constructor parameter and a\n * field initializer:\n *\n * ```typescript\n * @Injectable({providedIn: 'root'})\n * export class Car {\n * radio: Radio|undefined;\n * // OK: field initializer\n * spareTyre = inject(Tyre);\n *\n * constructor() {\n * // OK: constructor body\n * this.radio = inject(Radio);\n * }\n * }\n * ```\n *\n * It is also legal to call `inject` from a provider's factory:\n *\n * ```typescript\n * providers: [\n * {provide: Car, useFactory: () => {\n * // OK: a class factory\n * const engine = inject(Engine);\n * return new Car(engine);\n * }}\n * ]\n * ```\n *\n * Calls to the `inject()` function outside of the class creation context will result in error. Most\n * notably, calls to `inject()` are disallowed after a class instance was created, in methods\n * (including lifecycle hooks):\n *\n * ```typescript\n * @Component({ ... })\n * export class CarComponent {\n * ngOnInit() {\n * // ERROR: too late, the component instance was already created\n * const engine = inject(Engine);\n * engine.start();\n * }\n * }\n * ```\n *\n * @publicApi\n */\nfunction inject(token, flags = InjectFlags.Default) {\n // The `as any` here _shouldn't_ be necessary, but without it JSCompiler\n // throws a disambiguation error due to the multiple signatures.\n return ɵɵinject(token, convertToBitFlags(flags));\n}\n// Converts object-based DI flags (`InjectOptions`) to bit flags (`InjectFlags`).\nfunction convertToBitFlags(flags) {\n if (typeof flags === 'undefined' || typeof flags === 'number') {\n return flags;\n }\n // While TypeScript doesn't accept it without a cast, bitwise OR with false-y values in\n // JavaScript is a no-op. We can use that for a very codesize-efficient conversion from\n // `InjectOptions` to `InjectFlags`.\n return 0 /* InternalInjectFlags.Default */ | (\n // comment to force a line break in the formatter\n flags.optional && 8 /* InternalInjectFlags.Optional */) | (flags.host && 1 /* InternalInjectFlags.Host */) | (flags.self && 2 /* InternalInjectFlags.Self */) | (flags.skipSelf && 4 /* InternalInjectFlags.SkipSelf */);\n}\nfunction injectArgs(types) {\n const args = [];\n for (let i = 0; i < types.length; i++) {\n const arg = resolveForwardRef(types[i]);\n if (Array.isArray(arg)) {\n if (arg.length === 0) {\n throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');\n }\n let type = undefined;\n let flags = InjectFlags.Default;\n for (let j = 0; j < arg.length; j++) {\n const meta = arg[j];\n const flag = getInjectFlag(meta);\n if (typeof flag === 'number') {\n // Special case when we handle @Inject decorator.\n if (flag === -1 /* DecoratorFlags.Inject */) {\n type = meta.token;\n } else {\n flags |= flag;\n }\n } else {\n type = meta;\n }\n }\n args.push(ɵɵinject(type, flags));\n } else {\n args.push(ɵɵinject(arg));\n }\n }\n return args;\n}\n/**\n * Attaches a given InjectFlag to a given decorator using monkey-patching.\n * Since DI decorators can be used in providers `deps` array (when provider is configured using\n * `useFactory`) without initialization (e.g. `Host`) and as an instance (e.g. `new Host()`), we\n * attach the flag to make it available both as a static property and as a field on decorator\n * instance.\n *\n * @param decorator Provided DI decorator.\n * @param flag InjectFlag that should be applied.\n */\nfunction attachInjectFlag(decorator, flag) {\n decorator[DI_DECORATOR_FLAG] = flag;\n decorator.prototype[DI_DECORATOR_FLAG] = flag;\n return decorator;\n}\n/**\n * Reads monkey-patched property that contains InjectFlag attached to a decorator.\n *\n * @param token Token that may contain monkey-patched DI flags property.\n */\nfunction getInjectFlag(token) {\n return token[DI_DECORATOR_FLAG];\n}\nfunction catchInjectorError(e, token, injectorErrorName, source) {\n const tokenPath = e[NG_TEMP_TOKEN_PATH];\n if (token[SOURCE]) {\n tokenPath.unshift(token[SOURCE]);\n }\n e.message = formatError('\\n' + e.message, tokenPath, injectorErrorName, source);\n e[NG_TOKEN_PATH] = tokenPath;\n e[NG_TEMP_TOKEN_PATH] = null;\n throw e;\n}\nfunction formatError(text, obj, injectorErrorName, source = null) {\n text = text && text.charAt(0) === '\\n' && text.charAt(1) == NO_NEW_LINE ? text.slice(2) : text;\n let context = stringify(obj);\n if (Array.isArray(obj)) {\n context = obj.map(stringify).join(' -> ');\n } else if (typeof obj === 'object') {\n let parts = [];\n for (let key in obj) {\n if (obj.hasOwnProperty(key)) {\n let value = obj[key];\n parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));\n }\n }\n context = `{${parts.join(', ')}}`;\n }\n return `${injectorErrorName}${source ? '(' + source + ')' : ''}[${context}]: ${text.replace(NEW_LINE, '\\n ')}`;\n}\n\n/**\n * Inject decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Inject = /*#__PURE__*/attachInjectFlag(\n/*#__PURE__*/\n// Disable tslint because `DecoratorFlags` is a const enum which gets inlined.\n// tslint:disable-next-line: no-toplevel-property-access\nmakeParamDecorator('Inject', token => ({\n token\n})), -1 /* DecoratorFlags.Inject */);\n/**\n * Optional decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Optional =\n/*#__PURE__*/\n// Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.\n// tslint:disable-next-line: no-toplevel-property-access\nattachInjectFlag( /*#__PURE__*/makeParamDecorator('Optional'), 8 /* InternalInjectFlags.Optional */);\n/**\n * Self decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Self =\n/*#__PURE__*/\n// Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.\n// tslint:disable-next-line: no-toplevel-property-access\nattachInjectFlag( /*#__PURE__*/makeParamDecorator('Self'), 2 /* InternalInjectFlags.Self */);\n/**\n * `SkipSelf` decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst SkipSelf =\n/*#__PURE__*/\n// Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.\n// tslint:disable-next-line: no-toplevel-property-access\nattachInjectFlag( /*#__PURE__*/makeParamDecorator('SkipSelf'), 4 /* InternalInjectFlags.SkipSelf */);\n/**\n * Host decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Host =\n/*#__PURE__*/\n// Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.\n// tslint:disable-next-line: no-toplevel-property-access\nattachInjectFlag( /*#__PURE__*/makeParamDecorator('Host'), 1 /* InternalInjectFlags.Host */);\nfunction getFactoryDef(type, throwNotFound) {\n const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF);\n if (!hasFactoryDef && throwNotFound === true && ngDevMode) {\n throw new Error(`Type ${stringify(type)} does not have 'ɵfac' property.`);\n }\n return hasFactoryDef ? type[NG_FACTORY_DEF] : null;\n}\n\n/**\n * Determines if the contents of two arrays is identical\n *\n * @param a first array\n * @param b second array\n * @param identityAccessor Optional function for extracting stable object identity from a value in\n * the array.\n */\nfunction arrayEquals(a, b, identityAccessor) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n let valueA = a[i];\n let valueB = b[i];\n if (identityAccessor) {\n valueA = identityAccessor(valueA);\n valueB = identityAccessor(valueB);\n }\n if (valueB !== valueA) {\n return false;\n }\n }\n return true;\n}\n/**\n * Flattens an array.\n */\nfunction flatten(list) {\n return list.flat(Number.POSITIVE_INFINITY);\n}\nfunction deepForEach(input, fn) {\n input.forEach(value => Array.isArray(value) ? deepForEach(value, fn) : fn(value));\n}\nfunction addToArray(arr, index, value) {\n // perf: array.push is faster than array.splice!\n if (index >= arr.length) {\n arr.push(value);\n } else {\n arr.splice(index, 0, value);\n }\n}\nfunction removeFromArray(arr, index) {\n // perf: array.pop is faster than array.splice!\n if (index >= arr.length - 1) {\n return arr.pop();\n } else {\n return arr.splice(index, 1)[0];\n }\n}\nfunction newArray(size, value) {\n const list = [];\n for (let i = 0; i < size; i++) {\n list.push(value);\n }\n return list;\n}\n/**\n * Remove item from array (Same as `Array.splice()` but faster.)\n *\n * `Array.splice()` is not as fast because it has to allocate an array for the elements which were\n * removed. This causes memory pressure and slows down code when most of the time we don't\n * care about the deleted items array.\n *\n * https://jsperf.com/fast-array-splice (About 20x faster)\n *\n * @param array Array to splice\n * @param index Index of element in array to remove.\n * @param count Number of items to remove.\n */\nfunction arraySplice(array, index, count) {\n const length = array.length - count;\n while (index < length) {\n array[index] = array[index + count];\n index++;\n }\n while (count--) {\n array.pop(); // shrink the array\n }\n}\n/**\n * Same as `Array.splice(index, 0, value)` but faster.\n *\n * `Array.splice()` is not fast because it has to allocate an array for the elements which were\n * removed. This causes memory pressure and slows down code when most of the time we don't\n * care about the deleted items array.\n *\n * @param array Array to splice.\n * @param index Index in array where the `value` should be added.\n * @param value Value to add to array.\n */\nfunction arrayInsert(array, index, value) {\n ngDevMode && assertLessThanOrEqual(index, array.length, 'Can\\'t insert past array end.');\n let end = array.length;\n while (end > index) {\n const previousEnd = end - 1;\n array[end] = array[previousEnd];\n end = previousEnd;\n }\n array[index] = value;\n}\n/**\n * Same as `Array.splice2(index, 0, value1, value2)` but faster.\n *\n * `Array.splice()` is not fast because it has to allocate an array for the elements which were\n * removed. This causes memory pressure and slows down code when most of the time we don't\n * care about the deleted items array.\n *\n * @param array Array to splice.\n * @param index Index in array where the `value` should be added.\n * @param value1 Value to add to array.\n * @param value2 Value to add to array.\n */\nfunction arrayInsert2(array, index, value1, value2) {\n ngDevMode && assertLessThanOrEqual(index, array.length, 'Can\\'t insert past array end.');\n let end = array.length;\n if (end == index) {\n // inserting at the end.\n array.push(value1, value2);\n } else if (end === 1) {\n // corner case when we have less items in array than we have items to insert.\n array.push(value2, array[0]);\n array[0] = value1;\n } else {\n end--;\n array.push(array[end - 1], array[end]);\n while (end > index) {\n const previousEnd = end - 2;\n array[end] = array[previousEnd];\n end--;\n }\n array[index] = value1;\n array[index + 1] = value2;\n }\n}\n/**\n * Get an index of an `value` in a sorted `array`.\n *\n * NOTE:\n * - This uses binary search algorithm for fast removals.\n *\n * @param array A sorted array to binary search.\n * @param value The value to look for.\n * @returns index of the value.\n * - positive index if value found.\n * - negative index if value not found. (`~index` to get the value where it should have been\n * located)\n */\nfunction arrayIndexOfSorted(array, value) {\n return _arrayIndexOfSorted(array, value, 0);\n}\n/**\n * Set a `value` for a `key`.\n *\n * @param keyValueArray to modify.\n * @param key The key to locate or create.\n * @param value The value to set for a `key`.\n * @returns index (always even) of where the value vas set.\n */\nfunction keyValueArraySet(keyValueArray, key, value) {\n let index = keyValueArrayIndexOf(keyValueArray, key);\n if (index >= 0) {\n // if we found it set it.\n keyValueArray[index | 1] = value;\n } else {\n index = ~index;\n arrayInsert2(keyValueArray, index, key, value);\n }\n return index;\n}\n/**\n * Retrieve a `value` for a `key` (on `undefined` if not found.)\n *\n * @param keyValueArray to search.\n * @param key The key to locate.\n * @return The `value` stored at the `key` location or `undefined if not found.\n */\nfunction keyValueArrayGet(keyValueArray, key) {\n const index = keyValueArrayIndexOf(keyValueArray, key);\n if (index >= 0) {\n // if we found it retrieve it.\n return keyValueArray[index | 1];\n }\n return undefined;\n}\n/**\n * Retrieve a `key` index value in the array or `-1` if not found.\n *\n * @param keyValueArray to search.\n * @param key The key to locate.\n * @returns index of where the key is (or should have been.)\n * - positive (even) index if key found.\n * - negative index if key not found. (`~index` (even) to get the index where it should have\n * been inserted.)\n */\nfunction keyValueArrayIndexOf(keyValueArray, key) {\n return _arrayIndexOfSorted(keyValueArray, key, 1);\n}\n/**\n * Delete a `key` (and `value`) from the `KeyValueArray`.\n *\n * @param keyValueArray to modify.\n * @param key The key to locate or delete (if exist).\n * @returns index of where the key was (or should have been.)\n * - positive (even) index if key found and deleted.\n * - negative index if key not found. (`~index` (even) to get the index where it should have\n * been.)\n */\nfunction keyValueArrayDelete(keyValueArray, key) {\n const index = keyValueArrayIndexOf(keyValueArray, key);\n if (index >= 0) {\n // if we found it remove it.\n arraySplice(keyValueArray, index, 2);\n }\n return index;\n}\n/**\n * INTERNAL: Get an index of an `value` in a sorted `array` by grouping search by `shift`.\n *\n * NOTE:\n * - This uses binary search algorithm for fast removals.\n *\n * @param array A sorted array to binary search.\n * @param value The value to look for.\n * @param shift grouping shift.\n * - `0` means look at every location\n * - `1` means only look at every other (even) location (the odd locations are to be ignored as\n * they are values.)\n * @returns index of the value.\n * - positive index if value found.\n * - negative index if value not found. (`~index` to get the value where it should have been\n * inserted)\n */\nfunction _arrayIndexOfSorted(array, value, shift) {\n ngDevMode && assertEqual(Array.isArray(array), true, 'Expecting an array');\n let start = 0;\n let end = array.length >> shift;\n while (end !== start) {\n const middle = start + (end - start >> 1); // find the middle.\n const current = array[middle << shift];\n if (value === current) {\n return middle << shift;\n } else if (current > value) {\n end = middle;\n } else {\n start = middle + 1; // We already searched middle so make it non-inclusive by adding 1\n }\n }\n return ~(end << shift);\n}\n\n/**\n * This file contains reuseable \"empty\" symbols that can be used as default return values\n * in different parts of the rendering code. Because the same symbols are returned, this\n * allows for identity checks against these values to be consistently used by the framework\n * code.\n */\nconst EMPTY_OBJ = {};\nconst EMPTY_ARRAY = [];\n// freezing the values prevents any code from accidentally inserting new values in\nif ((typeof ngDevMode === 'undefined' || ngDevMode) && /*#__PURE__*/initNgDevMode()) {\n // These property accesses can be ignored because ngDevMode will be set to false\n // when optimizing code and the whole if statement will be dropped.\n // tslint:disable-next-line:no-toplevel-property-access\n /*#__PURE__*/Object.freeze(EMPTY_OBJ);\n // tslint:disable-next-line:no-toplevel-property-access\n /*#__PURE__*/Object.freeze(EMPTY_ARRAY);\n}\n\n/**\n * A multi-provider token for initialization functions that will run upon construction of an\n * environment injector.\n *\n * @publicApi\n */\nconst ENVIRONMENT_INITIALIZER = /*#__PURE__*/new InjectionToken(ngDevMode ? 'ENVIRONMENT_INITIALIZER' : '');\n\n/**\n * An InjectionToken that gets the current `Injector` for `createInjector()`-style injectors.\n *\n * Requesting this token instead of `Injector` allows `StaticInjector` to be tree-shaken from a\n * project.\n *\n * @publicApi\n */\nconst INJECTOR$1 = /*#__PURE__*/new InjectionToken(ngDevMode ? 'INJECTOR' : '',\n// Disable tslint because this is const enum which gets inlined not top level prop access.\n// tslint:disable-next-line: no-toplevel-property-access\n-1 /* InjectorMarkers.Injector */);\nconst INJECTOR_DEF_TYPES = /*#__PURE__*/new InjectionToken(ngDevMode ? 'INJECTOR_DEF_TYPES' : '');\nclass NullInjector {\n get(token, notFoundValue = THROW_IF_NOT_FOUND) {\n if (notFoundValue === THROW_IF_NOT_FOUND) {\n const error = new Error(`NullInjectorError: No provider for ${stringify(token)}!`);\n error.name = 'NullInjectorError';\n throw error;\n }\n return notFoundValue;\n }\n}\n\n/**\n * The strategy that the default change detector uses to detect changes.\n * When set, takes effect the next time change detection is triggered.\n *\n * @see [Change detection usage](/api/core/ChangeDetectorRef?tab=usage-notes)\n *\n * @publicApi\n */\nvar ChangeDetectionStrategy = /*#__PURE__*/function (ChangeDetectionStrategy) {\n /**\n * Use the `CheckOnce` strategy, meaning that automatic change detection is deactivated\n * until reactivated by setting the strategy to `Default` (`CheckAlways`).\n * Change detection can still be explicitly invoked.\n * This strategy applies to all child directives and cannot be overridden.\n */\n ChangeDetectionStrategy[ChangeDetectionStrategy[\"OnPush\"] = 0] = \"OnPush\";\n /**\n * Use the default `CheckAlways` strategy, in which change detection is automatic until\n * explicitly deactivated.\n */\n ChangeDetectionStrategy[ChangeDetectionStrategy[\"Default\"] = 1] = \"Default\";\n return ChangeDetectionStrategy;\n}(ChangeDetectionStrategy || {});\n/**\n * Defines the CSS styles encapsulation policies for the {@link Component} decorator's\n * `encapsulation` option.\n *\n * See {@link Component#encapsulation encapsulation}.\n *\n * @usageNotes\n * ### Example\n *\n * {@example core/ts/metadata/encapsulation.ts region='longform'}\n *\n * @publicApi\n */\nvar ViewEncapsulation$1 = /*#__PURE__*/function (ViewEncapsulation) {\n // TODO: consider making `ViewEncapsulation` a `const enum` instead. See\n // https://github.com/angular/angular/issues/44119 for additional information.\n /**\n * Emulates a native Shadow DOM encapsulation behavior by adding a specific attribute to the\n * component's host element and applying the same attribute to all the CSS selectors provided\n * via {@link Component#styles styles} or {@link Component#styleUrls styleUrls}.\n *\n * This is the default option.\n */\n ViewEncapsulation[ViewEncapsulation[\"Emulated\"] = 0] = \"Emulated\";\n // Historically the 1 value was for `Native` encapsulation which has been removed as of v11.\n /**\n * Doesn't provide any sort of CSS style encapsulation, meaning that all the styles provided\n * via {@link Component#styles styles} or {@link Component#styleUrls styleUrls} are applicable\n * to any HTML element of the application regardless of their host Component.\n */\n ViewEncapsulation[ViewEncapsulation[\"None\"] = 2] = \"None\";\n /**\n * Uses the browser's native Shadow DOM API to encapsulate CSS styles, meaning that it creates\n * a ShadowRoot for the component's host element which is then used to encapsulate\n * all the Component's styling.\n */\n ViewEncapsulation[ViewEncapsulation[\"ShadowDom\"] = 3] = \"ShadowDom\";\n return ViewEncapsulation;\n}(ViewEncapsulation$1 || {});\n/** Flags describing an input for a directive. */\nvar InputFlags = /*#__PURE__*/function (InputFlags) {\n InputFlags[InputFlags[\"None\"] = 0] = \"None\";\n InputFlags[InputFlags[\"SignalBased\"] = 1] = \"SignalBased\";\n InputFlags[InputFlags[\"HasDecoratorInputTransform\"] = 2] = \"HasDecoratorInputTransform\";\n return InputFlags;\n}(InputFlags || {});\n/**\n * Returns an index of `classToSearch` in `className` taking token boundaries into account.\n *\n * `classIndexOf('AB A', 'A', 0)` will be 3 (not 0 since `AB!==A`)\n *\n * @param className A string containing classes (whitespace separated)\n * @param classToSearch A class name to locate\n * @param startingIndex Starting location of search\n * @returns an index of the located class (or -1 if not found)\n */\nfunction classIndexOf(className, classToSearch, startingIndex) {\n ngDevMode && assertNotEqual(classToSearch, '', 'can not look for \"\" string.');\n let end = className.length;\n while (true) {\n const foundIndex = className.indexOf(classToSearch, startingIndex);\n if (foundIndex === -1) return foundIndex;\n if (foundIndex === 0 || className.charCodeAt(foundIndex - 1) <= 32 /* CharCode.SPACE */) {\n // Ensure that it has leading whitespace\n const length = classToSearch.length;\n if (foundIndex + length === end || className.charCodeAt(foundIndex + length) <= 32 /* CharCode.SPACE */) {\n // Ensure that it has trailing whitespace\n return foundIndex;\n }\n }\n // False positive, keep searching from where we left off.\n startingIndex = foundIndex + 1;\n }\n}\n\n/**\n * Assigns all attribute values to the provided element via the inferred renderer.\n *\n * This function accepts two forms of attribute entries:\n *\n * default: (key, value):\n * attrs = [key1, value1, key2, value2]\n *\n * namespaced: (NAMESPACE_MARKER, uri, name, value)\n * attrs = [NAMESPACE_MARKER, uri, name, value, NAMESPACE_MARKER, uri, name, value]\n *\n * The `attrs` array can contain a mix of both the default and namespaced entries.\n * The \"default\" values are set without a marker, but if the function comes across\n * a marker value then it will attempt to set a namespaced value. If the marker is\n * not of a namespaced value then the function will quit and return the index value\n * where it stopped during the iteration of the attrs array.\n *\n * See [AttributeMarker] to understand what the namespace marker value is.\n *\n * Note that this instruction does not support assigning style and class values to\n * an element. See `elementStart` and `elementHostAttrs` to learn how styling values\n * are applied to an element.\n * @param renderer The renderer to be used\n * @param native The element that the attributes will be assigned to\n * @param attrs The attribute array of values that will be assigned to the element\n * @returns the index value that was last accessed in the attributes array\n */\nfunction setUpAttributes(renderer, native, attrs) {\n let i = 0;\n while (i < attrs.length) {\n const value = attrs[i];\n if (typeof value === 'number') {\n // only namespaces are supported. Other value types (such as style/class\n // entries) are not supported in this function.\n if (value !== 0 /* AttributeMarker.NamespaceURI */) {\n break;\n }\n // we just landed on the marker value ... therefore\n // we should skip to the next entry\n i++;\n const namespaceURI = attrs[i++];\n const attrName = attrs[i++];\n const attrVal = attrs[i++];\n ngDevMode && ngDevMode.rendererSetAttribute++;\n renderer.setAttribute(native, attrName, attrVal, namespaceURI);\n } else {\n // attrName is string;\n const attrName = value;\n const attrVal = attrs[++i];\n // Standard attributes\n ngDevMode && ngDevMode.rendererSetAttribute++;\n if (isAnimationProp(attrName)) {\n renderer.setProperty(native, attrName, attrVal);\n } else {\n renderer.setAttribute(native, attrName, attrVal);\n }\n i++;\n }\n }\n // another piece of code may iterate over the same attributes array. Therefore\n // it may be helpful to return the exact spot where the attributes array exited\n // whether by running into an unsupported marker or if all the static values were\n // iterated over.\n return i;\n}\n/**\n * Test whether the given value is a marker that indicates that the following\n * attribute values in a `TAttributes` array are only the names of attributes,\n * and not name-value pairs.\n * @param marker The attribute marker to test.\n * @returns true if the marker is a \"name-only\" marker (e.g. `Bindings`, `Template` or `I18n`).\n */\nfunction isNameOnlyAttributeMarker(marker) {\n return marker === 3 /* AttributeMarker.Bindings */ || marker === 4 /* AttributeMarker.Template */ || marker === 6 /* AttributeMarker.I18n */;\n}\nfunction isAnimationProp(name) {\n // Perf note: accessing charCodeAt to check for the first character of a string is faster as\n // compared to accessing a character at index 0 (ex. name[0]). The main reason for this is that\n // charCodeAt doesn't allocate memory to return a substring.\n return name.charCodeAt(0) === 64 /* CharCode.AT_SIGN */;\n}\n/**\n * Merges `src` `TAttributes` into `dst` `TAttributes` removing any duplicates in the process.\n *\n * This merge function keeps the order of attrs same.\n *\n * @param dst Location of where the merged `TAttributes` should end up.\n * @param src `TAttributes` which should be appended to `dst`\n */\nfunction mergeHostAttrs(dst, src) {\n if (src === null || src.length === 0) {\n // do nothing\n } else if (dst === null || dst.length === 0) {\n // We have source, but dst is empty, just make a copy.\n dst = src.slice();\n } else {\n let srcMarker = -1 /* AttributeMarker.ImplicitAttributes */;\n for (let i = 0; i < src.length; i++) {\n const item = src[i];\n if (typeof item === 'number') {\n srcMarker = item;\n } else {\n if (srcMarker === 0 /* AttributeMarker.NamespaceURI */) {\n // Case where we need to consume `key1`, `key2`, `value` items.\n } else if (srcMarker === -1 /* AttributeMarker.ImplicitAttributes */ || srcMarker === 2 /* AttributeMarker.Styles */) {\n // Case where we have to consume `key1` and `value` only.\n mergeHostAttribute(dst, srcMarker, item, null, src[++i]);\n } else {\n // Case where we have to consume `key1` only.\n mergeHostAttribute(dst, srcMarker, item, null, null);\n }\n }\n }\n }\n return dst;\n}\n/**\n * Append `key`/`value` to existing `TAttributes` taking region marker and duplicates into account.\n *\n * @param dst `TAttributes` to append to.\n * @param marker Region where the `key`/`value` should be added.\n * @param key1 Key to add to `TAttributes`\n * @param key2 Key to add to `TAttributes` (in case of `AttributeMarker.NamespaceURI`)\n * @param value Value to add or to overwrite to `TAttributes` Only used if `marker` is not Class.\n */\nfunction mergeHostAttribute(dst, marker, key1, key2, value) {\n let i = 0;\n // Assume that new markers will be inserted at the end.\n let markerInsertPosition = dst.length;\n // scan until correct type.\n if (marker === -1 /* AttributeMarker.ImplicitAttributes */) {\n markerInsertPosition = -1;\n } else {\n while (i < dst.length) {\n const dstValue = dst[i++];\n if (typeof dstValue === 'number') {\n if (dstValue === marker) {\n markerInsertPosition = -1;\n break;\n } else if (dstValue > marker) {\n // We need to save this as we want the markers to be inserted in specific order.\n markerInsertPosition = i - 1;\n break;\n }\n }\n }\n }\n // search until you find place of insertion\n while (i < dst.length) {\n const item = dst[i];\n if (typeof item === 'number') {\n // since `i` started as the index after the marker, we did not find it if we are at the next\n // marker\n break;\n } else if (item === key1) {\n // We already have same token\n if (key2 === null) {\n if (value !== null) {\n dst[i + 1] = value;\n }\n return;\n } else if (key2 === dst[i + 1]) {\n dst[i + 2] = value;\n return;\n }\n }\n // Increment counter.\n i++;\n if (key2 !== null) i++;\n if (value !== null) i++;\n }\n // insert at location.\n if (markerInsertPosition !== -1) {\n dst.splice(markerInsertPosition, 0, marker);\n i = markerInsertPosition + 1;\n }\n dst.splice(i++, 0, key1);\n if (key2 !== null) {\n dst.splice(i++, 0, key2);\n }\n if (value !== null) {\n dst.splice(i++, 0, value);\n }\n}\nconst NG_TEMPLATE_SELECTOR = 'ng-template';\n/**\n * Search the `TAttributes` to see if it contains `cssClassToMatch` (case insensitive)\n *\n * @param tNode static data of the node to match\n * @param attrs `TAttributes` to search through.\n * @param cssClassToMatch class to match (lowercase)\n * @param isProjectionMode Whether or not class matching should look into the attribute `class` in\n * addition to the `AttributeMarker.Classes`.\n */\nfunction isCssClassMatching(tNode, attrs, cssClassToMatch, isProjectionMode) {\n ngDevMode && assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), 'Class name expected to be lowercase.');\n let i = 0;\n if (isProjectionMode) {\n for (; i < attrs.length && typeof attrs[i] === 'string'; i += 2) {\n // Search for an implicit `class` attribute and check if its value matches `cssClassToMatch`.\n if (attrs[i] === 'class' && classIndexOf(attrs[i + 1].toLowerCase(), cssClassToMatch, 0) !== -1) {\n return true;\n }\n }\n } else if (isInlineTemplate(tNode)) {\n // Matching directives (i.e. when not matching for projection mode) should not consider the\n // class bindings that are present on inline templates, as those class bindings only target\n // the root node of the template, not the template itself.\n return false;\n }\n // Resume the search for classes after the `Classes` marker.\n i = attrs.indexOf(1 /* AttributeMarker.Classes */, i);\n if (i > -1) {\n // We found the classes section. Start searching for the class.\n let item;\n while (++i < attrs.length && typeof (item = attrs[i]) === 'string') {\n if (item.toLowerCase() === cssClassToMatch) {\n return true;\n }\n }\n }\n return false;\n}\n/**\n * Checks whether the `tNode` represents an inline template (e.g. `*ngFor`).\n *\n * @param tNode current TNode\n */\nfunction isInlineTemplate(tNode) {\n return tNode.type === 4 /* TNodeType.Container */ && tNode.value !== NG_TEMPLATE_SELECTOR;\n}\n/**\n * Function that checks whether a given tNode matches tag-based selector and has a valid type.\n *\n * Matching can be performed in 2 modes: projection mode (when we project nodes) and regular\n * directive matching mode:\n * - in the \"directive matching\" mode we do _not_ take TContainer's tagName into account if it is\n * different from NG_TEMPLATE_SELECTOR (value different from NG_TEMPLATE_SELECTOR indicates that a\n * tag name was extracted from * syntax so we would match the same directive twice);\n * - in the \"projection\" mode, we use a tag name potentially extracted from the * syntax processing\n * (applicable to TNodeType.Container only).\n */\nfunction hasTagAndTypeMatch(tNode, currentSelector, isProjectionMode) {\n const tagNameToCompare = tNode.type === 4 /* TNodeType.Container */ && !isProjectionMode ? NG_TEMPLATE_SELECTOR : tNode.value;\n return currentSelector === tagNameToCompare;\n}\n/**\n * A utility function to match an Ivy node static data against a simple CSS selector\n *\n * @param tNode static data of the node to match\n * @param selector The selector to try matching against the node.\n * @param isProjectionMode if `true` we are matching for content projection, otherwise we are doing\n * directive matching.\n * @returns true if node matches the selector.\n */\nfunction isNodeMatchingSelector(tNode, selector, isProjectionMode) {\n ngDevMode && assertDefined(selector[0], 'Selector should have a tag name');\n let mode = 4 /* SelectorFlags.ELEMENT */;\n const nodeAttrs = tNode.attrs;\n // Find the index of first attribute that has no value, only a name.\n const nameOnlyMarkerIdx = nodeAttrs !== null ? getNameOnlyMarkerIndex(nodeAttrs) : 0;\n // When processing \":not\" selectors, we skip to the next \":not\" if the\n // current one doesn't match\n let skipToNextSelector = false;\n for (let i = 0; i < selector.length; i++) {\n const current = selector[i];\n if (typeof current === 'number') {\n // If we finish processing a :not selector and it hasn't failed, return false\n if (!skipToNextSelector && !isPositive(mode) && !isPositive(current)) {\n return false;\n }\n // If we are skipping to the next :not() and this mode flag is positive,\n // it's a part of the current :not() selector, and we should keep skipping\n if (skipToNextSelector && isPositive(current)) continue;\n skipToNextSelector = false;\n mode = current | mode & 1 /* SelectorFlags.NOT */;\n continue;\n }\n if (skipToNextSelector) continue;\n if (mode & 4 /* SelectorFlags.ELEMENT */) {\n mode = 2 /* SelectorFlags.ATTRIBUTE */ | mode & 1 /* SelectorFlags.NOT */;\n if (current !== '' && !hasTagAndTypeMatch(tNode, current, isProjectionMode) || current === '' && selector.length === 1) {\n if (isPositive(mode)) return false;\n skipToNextSelector = true;\n }\n } else if (mode & 8 /* SelectorFlags.CLASS */) {\n if (nodeAttrs === null || !isCssClassMatching(tNode, nodeAttrs, current, isProjectionMode)) {\n if (isPositive(mode)) return false;\n skipToNextSelector = true;\n }\n } else {\n const selectorAttrValue = selector[++i];\n const attrIndexInNode = findAttrIndexInNode(current, nodeAttrs, isInlineTemplate(tNode), isProjectionMode);\n if (attrIndexInNode === -1) {\n if (isPositive(mode)) return false;\n skipToNextSelector = true;\n continue;\n }\n if (selectorAttrValue !== '') {\n let nodeAttrValue;\n if (attrIndexInNode > nameOnlyMarkerIdx) {\n nodeAttrValue = '';\n } else {\n ngDevMode && assertNotEqual(nodeAttrs[attrIndexInNode], 0 /* AttributeMarker.NamespaceURI */, 'We do not match directives on namespaced attributes');\n // we lowercase the attribute value to be able to match\n // selectors without case-sensitivity\n // (selectors are already in lowercase when generated)\n nodeAttrValue = nodeAttrs[attrIndexInNode + 1].toLowerCase();\n }\n if (mode & 2 /* SelectorFlags.ATTRIBUTE */ && selectorAttrValue !== nodeAttrValue) {\n if (isPositive(mode)) return false;\n skipToNextSelector = true;\n }\n }\n }\n }\n return isPositive(mode) || skipToNextSelector;\n}\nfunction isPositive(mode) {\n return (mode & 1 /* SelectorFlags.NOT */) === 0;\n}\n/**\n * Examines the attribute's definition array for a node to find the index of the\n * attribute that matches the given `name`.\n *\n * NOTE: This will not match namespaced attributes.\n *\n * Attribute matching depends upon `isInlineTemplate` and `isProjectionMode`.\n * The following table summarizes which types of attributes we attempt to match:\n *\n * ===========================================================================================================\n * Modes | Normal Attributes | Bindings Attributes | Template Attributes | I18n\n * Attributes\n * ===========================================================================================================\n * Inline + Projection | YES | YES | NO | YES\n * -----------------------------------------------------------------------------------------------------------\n * Inline + Directive | NO | NO | YES | NO\n * -----------------------------------------------------------------------------------------------------------\n * Non-inline + Projection | YES | YES | NO | YES\n * -----------------------------------------------------------------------------------------------------------\n * Non-inline + Directive | YES | YES | NO | YES\n * ===========================================================================================================\n *\n * @param name the name of the attribute to find\n * @param attrs the attribute array to examine\n * @param isInlineTemplate true if the node being matched is an inline template (e.g. `*ngFor`)\n * rather than a manually expanded template node (e.g ``).\n * @param isProjectionMode true if we are matching against content projection otherwise we are\n * matching against directives.\n */\nfunction findAttrIndexInNode(name, attrs, isInlineTemplate, isProjectionMode) {\n if (attrs === null) return -1;\n let i = 0;\n if (isProjectionMode || !isInlineTemplate) {\n let bindingsMode = false;\n while (i < attrs.length) {\n const maybeAttrName = attrs[i];\n if (maybeAttrName === name) {\n return i;\n } else if (maybeAttrName === 3 /* AttributeMarker.Bindings */ || maybeAttrName === 6 /* AttributeMarker.I18n */) {\n bindingsMode = true;\n } else if (maybeAttrName === 1 /* AttributeMarker.Classes */ || maybeAttrName === 2 /* AttributeMarker.Styles */) {\n let value = attrs[++i];\n // We should skip classes here because we have a separate mechanism for\n // matching classes in projection mode.\n while (typeof value === 'string') {\n value = attrs[++i];\n }\n continue;\n } else if (maybeAttrName === 4 /* AttributeMarker.Template */) {\n // We do not care about Template attributes in this scenario.\n break;\n } else if (maybeAttrName === 0 /* AttributeMarker.NamespaceURI */) {\n // Skip the whole namespaced attribute and value. This is by design.\n i += 4;\n continue;\n }\n // In binding mode there are only names, rather than name-value pairs.\n i += bindingsMode ? 1 : 2;\n }\n // We did not match the attribute\n return -1;\n } else {\n return matchTemplateAttribute(attrs, name);\n }\n}\nfunction isNodeMatchingSelectorList(tNode, selector, isProjectionMode = false) {\n for (let i = 0; i < selector.length; i++) {\n if (isNodeMatchingSelector(tNode, selector[i], isProjectionMode)) {\n return true;\n }\n }\n return false;\n}\nfunction getProjectAsAttrValue(tNode) {\n const nodeAttrs = tNode.attrs;\n if (nodeAttrs != null) {\n const ngProjectAsAttrIdx = nodeAttrs.indexOf(5 /* AttributeMarker.ProjectAs */);\n // only check for ngProjectAs in attribute names, don't accidentally match attribute's value\n // (attribute names are stored at even indexes)\n if ((ngProjectAsAttrIdx & 1) === 0) {\n return nodeAttrs[ngProjectAsAttrIdx + 1];\n }\n }\n return null;\n}\nfunction getNameOnlyMarkerIndex(nodeAttrs) {\n for (let i = 0; i < nodeAttrs.length; i++) {\n const nodeAttr = nodeAttrs[i];\n if (isNameOnlyAttributeMarker(nodeAttr)) {\n return i;\n }\n }\n return nodeAttrs.length;\n}\nfunction matchTemplateAttribute(attrs, name) {\n let i = attrs.indexOf(4 /* AttributeMarker.Template */);\n if (i > -1) {\n i++;\n while (i < attrs.length) {\n const attr = attrs[i];\n // Return in case we checked all template attrs and are switching to the next section in the\n // attrs array (that starts with a number that represents an attribute marker).\n if (typeof attr === 'number') return -1;\n if (attr === name) return i;\n i++;\n }\n }\n return -1;\n}\n/**\n * Checks whether a selector is inside a CssSelectorList\n * @param selector Selector to be checked.\n * @param list List in which to look for the selector.\n */\nfunction isSelectorInSelectorList(selector, list) {\n selectorListLoop: for (let i = 0; i < list.length; i++) {\n const currentSelectorInList = list[i];\n if (selector.length !== currentSelectorInList.length) {\n continue;\n }\n for (let j = 0; j < selector.length; j++) {\n if (selector[j] !== currentSelectorInList[j]) {\n continue selectorListLoop;\n }\n }\n return true;\n }\n return false;\n}\nfunction maybeWrapInNotSelector(isNegativeMode, chunk) {\n return isNegativeMode ? ':not(' + chunk.trim() + ')' : chunk;\n}\nfunction stringifyCSSSelector(selector) {\n let result = selector[0];\n let i = 1;\n let mode = 2 /* SelectorFlags.ATTRIBUTE */;\n let currentChunk = '';\n let isNegativeMode = false;\n while (i < selector.length) {\n let valueOrMarker = selector[i];\n if (typeof valueOrMarker === 'string') {\n if (mode & 2 /* SelectorFlags.ATTRIBUTE */) {\n const attrValue = selector[++i];\n currentChunk += '[' + valueOrMarker + (attrValue.length > 0 ? '=\"' + attrValue + '\"' : '') + ']';\n } else if (mode & 8 /* SelectorFlags.CLASS */) {\n currentChunk += '.' + valueOrMarker;\n } else if (mode & 4 /* SelectorFlags.ELEMENT */) {\n currentChunk += ' ' + valueOrMarker;\n }\n } else {\n //\n // Append current chunk to the final result in case we come across SelectorFlag, which\n // indicates that the previous section of a selector is over. We need to accumulate content\n // between flags to make sure we wrap the chunk later in :not() selector if needed, e.g.\n // ```\n // ['', Flags.CLASS, '.classA', Flags.CLASS | Flags.NOT, '.classB', '.classC']\n // ```\n // should be transformed to `.classA :not(.classB .classC)`.\n //\n // Note: for negative selector part, we accumulate content between flags until we find the\n // next negative flag. This is needed to support a case where `:not()` rule contains more than\n // one chunk, e.g. the following selector:\n // ```\n // ['', Flags.ELEMENT | Flags.NOT, 'p', Flags.CLASS, 'foo', Flags.CLASS | Flags.NOT, 'bar']\n // ```\n // should be stringified to `:not(p.foo) :not(.bar)`\n //\n if (currentChunk !== '' && !isPositive(valueOrMarker)) {\n result += maybeWrapInNotSelector(isNegativeMode, currentChunk);\n currentChunk = '';\n }\n mode = valueOrMarker;\n // According to CssSelector spec, once we come across `SelectorFlags.NOT` flag, the negative\n // mode is maintained for remaining chunks of a selector.\n isNegativeMode = isNegativeMode || !isPositive(mode);\n }\n i++;\n }\n if (currentChunk !== '') {\n result += maybeWrapInNotSelector(isNegativeMode, currentChunk);\n }\n return result;\n}\n/**\n * Generates string representation of CSS selector in parsed form.\n *\n * ComponentDef and DirectiveDef are generated with the selector in parsed form to avoid doing\n * additional parsing at runtime (for example, for directive matching). However in some cases (for\n * example, while bootstrapping a component), a string version of the selector is required to query\n * for the host element on the page. This function takes the parsed form of a selector and returns\n * its string representation.\n *\n * @param selectorList selector in parsed form\n * @returns string representation of a given selector\n */\nfunction stringifyCSSSelectorList(selectorList) {\n return selectorList.map(stringifyCSSSelector).join(',');\n}\n/**\n * Extracts attributes and classes information from a given CSS selector.\n *\n * This function is used while creating a component dynamically. In this case, the host element\n * (that is created dynamically) should contain attributes and classes specified in component's CSS\n * selector.\n *\n * @param selector CSS selector in parsed form (in a form of array)\n * @returns object with `attrs` and `classes` fields that contain extracted information\n */\nfunction extractAttrsAndClassesFromSelector(selector) {\n const attrs = [];\n const classes = [];\n let i = 1;\n let mode = 2 /* SelectorFlags.ATTRIBUTE */;\n while (i < selector.length) {\n let valueOrMarker = selector[i];\n if (typeof valueOrMarker === 'string') {\n if (mode === 2 /* SelectorFlags.ATTRIBUTE */) {\n if (valueOrMarker !== '') {\n attrs.push(valueOrMarker, selector[++i]);\n }\n } else if (mode === 8 /* SelectorFlags.CLASS */) {\n classes.push(valueOrMarker);\n }\n } else {\n // According to CssSelector spec, once we come across `SelectorFlags.NOT` flag, the negative\n // mode is maintained for remaining chunks of a selector. Since attributes and classes are\n // extracted only for \"positive\" part of the selector, we can stop here.\n if (!isPositive(mode)) break;\n mode = valueOrMarker;\n }\n i++;\n }\n return {\n attrs,\n classes\n };\n}\n\n/**\n * Create a component definition object.\n *\n *\n * # Example\n * ```\n * class MyComponent {\n * // Generated by Angular Template Compiler\n * // [Symbol] syntax will not be supported by TypeScript until v2.7\n * static ɵcmp = defineComponent({\n * ...\n * });\n * }\n * ```\n * @codeGenApi\n */\nfunction ɵɵdefineComponent(componentDefinition) {\n return noSideEffects(() => {\n // Initialize ngDevMode. This must be the first statement in ɵɵdefineComponent.\n // See the `initNgDevMode` docstring for more information.\n (typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode();\n const baseDef = getNgDirectiveDef(componentDefinition);\n const def = {\n ...baseDef,\n decls: componentDefinition.decls,\n vars: componentDefinition.vars,\n template: componentDefinition.template,\n consts: componentDefinition.consts || null,\n ngContentSelectors: componentDefinition.ngContentSelectors,\n onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,\n directiveDefs: null,\n // assigned in noSideEffects\n pipeDefs: null,\n // assigned in noSideEffects\n dependencies: baseDef.standalone && componentDefinition.dependencies || null,\n getStandaloneInjector: null,\n signals: componentDefinition.signals ?? false,\n data: componentDefinition.data || {},\n encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated,\n styles: componentDefinition.styles || EMPTY_ARRAY,\n _: null,\n schemas: componentDefinition.schemas || null,\n tView: null,\n id: ''\n };\n initFeatures(def);\n const dependencies = componentDefinition.dependencies;\n def.directiveDefs = extractDefListOrFactory(dependencies, /* pipeDef */false);\n def.pipeDefs = extractDefListOrFactory(dependencies, /* pipeDef */true);\n def.id = getComponentId(def);\n return def;\n });\n}\nfunction extractDirectiveDef(type) {\n return getComponentDef(type) || getDirectiveDef(type);\n}\nfunction nonNull(value) {\n return value !== null;\n}\n/**\n * @codeGenApi\n */\nfunction ɵɵdefineNgModule(def) {\n return noSideEffects(() => {\n const res = {\n type: def.type,\n bootstrap: def.bootstrap || EMPTY_ARRAY,\n declarations: def.declarations || EMPTY_ARRAY,\n imports: def.imports || EMPTY_ARRAY,\n exports: def.exports || EMPTY_ARRAY,\n transitiveCompileScopes: null,\n schemas: def.schemas || null,\n id: def.id || null\n };\n return res;\n });\n}\nfunction parseAndConvertBindingsForDefinition(obj, declaredInputs) {\n if (obj == null) return EMPTY_OBJ;\n const newLookup = {};\n for (const minifiedKey in obj) {\n if (obj.hasOwnProperty(minifiedKey)) {\n const value = obj[minifiedKey];\n let publicName;\n let declaredName;\n let inputFlags = InputFlags.None;\n if (Array.isArray(value)) {\n inputFlags = value[0];\n publicName = value[1];\n declaredName = value[2] ?? publicName; // declared name might not be set to save bytes.\n } else {\n publicName = value;\n declaredName = value;\n }\n // For inputs, capture the declared name, or if some flags are set.\n if (declaredInputs) {\n // Perf note: An array is only allocated for the input if there are flags.\n newLookup[publicName] = inputFlags !== InputFlags.None ? [minifiedKey, inputFlags] : minifiedKey;\n declaredInputs[publicName] = declaredName;\n } else {\n newLookup[publicName] = minifiedKey;\n }\n }\n }\n return newLookup;\n}\n/**\n * Create a directive definition object.\n *\n * # Example\n * ```ts\n * class MyDirective {\n * // Generated by Angular Template Compiler\n * // [Symbol] syntax will not be supported by TypeScript until v2.7\n * static ɵdir = ɵɵdefineDirective({\n * ...\n * });\n * }\n * ```\n *\n * @codeGenApi\n */\nfunction ɵɵdefineDirective(directiveDefinition) {\n return noSideEffects(() => {\n const def = getNgDirectiveDef(directiveDefinition);\n initFeatures(def);\n return def;\n });\n}\n/**\n * Create a pipe definition object.\n *\n * # Example\n * ```\n * class MyPipe implements PipeTransform {\n * // Generated by Angular Template Compiler\n * static ɵpipe = definePipe({\n * ...\n * });\n * }\n * ```\n * @param pipeDef Pipe definition generated by the compiler\n *\n * @codeGenApi\n */\nfunction ɵɵdefinePipe(pipeDef) {\n return {\n type: pipeDef.type,\n name: pipeDef.name,\n factory: null,\n pure: pipeDef.pure !== false,\n standalone: pipeDef.standalone === true,\n onDestroy: pipeDef.type.prototype.ngOnDestroy || null\n };\n}\n/**\n * The following getter methods retrieve the definition from the type. Currently the retrieval\n * honors inheritance, but in the future we may change the rule to require that definitions are\n * explicit. This would require some sort of migration strategy.\n */\nfunction getComponentDef(type) {\n return type[NG_COMP_DEF] || null;\n}\nfunction getDirectiveDef(type) {\n return type[NG_DIR_DEF] || null;\n}\nfunction getPipeDef$1(type) {\n return type[NG_PIPE_DEF] || null;\n}\n/**\n * Checks whether a given Component, Directive or Pipe is marked as standalone.\n * This will return false if passed anything other than a Component, Directive, or Pipe class\n * See [this guide](/guide/standalone-components) for additional information:\n *\n * @param type A reference to a Component, Directive or Pipe.\n * @publicApi\n */\nfunction isStandalone(type) {\n const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);\n return def !== null ? def.standalone : false;\n}\nfunction getNgModuleDef(type, throwNotFound) {\n const ngModuleDef = type[NG_MOD_DEF] || null;\n if (!ngModuleDef && throwNotFound === true) {\n throw new Error(`Type ${stringify(type)} does not have 'ɵmod' property.`);\n }\n return ngModuleDef;\n}\nfunction getNgDirectiveDef(directiveDefinition) {\n const declaredInputs = {};\n return {\n type: directiveDefinition.type,\n providersResolver: null,\n factory: null,\n hostBindings: directiveDefinition.hostBindings || null,\n hostVars: directiveDefinition.hostVars || 0,\n hostAttrs: directiveDefinition.hostAttrs || null,\n contentQueries: directiveDefinition.contentQueries || null,\n declaredInputs: declaredInputs,\n inputTransforms: null,\n inputConfig: directiveDefinition.inputs || EMPTY_OBJ,\n exportAs: directiveDefinition.exportAs || null,\n standalone: directiveDefinition.standalone === true,\n signals: directiveDefinition.signals === true,\n selectors: directiveDefinition.selectors || EMPTY_ARRAY,\n viewQuery: directiveDefinition.viewQuery || null,\n features: directiveDefinition.features || null,\n setInput: null,\n findHostDirectiveDefs: null,\n hostDirectives: null,\n inputs: parseAndConvertBindingsForDefinition(directiveDefinition.inputs, declaredInputs),\n outputs: parseAndConvertBindingsForDefinition(directiveDefinition.outputs),\n debugInfo: null\n };\n}\nfunction initFeatures(definition) {\n definition.features?.forEach(fn => fn(definition));\n}\nfunction extractDefListOrFactory(dependencies, pipeDef) {\n if (!dependencies) {\n return null;\n }\n const defExtractor = pipeDef ? getPipeDef$1 : extractDirectiveDef;\n return () => (typeof dependencies === 'function' ? dependencies() : dependencies).map(dep => defExtractor(dep)).filter(nonNull);\n}\n/**\n * A map that contains the generated component IDs and type.\n */\nconst GENERATED_COMP_IDS = /*#__PURE__*/new Map();\n/**\n * A method can returns a component ID from the component definition using a variant of DJB2 hash\n * algorithm.\n */\nfunction getComponentId(componentDef) {\n let hash = 0;\n // We cannot rely solely on the component selector as the same selector can be used in different\n // modules.\n //\n // `componentDef.style` is not used, due to it causing inconsistencies. Ex: when server\n // component styles has no sourcemaps and browsers do.\n //\n // Example:\n // https://github.com/angular/components/blob/d9f82c8f95309e77a6d82fd574c65871e91354c2/src/material/core/option/option.ts#L248\n // https://github.com/angular/components/blob/285f46dc2b4c5b127d356cb7c4714b221f03ce50/src/material/legacy-core/option/option.ts#L32\n const hashSelectors = [componentDef.selectors, componentDef.ngContentSelectors, componentDef.hostVars, componentDef.hostAttrs, componentDef.consts, componentDef.vars, componentDef.decls, componentDef.encapsulation, componentDef.standalone, componentDef.signals, componentDef.exportAs, JSON.stringify(componentDef.inputs), JSON.stringify(componentDef.outputs),\n // We cannot use 'componentDef.type.name' as the name of the symbol will change and will not\n // match in the server and browser bundles.\n Object.getOwnPropertyNames(componentDef.type.prototype), !!componentDef.contentQueries, !!componentDef.viewQuery].join('|');\n for (const char of hashSelectors) {\n hash = Math.imul(31, hash) + char.charCodeAt(0) << 0;\n }\n // Force positive number hash.\n // 2147483647 = equivalent of Integer.MAX_VALUE.\n hash += 2147483647 + 1;\n const compId = 'c' + hash;\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (GENERATED_COMP_IDS.has(compId)) {\n const previousCompDefType = GENERATED_COMP_IDS.get(compId);\n if (previousCompDefType !== componentDef.type) {\n console.warn(formatRuntimeError(-912 /* RuntimeErrorCode.COMPONENT_ID_COLLISION */, `Component ID generation collision detected. Components '${previousCompDefType.name}' and '${componentDef.type.name}' with selector '${stringifyCSSSelectorList(componentDef.selectors)}' generated the same component ID. To fix this, you can change the selector of one of those components or add an extra host attribute to force a different ID.`));\n }\n } else {\n GENERATED_COMP_IDS.set(compId, componentDef.type);\n }\n }\n return compId;\n}\n\n/**\n * Wrap an array of `Provider`s into `EnvironmentProviders`, preventing them from being accidentally\n * referenced in `@Component` in a component injector.\n */\nfunction makeEnvironmentProviders(providers) {\n return {\n ɵproviders: providers\n };\n}\n/**\n * Collects providers from all NgModules and standalone components, including transitively imported\n * ones.\n *\n * Providers extracted via `importProvidersFrom` are only usable in an application injector or\n * another environment injector (such as a route injector). They should not be used in component\n * providers.\n *\n * More information about standalone components can be found in [this\n * guide](guide/standalone-components).\n *\n * @usageNotes\n * The results of the `importProvidersFrom` call can be used in the `bootstrapApplication` call:\n *\n * ```typescript\n * await bootstrapApplication(RootComponent, {\n * providers: [\n * importProvidersFrom(NgModuleOne, NgModuleTwo)\n * ]\n * });\n * ```\n *\n * You can also use the `importProvidersFrom` results in the `providers` field of a route, when a\n * standalone component is used:\n *\n * ```typescript\n * export const ROUTES: Route[] = [\n * {\n * path: 'foo',\n * providers: [\n * importProvidersFrom(NgModuleOne, NgModuleTwo)\n * ],\n * component: YourStandaloneComponent\n * }\n * ];\n * ```\n *\n * @returns Collected providers from the specified list of types.\n * @publicApi\n */\nfunction importProvidersFrom(...sources) {\n return {\n ɵproviders: internalImportProvidersFrom(true, sources),\n ɵfromNgModule: true\n };\n}\nfunction internalImportProvidersFrom(checkForStandaloneCmp, ...sources) {\n const providersOut = [];\n const dedup = new Set(); // already seen types\n let injectorTypesWithProviders;\n const collectProviders = provider => {\n providersOut.push(provider);\n };\n deepForEach(sources, source => {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && checkForStandaloneCmp) {\n const cmpDef = getComponentDef(source);\n if (cmpDef?.standalone) {\n throw new RuntimeError(800 /* RuntimeErrorCode.IMPORT_PROVIDERS_FROM_STANDALONE */, `Importing providers supports NgModule or ModuleWithProviders but got a standalone component \"${stringifyForError(source)}\"`);\n }\n }\n // Narrow `source` to access the internal type analogue for `ModuleWithProviders`.\n const internalSource = source;\n if (walkProviderTree(internalSource, collectProviders, [], dedup)) {\n injectorTypesWithProviders ||= [];\n injectorTypesWithProviders.push(internalSource);\n }\n });\n // Collect all providers from `ModuleWithProviders` types.\n if (injectorTypesWithProviders !== undefined) {\n processInjectorTypesWithProviders(injectorTypesWithProviders, collectProviders);\n }\n return providersOut;\n}\n/**\n * Collects all providers from the list of `ModuleWithProviders` and appends them to the provided\n * array.\n */\nfunction processInjectorTypesWithProviders(typesWithProviders, visitor) {\n for (let i = 0; i < typesWithProviders.length; i++) {\n const {\n ngModule,\n providers\n } = typesWithProviders[i];\n deepForEachProvider(providers, provider => {\n ngDevMode && validateProvider(provider, providers || EMPTY_ARRAY, ngModule);\n visitor(provider, ngModule);\n });\n }\n}\n/**\n * The logic visits an `InjectorType`, an `InjectorTypeWithProviders`, or a standalone\n * `ComponentType`, and all of its transitive providers and collects providers.\n *\n * If an `InjectorTypeWithProviders` that declares providers besides the type is specified,\n * the function will return \"true\" to indicate that the providers of the type definition need\n * to be processed. This allows us to process providers of injector types after all imports of\n * an injector definition are processed. (following View Engine semantics: see FW-1349)\n */\nfunction walkProviderTree(container, visitor, parents, dedup) {\n container = resolveForwardRef(container);\n if (!container) return false;\n // The actual type which had the definition. Usually `container`, but may be an unwrapped type\n // from `InjectorTypeWithProviders`.\n let defType = null;\n let injDef = getInjectorDef(container);\n const cmpDef = !injDef && getComponentDef(container);\n if (!injDef && !cmpDef) {\n // `container` is not an injector type or a component type. It might be:\n // * An `InjectorTypeWithProviders` that wraps an injector type.\n // * A standalone directive or pipe that got pulled in from a standalone component's\n // dependencies.\n // Try to unwrap it as an `InjectorTypeWithProviders` first.\n const ngModule = container.ngModule;\n injDef = getInjectorDef(ngModule);\n if (injDef) {\n defType = ngModule;\n } else {\n // Not a component or injector type, so ignore it.\n return false;\n }\n } else if (cmpDef && !cmpDef.standalone) {\n return false;\n } else {\n defType = container;\n }\n // Check for circular dependencies.\n if (ngDevMode && parents.indexOf(defType) !== -1) {\n const defName = stringify(defType);\n const path = parents.map(stringify);\n throwCyclicDependencyError(defName, path);\n }\n // Check for multiple imports of the same module\n const isDuplicate = dedup.has(defType);\n if (cmpDef) {\n if (isDuplicate) {\n // This component definition has already been processed.\n return false;\n }\n dedup.add(defType);\n if (cmpDef.dependencies) {\n const deps = typeof cmpDef.dependencies === 'function' ? cmpDef.dependencies() : cmpDef.dependencies;\n for (const dep of deps) {\n walkProviderTree(dep, visitor, parents, dedup);\n }\n }\n } else if (injDef) {\n // First, include providers from any imports.\n if (injDef.imports != null && !isDuplicate) {\n // Before processing defType's imports, add it to the set of parents. This way, if it ends\n // up deeply importing itself, this can be detected.\n ngDevMode && parents.push(defType);\n // Add it to the set of dedups. This way we can detect multiple imports of the same module\n dedup.add(defType);\n let importTypesWithProviders;\n try {\n deepForEach(injDef.imports, imported => {\n if (walkProviderTree(imported, visitor, parents, dedup)) {\n importTypesWithProviders ||= [];\n // If the processed import is an injector type with providers, we store it in the\n // list of import types with providers, so that we can process those afterwards.\n importTypesWithProviders.push(imported);\n }\n });\n } finally {\n // Remove it from the parents set when finished.\n ngDevMode && parents.pop();\n }\n // Imports which are declared with providers (TypeWithProviders) need to be processed\n // after all imported modules are processed. This is similar to how View Engine\n // processes/merges module imports in the metadata resolver. See: FW-1349.\n if (importTypesWithProviders !== undefined) {\n processInjectorTypesWithProviders(importTypesWithProviders, visitor);\n }\n }\n if (!isDuplicate) {\n // Track the InjectorType and add a provider for it.\n // It's important that this is done after the def's imports.\n const factory = getFactoryDef(defType) || (() => new defType());\n // Append extra providers to make more info available for consumers (to retrieve an injector\n // type), as well as internally (to calculate an injection scope correctly and eagerly\n // instantiate a `defType` when an injector is created).\n // Provider to create `defType` using its factory.\n visitor({\n provide: defType,\n useFactory: factory,\n deps: EMPTY_ARRAY\n }, defType);\n // Make this `defType` available to an internal logic that calculates injector scope.\n visitor({\n provide: INJECTOR_DEF_TYPES,\n useValue: defType,\n multi: true\n }, defType);\n // Provider to eagerly instantiate `defType` via `INJECTOR_INITIALIZER`.\n visitor({\n provide: ENVIRONMENT_INITIALIZER,\n useValue: () => ɵɵinject(defType),\n multi: true\n }, defType);\n }\n // Next, include providers listed on the definition itself.\n const defProviders = injDef.providers;\n if (defProviders != null && !isDuplicate) {\n const injectorType = container;\n deepForEachProvider(defProviders, provider => {\n ngDevMode && validateProvider(provider, defProviders, injectorType);\n visitor(provider, injectorType);\n });\n }\n } else {\n // Should not happen, but just in case.\n return false;\n }\n return defType !== container && container.providers !== undefined;\n}\nfunction validateProvider(provider, providers, containerType) {\n if (isTypeProvider(provider) || isValueProvider(provider) || isFactoryProvider(provider) || isExistingProvider(provider)) {\n return;\n }\n // Here we expect the provider to be a `useClass` provider (by elimination).\n const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));\n if (!classRef) {\n throwInvalidProviderError(containerType, providers, provider);\n }\n}\nfunction deepForEachProvider(providers, fn) {\n for (let provider of providers) {\n if (isEnvironmentProviders(provider)) {\n provider = provider.ɵproviders;\n }\n if (Array.isArray(provider)) {\n deepForEachProvider(provider, fn);\n } else {\n fn(provider);\n }\n }\n}\nconst USE_VALUE$1 = /*#__PURE__*/getClosureSafeProperty({\n provide: String,\n useValue: getClosureSafeProperty\n});\nfunction isValueProvider(value) {\n return value !== null && typeof value == 'object' && USE_VALUE$1 in value;\n}\nfunction isExistingProvider(value) {\n return !!(value && value.useExisting);\n}\nfunction isFactoryProvider(value) {\n return !!(value && value.useFactory);\n}\nfunction isTypeProvider(value) {\n return typeof value === 'function';\n}\nfunction isClassProvider(value) {\n return !!value.useClass;\n}\n\n/**\n * An internal token whose presence in an injector indicates that the injector should treat itself\n * as a root scoped injector when processing requests for unknown tokens which may indicate\n * they are provided in the root scope.\n */\nconst INJECTOR_SCOPE = /*#__PURE__*/new InjectionToken(ngDevMode ? 'Set Injector scope.' : '');\n\n/**\n * Marker which indicates that a value has not yet been created from the factory function.\n */\nconst NOT_YET = {};\n/**\n * Marker which indicates that the factory function for a token is in the process of being called.\n *\n * If the injector is asked to inject a token with its value set to CIRCULAR, that indicates\n * injection of a dependency has recursively attempted to inject the original token, and there is\n * a circular dependency among the providers.\n */\nconst CIRCULAR = {};\n/**\n * A lazily initialized NullInjector.\n */\nlet NULL_INJECTOR = undefined;\nfunction getNullInjector() {\n if (NULL_INJECTOR === undefined) {\n NULL_INJECTOR = new NullInjector();\n }\n return NULL_INJECTOR;\n}\n/**\n * An `Injector` that's part of the environment injector hierarchy, which exists outside of the\n * component tree.\n */\nclass EnvironmentInjector {}\nclass R3Injector extends EnvironmentInjector {\n /**\n * Flag indicating that this injector was previously destroyed.\n */\n get destroyed() {\n return this._destroyed;\n }\n constructor(providers, parent, source, scopes) {\n super();\n this.parent = parent;\n this.source = source;\n this.scopes = scopes;\n /**\n * Map of tokens to records which contain the instances of those tokens.\n * - `null` value implies that we don't have the record. Used by tree-shakable injectors\n * to prevent further searches.\n */\n this.records = new Map();\n /**\n * Set of values instantiated by this injector which contain `ngOnDestroy` lifecycle hooks.\n */\n this._ngOnDestroyHooks = new Set();\n this._onDestroyHooks = [];\n this._destroyed = false;\n // Start off by creating Records for every provider.\n forEachSingleProvider(providers, provider => this.processProvider(provider));\n // Make sure the INJECTOR token provides this injector.\n this.records.set(INJECTOR$1, makeRecord(undefined, this));\n // And `EnvironmentInjector` if the current injector is supposed to be env-scoped.\n if (scopes.has('environment')) {\n this.records.set(EnvironmentInjector, makeRecord(undefined, this));\n }\n // Detect whether this injector has the APP_ROOT_SCOPE token and thus should provide\n // any injectable scoped to APP_ROOT_SCOPE.\n const record = this.records.get(INJECTOR_SCOPE);\n if (record != null && typeof record.value === 'string') {\n this.scopes.add(record.value);\n }\n this.injectorDefTypes = new Set(this.get(INJECTOR_DEF_TYPES, EMPTY_ARRAY, InjectFlags.Self));\n }\n /**\n * Destroy the injector and release references to every instance or provider associated with it.\n *\n * Also calls the `OnDestroy` lifecycle hooks of every instance that was created for which a\n * hook was found.\n */\n destroy() {\n this.assertNotDestroyed();\n // Set destroyed = true first, in case lifecycle hooks re-enter destroy().\n this._destroyed = true;\n const prevConsumer = setActiveConsumer$1(null);\n try {\n // Call all the lifecycle hooks.\n for (const service of this._ngOnDestroyHooks) {\n service.ngOnDestroy();\n }\n const onDestroyHooks = this._onDestroyHooks;\n // Reset the _onDestroyHooks array before iterating over it to prevent hooks that unregister\n // themselves from mutating the array during iteration.\n this._onDestroyHooks = [];\n for (const hook of onDestroyHooks) {\n hook();\n }\n } finally {\n // Release all references.\n this.records.clear();\n this._ngOnDestroyHooks.clear();\n this.injectorDefTypes.clear();\n setActiveConsumer$1(prevConsumer);\n }\n }\n onDestroy(callback) {\n this.assertNotDestroyed();\n this._onDestroyHooks.push(callback);\n return () => this.removeOnDestroy(callback);\n }\n runInContext(fn) {\n this.assertNotDestroyed();\n const previousInjector = setCurrentInjector(this);\n const previousInjectImplementation = setInjectImplementation(undefined);\n let prevInjectContext;\n if (ngDevMode) {\n prevInjectContext = setInjectorProfilerContext({\n injector: this,\n token: null\n });\n }\n try {\n return fn();\n } finally {\n setCurrentInjector(previousInjector);\n setInjectImplementation(previousInjectImplementation);\n ngDevMode && setInjectorProfilerContext(prevInjectContext);\n }\n }\n get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {\n this.assertNotDestroyed();\n if (token.hasOwnProperty(NG_ENV_ID)) {\n return token[NG_ENV_ID](this);\n }\n flags = convertToBitFlags(flags);\n // Set the injection context.\n let prevInjectContext;\n if (ngDevMode) {\n prevInjectContext = setInjectorProfilerContext({\n injector: this,\n token: token\n });\n }\n const previousInjector = setCurrentInjector(this);\n const previousInjectImplementation = setInjectImplementation(undefined);\n try {\n // Check for the SkipSelf flag.\n if (!(flags & InjectFlags.SkipSelf)) {\n // SkipSelf isn't set, check if the record belongs to this injector.\n let record = this.records.get(token);\n if (record === undefined) {\n // No record, but maybe the token is scoped to this injector. Look for an injectable\n // def with a scope matching this injector.\n const def = couldBeInjectableType(token) && getInjectableDef(token);\n if (def && this.injectableDefInScope(def)) {\n // Found an injectable def and it's scoped to this injector. Pretend as if it was here\n // all along.\n if (ngDevMode) {\n runInInjectorProfilerContext(this, token, () => {\n emitProviderConfiguredEvent(token);\n });\n }\n record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET);\n } else {\n record = null;\n }\n this.records.set(token, record);\n }\n // If a record was found, get the instance for it and return it.\n if (record != null /* NOT null || undefined */) {\n return this.hydrate(token, record);\n }\n }\n // Select the next injector based on the Self flag - if self is set, the next injector is\n // the NullInjector, otherwise it's the parent.\n const nextInjector = !(flags & InjectFlags.Self) ? this.parent : getNullInjector();\n // Set the notFoundValue based on the Optional flag - if optional is set and notFoundValue\n // is undefined, the value is null, otherwise it's the notFoundValue.\n notFoundValue = flags & InjectFlags.Optional && notFoundValue === THROW_IF_NOT_FOUND ? null : notFoundValue;\n return nextInjector.get(token, notFoundValue);\n } catch (e) {\n if (e.name === 'NullInjectorError') {\n const path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];\n path.unshift(stringify(token));\n if (previousInjector) {\n // We still have a parent injector, keep throwing\n throw e;\n } else {\n // Format & throw the final error message when we don't have any previous injector\n return catchInjectorError(e, token, 'R3InjectorError', this.source);\n }\n } else {\n throw e;\n }\n } finally {\n // Lastly, restore the previous injection context.\n setInjectImplementation(previousInjectImplementation);\n setCurrentInjector(previousInjector);\n ngDevMode && setInjectorProfilerContext(prevInjectContext);\n }\n }\n /** @internal */\n resolveInjectorInitializers() {\n const prevConsumer = setActiveConsumer$1(null);\n const previousInjector = setCurrentInjector(this);\n const previousInjectImplementation = setInjectImplementation(undefined);\n let prevInjectContext;\n if (ngDevMode) {\n prevInjectContext = setInjectorProfilerContext({\n injector: this,\n token: null\n });\n }\n try {\n const initializers = this.get(ENVIRONMENT_INITIALIZER, EMPTY_ARRAY, InjectFlags.Self);\n if (ngDevMode && !Array.isArray(initializers)) {\n throw new RuntimeError(-209 /* RuntimeErrorCode.INVALID_MULTI_PROVIDER */, 'Unexpected type of the `ENVIRONMENT_INITIALIZER` token value ' + `(expected an array, but got ${typeof initializers}). ` + 'Please check that the `ENVIRONMENT_INITIALIZER` token is configured as a ' + '`multi: true` provider.');\n }\n for (const initializer of initializers) {\n initializer();\n }\n } finally {\n setCurrentInjector(previousInjector);\n setInjectImplementation(previousInjectImplementation);\n ngDevMode && setInjectorProfilerContext(prevInjectContext);\n setActiveConsumer$1(prevConsumer);\n }\n }\n toString() {\n const tokens = [];\n const records = this.records;\n for (const token of records.keys()) {\n tokens.push(stringify(token));\n }\n return `R3Injector[${tokens.join(', ')}]`;\n }\n assertNotDestroyed() {\n if (this._destroyed) {\n throw new RuntimeError(205 /* RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED */, ngDevMode && 'Injector has already been destroyed.');\n }\n }\n /**\n * Process a `SingleProvider` and add it.\n */\n processProvider(provider) {\n // Determine the token from the provider. Either it's its own token, or has a {provide: ...}\n // property.\n provider = resolveForwardRef(provider);\n let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide);\n // Construct a `Record` for the provider.\n const record = providerToRecord(provider);\n if (ngDevMode) {\n runInInjectorProfilerContext(this, token, () => {\n // Emit InjectorProfilerEventType.Create if provider is a value provider because\n // these are the only providers that do not go through the value hydration logic\n // where this event would normally be emitted from.\n if (isValueProvider(provider)) {\n emitInstanceCreatedByInjectorEvent(provider.useValue);\n }\n emitProviderConfiguredEvent(provider);\n });\n }\n if (!isTypeProvider(provider) && provider.multi === true) {\n // If the provider indicates that it's a multi-provider, process it specially.\n // First check whether it's been defined already.\n let multiRecord = this.records.get(token);\n if (multiRecord) {\n // It has. Throw a nice error if\n if (ngDevMode && multiRecord.multi === undefined) {\n throwMixedMultiProviderError();\n }\n } else {\n multiRecord = makeRecord(undefined, NOT_YET, true);\n multiRecord.factory = () => injectArgs(multiRecord.multi);\n this.records.set(token, multiRecord);\n }\n token = provider;\n multiRecord.multi.push(provider);\n } else {\n if (ngDevMode) {\n const existing = this.records.get(token);\n if (existing && existing.multi !== undefined) {\n throwMixedMultiProviderError();\n }\n }\n }\n this.records.set(token, record);\n }\n hydrate(token, record) {\n const prevConsumer = setActiveConsumer$1(null);\n try {\n if (ngDevMode && record.value === CIRCULAR) {\n throwCyclicDependencyError(stringify(token));\n } else if (record.value === NOT_YET) {\n record.value = CIRCULAR;\n if (ngDevMode) {\n runInInjectorProfilerContext(this, token, () => {\n record.value = record.factory();\n emitInstanceCreatedByInjectorEvent(record.value);\n });\n } else {\n record.value = record.factory();\n }\n }\n if (typeof record.value === 'object' && record.value && hasOnDestroy(record.value)) {\n this._ngOnDestroyHooks.add(record.value);\n }\n return record.value;\n } finally {\n setActiveConsumer$1(prevConsumer);\n }\n }\n injectableDefInScope(def) {\n if (!def.providedIn) {\n return false;\n }\n const providedIn = resolveForwardRef(def.providedIn);\n if (typeof providedIn === 'string') {\n return providedIn === 'any' || this.scopes.has(providedIn);\n } else {\n return this.injectorDefTypes.has(providedIn);\n }\n }\n removeOnDestroy(callback) {\n const destroyCBIdx = this._onDestroyHooks.indexOf(callback);\n if (destroyCBIdx !== -1) {\n this._onDestroyHooks.splice(destroyCBIdx, 1);\n }\n }\n}\nfunction injectableDefOrInjectorDefFactory(token) {\n // Most tokens will have an injectable def directly on them, which specifies a factory directly.\n const injectableDef = getInjectableDef(token);\n const factory = injectableDef !== null ? injectableDef.factory : getFactoryDef(token);\n if (factory !== null) {\n return factory;\n }\n // InjectionTokens should have an injectable def (ɵprov) and thus should be handled above.\n // If it's missing that, it's an error.\n if (token instanceof InjectionToken) {\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Token ${stringify(token)} is missing a ɵprov definition.`);\n }\n // Undecorated types can sometimes be created if they have no constructor arguments.\n if (token instanceof Function) {\n return getUndecoratedInjectableFactory(token);\n }\n // There was no way to resolve a factory for this token.\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && 'unreachable');\n}\nfunction getUndecoratedInjectableFactory(token) {\n // If the token has parameters then it has dependencies that we cannot resolve implicitly.\n const paramLength = token.length;\n if (paramLength > 0) {\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Can't resolve all parameters for ${stringify(token)}: (${newArray(paramLength, '?').join(', ')}).`);\n }\n // The constructor function appears to have no parameters.\n // This might be because it inherits from a super-class. In which case, use an injectable\n // def from an ancestor if there is one.\n // Otherwise this really is a simple class with no dependencies, so return a factory that\n // just instantiates the zero-arg constructor.\n const inheritedInjectableDef = getInheritedInjectableDef(token);\n if (inheritedInjectableDef !== null) {\n return () => inheritedInjectableDef.factory(token);\n } else {\n return () => new token();\n }\n}\nfunction providerToRecord(provider) {\n if (isValueProvider(provider)) {\n return makeRecord(undefined, provider.useValue);\n } else {\n const factory = providerToFactory(provider);\n return makeRecord(factory, NOT_YET);\n }\n}\n/**\n * Converts a `SingleProvider` into a factory function.\n *\n * @param provider provider to convert to factory\n */\nfunction providerToFactory(provider, ngModuleType, providers) {\n let factory = undefined;\n if (ngDevMode && isEnvironmentProviders(provider)) {\n throwInvalidProviderError(undefined, providers, provider);\n }\n if (isTypeProvider(provider)) {\n const unwrappedProvider = resolveForwardRef(provider);\n return getFactoryDef(unwrappedProvider) || injectableDefOrInjectorDefFactory(unwrappedProvider);\n } else {\n if (isValueProvider(provider)) {\n factory = () => resolveForwardRef(provider.useValue);\n } else if (isFactoryProvider(provider)) {\n factory = () => provider.useFactory(...injectArgs(provider.deps || []));\n } else if (isExistingProvider(provider)) {\n factory = () => ɵɵinject(resolveForwardRef(provider.useExisting));\n } else {\n const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));\n if (ngDevMode && !classRef) {\n throwInvalidProviderError(ngModuleType, providers, provider);\n }\n if (hasDeps(provider)) {\n factory = () => new classRef(...injectArgs(provider.deps));\n } else {\n return getFactoryDef(classRef) || injectableDefOrInjectorDefFactory(classRef);\n }\n }\n }\n return factory;\n}\nfunction makeRecord(factory, value, multi = false) {\n return {\n factory: factory,\n value: value,\n multi: multi ? [] : undefined\n };\n}\nfunction hasDeps(value) {\n return !!value.deps;\n}\nfunction hasOnDestroy(value) {\n return value !== null && typeof value === 'object' && typeof value.ngOnDestroy === 'function';\n}\nfunction couldBeInjectableType(value) {\n return typeof value === 'function' || typeof value === 'object' && value instanceof InjectionToken;\n}\nfunction forEachSingleProvider(providers, fn) {\n for (const provider of providers) {\n if (Array.isArray(provider)) {\n forEachSingleProvider(provider, fn);\n } else if (provider && isEnvironmentProviders(provider)) {\n forEachSingleProvider(provider.ɵproviders, fn);\n } else {\n fn(provider);\n }\n }\n}\n\n/**\n * Runs the given function in the [context](guide/dependency-injection-context) of the given\n * `Injector`.\n *\n * Within the function's stack frame, [`inject`](api/core/inject) can be used to inject dependencies\n * from the given `Injector`. Note that `inject` is only usable synchronously, and cannot be used in\n * any asynchronous callbacks or after any `await` points.\n *\n * @param injector the injector which will satisfy calls to [`inject`](api/core/inject) while `fn`\n * is executing\n * @param fn the closure to be run in the context of `injector`\n * @returns the return value of the function, if any\n * @publicApi\n */\nfunction runInInjectionContext(injector, fn) {\n if (injector instanceof R3Injector) {\n injector.assertNotDestroyed();\n }\n let prevInjectorProfilerContext;\n if (ngDevMode) {\n prevInjectorProfilerContext = setInjectorProfilerContext({\n injector,\n token: null\n });\n }\n const prevInjector = setCurrentInjector(injector);\n const previousInjectImplementation = setInjectImplementation(undefined);\n try {\n return fn();\n } finally {\n setCurrentInjector(prevInjector);\n ngDevMode && setInjectorProfilerContext(prevInjectorProfilerContext);\n setInjectImplementation(previousInjectImplementation);\n }\n}\n/**\n * Whether the current stack frame is inside an injection context.\n */\nfunction isInInjectionContext() {\n return getInjectImplementation() !== undefined || getCurrentInjector() != null;\n}\n/**\n * Asserts that the current stack frame is within an [injection\n * context](guide/dependency-injection-context) and has access to `inject`.\n *\n * @param debugFn a reference to the function making the assertion (used for the error message).\n *\n * @publicApi\n */\nfunction assertInInjectionContext(debugFn) {\n // Taking a `Function` instead of a string name here prevents the unminified name of the function\n // from being retained in the bundle regardless of minification.\n if (!isInInjectionContext()) {\n throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode && debugFn.name + '() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`');\n }\n}\nvar FactoryTarget = /*#__PURE__*/function (FactoryTarget) {\n FactoryTarget[FactoryTarget[\"Directive\"] = 0] = \"Directive\";\n FactoryTarget[FactoryTarget[\"Component\"] = 1] = \"Component\";\n FactoryTarget[FactoryTarget[\"Injectable\"] = 2] = \"Injectable\";\n FactoryTarget[FactoryTarget[\"Pipe\"] = 3] = \"Pipe\";\n FactoryTarget[FactoryTarget[\"NgModule\"] = 4] = \"NgModule\";\n return FactoryTarget;\n}(FactoryTarget || {});\nvar R3TemplateDependencyKind = /*#__PURE__*/function (R3TemplateDependencyKind) {\n R3TemplateDependencyKind[R3TemplateDependencyKind[\"Directive\"] = 0] = \"Directive\";\n R3TemplateDependencyKind[R3TemplateDependencyKind[\"Pipe\"] = 1] = \"Pipe\";\n R3TemplateDependencyKind[R3TemplateDependencyKind[\"NgModule\"] = 2] = \"NgModule\";\n return R3TemplateDependencyKind;\n}(R3TemplateDependencyKind || {});\nvar ViewEncapsulation = /*#__PURE__*/function (ViewEncapsulation) {\n ViewEncapsulation[ViewEncapsulation[\"Emulated\"] = 0] = \"Emulated\";\n // Historically the 1 value was for `Native` encapsulation which has been removed as of v11.\n ViewEncapsulation[ViewEncapsulation[\"None\"] = 2] = \"None\";\n ViewEncapsulation[ViewEncapsulation[\"ShadowDom\"] = 3] = \"ShadowDom\";\n return ViewEncapsulation;\n}(ViewEncapsulation || {});\nfunction getCompilerFacade(request) {\n const globalNg = _global['ng'];\n if (globalNg && globalNg.ɵcompilerFacade) {\n return globalNg.ɵcompilerFacade;\n }\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n // Log the type as an error so that a developer can easily navigate to the type from the\n // console.\n console.error(`JIT compilation failed for ${request.kind}`, request.type);\n let message = `The ${request.kind} '${request.type.name}' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.\\n\\n`;\n if (request.usage === 1 /* JitCompilerUsage.PartialDeclaration */) {\n message += `The ${request.kind} is part of a library that has been partially compiled.\\n`;\n message += `However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.\\n`;\n message += '\\n';\n message += `Ideally, the library is processed using the Angular Linker to become fully AOT compiled.\\n`;\n } else {\n message += `JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.\\n`;\n }\n message += `Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',\\n`;\n message += `or manually provide the compiler with 'import \"@angular/compiler\";' before bootstrapping.`;\n throw new Error(message);\n } else {\n throw new Error('JIT compiler unavailable');\n }\n}\n\n/**\n * A mapping of the @angular/core API surface used in generated expressions to the actual symbols.\n *\n * This should be kept up to date with the public exports of @angular/core.\n */\nconst angularCoreDiEnv = {\n 'ɵɵdefineInjectable': ɵɵdefineInjectable,\n 'ɵɵdefineInjector': ɵɵdefineInjector,\n 'ɵɵinject': ɵɵinject,\n 'ɵɵinvalidFactoryDep': ɵɵinvalidFactoryDep,\n 'resolveForwardRef': resolveForwardRef\n};\n\n/**\n * @description\n *\n * Represents a type that a Component or other object is instances of.\n *\n * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is represented by\n * the `MyCustomComponent` constructor function.\n *\n * @publicApi\n */\nconst Type = Function;\nfunction isType(v) {\n return typeof v === 'function';\n}\n\n/*\n * #########################\n * Attention: These Regular expressions have to hold even if the code is minified!\n * ##########################\n */\n/**\n * Regular expression that detects pass-through constructors for ES5 output. This Regex\n * intends to capture the common delegation pattern emitted by TypeScript and Babel. Also\n * it intends to capture the pattern where existing constructors have been downleveled from\n * ES2015 to ES5 using TypeScript w/ downlevel iteration. e.g.\n *\n * ```\n * function MyClass() {\n * var _this = _super.apply(this, arguments) || this;\n * ```\n *\n * downleveled to ES5 with `downlevelIteration` for TypeScript < 4.2:\n * ```\n * function MyClass() {\n * var _this = _super.apply(this, __spread(arguments)) || this;\n * ```\n *\n * or downleveled to ES5 with `downlevelIteration` for TypeScript >= 4.2:\n * ```\n * function MyClass() {\n * var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;\n * ```\n *\n * More details can be found in: https://github.com/angular/angular/issues/38453.\n */\nconst ES5_DELEGATE_CTOR = /^function\\s+\\S+\\(\\)\\s*{[\\s\\S]+\\.apply\\(this,\\s*(arguments|(?:[^()]+\\(\\[\\],)?[^()]+\\(arguments\\).*)\\)/;\n/** Regular expression that detects ES2015 classes which extend from other classes. */\nconst ES2015_INHERITED_CLASS = /^class\\s+[A-Za-z\\d$_]*\\s*extends\\s+[^{]+{/;\n/**\n * Regular expression that detects ES2015 classes which extend from other classes and\n * have an explicit constructor defined.\n */\nconst ES2015_INHERITED_CLASS_WITH_CTOR = /^class\\s+[A-Za-z\\d$_]*\\s*extends\\s+[^{]+{[\\s\\S]*constructor\\s*\\(/;\n/**\n * Regular expression that detects ES2015 classes which extend from other classes\n * and inherit a constructor.\n */\nconst ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\\s+[A-Za-z\\d$_]*\\s*extends\\s+[^{]+{[\\s\\S]*constructor\\s*\\(\\)\\s*{[^}]*super\\(\\.\\.\\.arguments\\)/;\n/**\n * Determine whether a stringified type is a class which delegates its constructor\n * to its parent.\n *\n * This is not trivial since compiled code can actually contain a constructor function\n * even if the original source code did not. For instance, when the child class contains\n * an initialized instance property.\n */\nfunction isDelegateCtor(typeStr) {\n return ES5_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr);\n}\nclass ReflectionCapabilities {\n constructor(reflect) {\n this._reflect = reflect || _global['Reflect'];\n }\n factory(t) {\n return (...args) => new t(...args);\n }\n /** @internal */\n _zipTypesAndAnnotations(paramTypes, paramAnnotations) {\n let result;\n if (typeof paramTypes === 'undefined') {\n result = newArray(paramAnnotations.length);\n } else {\n result = newArray(paramTypes.length);\n }\n for (let i = 0; i < result.length; i++) {\n // TS outputs Object for parameters without types, while Traceur omits\n // the annotations. For now we preserve the Traceur behavior to aid\n // migration, but this can be revisited.\n if (typeof paramTypes === 'undefined') {\n result[i] = [];\n } else if (paramTypes[i] && paramTypes[i] != Object) {\n result[i] = [paramTypes[i]];\n } else {\n result[i] = [];\n }\n if (paramAnnotations && paramAnnotations[i] != null) {\n result[i] = result[i].concat(paramAnnotations[i]);\n }\n }\n return result;\n }\n _ownParameters(type, parentCtor) {\n const typeStr = type.toString();\n // If we have no decorators, we only have function.length as metadata.\n // In that case, to detect whether a child class declared an own constructor or not,\n // we need to look inside of that constructor to check whether it is\n // just calling the parent.\n // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439\n // that sets 'design:paramtypes' to []\n // if a class inherits from another class but has no ctor declared itself.\n if (isDelegateCtor(typeStr)) {\n return null;\n }\n // Prefer the direct API.\n if (type.parameters && type.parameters !== parentCtor.parameters) {\n return type.parameters;\n }\n // API of tsickle for lowering decorators to properties on the class.\n const tsickleCtorParams = type.ctorParameters;\n if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {\n // Newer tsickle uses a function closure\n // Retain the non-function case for compatibility with older tsickle\n const ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;\n const paramTypes = ctorParameters.map(ctorParam => ctorParam && ctorParam.type);\n const paramAnnotations = ctorParameters.map(ctorParam => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators));\n return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);\n }\n // API for metadata created by invoking the decorators.\n const paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS];\n const paramTypes = this._reflect && this._reflect.getOwnMetadata && this._reflect.getOwnMetadata('design:paramtypes', type);\n if (paramTypes || paramAnnotations) {\n return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);\n }\n // If a class has no decorators, at least create metadata\n // based on function.length.\n // Note: We know that this is a real constructor as we checked\n // the content of the constructor above.\n return newArray(type.length);\n }\n parameters(type) {\n // Note: only report metadata if we have at least one class decorator\n // to stay in sync with the static reflector.\n if (!isType(type)) {\n return [];\n }\n const parentCtor = getParentCtor(type);\n let parameters = this._ownParameters(type, parentCtor);\n if (!parameters && parentCtor !== Object) {\n parameters = this.parameters(parentCtor);\n }\n return parameters || [];\n }\n _ownAnnotations(typeOrFunc, parentCtor) {\n // Prefer the direct API.\n if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) {\n let annotations = typeOrFunc.annotations;\n if (typeof annotations === 'function' && annotations.annotations) {\n annotations = annotations.annotations;\n }\n return annotations;\n }\n // API of tsickle for lowering decorators to properties on the class.\n if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) {\n return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators);\n }\n // API for metadata created by invoking the decorators.\n if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) {\n return typeOrFunc[ANNOTATIONS];\n }\n return null;\n }\n annotations(typeOrFunc) {\n if (!isType(typeOrFunc)) {\n return [];\n }\n const parentCtor = getParentCtor(typeOrFunc);\n const ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];\n const parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];\n return parentAnnotations.concat(ownAnnotations);\n }\n _ownPropMetadata(typeOrFunc, parentCtor) {\n // Prefer the direct API.\n if (typeOrFunc.propMetadata && typeOrFunc.propMetadata !== parentCtor.propMetadata) {\n let propMetadata = typeOrFunc.propMetadata;\n if (typeof propMetadata === 'function' && propMetadata.propMetadata) {\n propMetadata = propMetadata.propMetadata;\n }\n return propMetadata;\n }\n // API of tsickle for lowering decorators to properties on the class.\n if (typeOrFunc.propDecorators && typeOrFunc.propDecorators !== parentCtor.propDecorators) {\n const propDecorators = typeOrFunc.propDecorators;\n const propMetadata = {};\n Object.keys(propDecorators).forEach(prop => {\n propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);\n });\n return propMetadata;\n }\n // API for metadata created by invoking the decorators.\n if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {\n return typeOrFunc[PROP_METADATA];\n }\n return null;\n }\n propMetadata(typeOrFunc) {\n if (!isType(typeOrFunc)) {\n return {};\n }\n const parentCtor = getParentCtor(typeOrFunc);\n const propMetadata = {};\n if (parentCtor !== Object) {\n const parentPropMetadata = this.propMetadata(parentCtor);\n Object.keys(parentPropMetadata).forEach(propName => {\n propMetadata[propName] = parentPropMetadata[propName];\n });\n }\n const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);\n if (ownPropMetadata) {\n Object.keys(ownPropMetadata).forEach(propName => {\n const decorators = [];\n if (propMetadata.hasOwnProperty(propName)) {\n decorators.push(...propMetadata[propName]);\n }\n decorators.push(...ownPropMetadata[propName]);\n propMetadata[propName] = decorators;\n });\n }\n return propMetadata;\n }\n ownPropMetadata(typeOrFunc) {\n if (!isType(typeOrFunc)) {\n return {};\n }\n return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};\n }\n hasLifecycleHook(type, lcProperty) {\n return type instanceof Type && lcProperty in type.prototype;\n }\n}\nfunction convertTsickleDecoratorIntoMetadata(decoratorInvocations) {\n if (!decoratorInvocations) {\n return [];\n }\n return decoratorInvocations.map(decoratorInvocation => {\n const decoratorType = decoratorInvocation.type;\n const annotationCls = decoratorType.annotationCls;\n const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];\n return new annotationCls(...annotationArgs);\n });\n}\nfunction getParentCtor(ctor) {\n const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;\n const parentCtor = parentProto ? parentProto.constructor : null;\n // Note: We always use `Object` as the null value\n // to simplify checking later on.\n return parentCtor || Object;\n}\n\n// Below are constants for LView indices to help us look up LView members\n// without having to remember the specific indices.\n// Uglify will inline these when minifying so there shouldn't be a cost.\nconst HOST = 0;\nconst TVIEW = 1;\n// Shared with LContainer\nconst FLAGS = 2;\nconst PARENT = 3;\nconst NEXT = 4;\nconst T_HOST = 5;\n// End shared with LContainer\nconst HYDRATION = 6;\nconst CLEANUP = 7;\nconst CONTEXT = 8;\nconst INJECTOR = 9;\nconst ENVIRONMENT = 10;\nconst RENDERER = 11;\nconst CHILD_HEAD = 12;\nconst CHILD_TAIL = 13;\n// FIXME(misko): Investigate if the three declarations aren't all same thing.\nconst DECLARATION_VIEW = 14;\nconst DECLARATION_COMPONENT_VIEW = 15;\nconst DECLARATION_LCONTAINER = 16;\nconst PREORDER_HOOK_FLAGS = 17;\nconst QUERIES = 18;\nconst ID = 19;\nconst EMBEDDED_VIEW_INJECTOR = 20;\nconst ON_DESTROY_HOOKS = 21;\nconst EFFECTS_TO_SCHEDULE = 22;\nconst REACTIVE_TEMPLATE_CONSUMER = 23;\n/**\n * Size of LView's header. Necessary to adjust for it when setting slots.\n *\n * IMPORTANT: `HEADER_OFFSET` should only be referred to the in the `ɵɵ*` instructions to translate\n * instruction index into `LView` index. All other indexes should be in the `LView` index space and\n * there should be no need to refer to `HEADER_OFFSET` anywhere else.\n */\nconst HEADER_OFFSET = 25;\n\n/**\n * Special location which allows easy identification of type. If we have an array which was\n * retrieved from the `LView` and that array has `true` at `TYPE` location, we know it is\n * `LContainer`.\n */\nconst TYPE = 1;\n/**\n * Below are constants for LContainer indices to help us look up LContainer members\n * without having to remember the specific indices.\n * Uglify will inline these when minifying so there shouldn't be a cost.\n */\n// FLAGS, PARENT, NEXT, and T_HOST are indices 2, 3, 4, and 5\n// As we already have these constants in LView, we don't need to re-create them.\nconst DEHYDRATED_VIEWS = 6;\nconst NATIVE = 7;\nconst VIEW_REFS = 8;\nconst MOVED_VIEWS = 9;\n/**\n * Size of LContainer's header. Represents the index after which all views in the\n * container will be inserted. We need to keep a record of current views so we know\n * which views are already in the DOM (and don't need to be re-added) and so we can\n * remove views from the DOM when they are no longer required.\n */\nconst CONTAINER_HEADER_OFFSET = 10;\n/** Flags associated with an LContainer (saved in LContainer[FLAGS]) */\nvar LContainerFlags = /*#__PURE__*/function (LContainerFlags) {\n LContainerFlags[LContainerFlags[\"None\"] = 0] = \"None\";\n /**\n * Flag to signify that this `LContainer` may have transplanted views which need to be change\n * detected. (see: `LView[DECLARATION_COMPONENT_VIEW])`.\n *\n * This flag, once set, is never unset for the `LContainer`.\n */\n LContainerFlags[LContainerFlags[\"HasTransplantedViews\"] = 2] = \"HasTransplantedViews\";\n return LContainerFlags;\n}(LContainerFlags || {});\n/**\n * True if `value` is `LView`.\n * @param value wrapped value of `RNode`, `LView`, `LContainer`\n */\nfunction isLView(value) {\n return Array.isArray(value) && typeof value[TYPE] === 'object';\n}\n/**\n * True if `value` is `LContainer`.\n * @param value wrapped value of `RNode`, `LView`, `LContainer`\n */\nfunction isLContainer(value) {\n return Array.isArray(value) && value[TYPE] === true;\n}\nfunction isContentQueryHost(tNode) {\n return (tNode.flags & 4 /* TNodeFlags.hasContentQuery */) !== 0;\n}\nfunction isComponentHost(tNode) {\n return tNode.componentOffset > -1;\n}\nfunction isDirectiveHost(tNode) {\n return (tNode.flags & 1 /* TNodeFlags.isDirectiveHost */) === 1 /* TNodeFlags.isDirectiveHost */;\n}\nfunction isComponentDef(def) {\n return !!def.template;\n}\nfunction isRootView(target) {\n return (target[FLAGS] & 512 /* LViewFlags.IsRoot */) !== 0;\n}\nfunction isProjectionTNode(tNode) {\n return (tNode.type & 16 /* TNodeType.Projection */) === 16 /* TNodeType.Projection */;\n}\nfunction hasI18n(lView) {\n return (lView[FLAGS] & 32 /* LViewFlags.HasI18n */) === 32 /* LViewFlags.HasI18n */;\n}\nfunction isDestroyed(lView) {\n return (lView[FLAGS] & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */;\n}\n\n// [Assert functions do not constraint type when they are guarded by a truthy\n// expression.](https://github.com/microsoft/TypeScript/issues/37295)\nfunction assertTNodeForLView(tNode, lView) {\n assertTNodeForTView(tNode, lView[TVIEW]);\n}\nfunction assertTNodeForTView(tNode, tView) {\n assertTNode(tNode);\n const tData = tView.data;\n for (let i = HEADER_OFFSET; i < tData.length; i++) {\n if (tData[i] === tNode) {\n return;\n }\n }\n throwError('This TNode does not belong to this TView.');\n}\nfunction assertTNode(tNode) {\n assertDefined(tNode, 'TNode must be defined');\n if (!(tNode && typeof tNode === 'object' && tNode.hasOwnProperty('directiveStylingLast'))) {\n throwError('Not of type TNode, got: ' + tNode);\n }\n}\nfunction assertTIcu(tIcu) {\n assertDefined(tIcu, 'Expected TIcu to be defined');\n if (!(typeof tIcu.currentCaseLViewIndex === 'number')) {\n throwError('Object is not of TIcu type.');\n }\n}\nfunction assertComponentType(actual, msg = 'Type passed in is not ComponentType, it does not have \\'ɵcmp\\' property.') {\n if (!getComponentDef(actual)) {\n throwError(msg);\n }\n}\nfunction assertNgModuleType(actual, msg = 'Type passed in is not NgModuleType, it does not have \\'ɵmod\\' property.') {\n if (!getNgModuleDef(actual)) {\n throwError(msg);\n }\n}\nfunction assertCurrentTNodeIsParent(isParent) {\n assertEqual(isParent, true, 'currentTNode should be a parent');\n}\nfunction assertHasParent(tNode) {\n assertDefined(tNode, 'currentTNode should exist!');\n assertDefined(tNode.parent, 'currentTNode should have a parent');\n}\nfunction assertLContainer(value) {\n assertDefined(value, 'LContainer must be defined');\n assertEqual(isLContainer(value), true, 'Expecting LContainer');\n}\nfunction assertLViewOrUndefined(value) {\n value && assertEqual(isLView(value), true, 'Expecting LView or undefined or null');\n}\nfunction assertLView(value) {\n assertDefined(value, 'LView must be defined');\n assertEqual(isLView(value), true, 'Expecting LView');\n}\nfunction assertFirstCreatePass(tView, errMessage) {\n assertEqual(tView.firstCreatePass, true, errMessage || 'Should only be called in first create pass.');\n}\nfunction assertFirstUpdatePass(tView, errMessage) {\n assertEqual(tView.firstUpdatePass, true, errMessage || 'Should only be called in first update pass.');\n}\n/**\n * This is a basic sanity check that an object is probably a directive def. DirectiveDef is\n * an interface, so we can't do a direct instanceof check.\n */\nfunction assertDirectiveDef(obj) {\n if (obj.type === undefined || obj.selectors == undefined || obj.inputs === undefined) {\n throwError(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`);\n }\n}\nfunction assertIndexInDeclRange(tView, index) {\n assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index);\n}\nfunction assertIndexInExpandoRange(lView, index) {\n const tView = lView[1];\n assertBetween(tView.expandoStartIndex, lView.length, index);\n}\nfunction assertBetween(lower, upper, index) {\n if (!(lower <= index && index < upper)) {\n throwError(`Index out of range (expecting ${lower} <= ${index} < ${upper})`);\n }\n}\nfunction assertProjectionSlots(lView, errMessage) {\n assertDefined(lView[DECLARATION_COMPONENT_VIEW], 'Component views should exist.');\n assertDefined(lView[DECLARATION_COMPONENT_VIEW][T_HOST].projection, errMessage || 'Components with projection nodes () must have projection slots defined.');\n}\nfunction assertParentView(lView, errMessage) {\n assertDefined(lView, errMessage || 'Component views should always have a parent view (component\\'s host view)');\n}\nfunction assertNoDuplicateDirectives(directives) {\n // The array needs at least two elements in order to have duplicates.\n if (directives.length < 2) {\n return;\n }\n const seenDirectives = new Set();\n for (const current of directives) {\n if (seenDirectives.has(current)) {\n throw new RuntimeError(309 /* RuntimeErrorCode.DUPLICATE_DIRECTIVE */, `Directive ${current.type.name} matches multiple times on the same element. ` + `Directives can only match an element once.`);\n }\n seenDirectives.add(current);\n }\n}\n/**\n * This is a basic sanity check that the `injectorIndex` seems to point to what looks like a\n * NodeInjector data structure.\n *\n * @param lView `LView` which should be checked.\n * @param injectorIndex index into the `LView` where the `NodeInjector` is expected.\n */\nfunction assertNodeInjector(lView, injectorIndex) {\n assertIndexInExpandoRange(lView, injectorIndex);\n assertIndexInExpandoRange(lView, injectorIndex + 8 /* NodeInjectorOffset.PARENT */);\n assertNumber(lView[injectorIndex + 0], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 1], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 2], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 3], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 4], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 5], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 6], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 7], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */], 'injectorIndex should point to parent injector');\n}\n\n/**\n * Represents a basic change from a previous to a new value for a single\n * property on a directive instance. Passed as a value in a\n * {@link SimpleChanges} object to the `ngOnChanges` hook.\n *\n * @see {@link OnChanges}\n *\n * @publicApi\n */\nclass SimpleChange {\n constructor(previousValue, currentValue, firstChange) {\n this.previousValue = previousValue;\n this.currentValue = currentValue;\n this.firstChange = firstChange;\n }\n /**\n * Check whether the new value is the first value assigned.\n */\n isFirstChange() {\n return this.firstChange;\n }\n}\nfunction applyValueToInputField(instance, inputSignalNode, privateName, value) {\n if (inputSignalNode !== null) {\n inputSignalNode.applyValueToInputSignal(inputSignalNode, value);\n } else {\n instance[privateName] = value;\n }\n}\n\n/**\n * The NgOnChangesFeature decorates a component with support for the ngOnChanges\n * lifecycle hook, so it should be included in any component that implements\n * that hook.\n *\n * If the component or directive uses inheritance, the NgOnChangesFeature MUST\n * be included as a feature AFTER {@link InheritDefinitionFeature}, otherwise\n * inherited properties will not be propagated to the ngOnChanges lifecycle\n * hook.\n *\n * Example usage:\n *\n * ```\n * static ɵcmp = defineComponent({\n * ...\n * inputs: {name: 'publicName'},\n * features: [NgOnChangesFeature]\n * });\n * ```\n *\n * @codeGenApi\n */\nfunction ɵɵNgOnChangesFeature() {\n return NgOnChangesFeatureImpl;\n}\nfunction NgOnChangesFeatureImpl(definition) {\n if (definition.type.prototype.ngOnChanges) {\n definition.setInput = ngOnChangesSetInput;\n }\n return rememberChangeHistoryAndInvokeOnChangesHook;\n}\n// This option ensures that the ngOnChanges lifecycle hook will be inherited\n// from superclasses (in InheritDefinitionFeature).\n/** @nocollapse */\n// tslint:disable-next-line:no-toplevel-property-access\nɵɵNgOnChangesFeature.ngInherit = true;\n/**\n * This is a synthetic lifecycle hook which gets inserted into `TView.preOrderHooks` to simulate\n * `ngOnChanges`.\n *\n * The hook reads the `NgSimpleChangesStore` data from the component instance and if changes are\n * found it invokes `ngOnChanges` on the component instance.\n *\n * @param this Component instance. Because this function gets inserted into `TView.preOrderHooks`,\n * it is guaranteed to be called with component instance.\n */\nfunction rememberChangeHistoryAndInvokeOnChangesHook() {\n const simpleChangesStore = getSimpleChangesStore(this);\n const current = simpleChangesStore?.current;\n if (current) {\n const previous = simpleChangesStore.previous;\n if (previous === EMPTY_OBJ) {\n simpleChangesStore.previous = current;\n } else {\n // New changes are copied to the previous store, so that we don't lose history for inputs\n // which were not changed this time\n for (let key in current) {\n previous[key] = current[key];\n }\n }\n simpleChangesStore.current = null;\n this.ngOnChanges(current);\n }\n}\nfunction ngOnChangesSetInput(instance, inputSignalNode, value, publicName, privateName) {\n const declaredName = this.declaredInputs[publicName];\n ngDevMode && assertString(declaredName, 'Name of input in ngOnChanges has to be a string');\n const simpleChangesStore = getSimpleChangesStore(instance) || setSimpleChangesStore(instance, {\n previous: EMPTY_OBJ,\n current: null\n });\n const current = simpleChangesStore.current || (simpleChangesStore.current = {});\n const previous = simpleChangesStore.previous;\n const previousChange = previous[declaredName];\n current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ);\n applyValueToInputField(instance, inputSignalNode, privateName, value);\n}\nconst SIMPLE_CHANGES_STORE = '__ngSimpleChanges__';\nfunction getSimpleChangesStore(instance) {\n return instance[SIMPLE_CHANGES_STORE] || null;\n}\nfunction setSimpleChangesStore(instance, store) {\n return instance[SIMPLE_CHANGES_STORE] = store;\n}\nlet profilerCallback = null;\n/**\n * Sets the callback function which will be invoked before and after performing certain actions at\n * runtime (for example, before and after running change detection).\n *\n * Warning: this function is *INTERNAL* and should not be relied upon in application's code.\n * The contract of the function might be changed in any release and/or the function can be removed\n * completely.\n *\n * @param profiler function provided by the caller or null value to disable profiling.\n */\nconst setProfiler = profiler => {\n profilerCallback = profiler;\n};\n/**\n * Profiler function which wraps user code executed by the runtime.\n *\n * @param event ProfilerEvent corresponding to the execution context\n * @param instance component instance\n * @param hookOrListener lifecycle hook function or output listener. The value depends on the\n * execution context\n * @returns\n */\nconst profiler = function (event, instance, hookOrListener) {\n if (profilerCallback != null /* both `null` and `undefined` */) {\n profilerCallback(event, instance, hookOrListener);\n }\n};\nconst SVG_NAMESPACE = 'svg';\nconst MATH_ML_NAMESPACE = 'math';\n\n// TODO(atscott): flip default internally ASAP and externally for v18 (#52928)\nlet _ensureDirtyViewsAreAlwaysReachable = false;\nfunction getEnsureDirtyViewsAreAlwaysReachable() {\n return _ensureDirtyViewsAreAlwaysReachable;\n}\nfunction setEnsureDirtyViewsAreAlwaysReachable(v) {\n _ensureDirtyViewsAreAlwaysReachable = v;\n}\n\n/**\n * For efficiency reasons we often put several different data types (`RNode`, `LView`, `LContainer`)\n * in same location in `LView`. This is because we don't want to pre-allocate space for it\n * because the storage is sparse. This file contains utilities for dealing with such data types.\n *\n * How do we know what is stored at a given location in `LView`.\n * - `Array.isArray(value) === false` => `RNode` (The normal storage value)\n * - `Array.isArray(value) === true` => then the `value[0]` represents the wrapped value.\n * - `typeof value[TYPE] === 'object'` => `LView`\n * - This happens when we have a component at a given location\n * - `typeof value[TYPE] === true` => `LContainer`\n * - This happens when we have `LContainer` binding at a given location.\n *\n *\n * NOTE: it is assumed that `Array.isArray` and `typeof` operations are very efficient.\n */\n/**\n * Returns `RNode`.\n * @param value wrapped value of `RNode`, `LView`, `LContainer`\n */\nfunction unwrapRNode(value) {\n while (Array.isArray(value)) {\n value = value[HOST];\n }\n return value;\n}\n/**\n * Returns `LView` or `null` if not found.\n * @param value wrapped value of `RNode`, `LView`, `LContainer`\n */\nfunction unwrapLView(value) {\n while (Array.isArray(value)) {\n // This check is same as `isLView()` but we don't call at as we don't want to call\n // `Array.isArray()` twice and give JITer more work for inlining.\n if (typeof value[TYPE] === 'object') return value;\n value = value[HOST];\n }\n return null;\n}\n/**\n * Retrieves an element value from the provided `viewData`, by unwrapping\n * from any containers, component views, or style contexts.\n */\nfunction getNativeByIndex(index, lView) {\n ngDevMode && assertIndexInRange(lView, index);\n ngDevMode && assertGreaterThanOrEqual(index, HEADER_OFFSET, 'Expected to be past HEADER_OFFSET');\n return unwrapRNode(lView[index]);\n}\n/**\n * Retrieve an `RNode` for a given `TNode` and `LView`.\n *\n * This function guarantees in dev mode to retrieve a non-null `RNode`.\n *\n * @param tNode\n * @param lView\n */\nfunction getNativeByTNode(tNode, lView) {\n ngDevMode && assertTNodeForLView(tNode, lView);\n ngDevMode && assertIndexInRange(lView, tNode.index);\n const node = unwrapRNode(lView[tNode.index]);\n return node;\n}\n/**\n * Retrieve an `RNode` or `null` for a given `TNode` and `LView`.\n *\n * Some `TNode`s don't have associated `RNode`s. For example `Projection`\n *\n * @param tNode\n * @param lView\n */\nfunction getNativeByTNodeOrNull(tNode, lView) {\n const index = tNode === null ? -1 : tNode.index;\n if (index !== -1) {\n ngDevMode && assertTNodeForLView(tNode, lView);\n const node = unwrapRNode(lView[index]);\n return node;\n }\n return null;\n}\n// fixme(misko): The return Type should be `TNode|null`\nfunction getTNode(tView, index) {\n ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode');\n ngDevMode && assertLessThan(index, tView.data.length, 'wrong index for TNode');\n const tNode = tView.data[index];\n ngDevMode && tNode !== null && assertTNode(tNode);\n return tNode;\n}\n/** Retrieves a value from any `LView` or `TData`. */\nfunction load(view, index) {\n ngDevMode && assertIndexInRange(view, index);\n return view[index];\n}\nfunction getComponentLViewByIndex(nodeIndex, hostView) {\n // Could be an LView or an LContainer. If LContainer, unwrap to find LView.\n ngDevMode && assertIndexInRange(hostView, nodeIndex);\n const slotValue = hostView[nodeIndex];\n const lView = isLView(slotValue) ? slotValue : slotValue[HOST];\n return lView;\n}\n/** Checks whether a given view is in creation mode */\nfunction isCreationMode(view) {\n return (view[FLAGS] & 4 /* LViewFlags.CreationMode */) === 4 /* LViewFlags.CreationMode */;\n}\n/**\n * Returns a boolean for whether the view is attached to the change detection tree.\n *\n * Note: This determines whether a view should be checked, not whether it's inserted\n * into a container. For that, you'll want `viewAttachedToContainer` below.\n */\nfunction viewAttachedToChangeDetector(view) {\n return (view[FLAGS] & 128 /* LViewFlags.Attached */) === 128 /* LViewFlags.Attached */;\n}\n/** Returns a boolean for whether the view is attached to a container. */\nfunction viewAttachedToContainer(view) {\n return isLContainer(view[PARENT]);\n}\nfunction getConstant(consts, index) {\n if (index === null || index === undefined) return null;\n ngDevMode && assertIndexInRange(consts, index);\n return consts[index];\n}\n/**\n * Resets the pre-order hook flags of the view.\n * @param lView the LView on which the flags are reset\n */\nfunction resetPreOrderHookFlags(lView) {\n lView[PREORDER_HOOK_FLAGS] = 0;\n}\n/**\n * Adds the `RefreshView` flag from the lView and updates HAS_CHILD_VIEWS_TO_REFRESH flag of\n * parents.\n */\nfunction markViewForRefresh(lView) {\n if (lView[FLAGS] & 1024 /* LViewFlags.RefreshView */) {\n return;\n }\n lView[FLAGS] |= 1024 /* LViewFlags.RefreshView */;\n if (viewAttachedToChangeDetector(lView)) {\n markAncestorsForTraversal(lView);\n }\n}\n/**\n * Walks up the LView hierarchy.\n * @param nestingLevel Number of times to walk up in hierarchy.\n * @param currentView View from which to start the lookup.\n */\nfunction walkUpViews(nestingLevel, currentView) {\n while (nestingLevel > 0) {\n ngDevMode && assertDefined(currentView[DECLARATION_VIEW], 'Declaration view should be defined if nesting level is greater than 0.');\n currentView = currentView[DECLARATION_VIEW];\n nestingLevel--;\n }\n return currentView;\n}\nfunction requiresRefreshOrTraversal(lView) {\n return !!(lView[FLAGS] & (1024 /* LViewFlags.RefreshView */ | 8192 /* LViewFlags.HasChildViewsToRefresh */) || lView[REACTIVE_TEMPLATE_CONSUMER]?.dirty);\n}\n/**\n * Updates the `HasChildViewsToRefresh` flag on the parents of the `LView` as well as the\n * parents above.\n */\nfunction updateAncestorTraversalFlagsOnAttach(lView) {\n lView[ENVIRONMENT].changeDetectionScheduler?.notify(1 /* NotificationType.AfterRenderHooks */);\n // TODO(atscott): Simplify if...else cases once getEnsureDirtyViewsAreAlwaysReachable is always\n // `true`. When we attach a view that's marked `Dirty`, we should ensure that it is reached during\n // the next CD traversal so we add the `RefreshView` flag and mark ancestors accordingly.\n if (requiresRefreshOrTraversal(lView)) {\n markAncestorsForTraversal(lView);\n } else if (lView[FLAGS] & 64 /* LViewFlags.Dirty */) {\n if (getEnsureDirtyViewsAreAlwaysReachable()) {\n lView[FLAGS] |= 1024 /* LViewFlags.RefreshView */;\n markAncestorsForTraversal(lView);\n } else {\n lView[ENVIRONMENT].changeDetectionScheduler?.notify();\n }\n }\n}\n/**\n * Ensures views above the given `lView` are traversed during change detection even when they are\n * not dirty.\n *\n * This is done by setting the `HAS_CHILD_VIEWS_TO_REFRESH` flag up to the root, stopping when the\n * flag is already `true` or the `lView` is detached.\n */\nfunction markAncestorsForTraversal(lView) {\n lView[ENVIRONMENT].changeDetectionScheduler?.notify();\n let parent = getLViewParent(lView);\n while (parent !== null) {\n // We stop adding markers to the ancestors once we reach one that already has the marker. This\n // is to avoid needlessly traversing all the way to the root when the marker already exists.\n if (parent[FLAGS] & 8192 /* LViewFlags.HasChildViewsToRefresh */) {\n break;\n }\n parent[FLAGS] |= 8192 /* LViewFlags.HasChildViewsToRefresh */;\n if (!viewAttachedToChangeDetector(parent)) {\n break;\n }\n parent = getLViewParent(parent);\n }\n}\n/**\n * Stores a LView-specific destroy callback.\n */\nfunction storeLViewOnDestroy(lView, onDestroyCallback) {\n if ((lView[FLAGS] & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */) {\n throw new RuntimeError(911 /* RuntimeErrorCode.VIEW_ALREADY_DESTROYED */, ngDevMode && 'View has already been destroyed.');\n }\n if (lView[ON_DESTROY_HOOKS] === null) {\n lView[ON_DESTROY_HOOKS] = [];\n }\n lView[ON_DESTROY_HOOKS].push(onDestroyCallback);\n}\n/**\n * Removes previously registered LView-specific destroy callback.\n */\nfunction removeLViewOnDestroy(lView, onDestroyCallback) {\n if (lView[ON_DESTROY_HOOKS] === null) return;\n const destroyCBIdx = lView[ON_DESTROY_HOOKS].indexOf(onDestroyCallback);\n if (destroyCBIdx !== -1) {\n lView[ON_DESTROY_HOOKS].splice(destroyCBIdx, 1);\n }\n}\n/**\n * Gets the parent LView of the passed LView, if the PARENT is an LContainer, will get the parent of\n * that LContainer, which is an LView\n * @param lView the lView whose parent to get\n */\nfunction getLViewParent(lView) {\n ngDevMode && assertLView(lView);\n const parent = lView[PARENT];\n return isLContainer(parent) ? parent[PARENT] : parent;\n}\nconst instructionState = {\n lFrame: /*#__PURE__*/createLFrame(null),\n bindingsEnabled: true,\n skipHydrationRootTNode: null\n};\n/**\n * In this mode, any changes in bindings will throw an ExpressionChangedAfterChecked error.\n *\n * Necessary to support ChangeDetectorRef.checkNoChanges().\n *\n * The `checkNoChanges` function is invoked only in ngDevMode=true and verifies that no unintended\n * changes exist in the change detector or its children.\n */\nlet _isInCheckNoChangesMode = false;\n/**\n * Returns true if the instruction state stack is empty.\n *\n * Intended to be called from tests only (tree shaken otherwise).\n */\nfunction specOnlyIsInstructionStateEmpty() {\n return instructionState.lFrame.parent === null;\n}\nfunction getElementDepthCount() {\n return instructionState.lFrame.elementDepthCount;\n}\nfunction increaseElementDepthCount() {\n instructionState.lFrame.elementDepthCount++;\n}\nfunction decreaseElementDepthCount() {\n instructionState.lFrame.elementDepthCount--;\n}\nfunction getBindingsEnabled() {\n return instructionState.bindingsEnabled;\n}\n/**\n * Returns true if currently inside a skip hydration block.\n * @returns boolean\n */\nfunction isInSkipHydrationBlock$1() {\n return instructionState.skipHydrationRootTNode !== null;\n}\n/**\n * Returns true if this is the root TNode of the skip hydration block.\n * @param tNode the current TNode\n * @returns boolean\n */\nfunction isSkipHydrationRootTNode(tNode) {\n return instructionState.skipHydrationRootTNode === tNode;\n}\n/**\n * Enables directive matching on elements.\n *\n * * Example:\n * ```\n * \n * Should match component / directive.\n * \n *
\n * \n * \n * Should not match component / directive because we are in ngNonBindable.\n * \n * \n *
\n * ```\n *\n * @codeGenApi\n */\nfunction ɵɵenableBindings() {\n instructionState.bindingsEnabled = true;\n}\n/**\n * Sets a flag to specify that the TNode is in a skip hydration block.\n * @param tNode the current TNode\n */\nfunction enterSkipHydrationBlock(tNode) {\n instructionState.skipHydrationRootTNode = tNode;\n}\n/**\n * Disables directive matching on element.\n *\n * * Example:\n * ```\n * \n * Should match component / directive.\n * \n *
\n * \n * \n * Should not match component / directive because we are in ngNonBindable.\n * \n * \n *
\n * ```\n *\n * @codeGenApi\n */\nfunction ɵɵdisableBindings() {\n instructionState.bindingsEnabled = false;\n}\n/**\n * Clears the root skip hydration node when leaving a skip hydration block.\n */\nfunction leaveSkipHydrationBlock() {\n instructionState.skipHydrationRootTNode = null;\n}\n/**\n * Return the current `LView`.\n */\nfunction getLView() {\n return instructionState.lFrame.lView;\n}\n/**\n * Return the current `TView`.\n */\nfunction getTView() {\n return instructionState.lFrame.tView;\n}\n/**\n * Restores `contextViewData` to the given OpaqueViewState instance.\n *\n * Used in conjunction with the getCurrentView() instruction to save a snapshot\n * of the current view and restore it when listeners are invoked. This allows\n * walking the declaration view tree in listeners to get vars from parent views.\n *\n * @param viewToRestore The OpaqueViewState instance to restore.\n * @returns Context of the restored OpaqueViewState instance.\n *\n * @codeGenApi\n */\nfunction ɵɵrestoreView(viewToRestore) {\n instructionState.lFrame.contextLView = viewToRestore;\n return viewToRestore[CONTEXT];\n}\n/**\n * Clears the view set in `ɵɵrestoreView` from memory. Returns the passed in\n * value so that it can be used as a return value of an instruction.\n *\n * @codeGenApi\n */\nfunction ɵɵresetView(value) {\n instructionState.lFrame.contextLView = null;\n return value;\n}\nfunction getCurrentTNode() {\n let currentTNode = getCurrentTNodePlaceholderOk();\n while (currentTNode !== null && currentTNode.type === 64 /* TNodeType.Placeholder */) {\n currentTNode = currentTNode.parent;\n }\n return currentTNode;\n}\nfunction getCurrentTNodePlaceholderOk() {\n return instructionState.lFrame.currentTNode;\n}\nfunction getCurrentParentTNode() {\n const lFrame = instructionState.lFrame;\n const currentTNode = lFrame.currentTNode;\n return lFrame.isParent ? currentTNode : currentTNode.parent;\n}\nfunction setCurrentTNode(tNode, isParent) {\n ngDevMode && tNode && assertTNodeForTView(tNode, instructionState.lFrame.tView);\n const lFrame = instructionState.lFrame;\n lFrame.currentTNode = tNode;\n lFrame.isParent = isParent;\n}\nfunction isCurrentTNodeParent() {\n return instructionState.lFrame.isParent;\n}\nfunction setCurrentTNodeAsNotParent() {\n instructionState.lFrame.isParent = false;\n}\nfunction getContextLView() {\n const contextLView = instructionState.lFrame.contextLView;\n ngDevMode && assertDefined(contextLView, 'contextLView must be defined.');\n return contextLView;\n}\nfunction isInCheckNoChangesMode() {\n !ngDevMode && throwError('Must never be called in production mode');\n return _isInCheckNoChangesMode;\n}\nfunction setIsInCheckNoChangesMode(mode) {\n !ngDevMode && throwError('Must never be called in production mode');\n _isInCheckNoChangesMode = mode;\n}\n// top level variables should not be exported for performance reasons (PERF_NOTES.md)\nfunction getBindingRoot() {\n const lFrame = instructionState.lFrame;\n let index = lFrame.bindingRootIndex;\n if (index === -1) {\n index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex;\n }\n return index;\n}\nfunction getBindingIndex() {\n return instructionState.lFrame.bindingIndex;\n}\nfunction setBindingIndex(value) {\n return instructionState.lFrame.bindingIndex = value;\n}\nfunction nextBindingIndex() {\n return instructionState.lFrame.bindingIndex++;\n}\nfunction incrementBindingIndex(count) {\n const lFrame = instructionState.lFrame;\n const index = lFrame.bindingIndex;\n lFrame.bindingIndex = lFrame.bindingIndex + count;\n return index;\n}\nfunction isInI18nBlock() {\n return instructionState.lFrame.inI18n;\n}\nfunction setInI18nBlock(isInI18nBlock) {\n instructionState.lFrame.inI18n = isInI18nBlock;\n}\n/**\n * Set a new binding root index so that host template functions can execute.\n *\n * Bindings inside the host template are 0 index. But because we don't know ahead of time\n * how many host bindings we have we can't pre-compute them. For this reason they are all\n * 0 index and we just shift the root so that they match next available location in the LView.\n *\n * @param bindingRootIndex Root index for `hostBindings`\n * @param currentDirectiveIndex `TData[currentDirectiveIndex]` will point to the current directive\n * whose `hostBindings` are being processed.\n */\nfunction setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {\n const lFrame = instructionState.lFrame;\n lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;\n setCurrentDirectiveIndex(currentDirectiveIndex);\n}\n/**\n * When host binding is executing this points to the directive index.\n * `TView.data[getCurrentDirectiveIndex()]` is `DirectiveDef`\n * `LView[getCurrentDirectiveIndex()]` is directive instance.\n */\nfunction getCurrentDirectiveIndex() {\n return instructionState.lFrame.currentDirectiveIndex;\n}\n/**\n * Sets an index of a directive whose `hostBindings` are being processed.\n *\n * @param currentDirectiveIndex `TData` index where current directive instance can be found.\n */\nfunction setCurrentDirectiveIndex(currentDirectiveIndex) {\n instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;\n}\n/**\n * Retrieve the current `DirectiveDef` which is active when `hostBindings` instruction is being\n * executed.\n *\n * @param tData Current `TData` where the `DirectiveDef` will be looked up at.\n */\nfunction getCurrentDirectiveDef(tData) {\n const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;\n return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];\n}\nfunction getCurrentQueryIndex() {\n return instructionState.lFrame.currentQueryIndex;\n}\nfunction setCurrentQueryIndex(value) {\n instructionState.lFrame.currentQueryIndex = value;\n}\n/**\n * Returns a `TNode` of the location where the current `LView` is declared at.\n *\n * @param lView an `LView` that we want to find parent `TNode` for.\n */\nfunction getDeclarationTNode(lView) {\n const tView = lView[TVIEW];\n // Return the declaration parent for embedded views\n if (tView.type === 2 /* TViewType.Embedded */) {\n ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');\n return tView.declTNode;\n }\n // Components don't have `TView.declTNode` because each instance of component could be\n // inserted in different location, hence `TView.declTNode` is meaningless.\n // Falling back to `T_HOST` in case we cross component boundary.\n if (tView.type === 1 /* TViewType.Component */) {\n return lView[T_HOST];\n }\n // Remaining TNode type is `TViewType.Root` which doesn't have a parent TNode.\n return null;\n}\n/**\n * This is a light weight version of the `enterView` which is needed by the DI system.\n *\n * @param lView `LView` location of the DI context.\n * @param tNode `TNode` for DI context\n * @param flags DI context flags. if `SkipSelf` flag is set than we walk up the declaration\n * tree from `tNode` until we find parent declared `TElementNode`.\n * @returns `true` if we have successfully entered DI associated with `tNode` (or with declared\n * `TNode` if `flags` has `SkipSelf`). Failing to enter DI implies that no associated\n * `NodeInjector` can be found and we should instead use `ModuleInjector`.\n * - If `true` than this call must be fallowed by `leaveDI`\n * - If `false` than this call failed and we should NOT call `leaveDI`\n */\nfunction enterDI(lView, tNode, flags) {\n ngDevMode && assertLViewOrUndefined(lView);\n if (flags & InjectFlags.SkipSelf) {\n ngDevMode && assertTNodeForTView(tNode, lView[TVIEW]);\n let parentTNode = tNode;\n let parentLView = lView;\n while (true) {\n ngDevMode && assertDefined(parentTNode, 'Parent TNode should be defined');\n parentTNode = parentTNode.parent;\n if (parentTNode === null && !(flags & InjectFlags.Host)) {\n parentTNode = getDeclarationTNode(parentLView);\n if (parentTNode === null) break;\n // In this case, a parent exists and is definitely an element. So it will definitely\n // have an existing lView as the declaration view, which is why we can assume it's defined.\n ngDevMode && assertDefined(parentLView, 'Parent LView should be defined');\n parentLView = parentLView[DECLARATION_VIEW];\n // In Ivy there are Comment nodes that correspond to ngIf and NgFor embedded directives\n // We want to skip those and look only at Elements and ElementContainers to ensure\n // we're looking at true parent nodes, and not content or other types.\n if (parentTNode.type & (2 /* TNodeType.Element */ | 8 /* TNodeType.ElementContainer */)) {\n break;\n }\n } else {\n break;\n }\n }\n if (parentTNode === null) {\n // If we failed to find a parent TNode this means that we should use module injector.\n return false;\n } else {\n tNode = parentTNode;\n lView = parentLView;\n }\n }\n ngDevMode && assertTNodeForLView(tNode, lView);\n const lFrame = instructionState.lFrame = allocLFrame();\n lFrame.currentTNode = tNode;\n lFrame.lView = lView;\n return true;\n}\n/**\n * Swap the current lView with a new lView.\n *\n * For performance reasons we store the lView in the top level of the module.\n * This way we minimize the number of properties to read. Whenever a new view\n * is entered we have to store the lView for later, and when the view is\n * exited the state has to be restored\n *\n * @param newView New lView to become active\n * @returns the previously active lView;\n */\nfunction enterView(newView) {\n ngDevMode && assertNotEqual(newView[0], newView[1], '????');\n ngDevMode && assertLViewOrUndefined(newView);\n const newLFrame = allocLFrame();\n if (ngDevMode) {\n assertEqual(newLFrame.isParent, true, 'Expected clean LFrame');\n assertEqual(newLFrame.lView, null, 'Expected clean LFrame');\n assertEqual(newLFrame.tView, null, 'Expected clean LFrame');\n assertEqual(newLFrame.selectedIndex, -1, 'Expected clean LFrame');\n assertEqual(newLFrame.elementDepthCount, 0, 'Expected clean LFrame');\n assertEqual(newLFrame.currentDirectiveIndex, -1, 'Expected clean LFrame');\n assertEqual(newLFrame.currentNamespace, null, 'Expected clean LFrame');\n assertEqual(newLFrame.bindingRootIndex, -1, 'Expected clean LFrame');\n assertEqual(newLFrame.currentQueryIndex, 0, 'Expected clean LFrame');\n }\n const tView = newView[TVIEW];\n instructionState.lFrame = newLFrame;\n ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);\n newLFrame.currentTNode = tView.firstChild;\n newLFrame.lView = newView;\n newLFrame.tView = tView;\n newLFrame.contextLView = newView;\n newLFrame.bindingIndex = tView.bindingStartIndex;\n newLFrame.inI18n = false;\n}\n/**\n * Allocates next free LFrame. This function tries to reuse the `LFrame`s to lower memory pressure.\n */\nfunction allocLFrame() {\n const currentLFrame = instructionState.lFrame;\n const childLFrame = currentLFrame === null ? null : currentLFrame.child;\n const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame;\n return newLFrame;\n}\nfunction createLFrame(parent) {\n const lFrame = {\n currentTNode: null,\n isParent: true,\n lView: null,\n tView: null,\n selectedIndex: -1,\n contextLView: null,\n elementDepthCount: 0,\n currentNamespace: null,\n currentDirectiveIndex: -1,\n bindingRootIndex: -1,\n bindingIndex: -1,\n currentQueryIndex: 0,\n parent: parent,\n child: null,\n inI18n: false\n };\n parent !== null && (parent.child = lFrame); // link the new LFrame for reuse.\n return lFrame;\n}\n/**\n * A lightweight version of leave which is used with DI.\n *\n * This function only resets `currentTNode` and `LView` as those are the only properties\n * used with DI (`enterDI()`).\n *\n * NOTE: This function is reexported as `leaveDI`. However `leaveDI` has return type of `void` where\n * as `leaveViewLight` has `LFrame`. This is so that `leaveViewLight` can be used in `leaveView`.\n */\nfunction leaveViewLight() {\n const oldLFrame = instructionState.lFrame;\n instructionState.lFrame = oldLFrame.parent;\n oldLFrame.currentTNode = null;\n oldLFrame.lView = null;\n return oldLFrame;\n}\n/**\n * This is a lightweight version of the `leaveView` which is needed by the DI system.\n *\n * NOTE: this function is an alias so that we can change the type of the function to have `void`\n * return type.\n */\nconst leaveDI = leaveViewLight;\n/**\n * Leave the current `LView`\n *\n * This pops the `LFrame` with the associated `LView` from the stack.\n *\n * IMPORTANT: We must zero out the `LFrame` values here otherwise they will be retained. This is\n * because for performance reasons we don't release `LFrame` but rather keep it for next use.\n */\nfunction leaveView() {\n const oldLFrame = leaveViewLight();\n oldLFrame.isParent = true;\n oldLFrame.tView = null;\n oldLFrame.selectedIndex = -1;\n oldLFrame.contextLView = null;\n oldLFrame.elementDepthCount = 0;\n oldLFrame.currentDirectiveIndex = -1;\n oldLFrame.currentNamespace = null;\n oldLFrame.bindingRootIndex = -1;\n oldLFrame.bindingIndex = -1;\n oldLFrame.currentQueryIndex = 0;\n}\nfunction nextContextImpl(level) {\n const contextLView = instructionState.lFrame.contextLView = walkUpViews(level, instructionState.lFrame.contextLView);\n return contextLView[CONTEXT];\n}\n/**\n * Gets the currently selected element index.\n *\n * Used with {@link property} instruction (and more in the future) to identify the index in the\n * current `LView` to act on.\n */\nfunction getSelectedIndex() {\n return instructionState.lFrame.selectedIndex;\n}\n/**\n * Sets the most recent index passed to {@link select}\n *\n * Used with {@link property} instruction (and more in the future) to identify the index in the\n * current `LView` to act on.\n *\n * (Note that if an \"exit function\" was set earlier (via `setElementExitFn()`) then that will be\n * run if and when the provided `index` value is different from the current selected index value.)\n */\nfunction setSelectedIndex(index) {\n ngDevMode && index !== -1 && assertGreaterThanOrEqual(index, HEADER_OFFSET, 'Index must be past HEADER_OFFSET (or -1).');\n ngDevMode && assertLessThan(index, instructionState.lFrame.lView.length, 'Can\\'t set index passed end of LView');\n instructionState.lFrame.selectedIndex = index;\n}\n/**\n * Gets the `tNode` that represents currently selected element.\n */\nfunction getSelectedTNode() {\n const lFrame = instructionState.lFrame;\n return getTNode(lFrame.tView, lFrame.selectedIndex);\n}\n/**\n * Sets the namespace used to create elements to `'http://www.w3.org/2000/svg'` in global state.\n *\n * @codeGenApi\n */\nfunction ɵɵnamespaceSVG() {\n instructionState.lFrame.currentNamespace = SVG_NAMESPACE;\n}\n/**\n * Sets the namespace used to create elements to `'http://www.w3.org/1998/MathML/'` in global state.\n *\n * @codeGenApi\n */\nfunction ɵɵnamespaceMathML() {\n instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE;\n}\n/**\n * Sets the namespace used to create elements to `null`, which forces element creation to use\n * `createElement` rather than `createElementNS`.\n *\n * @codeGenApi\n */\nfunction ɵɵnamespaceHTML() {\n namespaceHTMLInternal();\n}\n/**\n * Sets the namespace used to create elements to `null`, which forces element creation to use\n * `createElement` rather than `createElementNS`.\n */\nfunction namespaceHTMLInternal() {\n instructionState.lFrame.currentNamespace = null;\n}\nfunction getNamespace$1() {\n return instructionState.lFrame.currentNamespace;\n}\nlet _wasLastNodeCreated = true;\n/**\n * Retrieves a global flag that indicates whether the most recent DOM node\n * was created or hydrated.\n */\nfunction wasLastNodeCreated() {\n return _wasLastNodeCreated;\n}\n/**\n * Sets a global flag to indicate whether the most recent DOM node\n * was created or hydrated.\n */\nfunction lastNodeWasCreated(flag) {\n _wasLastNodeCreated = flag;\n}\n\n/**\n * Adds all directive lifecycle hooks from the given `DirectiveDef` to the given `TView`.\n *\n * Must be run *only* on the first template pass.\n *\n * Sets up the pre-order hooks on the provided `tView`,\n * see {@link HookData} for details about the data structure.\n *\n * @param directiveIndex The index of the directive in LView\n * @param directiveDef The definition containing the hooks to setup in tView\n * @param tView The current TView\n */\nfunction registerPreOrderHooks(directiveIndex, directiveDef, tView) {\n ngDevMode && assertFirstCreatePass(tView);\n const {\n ngOnChanges,\n ngOnInit,\n ngDoCheck\n } = directiveDef.type.prototype;\n if (ngOnChanges) {\n const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef);\n (tView.preOrderHooks ??= []).push(directiveIndex, wrappedOnChanges);\n (tView.preOrderCheckHooks ??= []).push(directiveIndex, wrappedOnChanges);\n }\n if (ngOnInit) {\n (tView.preOrderHooks ??= []).push(0 - directiveIndex, ngOnInit);\n }\n if (ngDoCheck) {\n (tView.preOrderHooks ??= []).push(directiveIndex, ngDoCheck);\n (tView.preOrderCheckHooks ??= []).push(directiveIndex, ngDoCheck);\n }\n}\n/**\n *\n * Loops through the directives on the provided `tNode` and queues hooks to be\n * run that are not initialization hooks.\n *\n * Should be executed during `elementEnd()` and similar to\n * preserve hook execution order. Content, view, and destroy hooks for projected\n * components and directives must be called *before* their hosts.\n *\n * Sets up the content, view, and destroy hooks on the provided `tView`,\n * see {@link HookData} for details about the data structure.\n *\n * NOTE: This does not set up `onChanges`, `onInit` or `doCheck`, those are set up\n * separately at `elementStart`.\n *\n * @param tView The current TView\n * @param tNode The TNode whose directives are to be searched for hooks to queue\n */\nfunction registerPostOrderHooks(tView, tNode) {\n ngDevMode && assertFirstCreatePass(tView);\n // It's necessary to loop through the directives at elementEnd() (rather than processing in\n // directiveCreate) so we can preserve the current hook order. Content, view, and destroy\n // hooks for projected components and directives must be called *before* their hosts.\n for (let i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) {\n const directiveDef = tView.data[i];\n ngDevMode && assertDefined(directiveDef, 'Expecting DirectiveDef');\n const lifecycleHooks = directiveDef.type.prototype;\n const {\n ngAfterContentInit,\n ngAfterContentChecked,\n ngAfterViewInit,\n ngAfterViewChecked,\n ngOnDestroy\n } = lifecycleHooks;\n if (ngAfterContentInit) {\n (tView.contentHooks ??= []).push(-i, ngAfterContentInit);\n }\n if (ngAfterContentChecked) {\n (tView.contentHooks ??= []).push(i, ngAfterContentChecked);\n (tView.contentCheckHooks ??= []).push(i, ngAfterContentChecked);\n }\n if (ngAfterViewInit) {\n (tView.viewHooks ??= []).push(-i, ngAfterViewInit);\n }\n if (ngAfterViewChecked) {\n (tView.viewHooks ??= []).push(i, ngAfterViewChecked);\n (tView.viewCheckHooks ??= []).push(i, ngAfterViewChecked);\n }\n if (ngOnDestroy != null) {\n (tView.destroyHooks ??= []).push(i, ngOnDestroy);\n }\n }\n}\n/**\n * Executing hooks requires complex logic as we need to deal with 2 constraints.\n *\n * 1. Init hooks (ngOnInit, ngAfterContentInit, ngAfterViewInit) must all be executed once and only\n * once, across many change detection cycles. This must be true even if some hooks throw, or if\n * some recursively trigger a change detection cycle.\n * To solve that, it is required to track the state of the execution of these init hooks.\n * This is done by storing and maintaining flags in the view: the {@link InitPhaseState},\n * and the index within that phase. They can be seen as a cursor in the following structure:\n * [[onInit1, onInit2], [afterContentInit1], [afterViewInit1, afterViewInit2, afterViewInit3]]\n * They are stored as flags in LView[FLAGS].\n *\n * 2. Pre-order hooks can be executed in batches, because of the select instruction.\n * To be able to pause and resume their execution, we also need some state about the hook's array\n * that is being processed:\n * - the index of the next hook to be executed\n * - the number of init hooks already found in the processed part of the array\n * They are stored as flags in LView[PREORDER_HOOK_FLAGS].\n */\n/**\n * Executes pre-order check hooks ( OnChanges, DoChanges) given a view where all the init hooks were\n * executed once. This is a light version of executeInitAndCheckPreOrderHooks where we can skip read\n * / write of the init-hooks related flags.\n * @param lView The LView where hooks are defined\n * @param hooks Hooks to be run\n * @param nodeIndex 3 cases depending on the value:\n * - undefined: all hooks from the array should be executed (post-order case)\n * - null: execute hooks only from the saved index until the end of the array (pre-order case, when\n * flushing the remaining hooks)\n * - number: execute hooks only from the saved index until that node index exclusive (pre-order\n * case, when executing select(number))\n */\nfunction executeCheckHooks(lView, hooks, nodeIndex) {\n callHooks(lView, hooks, 3 /* InitPhaseState.InitPhaseCompleted */, nodeIndex);\n}\n/**\n * Executes post-order init and check hooks (one of AfterContentInit, AfterContentChecked,\n * AfterViewInit, AfterViewChecked) given a view where there are pending init hooks to be executed.\n * @param lView The LView where hooks are defined\n * @param hooks Hooks to be run\n * @param initPhase A phase for which hooks should be run\n * @param nodeIndex 3 cases depending on the value:\n * - undefined: all hooks from the array should be executed (post-order case)\n * - null: execute hooks only from the saved index until the end of the array (pre-order case, when\n * flushing the remaining hooks)\n * - number: execute hooks only from the saved index until that node index exclusive (pre-order\n * case, when executing select(number))\n */\nfunction executeInitAndCheckHooks(lView, hooks, initPhase, nodeIndex) {\n ngDevMode && assertNotEqual(initPhase, 3 /* InitPhaseState.InitPhaseCompleted */, 'Init pre-order hooks should not be called more than once');\n if ((lView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {\n callHooks(lView, hooks, initPhase, nodeIndex);\n }\n}\nfunction incrementInitPhaseFlags(lView, initPhase) {\n ngDevMode && assertNotEqual(initPhase, 3 /* InitPhaseState.InitPhaseCompleted */, 'Init hooks phase should not be incremented after all init hooks have been run.');\n let flags = lView[FLAGS];\n if ((flags & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {\n flags &= 16383 /* LViewFlags.IndexWithinInitPhaseReset */;\n flags += 1 /* LViewFlags.InitPhaseStateIncrementer */;\n lView[FLAGS] = flags;\n }\n}\n/**\n * Calls lifecycle hooks with their contexts, skipping init hooks if it's not\n * the first LView pass\n *\n * @param currentView The current view\n * @param arr The array in which the hooks are found\n * @param initPhaseState the current state of the init phase\n * @param currentNodeIndex 3 cases depending on the value:\n * - undefined: all hooks from the array should be executed (post-order case)\n * - null: execute hooks only from the saved index until the end of the array (pre-order case, when\n * flushing the remaining hooks)\n * - number: execute hooks only from the saved index until that node index exclusive (pre-order\n * case, when executing select(number))\n */\nfunction callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode && assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n const startIndex = currentNodeIndex !== undefined ? currentView[PREORDER_HOOK_FLAGS] & 65535 /* PreOrderHookFlags.IndexOfTheNextPreOrderHookMaskMask */ : 0;\n const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n const max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1\n let lastNodeIndexFound = 0;\n for (let i = startIndex; i < max; i++) {\n const hook = arr[i + 1];\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n } else {\n const isInitHook = arr[i] < 0;\n if (isInitHook) {\n currentView[PREORDER_HOOK_FLAGS] += 65536 /* PreOrderHookFlags.NumberOfInitHooksCalledIncrementer */;\n }\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* PreOrderHookFlags.NumberOfInitHooksCalledMask */) + i + 2;\n }\n i++;\n }\n }\n}\n/**\n * Executes a single lifecycle hook, making sure that:\n * - it is called in the non-reactive context;\n * - profiling data are registered.\n */\nfunction callHookInternal(directive, hook) {\n profiler(4 /* ProfilerEvent.LifecycleHookStart */, directive, hook);\n const prevConsumer = setActiveConsumer$1(null);\n try {\n hook.call(directive);\n } finally {\n setActiveConsumer$1(prevConsumer);\n profiler(5 /* ProfilerEvent.LifecycleHookEnd */, directive, hook);\n }\n}\n/**\n * Execute one hook against the current `LView`.\n *\n * @param currentView The current view\n * @param initPhaseState the current state of the init phase\n * @param arr The array in which the hooks are found\n * @param i The current index within the hook data array\n */\nfunction callHook(currentView, initPhase, arr, i) {\n const isInitHook = arr[i] < 0;\n const hook = arr[i + 1];\n const directiveIndex = isInitHook ? -arr[i] : arr[i];\n const directive = currentView[directiveIndex];\n if (isInitHook) {\n const indexWithintInitPhase = currentView[FLAGS] >> 14 /* LViewFlags.IndexWithinInitPhaseShift */;\n // The init phase state must be always checked here as it may have been recursively updated.\n if (indexWithintInitPhase < currentView[PREORDER_HOOK_FLAGS] >> 16 /* PreOrderHookFlags.NumberOfInitHooksCalledShift */ && (currentView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {\n currentView[FLAGS] += 16384 /* LViewFlags.IndexWithinInitPhaseIncrementer */;\n callHookInternal(directive, hook);\n }\n } else {\n callHookInternal(directive, hook);\n }\n}\nconst NO_PARENT_INJECTOR = -1;\n/**\n * Each injector is saved in 9 contiguous slots in `LView` and 9 contiguous slots in\n * `TView.data`. This allows us to store information about the current node's tokens (which\n * can be shared in `TView`) as well as the tokens of its ancestor nodes (which cannot be\n * shared, so they live in `LView`).\n *\n * Each of these slots (aside from the last slot) contains a bloom filter. This bloom filter\n * determines whether a directive is available on the associated node or not. This prevents us\n * from searching the directives array at this level unless it's probable the directive is in it.\n *\n * See: https://en.wikipedia.org/wiki/Bloom_filter for more about bloom filters.\n *\n * Because all injectors have been flattened into `LView` and `TViewData`, they cannot typed\n * using interfaces as they were previously. The start index of each `LInjector` and `TInjector`\n * will differ based on where it is flattened into the main array, so it's not possible to know\n * the indices ahead of time and save their types here. The interfaces are still included here\n * for documentation purposes.\n *\n * export interface LInjector extends Array {\n *\n * // Cumulative bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE)\n * [0]: number;\n *\n * // Cumulative bloom for directive IDs 32-63\n * [1]: number;\n *\n * // Cumulative bloom for directive IDs 64-95\n * [2]: number;\n *\n * // Cumulative bloom for directive IDs 96-127\n * [3]: number;\n *\n * // Cumulative bloom for directive IDs 128-159\n * [4]: number;\n *\n * // Cumulative bloom for directive IDs 160 - 191\n * [5]: number;\n *\n * // Cumulative bloom for directive IDs 192 - 223\n * [6]: number;\n *\n * // Cumulative bloom for directive IDs 224 - 255\n * [7]: number;\n *\n * // We need to store a reference to the injector's parent so DI can keep looking up\n * // the injector tree until it finds the dependency it's looking for.\n * [PARENT_INJECTOR]: number;\n * }\n *\n * export interface TInjector extends Array {\n *\n * // Shared node bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE)\n * [0]: number;\n *\n * // Shared node bloom for directive IDs 32-63\n * [1]: number;\n *\n * // Shared node bloom for directive IDs 64-95\n * [2]: number;\n *\n * // Shared node bloom for directive IDs 96-127\n * [3]: number;\n *\n * // Shared node bloom for directive IDs 128-159\n * [4]: number;\n *\n * // Shared node bloom for directive IDs 160 - 191\n * [5]: number;\n *\n * // Shared node bloom for directive IDs 192 - 223\n * [6]: number;\n *\n * // Shared node bloom for directive IDs 224 - 255\n * [7]: number;\n *\n * // Necessary to find directive indices for a particular node.\n * [TNODE]: TElementNode|TElementContainerNode|TContainerNode;\n * }\n */\n/**\n * Factory for creating instances of injectors in the NodeInjector.\n *\n * This factory is complicated by the fact that it can resolve `multi` factories as well.\n *\n * NOTE: Some of the fields are optional which means that this class has two hidden classes.\n * - One without `multi` support (most common)\n * - One with `multi` values, (rare).\n *\n * Since VMs can cache up to 4 inline hidden classes this is OK.\n *\n * - Single factory: Only `resolving` and `factory` is defined.\n * - `providers` factory: `componentProviders` is a number and `index = -1`.\n * - `viewProviders` factory: `componentProviders` is a number and `index` points to `providers`.\n */\nclass NodeInjectorFactory {\n constructor(\n /**\n * Factory to invoke in order to create a new instance.\n */\n factory,\n /**\n * Set to `true` if the token is declared in `viewProviders` (or if it is component).\n */\n isViewProvider, injectImplementation) {\n this.factory = factory;\n /**\n * Marker set to true during factory invocation to see if we get into recursive loop.\n * Recursive loop causes an error to be displayed.\n */\n this.resolving = false;\n ngDevMode && assertDefined(factory, 'Factory not specified');\n ngDevMode && assertEqual(typeof factory, 'function', 'Expected factory function.');\n this.canSeeViewProviders = isViewProvider;\n this.injectImpl = injectImplementation;\n }\n}\nfunction isFactory(obj) {\n return obj instanceof NodeInjectorFactory;\n}\n\n/**\n * Converts `TNodeType` into human readable text.\n * Make sure this matches with `TNodeType`\n */\nfunction toTNodeTypeAsString(tNodeType) {\n let text = '';\n tNodeType & 1 /* TNodeType.Text */ && (text += '|Text');\n tNodeType & 2 /* TNodeType.Element */ && (text += '|Element');\n tNodeType & 4 /* TNodeType.Container */ && (text += '|Container');\n tNodeType & 8 /* TNodeType.ElementContainer */ && (text += '|ElementContainer');\n tNodeType & 16 /* TNodeType.Projection */ && (text += '|Projection');\n tNodeType & 32 /* TNodeType.Icu */ && (text += '|IcuContainer');\n tNodeType & 64 /* TNodeType.Placeholder */ && (text += '|Placeholder');\n return text.length > 0 ? text.substring(1) : text;\n}\n/**\n * Helper function to detect if a given value matches a `TNode` shape.\n *\n * The logic uses the `insertBeforeIndex` and its possible values as\n * a way to differentiate a TNode shape from other types of objects\n * within the `TView.data`. This is not a perfect check, but it can\n * be a reasonable differentiator, since we control the shapes of objects\n * within `TView.data`.\n */\nfunction isTNodeShape(value) {\n return value != null && typeof value === 'object' && (value.insertBeforeIndex === null || typeof value.insertBeforeIndex === 'number' || Array.isArray(value.insertBeforeIndex));\n}\n/**\n * Returns `true` if the `TNode` has a directive which has `@Input()` for `class` binding.\n *\n * ```\n *
\n * ```\n * and\n * ```\n * @Directive({\n * })\n * class MyDirective {\n * @Input()\n * class: string;\n * }\n * ```\n *\n * In the above case it is necessary to write the reconciled styling information into the\n * directive's input.\n *\n * @param tNode\n */\nfunction hasClassInput(tNode) {\n return (tNode.flags & 8 /* TNodeFlags.hasClassInput */) !== 0;\n}\n/**\n * Returns `true` if the `TNode` has a directive which has `@Input()` for `style` binding.\n *\n * ```\n *
\n * ```\n * and\n * ```\n * @Directive({\n * })\n * class MyDirective {\n * @Input()\n * class: string;\n * }\n * ```\n *\n * In the above case it is necessary to write the reconciled styling information into the\n * directive's input.\n *\n * @param tNode\n */\nfunction hasStyleInput(tNode) {\n return (tNode.flags & 16 /* TNodeFlags.hasStyleInput */) !== 0;\n}\nfunction assertTNodeType(tNode, expectedTypes, message) {\n assertDefined(tNode, 'should be called with a TNode');\n if ((tNode.type & expectedTypes) === 0) {\n throwError(message || `Expected [${toTNodeTypeAsString(expectedTypes)}] but got ${toTNodeTypeAsString(tNode.type)}.`);\n }\n}\nfunction assertPureTNodeType(type) {\n if (!(type === 2 /* TNodeType.Element */ ||\n //\n type === 1 /* TNodeType.Text */ ||\n //\n type === 4 /* TNodeType.Container */ ||\n //\n type === 8 /* TNodeType.ElementContainer */ ||\n //\n type === 32 /* TNodeType.Icu */ ||\n //\n type === 16 /* TNodeType.Projection */ ||\n //\n type === 64 /* TNodeType.Placeholder */)) {\n throwError(`Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString(type)}.`);\n }\n}\n\n/// Parent Injector Utils ///////////////////////////////////////////////////////////////\nfunction hasParentInjector(parentLocation) {\n return parentLocation !== NO_PARENT_INJECTOR;\n}\nfunction getParentInjectorIndex(parentLocation) {\n if (ngDevMode) {\n assertNumber(parentLocation, 'Number expected');\n assertNotEqual(parentLocation, -1, 'Not a valid state.');\n const parentInjectorIndex = parentLocation & 32767 /* RelativeInjectorLocationFlags.InjectorIndexMask */;\n assertGreaterThan(parentInjectorIndex, HEADER_OFFSET, 'Parent injector must be pointing past HEADER_OFFSET.');\n }\n return parentLocation & 32767 /* RelativeInjectorLocationFlags.InjectorIndexMask */;\n}\nfunction getParentInjectorViewOffset(parentLocation) {\n return parentLocation >> 16 /* RelativeInjectorLocationFlags.ViewOffsetShift */;\n}\n/**\n * Unwraps a parent injector location number to find the view offset from the current injector,\n * then walks up the declaration view tree until the view is found that contains the parent\n * injector.\n *\n * @param location The location of the parent injector, which contains the view offset\n * @param startView The LView instance from which to start walking up the view tree\n * @returns The LView instance that contains the parent injector\n */\nfunction getParentInjectorView(location, startView) {\n let viewOffset = getParentInjectorViewOffset(location);\n let parentView = startView;\n // For most cases, the parent injector can be found on the host node (e.g. for component\n // or container), but we must keep the loop here to support the rarer case of deeply nested\n // tags or inline views, where the parent injector might live many views\n // above the child injector.\n while (viewOffset > 0) {\n parentView = parentView[DECLARATION_VIEW];\n viewOffset--;\n }\n return parentView;\n}\n\n/**\n * Defines if the call to `inject` should include `viewProviders` in its resolution.\n *\n * This is set to true when we try to instantiate a component. This value is reset in\n * `getNodeInjectable` to a value which matches the declaration location of the token about to be\n * instantiated. This is done so that if we are injecting a token which was declared outside of\n * `viewProviders` we don't accidentally pull `viewProviders` in.\n *\n * Example:\n *\n * ```\n * @Injectable()\n * class MyService {\n * constructor(public value: String) {}\n * }\n *\n * @Component({\n * providers: [\n * MyService,\n * {provide: String, value: 'providers' }\n * ]\n * viewProviders: [\n * {provide: String, value: 'viewProviders'}\n * ]\n * })\n * class MyComponent {\n * constructor(myService: MyService, value: String) {\n * // We expect that Component can see into `viewProviders`.\n * expect(value).toEqual('viewProviders');\n * // `MyService` was not declared in `viewProviders` hence it can't see it.\n * expect(myService.value).toEqual('providers');\n * }\n * }\n *\n * ```\n */\nlet includeViewProviders = true;\nfunction setIncludeViewProviders(v) {\n const oldValue = includeViewProviders;\n includeViewProviders = v;\n return oldValue;\n}\n/**\n * The number of slots in each bloom filter (used by DI). The larger this number, the fewer\n * directives that will share slots, and thus, the fewer false positives when checking for\n * the existence of a directive.\n */\nconst BLOOM_SIZE = 256;\nconst BLOOM_MASK = BLOOM_SIZE - 1;\n/**\n * The number of bits that is represented by a single bloom bucket. JS bit operations are 32 bits,\n * so each bucket represents 32 distinct tokens which accounts for log2(32) = 5 bits of a bloom hash\n * number.\n */\nconst BLOOM_BUCKET_BITS = 5;\n/** Counter used to generate unique IDs for directives. */\nlet nextNgElementId = 0;\n/** Value used when something wasn't found by an injector. */\nconst NOT_FOUND = {};\n/**\n * Registers this directive as present in its node's injector by flipping the directive's\n * corresponding bit in the injector's bloom filter.\n *\n * @param injectorIndex The index of the node injector where this token should be registered\n * @param tView The TView for the injector's bloom filters\n * @param type The directive token to register\n */\nfunction bloomAdd(injectorIndex, tView, type) {\n ngDevMode && assertEqual(tView.firstCreatePass, true, 'expected firstCreatePass to be true');\n let id;\n if (typeof type === 'string') {\n id = type.charCodeAt(0) || 0;\n } else if (type.hasOwnProperty(NG_ELEMENT_ID)) {\n id = type[NG_ELEMENT_ID];\n }\n // Set a unique ID on the directive type, so if something tries to inject the directive,\n // we can easily retrieve the ID and hash it into the bloom bit that should be checked.\n if (id == null) {\n id = type[NG_ELEMENT_ID] = nextNgElementId++;\n }\n // We only have BLOOM_SIZE (256) slots in our bloom filter (8 buckets * 32 bits each),\n // so all unique IDs must be modulo-ed into a number from 0 - 255 to fit into the filter.\n const bloomHash = id & BLOOM_MASK;\n // Create a mask that targets the specific bit associated with the directive.\n // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding\n // to bit positions 0 - 31 in a 32 bit integer.\n const mask = 1 << bloomHash;\n // Each bloom bucket in `tData` represents `BLOOM_BUCKET_BITS` number of bits of `bloomHash`.\n // Any bits in `bloomHash` beyond `BLOOM_BUCKET_BITS` indicate the bucket offset that the mask\n // should be written to.\n tView.data[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)] |= mask;\n}\n/**\n * Creates (or gets an existing) injector for a given element or container.\n *\n * @param tNode for which an injector should be retrieved / created.\n * @param lView View where the node is stored\n * @returns Node injector\n */\nfunction getOrCreateNodeInjectorForNode(tNode, lView) {\n const existingInjectorIndex = getInjectorIndex(tNode, lView);\n if (existingInjectorIndex !== -1) {\n return existingInjectorIndex;\n }\n const tView = lView[TVIEW];\n if (tView.firstCreatePass) {\n tNode.injectorIndex = lView.length;\n insertBloom(tView.data, tNode); // foundation for node bloom\n insertBloom(lView, null); // foundation for cumulative bloom\n insertBloom(tView.blueprint, null);\n }\n const parentLoc = getParentInjectorLocation(tNode, lView);\n const injectorIndex = tNode.injectorIndex;\n // If a parent injector can't be found, its location is set to -1.\n // In that case, we don't need to set up a cumulative bloom\n if (hasParentInjector(parentLoc)) {\n const parentIndex = getParentInjectorIndex(parentLoc);\n const parentLView = getParentInjectorView(parentLoc, lView);\n const parentData = parentLView[TVIEW].data;\n // Creates a cumulative bloom filter that merges the parent's bloom filter\n // and its own cumulative bloom (which contains tokens for all ancestors)\n for (let i = 0; i < 8 /* NodeInjectorOffset.BLOOM_SIZE */; i++) {\n lView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i];\n }\n }\n lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */] = parentLoc;\n return injectorIndex;\n}\nfunction insertBloom(arr, footer) {\n arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer);\n}\nfunction getInjectorIndex(tNode, lView) {\n if (tNode.injectorIndex === -1 ||\n // If the injector index is the same as its parent's injector index, then the index has been\n // copied down from the parent node. No injector has been created yet on this node.\n tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex ||\n // After the first template pass, the injector index might exist but the parent values\n // might not have been calculated yet for this instance\n lView[tNode.injectorIndex + 8 /* NodeInjectorOffset.PARENT */] === null) {\n return -1;\n } else {\n ngDevMode && assertIndexInRange(lView, tNode.injectorIndex);\n return tNode.injectorIndex;\n }\n}\n/**\n * Finds the index of the parent injector, with a view offset if applicable. Used to set the\n * parent injector initially.\n *\n * @returns Returns a number that is the combination of the number of LViews that we have to go up\n * to find the LView containing the parent inject AND the index of the injector within that LView.\n */\nfunction getParentInjectorLocation(tNode, lView) {\n if (tNode.parent && tNode.parent.injectorIndex !== -1) {\n // If we have a parent `TNode` and there is an injector associated with it we are done, because\n // the parent injector is within the current `LView`.\n return tNode.parent.injectorIndex; // ViewOffset is 0\n }\n // When parent injector location is computed it may be outside of the current view. (ie it could\n // be pointing to a declared parent location). This variable stores number of declaration parents\n // we need to walk up in order to find the parent injector location.\n let declarationViewOffset = 0;\n let parentTNode = null;\n let lViewCursor = lView;\n // The parent injector is not in the current `LView`. We will have to walk the declared parent\n // `LView` hierarchy and look for it. If we walk of the top, that means that there is no parent\n // `NodeInjector`.\n while (lViewCursor !== null) {\n parentTNode = getTNodeFromLView(lViewCursor);\n if (parentTNode === null) {\n // If we have no parent, than we are done.\n return NO_PARENT_INJECTOR;\n }\n ngDevMode && parentTNode && assertTNodeForLView(parentTNode, lViewCursor[DECLARATION_VIEW]);\n // Every iteration of the loop requires that we go to the declared parent.\n declarationViewOffset++;\n lViewCursor = lViewCursor[DECLARATION_VIEW];\n if (parentTNode.injectorIndex !== -1) {\n // We found a NodeInjector which points to something.\n return parentTNode.injectorIndex | declarationViewOffset << 16 /* RelativeInjectorLocationFlags.ViewOffsetShift */;\n }\n }\n return NO_PARENT_INJECTOR;\n}\n/**\n * Makes a type or an injection token public to the DI system by adding it to an\n * injector's bloom filter.\n *\n * @param di The node injector in which a directive will be added\n * @param token The type or the injection token to be made public\n */\nfunction diPublicInInjector(injectorIndex, tView, token) {\n bloomAdd(injectorIndex, tView, token);\n}\n/**\n * Inject static attribute value into directive constructor.\n *\n * This method is used with `factory` functions which are generated as part of\n * `defineDirective` or `defineComponent`. The method retrieves the static value\n * of an attribute. (Dynamic attributes are not supported since they are not resolved\n * at the time of injection and can change over time.)\n *\n * # Example\n * Given:\n * ```\n * @Component(...)\n * class MyComponent {\n * constructor(@Attribute('title') title: string) { ... }\n * }\n * ```\n * When instantiated with\n * ```\n * \n * ```\n *\n * Then factory method generated is:\n * ```\n * MyComponent.ɵcmp = defineComponent({\n * factory: () => new MyComponent(injectAttribute('title'))\n * ...\n * })\n * ```\n *\n * @publicApi\n */\nfunction injectAttributeImpl(tNode, attrNameToInject) {\n ngDevMode && assertTNodeType(tNode, 12 /* TNodeType.AnyContainer */ | 3 /* TNodeType.AnyRNode */);\n ngDevMode && assertDefined(tNode, 'expecting tNode');\n if (attrNameToInject === 'class') {\n return tNode.classes;\n }\n if (attrNameToInject === 'style') {\n return tNode.styles;\n }\n const attrs = tNode.attrs;\n if (attrs) {\n const attrsLength = attrs.length;\n let i = 0;\n while (i < attrsLength) {\n const value = attrs[i];\n // If we hit a `Bindings` or `Template` marker then we are done.\n if (isNameOnlyAttributeMarker(value)) break;\n // Skip namespaced attributes\n if (value === 0 /* AttributeMarker.NamespaceURI */) {\n // we skip the next two values\n // as namespaced attributes looks like\n // [..., AttributeMarker.NamespaceURI, 'http://someuri.com/test', 'test:exist',\n // 'existValue', ...]\n i = i + 2;\n } else if (typeof value === 'number') {\n // Skip to the first value of the marked attribute.\n i++;\n while (i < attrsLength && typeof attrs[i] === 'string') {\n i++;\n }\n } else if (value === attrNameToInject) {\n return attrs[i + 1];\n } else {\n i = i + 2;\n }\n }\n }\n return null;\n}\nfunction notFoundValueOrThrow(notFoundValue, token, flags) {\n if (flags & InjectFlags.Optional || notFoundValue !== undefined) {\n return notFoundValue;\n } else {\n throwProviderNotFoundError(token, 'NodeInjector');\n }\n}\n/**\n * Returns the value associated to the given token from the ModuleInjector or throws exception\n *\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector or throws an exception\n */\nfunction lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) {\n if (flags & InjectFlags.Optional && notFoundValue === undefined) {\n // This must be set or the NullInjector will throw for optional deps\n notFoundValue = null;\n }\n if ((flags & (InjectFlags.Self | InjectFlags.Host)) === 0) {\n const moduleInjector = lView[INJECTOR];\n // switch to `injectInjectorOnly` implementation for module injector, since module injector\n // should not have access to Component/Directive DI scope (that may happen through\n // `directiveInject` implementation)\n const previousInjectImplementation = setInjectImplementation(undefined);\n try {\n if (moduleInjector) {\n return moduleInjector.get(token, notFoundValue, flags & InjectFlags.Optional);\n } else {\n return injectRootLimpMode(token, notFoundValue, flags & InjectFlags.Optional);\n }\n } finally {\n setInjectImplementation(previousInjectImplementation);\n }\n }\n return notFoundValueOrThrow(notFoundValue, token, flags);\n}\n/**\n * Returns the value associated to the given token from the NodeInjectors => ModuleInjector.\n *\n * Look for the injector providing the token by walking up the node injector tree and then\n * the module injector tree.\n *\n * This function patches `token` with `__NG_ELEMENT_ID__` which contains the id for the bloom\n * filter. `-1` is reserved for injecting `Injector` (implemented by `NodeInjector`)\n *\n * @param tNode The Node where the search for the injector should start\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector, `null` when not found, or `notFoundValue` if provided\n */\nfunction getOrCreateInjectable(tNode, lView, token, flags = InjectFlags.Default, notFoundValue) {\n if (tNode !== null) {\n // If the view or any of its ancestors have an embedded\n // view injector, we have to look it up there first.\n if (lView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */ &&\n // The token must be present on the current node injector when the `Self`\n // flag is set, so the lookup on embedded view injector(s) can be skipped.\n !(flags & InjectFlags.Self)) {\n const embeddedInjectorValue = lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, NOT_FOUND);\n if (embeddedInjectorValue !== NOT_FOUND) {\n return embeddedInjectorValue;\n }\n }\n // Otherwise try the node injector.\n const value = lookupTokenUsingNodeInjector(tNode, lView, token, flags, NOT_FOUND);\n if (value !== NOT_FOUND) {\n return value;\n }\n }\n // Finally, fall back to the module injector.\n return lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);\n}\n/**\n * Returns the value associated to the given token from the node injector.\n *\n * @param tNode The Node where the search for the injector should start\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector, `null` when not found, or `notFoundValue` if provided\n */\nfunction lookupTokenUsingNodeInjector(tNode, lView, token, flags, notFoundValue) {\n const bloomHash = bloomHashBitOrFactory(token);\n // If the ID stored here is a function, this is a special object like ElementRef or TemplateRef\n // so just call the factory function to create it.\n if (typeof bloomHash === 'function') {\n if (!enterDI(lView, tNode, flags)) {\n // Failed to enter DI, try module injector instead. If a token is injected with the @Host\n // flag, the module injector is not searched for that token in Ivy.\n return flags & InjectFlags.Host ? notFoundValueOrThrow(notFoundValue, token, flags) : lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);\n }\n try {\n let value;\n if (ngDevMode) {\n runInInjectorProfilerContext(new NodeInjector(getCurrentTNode(), getLView()), token, () => {\n value = bloomHash(flags);\n if (value != null) {\n emitInstanceCreatedByInjectorEvent(value);\n }\n });\n } else {\n value = bloomHash(flags);\n }\n if (value == null && !(flags & InjectFlags.Optional)) {\n throwProviderNotFoundError(token);\n } else {\n return value;\n }\n } finally {\n leaveDI();\n }\n } else if (typeof bloomHash === 'number') {\n // A reference to the previous injector TView that was found while climbing the element\n // injector tree. This is used to know if viewProviders can be accessed on the current\n // injector.\n let previousTView = null;\n let injectorIndex = getInjectorIndex(tNode, lView);\n let parentLocation = NO_PARENT_INJECTOR;\n let hostTElementNode = flags & InjectFlags.Host ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null;\n // If we should skip this injector, or if there is no injector on this node, start by\n // searching the parent injector.\n if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) {\n parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) : lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */];\n if (parentLocation === NO_PARENT_INJECTOR || !shouldSearchParent(flags, false)) {\n injectorIndex = -1;\n } else {\n previousTView = lView[TVIEW];\n injectorIndex = getParentInjectorIndex(parentLocation);\n lView = getParentInjectorView(parentLocation, lView);\n }\n }\n // Traverse up the injector tree until we find a potential match or until we know there\n // *isn't* a match.\n while (injectorIndex !== -1) {\n ngDevMode && assertNodeInjector(lView, injectorIndex);\n // Check the current injector. If it matches, see if it contains token.\n const tView = lView[TVIEW];\n ngDevMode && assertTNodeForLView(tView.data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */], lView);\n if (bloomHasToken(bloomHash, injectorIndex, tView.data)) {\n // At this point, we have an injector which *may* contain the token, so we step through\n // the providers and directives associated with the injector's corresponding node to get\n // the instance.\n const instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode);\n if (instance !== NOT_FOUND) {\n return instance;\n }\n }\n parentLocation = lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */];\n if (parentLocation !== NO_PARENT_INJECTOR && shouldSearchParent(flags, lView[TVIEW].data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */] === hostTElementNode) && bloomHasToken(bloomHash, injectorIndex, lView)) {\n // The def wasn't found anywhere on this node, so it was a false positive.\n // Traverse up the tree and continue searching.\n previousTView = tView;\n injectorIndex = getParentInjectorIndex(parentLocation);\n lView = getParentInjectorView(parentLocation, lView);\n } else {\n // If we should not search parent OR If the ancestor bloom filter value does not have the\n // bit corresponding to the directive we can give up on traversing up to find the specific\n // injector.\n injectorIndex = -1;\n }\n }\n }\n return notFoundValue;\n}\nfunction searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) {\n const currentTView = lView[TVIEW];\n const tNode = currentTView.data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */];\n // First, we need to determine if view providers can be accessed by the starting element.\n // There are two possibilities\n const canAccessViewProviders = previousTView == null ?\n // 1) This is the first invocation `previousTView == null` which means that we are at the\n // `TNode` of where injector is starting to look. In such a case the only time we are allowed\n // to look into the ViewProviders is if:\n // - we are on a component\n // - AND the injector set `includeViewProviders` to true (implying that the token can see\n // ViewProviders because it is the Component or a Service which itself was declared in\n // ViewProviders)\n isComponentHost(tNode) && includeViewProviders :\n // 2) `previousTView != null` which means that we are now walking across the parent nodes.\n // In such a case we are only allowed to look into the ViewProviders if:\n // - We just crossed from child View to Parent View `previousTView != currentTView`\n // - AND the parent TNode is an Element.\n // This means that we just came from the Component's View and therefore are allowed to see\n // into the ViewProviders.\n previousTView != currentTView && (tNode.type & 3 /* TNodeType.AnyRNode */) !== 0;\n // This special case happens when there is a @host on the inject and when we are searching\n // on the host element node.\n const isHostSpecialCase = flags & InjectFlags.Host && hostTElementNode === tNode;\n const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase);\n if (injectableIdx !== null) {\n return getNodeInjectable(lView, currentTView, injectableIdx, tNode);\n } else {\n return NOT_FOUND;\n }\n}\n/**\n * Searches for the given token among the node's directives and providers.\n *\n * @param tNode TNode on which directives are present.\n * @param tView The tView we are currently processing\n * @param token Provider token or type of a directive to look for.\n * @param canAccessViewProviders Whether view providers should be considered.\n * @param isHostSpecialCase Whether the host special case applies.\n * @returns Index of a found directive or provider, or null when none found.\n */\nfunction locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) {\n const nodeProviderIndexes = tNode.providerIndexes;\n const tInjectables = tView.data;\n const injectablesStart = nodeProviderIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;\n const directivesStart = tNode.directiveStart;\n const directiveEnd = tNode.directiveEnd;\n const cptViewProvidersCount = nodeProviderIndexes >> 20 /* TNodeProviderIndexes.CptViewProvidersCountShift */;\n const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount;\n // When the host special case applies, only the viewProviders and the component are visible\n const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd;\n for (let i = startingIndex; i < endIndex; i++) {\n const providerTokenOrDef = tInjectables[i];\n if (i < directivesStart && token === providerTokenOrDef || i >= directivesStart && providerTokenOrDef.type === token) {\n return i;\n }\n }\n if (isHostSpecialCase) {\n const dirDef = tInjectables[directivesStart];\n if (dirDef && isComponentDef(dirDef) && dirDef.type === token) {\n return directivesStart;\n }\n }\n return null;\n}\n/**\n * Retrieve or instantiate the injectable from the `LView` at particular `index`.\n *\n * This function checks to see if the value has already been instantiated and if so returns the\n * cached `injectable`. Otherwise if it detects that the value is still a factory it\n * instantiates the `injectable` and caches the value.\n */\nfunction getNodeInjectable(lView, tView, index, tNode) {\n let value = lView[index];\n const tData = tView.data;\n if (isFactory(value)) {\n const factory = value;\n if (factory.resolving) {\n throwCyclicDependencyError(stringifyForError(tData[index]));\n }\n const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);\n factory.resolving = true;\n let prevInjectContext;\n if (ngDevMode) {\n // tData indexes mirror the concrete instances in its corresponding LView.\n // lView[index] here is either the injectable instace itself or a factory,\n // therefore tData[index] is the constructor of that injectable or a\n // definition object that contains the constructor in a `.type` field.\n const token = tData[index].type || tData[index];\n const injector = new NodeInjector(tNode, lView);\n prevInjectContext = setInjectorProfilerContext({\n injector,\n token\n });\n }\n const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null;\n const success = enterDI(lView, tNode, InjectFlags.Default);\n ngDevMode && assertEqual(success, true, 'Because flags do not contain \\`SkipSelf\\' we expect this to always succeed.');\n try {\n value = lView[index] = factory.factory(undefined, tData, lView, tNode);\n ngDevMode && emitInstanceCreatedByInjectorEvent(value);\n // This code path is hit for both directives and providers.\n // For perf reasons, we want to avoid searching for hooks on providers.\n // It does no harm to try (the hooks just won't exist), but the extra\n // checks are unnecessary and this is a hot path. So we check to see\n // if the index of the dependency is in the directive range for this\n // tNode. If it's not, we know it's a provider and skip hook registration.\n if (tView.firstCreatePass && index >= tNode.directiveStart) {\n ngDevMode && assertDirectiveDef(tData[index]);\n registerPreOrderHooks(index, tData[index], tView);\n }\n } finally {\n ngDevMode && setInjectorProfilerContext(prevInjectContext);\n previousInjectImplementation !== null && setInjectImplementation(previousInjectImplementation);\n setIncludeViewProviders(previousIncludeViewProviders);\n factory.resolving = false;\n leaveDI();\n }\n }\n return value;\n}\n/**\n * Returns the bit in an injector's bloom filter that should be used to determine whether or not\n * the directive might be provided by the injector.\n *\n * When a directive is public, it is added to the bloom filter and given a unique ID that can be\n * retrieved on the Type. When the directive isn't public or the token is not a directive `null`\n * is returned as the node injector can not possibly provide that token.\n *\n * @param token the injection token\n * @returns the matching bit to check in the bloom filter or `null` if the token is not known.\n * When the returned value is negative then it represents special values such as `Injector`.\n */\nfunction bloomHashBitOrFactory(token) {\n ngDevMode && assertDefined(token, 'token must be defined');\n if (typeof token === 'string') {\n return token.charCodeAt(0) || 0;\n }\n const tokenId =\n // First check with `hasOwnProperty` so we don't get an inherited ID.\n token.hasOwnProperty(NG_ELEMENT_ID) ? token[NG_ELEMENT_ID] : undefined;\n // Negative token IDs are used for special objects such as `Injector`\n if (typeof tokenId === 'number') {\n if (tokenId >= 0) {\n return tokenId & BLOOM_MASK;\n } else {\n ngDevMode && assertEqual(tokenId, -1 /* InjectorMarkers.Injector */, 'Expecting to get Special Injector Id');\n return createNodeInjector;\n }\n } else {\n return tokenId;\n }\n}\nfunction bloomHasToken(bloomHash, injectorIndex, injectorView) {\n // Create a mask that targets the specific bit associated with the directive we're looking for.\n // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding\n // to bit positions 0 - 31 in a 32 bit integer.\n const mask = 1 << bloomHash;\n // Each bloom bucket in `injectorView` represents `BLOOM_BUCKET_BITS` number of bits of\n // `bloomHash`. Any bits in `bloomHash` beyond `BLOOM_BUCKET_BITS` indicate the bucket offset\n // that should be used.\n const value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)];\n // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on,\n // this injector is a potential match.\n return !!(value & mask);\n}\n/** Returns true if flags prevent parent injector from being searched for tokens */\nfunction shouldSearchParent(flags, isFirstHostTNode) {\n return !(flags & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode);\n}\nfunction getNodeInjectorLView(nodeInjector) {\n return nodeInjector._lView;\n}\nfunction getNodeInjectorTNode(nodeInjector) {\n return nodeInjector._tNode;\n}\nclass NodeInjector {\n constructor(_tNode, _lView) {\n this._tNode = _tNode;\n this._lView = _lView;\n }\n get(token, notFoundValue, flags) {\n return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue);\n }\n}\n/** Creates a `NodeInjector` for the current node. */\nfunction createNodeInjector() {\n return new NodeInjector(getCurrentTNode(), getLView());\n}\n/**\n * @codeGenApi\n */\nfunction ɵɵgetInheritedFactory(type) {\n return noSideEffects(() => {\n const ownConstructor = type.prototype.constructor;\n const ownFactory = ownConstructor[NG_FACTORY_DEF] || getFactoryOf(ownConstructor);\n const objectPrototype = Object.prototype;\n let parent = Object.getPrototypeOf(type.prototype).constructor;\n // Go up the prototype until we hit `Object`.\n while (parent && parent !== objectPrototype) {\n const factory = parent[NG_FACTORY_DEF] || getFactoryOf(parent);\n // If we hit something that has a factory and the factory isn't the same as the type,\n // we've found the inherited factory. Note the check that the factory isn't the type's\n // own factory is redundant in most cases, but if the user has custom decorators on the\n // class, this lookup will start one level down in the prototype chain, causing us to\n // find the own factory first and potentially triggering an infinite loop downstream.\n if (factory && factory !== ownFactory) {\n return factory;\n }\n parent = Object.getPrototypeOf(parent);\n }\n // There is no factory defined. Either this was improper usage of inheritance\n // (no Angular decorator on the superclass) or there is no constructor at all\n // in the inheritance chain. Since the two cases cannot be distinguished, the\n // latter has to be assumed.\n return t => new t();\n });\n}\nfunction getFactoryOf(type) {\n if (isForwardRef(type)) {\n return () => {\n const factory = getFactoryOf(resolveForwardRef(type));\n return factory && factory();\n };\n }\n return getFactoryDef(type);\n}\n/**\n * Returns a value from the closest embedded or node injector.\n *\n * @param tNode The Node where the search for the injector should start\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector, `null` when not found, or `notFoundValue` if provided\n */\nfunction lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundValue) {\n let currentTNode = tNode;\n let currentLView = lView;\n // When an LView with an embedded view injector is inserted, it'll likely be interlaced with\n // nodes who may have injectors (e.g. node injector -> embedded view injector -> node injector).\n // Since the bloom filters for the node injectors have already been constructed and we don't\n // have a way of extracting the records from an injector, the only way to maintain the correct\n // hierarchy when resolving the value is to walk it node-by-node while attempting to resolve\n // the token at each level.\n while (currentTNode !== null && currentLView !== null && currentLView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */ && !(currentLView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {\n ngDevMode && assertTNodeForLView(currentTNode, currentLView);\n // Note that this lookup on the node injector is using the `Self` flag, because\n // we don't want the node injector to look at any parent injectors since we\n // may hit the embedded view injector first.\n const nodeInjectorValue = lookupTokenUsingNodeInjector(currentTNode, currentLView, token, flags | InjectFlags.Self, NOT_FOUND);\n if (nodeInjectorValue !== NOT_FOUND) {\n return nodeInjectorValue;\n }\n // Has an explicit type due to a TS bug: https://github.com/microsoft/TypeScript/issues/33191\n let parentTNode = currentTNode.parent;\n // `TNode.parent` includes the parent within the current view only. If it doesn't exist,\n // it means that we've hit the view boundary and we need to go up to the next view.\n if (!parentTNode) {\n // Before we go to the next LView, check if the token exists on the current embedded injector.\n const embeddedViewInjector = currentLView[EMBEDDED_VIEW_INJECTOR];\n if (embeddedViewInjector) {\n const embeddedViewInjectorValue = embeddedViewInjector.get(token, NOT_FOUND, flags);\n if (embeddedViewInjectorValue !== NOT_FOUND) {\n return embeddedViewInjectorValue;\n }\n }\n // Otherwise keep going up the tree.\n parentTNode = getTNodeFromLView(currentLView);\n currentLView = currentLView[DECLARATION_VIEW];\n }\n currentTNode = parentTNode;\n }\n return notFoundValue;\n}\n/** Gets the TNode associated with an LView inside of the declaration view. */\nfunction getTNodeFromLView(lView) {\n const tView = lView[TVIEW];\n const tViewType = tView.type;\n // The parent pointer differs based on `TView.type`.\n if (tViewType === 2 /* TViewType.Embedded */) {\n ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');\n return tView.declTNode;\n } else if (tViewType === 1 /* TViewType.Component */) {\n // Components don't have `TView.declTNode` because each instance of component could be\n // inserted in different location, hence `TView.declTNode` is meaningless.\n return lView[T_HOST];\n }\n return null;\n}\n\n/**\n * Facade for the attribute injection from DI.\n *\n * @codeGenApi\n */\nfunction ɵɵinjectAttribute(attrNameToInject) {\n return injectAttributeImpl(getCurrentTNode(), attrNameToInject);\n}\n\n/**\n * Attribute decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Attribute = /*#__PURE__*/makeParamDecorator('Attribute', attributeName => ({\n attributeName,\n __NG_ELEMENT_ID__: () => ɵɵinjectAttribute(attributeName)\n}));\nlet _reflect = null;\nfunction getReflect() {\n return _reflect = _reflect || new ReflectionCapabilities();\n}\nfunction reflectDependencies(type) {\n return convertDependencies(getReflect().parameters(type));\n}\nfunction convertDependencies(deps) {\n return deps.map(dep => reflectDependency(dep));\n}\nfunction reflectDependency(dep) {\n const meta = {\n token: null,\n attribute: null,\n host: false,\n optional: false,\n self: false,\n skipSelf: false\n };\n if (Array.isArray(dep) && dep.length > 0) {\n for (let j = 0; j < dep.length; j++) {\n const param = dep[j];\n if (param === undefined) {\n // param may be undefined if type of dep is not set by ngtsc\n continue;\n }\n const proto = Object.getPrototypeOf(param);\n if (param instanceof Optional || proto.ngMetadataName === 'Optional') {\n meta.optional = true;\n } else if (param instanceof SkipSelf || proto.ngMetadataName === 'SkipSelf') {\n meta.skipSelf = true;\n } else if (param instanceof Self || proto.ngMetadataName === 'Self') {\n meta.self = true;\n } else if (param instanceof Host || proto.ngMetadataName === 'Host') {\n meta.host = true;\n } else if (param instanceof Inject) {\n meta.token = param.token;\n } else if (param instanceof Attribute) {\n if (param.attributeName === undefined) {\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Attribute name must be defined.`);\n }\n meta.attribute = param.attributeName;\n } else {\n meta.token = param;\n }\n }\n } else if (dep === undefined || Array.isArray(dep) && dep.length === 0) {\n meta.token = null;\n } else {\n meta.token = dep;\n }\n return meta;\n}\n\n/**\n * Compile an Angular injectable according to its `Injectable` metadata, and patch the resulting\n * injectable def (`ɵprov`) onto the injectable type.\n */\nfunction compileInjectable(type, meta) {\n let ngInjectableDef = null;\n let ngFactoryDef = null;\n // if NG_PROV_DEF is already defined on this class then don't overwrite it\n if (!type.hasOwnProperty(NG_PROV_DEF)) {\n Object.defineProperty(type, NG_PROV_DEF, {\n get: () => {\n if (ngInjectableDef === null) {\n const compiler = getCompilerFacade({\n usage: 0 /* JitCompilerUsage.Decorator */,\n kind: 'injectable',\n type\n });\n ngInjectableDef = compiler.compileInjectable(angularCoreDiEnv, `ng:///${type.name}/ɵprov.js`, getInjectableMetadata(type, meta));\n }\n return ngInjectableDef;\n }\n });\n }\n // if NG_FACTORY_DEF is already defined on this class then don't overwrite it\n if (!type.hasOwnProperty(NG_FACTORY_DEF)) {\n Object.defineProperty(type, NG_FACTORY_DEF, {\n get: () => {\n if (ngFactoryDef === null) {\n const compiler = getCompilerFacade({\n usage: 0 /* JitCompilerUsage.Decorator */,\n kind: 'injectable',\n type\n });\n ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, `ng:///${type.name}/ɵfac.js`, {\n name: type.name,\n type,\n typeArgumentCount: 0,\n // In JIT mode types are not available nor used.\n deps: reflectDependencies(type),\n target: compiler.FactoryTarget.Injectable\n });\n }\n return ngFactoryDef;\n },\n // Leave this configurable so that the factories from directives or pipes can take precedence.\n configurable: true\n });\n }\n}\nconst USE_VALUE = /*#__PURE__*/getClosureSafeProperty({\n provide: String,\n useValue: getClosureSafeProperty\n});\nfunction isUseClassProvider(meta) {\n return meta.useClass !== undefined;\n}\nfunction isUseValueProvider(meta) {\n return USE_VALUE in meta;\n}\nfunction isUseFactoryProvider(meta) {\n return meta.useFactory !== undefined;\n}\nfunction isUseExistingProvider(meta) {\n return meta.useExisting !== undefined;\n}\nfunction getInjectableMetadata(type, srcMeta) {\n // Allow the compilation of a class with a `@Injectable()` decorator without parameters\n const meta = srcMeta || {\n providedIn: null\n };\n const compilerMeta = {\n name: type.name,\n type: type,\n typeArgumentCount: 0,\n providedIn: meta.providedIn\n };\n if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== undefined) {\n compilerMeta.deps = convertDependencies(meta.deps);\n }\n // Check to see if the user explicitly provided a `useXxxx` property.\n if (isUseClassProvider(meta)) {\n compilerMeta.useClass = meta.useClass;\n } else if (isUseValueProvider(meta)) {\n compilerMeta.useValue = meta.useValue;\n } else if (isUseFactoryProvider(meta)) {\n compilerMeta.useFactory = meta.useFactory;\n } else if (isUseExistingProvider(meta)) {\n compilerMeta.useExisting = meta.useExisting;\n }\n return compilerMeta;\n}\n\n/**\n * Injectable decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Injectable = /*#__PURE__*/makeDecorator('Injectable', undefined, undefined, undefined, (type, meta) => compileInjectable(type, meta));\n\n/**\n * Create a new `Injector` which is configured using a `defType` of `InjectorType`s.\n */\nfunction createInjector(defType, parent = null, additionalProviders = null, name) {\n const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name);\n injector.resolveInjectorInitializers();\n return injector;\n}\n/**\n * Creates a new injector without eagerly resolving its injector types. Can be used in places\n * where resolving the injector types immediately can lead to an infinite loop. The injector types\n * should be resolved at a later point by calling `_resolveInjectorDefTypes`.\n */\nfunction createInjectorWithoutInjectorInstances(defType, parent = null, additionalProviders = null, name, scopes = new Set()) {\n const providers = [additionalProviders || EMPTY_ARRAY, importProvidersFrom(defType)];\n name = name || (typeof defType === 'object' ? undefined : stringify(defType));\n return new R3Injector(providers, parent || getNullInjector(), name || null, scopes);\n}\n\n/**\n * Concrete injectors implement this interface. Injectors are configured\n * with [providers](guide/dependency-injection-providers) that associate\n * dependencies of various types with [injection tokens](guide/dependency-injection-providers).\n *\n * @see [DI Providers](guide/dependency-injection-providers).\n * @see {@link StaticProvider}\n *\n * @usageNotes\n *\n * The following example creates a service injector instance.\n *\n * {@example core/di/ts/provider_spec.ts region='ConstructorProvider'}\n *\n * ### Usage example\n *\n * {@example core/di/ts/injector_spec.ts region='Injector'}\n *\n * `Injector` returns itself when given `Injector` as a token:\n *\n * {@example core/di/ts/injector_spec.ts region='injectInjector'}\n *\n * @publicApi\n */\nlet Injector = /*#__PURE__*/(() => {\n class Injector {\n static {\n this.THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;\n }\n static {\n this.NULL = /* @__PURE__ */new NullInjector();\n }\n static create(options, parent) {\n if (Array.isArray(options)) {\n return createInjector({\n name: ''\n }, parent, options, '');\n } else {\n const name = options.name ?? '';\n return createInjector({\n name\n }, options.parent, options.providers, name);\n }\n }\n /** @nocollapse */\n static {\n this.ɵprov = ɵɵdefineInjectable({\n token: Injector,\n providedIn: 'any',\n factory: () => ɵɵinject(INJECTOR$1)\n });\n }\n /**\n * @internal\n * @nocollapse\n */\n static {\n this.__NG_ELEMENT_ID__ = -1 /* InjectorMarkers.Injector */;\n }\n }\n return Injector;\n})();\n/*!\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * Creates a token that can be used to inject static attributes of the host node.\n *\n * @usageNotes\n * ### Injecting an attribute that is known to exist\n * ```typescript\n * @Directive()\n * class MyDir {\n * attr: string = inject(new HostAttributeToken('some-attr'));\n * }\n * ```\n *\n * ### Optionally injecting an attribute\n * ```typescript\n * @Directive()\n * class MyDir {\n * attr: string | null = inject(new HostAttributeToken('some-attr'), {optional: true});\n * }\n * ```\n * @publicApi\n */\nclass HostAttributeToken {\n constructor(attributeName) {\n this.attributeName = attributeName;\n /** @internal */\n this.__NG_ELEMENT_ID__ = () => ɵɵinjectAttribute(this.attributeName);\n }\n toString() {\n return `HostAttributeToken ${this.attributeName}`;\n }\n}\n\n/**\n * @module\n * @description\n * The `di` module provides dependency injection container services.\n */\n\n/**\n * This file should not be necessary because node resolution should just default to `./di/index`!\n *\n * However it does not seem to work and it breaks:\n * - //packages/animations/browser/test:test_web_chromium-local\n * - //packages/compiler-cli/test:extract_i18n\n * - //packages/compiler-cli/test:ngc\n * - //packages/compiler-cli/test:perform_watch\n * - //packages/compiler-cli/test/diagnostics:check_types\n * - //packages/compiler-cli/test/transformers:test\n * - //packages/compiler/test:test\n * - //tools/public_api_guard:core_api\n *\n * Remove this file once the above is solved or wait until `ngc` is deleted and then it should be\n * safe to delete this file.\n */\n\nconst ERROR_ORIGINAL_ERROR = 'ngOriginalError';\nfunction wrappedError(message, originalError) {\n const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;\n const error = Error(msg);\n error[ERROR_ORIGINAL_ERROR] = originalError;\n return error;\n}\nfunction getOriginalError(error) {\n return error[ERROR_ORIGINAL_ERROR];\n}\n\n/**\n * Provides a hook for centralized exception handling.\n *\n * The default implementation of `ErrorHandler` prints error messages to the `console`. To\n * intercept error handling, write a custom exception handler that replaces this default as\n * appropriate for your app.\n *\n * @usageNotes\n * ### Example\n *\n * ```\n * class MyErrorHandler implements ErrorHandler {\n * handleError(error) {\n * // do something with the exception\n * }\n * }\n *\n * @NgModule({\n * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]\n * })\n * class MyModule {}\n * ```\n *\n * @publicApi\n */\nclass ErrorHandler {\n constructor() {\n /**\n * @internal\n */\n this._console = console;\n }\n handleError(error) {\n const originalError = this._findOriginalError(error);\n this._console.error('ERROR', error);\n if (originalError) {\n this._console.error('ORIGINAL ERROR', originalError);\n }\n }\n /** @internal */\n _findOriginalError(error) {\n let e = error && getOriginalError(error);\n while (e && getOriginalError(e)) {\n e = getOriginalError(e);\n }\n return e || null;\n }\n}\n/**\n * `InjectionToken` used to configure how to call the `ErrorHandler`.\n *\n * `NgZone` is provided by default today so the default (and only) implementation for this\n * is calling `ErrorHandler.handleError` outside of the Angular zone.\n */\nconst INTERNAL_APPLICATION_ERROR_HANDLER = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'internal error handler' : '', {\n providedIn: 'root',\n factory: () => {\n const userErrorHandler = inject(ErrorHandler);\n return userErrorHandler.handleError.bind(undefined);\n }\n});\n\n/**\n * `DestroyRef` lets you set callbacks to run for any cleanup or destruction behavior.\n * The scope of this destruction depends on where `DestroyRef` is injected. If `DestroyRef`\n * is injected in a component or directive, the callbacks run when that component or\n * directive is destroyed. Otherwise the callbacks run when a corresponding injector is destroyed.\n *\n * @publicApi\n */\nlet DestroyRef = /*#__PURE__*/(() => {\n class DestroyRef {\n /**\n * @internal\n * @nocollapse\n */\n static {\n this.__NG_ELEMENT_ID__ = injectDestroyRef;\n }\n /**\n * @internal\n * @nocollapse\n */\n static {\n this.__NG_ENV_ID__ = injector => injector;\n }\n }\n return DestroyRef;\n})();\nclass NodeInjectorDestroyRef extends DestroyRef {\n constructor(_lView) {\n super();\n this._lView = _lView;\n }\n onDestroy(callback) {\n storeLViewOnDestroy(this._lView, callback);\n return () => removeLViewOnDestroy(this._lView, callback);\n }\n}\nfunction injectDestroyRef() {\n return new NodeInjectorDestroyRef(getLView());\n}\n\n/**\n * An `OutputEmitterRef` is created by the `output()` function and can be\n * used to emit values to consumers of your directive or component.\n *\n * Consumers of your directive/component can bind to the output and\n * subscribe to changes via the bound event syntax. For example:\n *\n * ```html\n * \n * ```\n *\n * @developerPreview\n */\nclass OutputEmitterRef {\n constructor() {\n this.destroyed = false;\n this.listeners = null;\n this.errorHandler = inject(ErrorHandler, {\n optional: true\n });\n /** @internal */\n this.destroyRef = inject(DestroyRef);\n // Clean-up all listeners and mark as destroyed upon destroy.\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.listeners = null;\n });\n }\n subscribe(callback) {\n if (this.destroyed) {\n throw new RuntimeError(953 /* RuntimeErrorCode.OUTPUT_REF_DESTROYED */, ngDevMode && 'Unexpected subscription to destroyed `OutputRef`. ' + 'The owning directive/component is destroyed.');\n }\n (this.listeners ??= []).push(callback);\n return {\n unsubscribe: () => {\n const idx = this.listeners?.indexOf(callback);\n if (idx !== undefined && idx !== -1) {\n this.listeners?.splice(idx, 1);\n }\n }\n };\n }\n /** Emits a new value to the output. */\n emit(value) {\n if (this.destroyed) {\n throw new RuntimeError(953 /* RuntimeErrorCode.OUTPUT_REF_DESTROYED */, ngDevMode && 'Unexpected emit for destroyed `OutputRef`. ' + 'The owning directive/component is destroyed.');\n }\n if (this.listeners === null) {\n return;\n }\n const previousConsumer = setActiveConsumer$1(null);\n try {\n for (const listenerFn of this.listeners) {\n try {\n listenerFn(value);\n } catch (err) {\n this.errorHandler?.handleError(err);\n }\n }\n } finally {\n setActiveConsumer$1(previousConsumer);\n }\n }\n}\n/** Gets the owning `DestroyRef` for the given output. */\nfunction getOutputDestroyRef(ref) {\n return ref.destroyRef;\n}\n\n/**\n * The `output` function allows declaration of Angular outputs in\n * directives and components.\n *\n * You can use outputs to emit values to parent directives and component.\n * Parents can subscribe to changes via:\n *\n * - template event bindings. For example, `(myOutput)=\"doSomething($event)\"`\n * - programmatic subscription by using `OutputRef#subscribe`.\n *\n * @usageNotes\n *\n * To use `output()`, import the function from `@angular/core`.\n *\n * ```\n * import {output} from '@angular/core`;\n * ```\n *\n * Inside your component, introduce a new class member and initialize\n * it with a call to `output`.\n *\n * ```ts\n * @Directive({\n * ...\n * })\n * export class MyDir {\n * nameChange = output(); // OutputEmitterRef\n * onClick = output(); // OutputEmitterRef\n * }\n * ```\n *\n * You can emit values to consumers of your directive, by using\n * the `emit` method from `OutputEmitterRef`.\n *\n * ```ts\n * updateName(newName: string): void {\n * this.nameChange.emit(newName);\n * }\n * ```\n *\n * @developerPreview\n * @initializerApiFunction {\"showTypesInSignaturePreview\": true}\n */\nfunction output(opts) {\n ngDevMode && assertInInjectionContext(output);\n return new OutputEmitterRef();\n}\nfunction inputFunction(initialValue, opts) {\n ngDevMode && assertInInjectionContext(input);\n return createInputSignal(initialValue, opts);\n}\nfunction inputRequiredFunction(opts) {\n ngDevMode && assertInInjectionContext(input);\n return createInputSignal(REQUIRED_UNSET_VALUE, opts);\n}\n/**\n * The `input` function allows declaration of Angular inputs in directives\n * and components.\n *\n * There are two variants of inputs that can be declared:\n *\n * 1. **Optional inputs** with an initial value.\n * 2. **Required inputs** that consumers need to set.\n *\n * By default, the `input` function will declare optional inputs that\n * always have an initial value. Required inputs can be declared\n * using the `input.required()` function.\n *\n * Inputs are signals. The values of an input are exposed as a `Signal`.\n * The signal always holds the latest value of the input that is bound\n * from the parent.\n *\n * @usageNotes\n * To use signal-based inputs, import `input` from `@angular/core`.\n *\n * ```\n * import {input} from '@angular/core`;\n * ```\n *\n * Inside your component, introduce a new class member and initialize\n * it with a call to `input` or `input.required`.\n *\n * ```ts\n * @Component({\n * ...\n * })\n * export class UserProfileComponent {\n * firstName = input(); // Signal\n * lastName = input.required(); // Signal\n * age = input(0) // Signal\n * }\n * ```\n *\n * Inside your component template, you can display values of the inputs\n * by calling the signal.\n *\n * ```html\n * {{firstName()}}\n * ```\n *\n * @developerPreview\n * @initializerApiFunction\n */\nconst input = /*#__PURE__*/(() => {\n // Note: This may be considered a side-effect, but nothing will depend on\n // this assignment, unless this `input` constant export is accessed. It's a\n // self-contained side effect that is local to the user facing`input` export.\n inputFunction.required = inputRequiredFunction;\n return inputFunction;\n})();\n\n/**\n * Creates an ElementRef from the most recent node.\n *\n * @returns The ElementRef instance to use\n */\nfunction injectElementRef() {\n return createElementRef(getCurrentTNode(), getLView());\n}\n/**\n * Creates an ElementRef given a node.\n *\n * @param tNode The node for which you'd like an ElementRef\n * @param lView The view to which the node belongs\n * @returns The ElementRef instance to use\n */\nfunction createElementRef(tNode, lView) {\n return new ElementRef(getNativeByTNode(tNode, lView));\n}\n/**\n * A wrapper around a native element inside of a View.\n *\n * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM\n * element.\n *\n * @security Permitting direct access to the DOM can make your application more vulnerable to\n * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the\n * [Security Guide](https://g.co/ng/security).\n *\n * @publicApi\n */\n// Note: We don't expose things like `Injector`, `ViewContainer`, ... here,\n// i.e. users have to ask for what they need. With that, we can build better analysis tools\n// and could do better codegen in the future.\nlet ElementRef = /*#__PURE__*/(() => {\n class ElementRef {\n constructor(nativeElement) {\n this.nativeElement = nativeElement;\n }\n /**\n * @internal\n * @nocollapse\n */\n static {\n this.__NG_ELEMENT_ID__ = injectElementRef;\n }\n }\n return ElementRef;\n})();\n/**\n * Unwraps `ElementRef` and return the `nativeElement`.\n *\n * @param value value to unwrap\n * @returns `nativeElement` if `ElementRef` otherwise returns value as is.\n */\nfunction unwrapElementRef(value) {\n return value instanceof ElementRef ? value.nativeElement : value;\n}\nclass EventEmitter_ extends Subject {\n constructor(isAsync = false) {\n super();\n this.destroyRef = undefined;\n this.__isAsync = isAsync;\n // Attempt to retrieve a `DestroyRef` optionally.\n // For backwards compatibility reasons, this cannot be required\n if (isInInjectionContext()) {\n this.destroyRef = inject(DestroyRef, {\n optional: true\n }) ?? undefined;\n }\n }\n emit(value) {\n const prevConsumer = setActiveConsumer$1(null);\n try {\n super.next(value);\n } finally {\n setActiveConsumer$1(prevConsumer);\n }\n }\n subscribe(observerOrNext, error, complete) {\n let nextFn = observerOrNext;\n let errorFn = error || (() => null);\n let completeFn = complete;\n if (observerOrNext && typeof observerOrNext === 'object') {\n const observer = observerOrNext;\n nextFn = observer.next?.bind(observer);\n errorFn = observer.error?.bind(observer);\n completeFn = observer.complete?.bind(observer);\n }\n if (this.__isAsync) {\n errorFn = _wrapInTimeout(errorFn);\n if (nextFn) {\n nextFn = _wrapInTimeout(nextFn);\n }\n if (completeFn) {\n completeFn = _wrapInTimeout(completeFn);\n }\n }\n const sink = super.subscribe({\n next: nextFn,\n error: errorFn,\n complete: completeFn\n });\n if (observerOrNext instanceof Subscription) {\n observerOrNext.add(sink);\n }\n return sink;\n }\n}\nfunction _wrapInTimeout(fn) {\n return value => {\n setTimeout(fn, undefined, value);\n };\n}\n/**\n * @publicApi\n */\nconst EventEmitter = EventEmitter_;\nfunction symbolIterator() {\n // @ts-expect-error accessing a private member\n return this._results[Symbol.iterator]();\n}\n/**\n * An unmodifiable list of items that Angular keeps up to date when the state\n * of the application changes.\n *\n * The type of object that {@link ViewChildren}, {@link ContentChildren}, and {@link QueryList}\n * provide.\n *\n * Implements an iterable interface, therefore it can be used in both ES6\n * javascript `for (var i of items)` loops as well as in Angular templates with\n * `*ngFor=\"let i of myList\"`.\n *\n * Changes can be observed by subscribing to the changes `Observable`.\n *\n * NOTE: In the future this class will implement an `Observable` interface.\n *\n * @usageNotes\n * ### Example\n * ```typescript\n * @Component({...})\n * class Container {\n * @ViewChildren(Item) items:QueryList;\n * }\n * ```\n *\n * @publicApi\n */\nclass QueryList {\n static {\n Symbol.iterator;\n }\n /**\n * Returns `Observable` of `QueryList` notifying the subscriber of changes.\n */\n get changes() {\n return this._changes ??= new EventEmitter();\n }\n /**\n * @param emitDistinctChangesOnly Whether `QueryList.changes` should fire only when actual change\n * has occurred. Or if it should fire when query is recomputed. (recomputing could resolve in\n * the same result)\n */\n constructor(_emitDistinctChangesOnly = false) {\n this._emitDistinctChangesOnly = _emitDistinctChangesOnly;\n this.dirty = true;\n this._onDirty = undefined;\n this._results = [];\n this._changesDetected = false;\n this._changes = undefined;\n this.length = 0;\n this.first = undefined;\n this.last = undefined;\n // This function should be declared on the prototype, but doing so there will cause the class\n // declaration to have side-effects and become not tree-shakable. For this reason we do it in\n // the constructor.\n // [Symbol.iterator](): Iterator { ... }\n const proto = QueryList.prototype;\n if (!proto[Symbol.iterator]) proto[Symbol.iterator] = symbolIterator;\n }\n /**\n * Returns the QueryList entry at `index`.\n */\n get(index) {\n return this._results[index];\n }\n /**\n * See\n * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\n */\n map(fn) {\n return this._results.map(fn);\n }\n filter(fn) {\n return this._results.filter(fn);\n }\n /**\n * See\n * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)\n */\n find(fn) {\n return this._results.find(fn);\n }\n /**\n * See\n * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)\n */\n reduce(fn, init) {\n return this._results.reduce(fn, init);\n }\n /**\n * See\n * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)\n */\n forEach(fn) {\n this._results.forEach(fn);\n }\n /**\n * See\n * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)\n */\n some(fn) {\n return this._results.some(fn);\n }\n /**\n * Returns a copy of the internal results list as an Array.\n */\n toArray() {\n return this._results.slice();\n }\n toString() {\n return this._results.toString();\n }\n /**\n * Updates the stored data of the query list, and resets the `dirty` flag to `false`, so that\n * on change detection, it will not notify of changes to the queries, unless a new change\n * occurs.\n *\n * @param resultsTree The query results to store\n * @param identityAccessor Optional function for extracting stable object identity from a value\n * in the array. This function is executed for each element of the query result list while\n * comparing current query list with the new one (provided as a first argument of the `reset`\n * function) to detect if the lists are different. If the function is not provided, elements\n * are compared as is (without any pre-processing).\n */\n reset(resultsTree, identityAccessor) {\n this.dirty = false;\n const newResultFlat = flatten(resultsTree);\n if (this._changesDetected = !arrayEquals(this._results, newResultFlat, identityAccessor)) {\n this._results = newResultFlat;\n this.length = newResultFlat.length;\n this.last = newResultFlat[this.length - 1];\n this.first = newResultFlat[0];\n }\n }\n /**\n * Triggers a change event by emitting on the `changes` {@link EventEmitter}.\n */\n notifyOnChanges() {\n if (this._changes !== undefined && (this._changesDetected || !this._emitDistinctChangesOnly)) this._changes.emit(this);\n }\n /** @internal */\n onDirty(cb) {\n this._onDirty = cb;\n }\n /** internal */\n setDirty() {\n this.dirty = true;\n this._onDirty?.();\n }\n /** internal */\n destroy() {\n if (this._changes !== undefined) {\n this._changes.complete();\n this._changes.unsubscribe();\n }\n }\n}\n\n/**\n * The name of an attribute that can be added to the hydration boundary node\n * (component host node) to disable hydration for the content within that boundary.\n */\nconst SKIP_HYDRATION_ATTR_NAME = 'ngSkipHydration';\n/** Lowercase name of the `ngSkipHydration` attribute used for case-insensitive comparisons. */\nconst SKIP_HYDRATION_ATTR_NAME_LOWER_CASE = 'ngskiphydration';\n/**\n * Helper function to check if a given TNode has the 'ngSkipHydration' attribute.\n */\nfunction hasSkipHydrationAttrOnTNode(tNode) {\n const attrs = tNode.mergedAttrs;\n if (attrs === null) return false;\n // only ever look at the attribute name and skip the values\n for (let i = 0; i < attrs.length; i += 2) {\n const value = attrs[i];\n // This is a marker, which means that the static attributes section is over,\n // so we can exit early.\n if (typeof value === 'number') return false;\n if (typeof value === 'string' && value.toLowerCase() === SKIP_HYDRATION_ATTR_NAME_LOWER_CASE) {\n return true;\n }\n }\n return false;\n}\n/**\n * Helper function to check if a given RElement has the 'ngSkipHydration' attribute.\n */\nfunction hasSkipHydrationAttrOnRElement(rNode) {\n return rNode.hasAttribute(SKIP_HYDRATION_ATTR_NAME);\n}\n/**\n * Checks whether a TNode has a flag to indicate that it's a part of\n * a skip hydration block.\n */\nfunction hasInSkipHydrationBlockFlag(tNode) {\n return (tNode.flags & 128 /* TNodeFlags.inSkipHydrationBlock */) === 128 /* TNodeFlags.inSkipHydrationBlock */;\n}\n/**\n * Helper function that determines if a given node is within a skip hydration block\n * by navigating up the TNode tree to see if any parent nodes have skip hydration\n * attribute.\n */\nfunction isInSkipHydrationBlock(tNode) {\n if (hasInSkipHydrationBlockFlag(tNode)) {\n return true;\n }\n let currentTNode = tNode.parent;\n while (currentTNode) {\n if (hasInSkipHydrationBlockFlag(tNode) || hasSkipHydrationAttrOnTNode(currentTNode)) {\n return true;\n }\n currentTNode = currentTNode.parent;\n }\n return false;\n}\n\n// Keeps track of the currently-active LViews.\nconst TRACKED_LVIEWS = /*#__PURE__*/new Map();\n// Used for generating unique IDs for LViews.\nlet uniqueIdCounter = 0;\n/** Gets a unique ID that can be assigned to an LView. */\nfunction getUniqueLViewId() {\n return uniqueIdCounter++;\n}\n/** Starts tracking an LView. */\nfunction registerLView(lView) {\n ngDevMode && assertNumber(lView[ID], 'LView must have an ID in order to be registered');\n TRACKED_LVIEWS.set(lView[ID], lView);\n}\n/** Gets an LView by its unique ID. */\nfunction getLViewById(id) {\n ngDevMode && assertNumber(id, 'ID used for LView lookup must be a number');\n return TRACKED_LVIEWS.get(id) || null;\n}\n/** Stops tracking an LView. */\nfunction unregisterLView(lView) {\n ngDevMode && assertNumber(lView[ID], 'Cannot stop tracking an LView that does not have an ID');\n TRACKED_LVIEWS.delete(lView[ID]);\n}\n\n/**\n * The internal view context which is specific to a given DOM element, directive or\n * component instance. Each value in here (besides the LView and element node details)\n * can be present, null or undefined. If undefined then it implies the value has not been\n * looked up yet, otherwise, if null, then a lookup was executed and nothing was found.\n *\n * Each value will get filled when the respective value is examined within the getContext\n * function. The component, element and each directive instance will share the same instance\n * of the context.\n */\nclass LContext {\n /** Component's parent view data. */\n get lView() {\n return getLViewById(this.lViewId);\n }\n constructor(\n /**\n * ID of the component's parent view data.\n */\n lViewId,\n /**\n * The index instance of the node.\n */\n nodeIndex,\n /**\n * The instance of the DOM node that is attached to the lNode.\n */\n native) {\n this.lViewId = lViewId;\n this.nodeIndex = nodeIndex;\n this.native = native;\n }\n}\n\n/**\n * Returns the matching `LContext` data for a given DOM node, directive or component instance.\n *\n * This function will examine the provided DOM element, component, or directive instance\\'s\n * monkey-patched property to derive the `LContext` data. Once called then the monkey-patched\n * value will be that of the newly created `LContext`.\n *\n * If the monkey-patched value is the `LView` instance then the context value for that\n * target will be created and the monkey-patch reference will be updated. Therefore when this\n * function is called it may mutate the provided element\\'s, component\\'s or any of the associated\n * directive\\'s monkey-patch values.\n *\n * If the monkey-patch value is not detected then the code will walk up the DOM until an element\n * is found which contains a monkey-patch reference. When that occurs then the provided element\n * will be updated with a new context (which is then returned). If the monkey-patch value is not\n * detected for a component/directive instance then it will throw an error (all components and\n * directives should be automatically monkey-patched by ivy).\n *\n * @param target Component, Directive or DOM Node.\n */\nfunction getLContext(target) {\n let mpValue = readPatchedData(target);\n if (mpValue) {\n // only when it's an array is it considered an LView instance\n // ... otherwise it's an already constructed LContext instance\n if (isLView(mpValue)) {\n const lView = mpValue;\n let nodeIndex;\n let component = undefined;\n let directives = undefined;\n if (isComponentInstance(target)) {\n nodeIndex = findViaComponent(lView, target);\n if (nodeIndex == -1) {\n throw new Error('The provided component was not found in the application');\n }\n component = target;\n } else if (isDirectiveInstance(target)) {\n nodeIndex = findViaDirective(lView, target);\n if (nodeIndex == -1) {\n throw new Error('The provided directive was not found in the application');\n }\n directives = getDirectivesAtNodeIndex(nodeIndex, lView);\n } else {\n nodeIndex = findViaNativeElement(lView, target);\n if (nodeIndex == -1) {\n return null;\n }\n }\n // the goal is not to fill the entire context full of data because the lookups\n // are expensive. Instead, only the target data (the element, component, container, ICU\n // expression or directive details) are filled into the context. If called multiple times\n // with different target values then the missing target data will be filled in.\n const native = unwrapRNode(lView[nodeIndex]);\n const existingCtx = readPatchedData(native);\n const context = existingCtx && !Array.isArray(existingCtx) ? existingCtx : createLContext(lView, nodeIndex, native);\n // only when the component has been discovered then update the monkey-patch\n if (component && context.component === undefined) {\n context.component = component;\n attachPatchData(context.component, context);\n }\n // only when the directives have been discovered then update the monkey-patch\n if (directives && context.directives === undefined) {\n context.directives = directives;\n for (let i = 0; i < directives.length; i++) {\n attachPatchData(directives[i], context);\n }\n }\n attachPatchData(context.native, context);\n mpValue = context;\n }\n } else {\n const rElement = target;\n ngDevMode && assertDomNode(rElement);\n // if the context is not found then we need to traverse upwards up the DOM\n // to find the nearest element that has already been monkey patched with data\n let parent = rElement;\n while (parent = parent.parentNode) {\n const parentContext = readPatchedData(parent);\n if (parentContext) {\n const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView;\n // the edge of the app was also reached here through another means\n // (maybe because the DOM was changed manually).\n if (!lView) {\n return null;\n }\n const index = findViaNativeElement(lView, rElement);\n if (index >= 0) {\n const native = unwrapRNode(lView[index]);\n const context = createLContext(lView, index, native);\n attachPatchData(native, context);\n mpValue = context;\n break;\n }\n }\n }\n }\n return mpValue || null;\n}\n/**\n * Creates an empty instance of a `LContext` context\n */\nfunction createLContext(lView, nodeIndex, native) {\n return new LContext(lView[ID], nodeIndex, native);\n}\n/**\n * Takes a component instance and returns the view for that component.\n *\n * @param componentInstance\n * @returns The component's view\n */\nfunction getComponentViewByInstance(componentInstance) {\n let patchedData = readPatchedData(componentInstance);\n let lView;\n if (isLView(patchedData)) {\n const contextLView = patchedData;\n const nodeIndex = findViaComponent(contextLView, componentInstance);\n lView = getComponentLViewByIndex(nodeIndex, contextLView);\n const context = createLContext(contextLView, nodeIndex, lView[HOST]);\n context.component = componentInstance;\n attachPatchData(componentInstance, context);\n attachPatchData(context.native, context);\n } else {\n const context = patchedData;\n const contextLView = context.lView;\n ngDevMode && assertLView(contextLView);\n lView = getComponentLViewByIndex(context.nodeIndex, contextLView);\n }\n return lView;\n}\n/**\n * This property will be monkey-patched on elements, components and directives.\n */\nconst MONKEY_PATCH_KEY_NAME = '__ngContext__';\n/**\n * Assigns the given data to the given target (which could be a component,\n * directive or DOM node instance) using monkey-patching.\n */\nfunction attachPatchData(target, data) {\n ngDevMode && assertDefined(target, 'Target expected');\n // Only attach the ID of the view in order to avoid memory leaks (see #41047). We only do this\n // for `LView`, because we have control over when an `LView` is created and destroyed, whereas\n // we can't know when to remove an `LContext`.\n if (isLView(data)) {\n target[MONKEY_PATCH_KEY_NAME] = data[ID];\n registerLView(data);\n } else {\n target[MONKEY_PATCH_KEY_NAME] = data;\n }\n}\n/**\n * Returns the monkey-patch value data present on the target (which could be\n * a component, directive or a DOM node).\n */\nfunction readPatchedData(target) {\n ngDevMode && assertDefined(target, 'Target expected');\n const data = target[MONKEY_PATCH_KEY_NAME];\n return typeof data === 'number' ? getLViewById(data) : data || null;\n}\nfunction readPatchedLView(target) {\n const value = readPatchedData(target);\n if (value) {\n return isLView(value) ? value : value.lView;\n }\n return null;\n}\nfunction isComponentInstance(instance) {\n return instance && instance.constructor && instance.constructor.ɵcmp;\n}\nfunction isDirectiveInstance(instance) {\n return instance && instance.constructor && instance.constructor.ɵdir;\n}\n/**\n * Locates the element within the given LView and returns the matching index\n */\nfunction findViaNativeElement(lView, target) {\n const tView = lView[TVIEW];\n for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {\n if (unwrapRNode(lView[i]) === target) {\n return i;\n }\n }\n return -1;\n}\n/**\n * Locates the next tNode (child, sibling or parent).\n */\nfunction traverseNextElement(tNode) {\n if (tNode.child) {\n return tNode.child;\n } else if (tNode.next) {\n return tNode.next;\n } else {\n // Let's take the following template:
text
\n // After checking the text node, we need to find the next parent that has a \"next\" TNode,\n // in this case the parent `div`, so that we can find the component.\n while (tNode.parent && !tNode.parent.next) {\n tNode = tNode.parent;\n }\n return tNode.parent && tNode.parent.next;\n }\n}\n/**\n * Locates the component within the given LView and returns the matching index\n */\nfunction findViaComponent(lView, componentInstance) {\n const componentIndices = lView[TVIEW].components;\n if (componentIndices) {\n for (let i = 0; i < componentIndices.length; i++) {\n const elementComponentIndex = componentIndices[i];\n const componentView = getComponentLViewByIndex(elementComponentIndex, lView);\n if (componentView[CONTEXT] === componentInstance) {\n return elementComponentIndex;\n }\n }\n } else {\n const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);\n const rootComponent = rootComponentView[CONTEXT];\n if (rootComponent === componentInstance) {\n // we are dealing with the root element here therefore we know that the\n // element is the very first element after the HEADER data in the lView\n return HEADER_OFFSET;\n }\n }\n return -1;\n}\n/**\n * Locates the directive within the given LView and returns the matching index\n */\nfunction findViaDirective(lView, directiveInstance) {\n // if a directive is monkey patched then it will (by default)\n // have a reference to the LView of the current view. The\n // element bound to the directive being search lives somewhere\n // in the view data. We loop through the nodes and check their\n // list of directives for the instance.\n let tNode = lView[TVIEW].firstChild;\n while (tNode) {\n const directiveIndexStart = tNode.directiveStart;\n const directiveIndexEnd = tNode.directiveEnd;\n for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {\n if (lView[i] === directiveInstance) {\n return tNode.index;\n }\n }\n tNode = traverseNextElement(tNode);\n }\n return -1;\n}\n/**\n * Returns a list of directives applied to a node at a specific index. The list includes\n * directives matched by selector and any host directives, but it excludes components.\n * Use `getComponentAtNodeIndex` to find the component applied to a node.\n *\n * @param nodeIndex The node index\n * @param lView The target view data\n */\nfunction getDirectivesAtNodeIndex(nodeIndex, lView) {\n const tNode = lView[TVIEW].data[nodeIndex];\n if (tNode.directiveStart === 0) return EMPTY_ARRAY;\n const results = [];\n for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {\n const directiveInstance = lView[i];\n if (!isComponentInstance(directiveInstance)) {\n results.push(directiveInstance);\n }\n }\n return results;\n}\nfunction getComponentAtNodeIndex(nodeIndex, lView) {\n const tNode = lView[TVIEW].data[nodeIndex];\n const {\n directiveStart,\n componentOffset\n } = tNode;\n return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;\n}\n/**\n * Returns a map of local references (local reference name => element or directive instance) that\n * exist on a given element.\n */\nfunction discoverLocalRefs(lView, nodeIndex) {\n const tNode = lView[TVIEW].data[nodeIndex];\n if (tNode && tNode.localNames) {\n const result = {};\n let localIndex = tNode.index + 1;\n for (let i = 0; i < tNode.localNames.length; i += 2) {\n result[tNode.localNames[i]] = lView[localIndex];\n localIndex++;\n }\n return result;\n }\n return null;\n}\n\n/**\n * Retrieve the root view from any component or `LView` by walking the parent `LView` until\n * reaching the root `LView`.\n *\n * @param componentOrLView any component or `LView`\n */\nfunction getRootView(componentOrLView) {\n ngDevMode && assertDefined(componentOrLView, 'component');\n let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);\n while (lView && !(lView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {\n lView = getLViewParent(lView);\n }\n ngDevMode && assertLView(lView);\n return lView;\n}\n/**\n * Returns the context information associated with the application where the target is situated. It\n * does this by walking the parent views until it gets to the root view, then getting the context\n * off of that.\n *\n * @param viewOrComponent the `LView` or component to get the root context for.\n */\nfunction getRootContext(viewOrComponent) {\n const rootView = getRootView(viewOrComponent);\n ngDevMode && assertDefined(rootView[CONTEXT], 'Root view has no context. Perhaps it is disconnected?');\n return rootView[CONTEXT];\n}\n/**\n * Gets the first `LContainer` in the LView or `null` if none exists.\n */\nfunction getFirstLContainer(lView) {\n return getNearestLContainer(lView[CHILD_HEAD]);\n}\n/**\n * Gets the next `LContainer` that is a sibling of the given container.\n */\nfunction getNextLContainer(container) {\n return getNearestLContainer(container[NEXT]);\n}\nfunction getNearestLContainer(viewOrContainer) {\n while (viewOrContainer !== null && !isLContainer(viewOrContainer)) {\n viewOrContainer = viewOrContainer[NEXT];\n }\n return viewOrContainer;\n}\n\n/**\n * Retrieves the component instance associated with a given DOM element.\n *\n * @usageNotes\n * Given the following DOM structure:\n *\n * ```html\n * \n *
\n * \n *
\n *
\n * ```\n *\n * Calling `getComponent` on `` will return the instance of `ChildComponent`\n * associated with this DOM element.\n *\n * Calling the function on `` will return the `MyApp` instance.\n *\n *\n * @param element DOM element from which the component should be retrieved.\n * @returns Component instance associated with the element or `null` if there\n * is no component associated with it.\n *\n * @publicApi\n * @globalApi ng\n */\nfunction getComponent$1(element) {\n ngDevMode && assertDomElement(element);\n const context = getLContext(element);\n if (context === null) return null;\n if (context.component === undefined) {\n const lView = context.lView;\n if (lView === null) {\n return null;\n }\n context.component = getComponentAtNodeIndex(context.nodeIndex, lView);\n }\n return context.component;\n}\n/**\n * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded\n * view that the element is part of. Otherwise retrieves the instance of the component whose view\n * owns the element (in this case, the result is the same as calling `getOwningComponent`).\n *\n * @param element Element for which to get the surrounding component instance.\n * @returns Instance of the component that is around the element or null if the element isn't\n * inside any component.\n *\n * @publicApi\n * @globalApi ng\n */\nfunction getContext(element) {\n assertDomElement(element);\n const context = getLContext(element);\n const lView = context ? context.lView : null;\n return lView === null ? null : lView[CONTEXT];\n}\n/**\n * Retrieves the component instance whose view contains the DOM element.\n *\n * For example, if `` is used in the template of ``\n * (i.e. a `ViewChild` of ``), calling `getOwningComponent` on ``\n * would return ``.\n *\n * @param elementOrDir DOM element, component or directive instance\n * for which to retrieve the root components.\n * @returns Component instance whose view owns the DOM element or null if the element is not\n * part of a component view.\n *\n * @publicApi\n * @globalApi ng\n */\nfunction getOwningComponent(elementOrDir) {\n const context = getLContext(elementOrDir);\n let lView = context ? context.lView : null;\n if (lView === null) return null;\n let parent;\n while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {\n lView = parent;\n }\n return lView[FLAGS] & 512 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];\n}\n/**\n * Retrieves all root components associated with a DOM element, directive or component instance.\n * Root components are those which have been bootstrapped by Angular.\n *\n * @param elementOrDir DOM element, component or directive instance\n * for which to retrieve the root components.\n * @returns Root components associated with the target object.\n *\n * @publicApi\n * @globalApi ng\n */\nfunction getRootComponents(elementOrDir) {\n const lView = readPatchedLView(elementOrDir);\n return lView !== null ? [getRootContext(lView)] : [];\n}\n/**\n * Retrieves an `Injector` associated with an element, component or directive instance.\n *\n * @param elementOrDir DOM element, component or directive instance for which to\n * retrieve the injector.\n * @returns Injector associated with the element, component or directive instance.\n *\n * @publicApi\n * @globalApi ng\n */\nfunction getInjector(elementOrDir) {\n const context = getLContext(elementOrDir);\n const lView = context ? context.lView : null;\n if (lView === null) return Injector.NULL;\n const tNode = lView[TVIEW].data[context.nodeIndex];\n return new NodeInjector(tNode, lView);\n}\n/**\n * Retrieve a set of injection tokens at a given DOM node.\n *\n * @param element Element for which the injection tokens should be retrieved.\n */\nfunction getInjectionTokens(element) {\n const context = getLContext(element);\n const lView = context ? context.lView : null;\n if (lView === null) return [];\n const tView = lView[TVIEW];\n const tNode = tView.data[context.nodeIndex];\n const providerTokens = [];\n const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;\n const endIndex = tNode.directiveEnd;\n for (let i = startIndex; i < endIndex; i++) {\n let value = tView.data[i];\n if (isDirectiveDefHack(value)) {\n // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a\n // design flaw. We should always store same type so that we can be monomorphic. The issue\n // is that for Components/Directives we store the def instead the type. The correct behavior\n // is that we should always be storing injectable type in this location.\n value = value.type;\n }\n providerTokens.push(value);\n }\n return providerTokens;\n}\n/**\n * Retrieves directive instances associated with a given DOM node. Does not include\n * component instances.\n *\n * @usageNotes\n * Given the following DOM structure:\n *\n * ```html\n * \n * \n * \n * \n * ```\n *\n * Calling `getDirectives` on `