diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..4eca6c46f --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at help@standardnotes.org. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/app/assets/javascripts/app.ts b/app/assets/javascripts/app.ts index 32529da33..a49e22c40 100644 --- a/app/assets/javascripts/app.ts +++ b/app/assets/javascripts/app.ts @@ -18,7 +18,7 @@ import { TagsView, NotesView, FooterView, - ChallengeModal + ChallengeModal, } from '@/views'; import { @@ -30,7 +30,7 @@ import { infiniteScroll, lowercase, selectOnFocus, - snEnter + snEnter, } from './directives/functional'; import { @@ -48,27 +48,23 @@ import { PrivilegesManagementModal, RevisionPreviewModal, HistoryMenu, - SyncResolutionMenu + SyncResolutionMenu, } from './directives/views'; import { trusted } from './filters'; import { isDev } from './utils'; import { Bridge, BrowserBridge } from './services/bridge'; import { startErrorReporting } from './services/errorReporting'; +import { alertDialog } from './services/alertService'; if (__WEB__) { - startApplication( - (window as any)._default_sync_server, - new BrowserBridge() - ); + startApplication((window as any)._default_sync_server, new BrowserBridge()); } else { (window as any).startApplication = startApplication; } -async function startApplication( - defaultSyncServerHost: string, - bridge: Bridge -) { +async function startApplication(defaultSyncServerHost: string, bridge: Bridge) { + notifyBetaPeriodEnd(); SNLog.onLog = console.log; startErrorReporting(); @@ -92,7 +88,7 @@ async function startApplication( .directive('editorView', () => new EditorView()) .directive('tagsView', () => new TagsView()) .directive('notesView', () => new NotesView()) - .directive('footerView', () => new FooterView()) + .directive('footerView', () => new FooterView()); // Directives - Functional angular @@ -123,15 +119,16 @@ async function startApplication( .directive('passwordWizard', () => new PasswordWizard()) .directive('permissionsModal', () => new PermissionsModal()) .directive('privilegesAuthModal', () => new PrivilegesAuthModal()) - .directive('privilegesManagementModal', () => new PrivilegesManagementModal()) + .directive( + 'privilegesManagementModal', + () => new PrivilegesManagementModal() + ) .directive('revisionPreviewModal', () => new RevisionPreviewModal()) .directive('historyMenu', () => new HistoryMenu()) .directive('syncResolutionMenu', () => new SyncResolutionMenu()); // Filters - angular - .module('app') - .filter('trusted', ['$sce', trusted]); + angular.module('app').filter('trusted', ['$sce', trusted]); // Services angular.module('app').service('mainApplicationGroup', ApplicationGroup); @@ -141,8 +138,10 @@ async function startApplication( Object.defineProperties(window, { application: { get: () => - (angular.element(document).injector().get('mainApplicationGroup') as any) - .primaryApplication + (angular + .element(document) + .injector() + .get('mainApplicationGroup') as any).primaryApplication, }, }); } @@ -151,3 +150,16 @@ async function startApplication( angular.bootstrap(document, ['app']); }); } + +function notifyBetaPeriodEnd() { + if (window.location.hostname === 'app-beta.standardnotes.org') { + alertDialog({ + title: 'Beta period has ended', + text: + 'Thank you for trying this beta version. Please sign out, then ' + + 'sign in to ' + + 'app.standardnotes.org ' + + 'to continue using Standard Notes.', + }); + } +} diff --git a/app/assets/javascripts/directives/views/componentView.js b/app/assets/javascripts/directives/views/componentView.js deleted file mode 100644 index 78777535b..000000000 --- a/app/assets/javascripts/directives/views/componentView.js +++ /dev/null @@ -1,280 +0,0 @@ -import template from '%/directives/component-view.pug'; -import { isDesktopApplication } from '../../utils'; -/** - * The maximum amount of time we'll wait for a component - * to load before displaying error - */ -const MAX_LOAD_THRESHOLD = 4000; - -const VISIBILITY_CHANGE_LISTENER_KEY = 'visibilitychange'; - -class ComponentViewCtrl { - /* @ngInject */ - constructor( - $scope, - $rootScope, - $timeout, - componentManager, - desktopManager, - themeManager - ) { - this.$rootScope = $rootScope; - this.$timeout = $timeout; - this.themeManager = themeManager; - this.desktopManager = desktopManager; - this.componentManager = componentManager; - this.componentValid = true; - this.destroyed = false; - - $scope.$watch('ctrl.component', (component, prevComponent) => { - this.componentValueDidSet(component, prevComponent); - }); - $scope.$on('ext-reload-complete', () => { - this.reloadStatus(false); - }); - $scope.$on('$destroy', () => { - this.destroyed = true; - this.destroy(); - }); - } - - $onInit() { - this.registerComponentHandlers(); - this.registerPackageUpdateObserver(); - }; - - registerPackageUpdateObserver() { - this.updateObserver = this.desktopManager - .registerUpdateObserver((component) => { - if(component === this.component && component.active) { - this.reloadComponent(); - } - }); - } - - registerComponentHandlers() { - this.themeHandlerIdentifier = 'component-view-' + Math.random(); - this.componentManager.registerHandler({ - identifier: this.themeHandlerIdentifier, - areas: ['themes'], - activationHandler: (component) => { - this.reloadThemeStatus(); - } - }); - - this.identifier = 'component-view-' + Math.random(); - this.componentManager.registerHandler({ - identifier: this.identifier, - areas: [this.component.area], - activationHandler: (component) => { - if(component !== this.component) { - return; - } - this.$timeout(() => { - this.handleActivation(); - }); - }, - actionHandler: (component, action, data) => { - if(action === 'set-size') { - this.componentManager.handleSetSizeEvent(component, data); - } - } - }); - } - - onVisibilityChange() { - if(document.visibilityState === 'hidden') { - return; - } - if(this.issueLoading) { - this.reloadComponent(); - } - } - - async reloadComponent() { - this.componentValid = false; - await this.componentManager.reloadComponent(this.component); - if (this.destroyed) return; - this.reloadStatus(); - } - - reloadStatus(doManualReload = true) { - this.reloading = true; - const component = this.component; - const previouslyValid = this.componentValid; - const offlineRestricted = component.offlineOnly && !isDesktopApplication(); - const hasUrlError = function(){ - if(isDesktopApplication()) { - return !component.local_url && !component.hasValidHostedUrl(); - } else { - return !component.hasValidHostedUrl(); - } - }(); - this.expired = component.valid_until && component.valid_until <= new Date(); - if(!component.lockReadonly) { - component.readonly = this.expired; - } - this.componentValid = !offlineRestricted && !hasUrlError; - if(!this.componentValid) { - this.loading = false; - } - if(offlineRestricted) { - this.error = 'offline-restricted'; - } else if(hasUrlError) { - this.error = 'url-missing'; - } else { - this.error = null; - } - if(this.componentValid !== previouslyValid) { - if(this.componentValid) { - this.componentManager.reloadComponent(component, true); - } - } - if(this.expired && doManualReload) { - this.$rootScope.$broadcast('reload-ext-data'); - } - this.reloadThemeStatus(); - this.$timeout(() => { - this.reloading = false; - }, 500); - } - - handleActivation() { - if(!this.component.active) { - return; - } - const iframe = this.componentManager.iframeForComponent( - this.component - ); - if(!iframe) { - return; - } - this.loading = true; - if(this.loadTimeout) { - this.$timeout.cancel(this.loadTimeout); - } - this.loadTimeout = this.$timeout(() => { - this.handleIframeLoadTimeout(); - }, MAX_LOAD_THRESHOLD); - - iframe.onload = (event) => { - this.handleIframeLoad(iframe); - }; - } - - async handleIframeLoadTimeout() { - if(this.loading) { - this.loading = false; - this.issueLoading = true; - if(!this.didAttemptReload) { - this.didAttemptReload = true; - this.reloadComponent(); - } else { - document.addEventListener( - VISIBILITY_CHANGE_LISTENER_KEY, - this.onVisibilityChange.bind(this) - ); - } - } - } - - async handleIframeLoad(iframe) { - let desktopError = false; - if(isDesktopApplication()) { - try { - /** Accessing iframe.contentWindow.origin only allowed in desktop app. */ - if(!iframe.contentWindow.origin || iframe.contentWindow.origin === 'null') { - desktopError = true; - } - } catch (e) {} - } - this.$timeout.cancel(this.loadTimeout); - await this.componentManager.registerComponentWindow( - this.component, - iframe.contentWindow - ); - const avoidFlickerTimeout = 7; - this.$timeout(() => { - this.loading = false; - // eslint-disable-next-line no-unneeded-ternary - this.issueLoading = desktopError ? true : false; - this.onLoad && this.onLoad(this.component); - }, avoidFlickerTimeout); - } - - componentValueDidSet(component, prevComponent) { - const dontSync = true; - if(prevComponent && component !== prevComponent) { - this.componentManager.deactivateComponent( - prevComponent, - dontSync - ); - } - if(component) { - this.componentManager.activateComponent( - component, - dontSync - ); - this.reloadStatus(); - } - } - - reloadThemeStatus() { - if(this.component.acceptsThemes()) { - return; - } - if(this.themeManager.hasActiveTheme()) { - if(!this.dismissedNoThemesMessage) { - this.showNoThemesMessage = true; - } - } else { - this.showNoThemesMessage = false; - } - } - - dismissNoThemesMessage() { - this.showNoThemesMessage = false; - this.dismissedNoThemesMessage = true; - } - - disableActiveTheme() { - this.themeManager.deactivateAllThemes(); - this.dismissNoThemesMessage(); - } - - getUrl() { - const url = this.componentManager.urlForComponent(this.component); - this.component.runningLocally = (url === this.component.local_url); - return url; - } - - destroy() { - this.componentManager.deregisterHandler(this.themeHandlerIdentifier); - this.componentManager.deregisterHandler(this.identifier); - if(this.component && !this.manualDealloc) { - const dontSync = true; - this.componentManager.deactivateComponent(this.component, dontSync); - } - - this.desktopManager.deregisterUpdateObserver(this.updateObserver); - document.removeEventListener( - VISIBILITY_CHANGE_LISTENER_KEY, - this.onVisibilityChange.bind(this) - ); - } -} - -export class ComponentView { - constructor() { - this.restrict = 'E'; - this.template = template; - this.scope = { - component: '=', - onLoad: '=?', - manualDealloc: '=?' - }; - this.controller = ComponentViewCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - } -} diff --git a/app/assets/javascripts/views/application/application_view.ts b/app/assets/javascripts/views/application/application_view.ts index 28229819f..ebb346437 100644 --- a/app/assets/javascripts/views/application/application_view.ts +++ b/app/assets/javascripts/views/application/application_view.ts @@ -76,7 +76,7 @@ class ApplicationViewCtrl extends PureViewCtrl { async onAppLaunch() { super.onAppLaunch(); this.setState({ needsUnlock: false }); - this.handleAutoSignInFromParams(); + this.handleDemoSignInFromParams(); } onUpdateAvailable() { @@ -142,28 +142,19 @@ class ApplicationViewCtrl extends PureViewCtrl { } } - async handleAutoSignInFromParams() { - const params = this.$location!.search(); - const server = params.server; - const email = params.email; - const password = params.pw; - if (!server || !email || !password) return; - - const user = this.application!.getUser(); - if (user) { - if (user.email === email && await this.application!.getHost() === server) { - /** Already signed in, return */ - return; - } else { - /** Sign out */ - await this.application!.signOut(); - } + async handleDemoSignInFromParams() { + if ( + this.$location!.search().demo === 'true' && + !this.application.hasAccount() + ) { + await this.application!.setHost( + 'https://syncing-server-demo.standardnotes.org' + ); + this.application!.signIn( + 'demo@standardnotes.org', + 'password', + ); } - await this.application!.setHost(server); - this.application!.signIn( - email, - password, - ); } } diff --git a/app/assets/javascripts/views/footer/footer_view.ts b/app/assets/javascripts/views/footer/footer_view.ts index 1e17b156c..d8ed09884 100644 --- a/app/assets/javascripts/views/footer/footer_view.ts +++ b/app/assets/javascripts/views/footer/footer_view.ts @@ -1,6 +1,6 @@ import { RootScopeMessages } from './../../messages'; import { ApplicationGroup } from '@/ui_models/application_group'; -import { FooterStatus, WebDirective } from '@/types'; +import { WebDirective } from '@/types'; import { dateToLocalizedString, preventRefreshing } from '@/utils'; import { ApplicationEvent, @@ -10,10 +10,7 @@ import { SNComponent, SNTheme, ComponentArea, - ComponentAction, - topLevelCompare, CollectionSort, - ComponentMutator } from 'snjs'; import template from './footer-view.pug'; import { AppStateEvent, EventSource } from '@/ui_models/app_state'; diff --git a/config/application.rb b/config/application.rb index 984e28a0f..78affeb27 100644 --- a/config/application.rb +++ b/config/application.rb @@ -53,7 +53,7 @@ module Web media_src: %w('self'), object_src: %w('self'), plugin_types: %w(), - script_src: %w('self' 'unsafe-inline' 'wasm-eval' 'unsafe-eval'), + script_src: %w('self' 'unsafe-inline' 'unsafe-eval'), style_src: %w(* 'unsafe-inline'), upgrade_insecure_requests: false, # see https://www.w3.org/TR/upgrade-insecure-requests/ } diff --git a/dist/@types/app/assets/javascripts/services/autolock_service.d.ts b/dist/@types/app/assets/javascripts/services/autolock_service.d.ts index 43a26367d..db4b21d15 100644 --- a/dist/@types/app/assets/javascripts/services/autolock_service.d.ts +++ b/dist/@types/app/assets/javascripts/services/autolock_service.d.ts @@ -1,6 +1,6 @@ import { ApplicationService } from 'snjs'; export declare class AutolockService extends ApplicationService { - private unsubState; + private unsubState?; private pollFocusInterval; private lastFocusState?; private lockAfterDate?; diff --git a/dist/@types/app/assets/javascripts/services/errorReporting.d.ts b/dist/@types/app/assets/javascripts/services/errorReporting.d.ts new file mode 100644 index 000000000..1a475a492 --- /dev/null +++ b/dist/@types/app/assets/javascripts/services/errorReporting.d.ts @@ -0,0 +1 @@ +export declare function startErrorReporting(): void; diff --git a/dist/@types/app/assets/javascripts/services/localStorage.d.ts b/dist/@types/app/assets/javascripts/services/localStorage.d.ts new file mode 100644 index 000000000..6d37afec1 --- /dev/null +++ b/dist/@types/app/assets/javascripts/services/localStorage.d.ts @@ -0,0 +1,8 @@ +export declare enum StorageKey { + DisableErrorReporting = "DisableErrorReporting" +} +export declare const storage: { + get(key: StorageKey): any; + set(key: StorageKey, value: unknown): void; + remove(key: StorageKey): void; +}; diff --git a/dist/@types/app/assets/javascripts/services/preferencesManager.d.ts b/dist/@types/app/assets/javascripts/services/preferencesManager.d.ts index dbafa5338..ac3369374 100644 --- a/dist/@types/app/assets/javascripts/services/preferencesManager.d.ts +++ b/dist/@types/app/assets/javascripts/services/preferencesManager.d.ts @@ -1,11 +1,13 @@ import { WebApplication } from '@/ui_models/application'; -import { ApplicationService, WebPrefKey } from 'snjs'; +import { ApplicationService, WebPrefKey, ApplicationEvent } from 'snjs'; export declare class PreferencesManager extends ApplicationService { private userPreferences; private loadingPrefs; private unubscribeStreamItems?; + private needsSingletonReload; /** @override */ onAppLaunch(): Promise; + onAppEvent(event: ApplicationEvent): Promise; deinit(): void; get webApplication(): WebApplication; streamPreferences(): void; diff --git a/dist/@types/app/assets/javascripts/strings.d.ts b/dist/@types/app/assets/javascripts/strings.d.ts index aaca54a5b..625a2e4b1 100644 --- a/dist/@types/app/assets/javascripts/strings.d.ts +++ b/dist/@types/app/assets/javascripts/strings.d.ts @@ -14,6 +14,8 @@ export declare const STRING_INVALID_NOTE = "The note you are attempting to save export declare const STRING_ELLIPSES = "..."; export declare const STRING_GENERIC_SAVE_ERROR = "There was an error saving your note. Please try again."; export declare const STRING_DELETE_PLACEHOLDER_ATTEMPT = "This note is a placeholder and cannot be deleted. To remove from your list, simply navigate to a different note."; +export declare const STRING_ARCHIVE_LOCKED_ATTEMPT = "This note is locked. If you'd like to archive it, unlock it, and try again."; +export declare const STRING_UNARCHIVE_LOCKED_ATTEMPT = "This note is locked. If you'd like to archive it, unlock it, and try again."; export declare const STRING_DELETE_LOCKED_ATTEMPT = "This note is locked. If you'd like to delete it, unlock it, and try again."; export declare function StringDeleteNote(title: string, permanently: boolean): string; export declare function StringEmptyTrash(count: number): string; diff --git a/dist/@types/app/assets/javascripts/ui_models/app_state.d.ts b/dist/@types/app/assets/javascripts/ui_models/app_state.d.ts index dc66489fd..7db839ae8 100644 --- a/dist/@types/app/assets/javascripts/ui_models/app_state.d.ts +++ b/dist/@types/app/assets/javascripts/ui_models/app_state.d.ts @@ -1,5 +1,5 @@ /// -import { SNTag, SNNote, SNUserPrefs } from 'snjs'; +import { SNTag, SNNote, SNUserPrefs, DeinitSource, UuidString } from 'snjs'; import { WebApplication } from '@/ui_models/application'; import { Editor } from '@/ui_models/editor'; export declare enum AppStateEvent { @@ -18,6 +18,12 @@ export declare enum EventSource { Script = 2 } declare type ObserverCallback = (event: AppStateEvent, data?: any) => Promise; +declare class ActionsMenuState { + hiddenExtensions: Record; + constructor(); + toggleExtensionVisibility(uuid: UuidString): void; + deinit(): void; +} export declare class AppState { $rootScope: ng.IRootScopeService; $timeout: ng.ITimeoutService; @@ -31,8 +37,14 @@ export declare class AppState { selectedTag?: SNTag; userPreferences?: SNUserPrefs; multiEditorEnabled: boolean; + showBetaWarning: boolean; + actionsMenu: ActionsMenuState; constructor($rootScope: ng.IRootScopeService, $timeout: ng.ITimeoutService, application: WebApplication); - deinit(): void; + deinit(source: DeinitSource): void; + disableBetaWarning(): void; + enableBetaWarning(): void; + clearBetaWarning(): void; + private determineBetaWarningValue; /** * Creates a new editor if one doesn't exist. If one does, we'll replace the * editor's note with an empty one. diff --git a/dist/@types/app/assets/javascripts/web_device_interface.d.ts b/dist/@types/app/assets/javascripts/web_device_interface.d.ts index 4d2c9556e..2460a4b20 100644 --- a/dist/@types/app/assets/javascripts/web_device_interface.d.ts +++ b/dist/@types/app/assets/javascripts/web_device_interface.d.ts @@ -7,7 +7,7 @@ export declare class WebDeviceInterface extends DeviceInterface { setApplication(application: SNApplication): void; private databaseForIdentifier; deinit(): void; - getRawStorageValue(key: string): Promise; + getRawStorageValue(key: string): Promise; getAllRawStorageKeyValues(): Promise<{ key: string; value: any; diff --git a/dist/javascripts/app.js b/dist/javascripts/app.js deleted file mode 100644 index c59286a25..000000000 --- a/dist/javascripts/app.js +++ /dev/null @@ -1,30 +0,0 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=74)}([function(e,t,n){e.exports=n(46)},function(e,t){function n(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(i,a){var o=e.apply(t,r);function s(e){n(o,i,a,s,c,"next",e)}function c(e){n(o,i,a,s,c,"throw",e)}s(void 0)}))}}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n>>2]>>>24-a%4*8&255;t[r+a>>>2]|=o<<24-(r+a)%4*8}else for(a=0;a>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,r=[],i=function(t){t=t;var n=987654321,r=4294967295;return function(){var i=((n=36969*(65535&n)+(n>>16)&r)<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},a=0;a>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new o.init(n,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new o.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,u=e.min(4*c,i);if(c){for(var l=0;l>>2];e.sigBytes-=t}},v=(r.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:h}),reset:function(){l.reset.call(this);var e=this.cfg,t=e.iv,n=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=n.createEncryptor;else r=n.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==r?this._mode.init(this,t&&t.words):(this._mode=r.call(n,this,t&&t.words),this._mode.__creator=r)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4}),r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}})),m=(n.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;if(n)var r=a.create([1398893684,1701076831]).concat(n).concat(t);else r=t;return r.toString(c)},parse:function(e){var t=c.parse(e),n=t.words;if(1398893684==n[0]&&1701076831==n[1]){var r=a.create(n.slice(2,4));n.splice(0,4),t.sigBytes-=16}return v.create({ciphertext:t,salt:r})}},y=r.SerializableCipher=i.extend({cfg:i.extend({format:m}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r),a=i.finalize(t),o=i.cfg;return v.create({ciphertext:a,key:n,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),g=(n.kdf={}).OpenSSL={execute:function(e,t,n,r){r||(r=a.random(8));var i=u.create({keySize:t+n}).compute(e,r),o=a.create(i.words.slice(t),4*n);return i.sigBytes=4*t,v.create({key:i,iv:o,salt:r})}},b=r.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:g}),encrypt:function(e,t,n,r){var i=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize);r.iv=i.iv;var a=y.encrypt.call(this,e,t,i.key,r);return a.mixIn(i),a},decrypt:function(e,t,n,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var i=r.kdf.execute(n,e.keySize,e.ivSize,t.salt);return r.iv=i.iv,y.decrypt.call(this,e,t,i.key,r)}})}()},"object"===c(t)?e.exports=t=s(n(0),n(2)):(i=[n(0),n(2)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){var t,n,r,i,a,o,s;return r=(n=(t=e).lib).Base,i=n.WordArray,o=(a=t.algo).MD5,s=a.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:o,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,r=n.hasher.create(),a=i.create(),o=a.words,s=n.keySize,c=n.iterations;o.length>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s>>6*(3-s)&63));var c=r.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a>>6-o%4*2;i[a>>>2]|=(s|c)<<24-a%4*8,a++}return n.create(i,a)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.enc.Base64},"object"===c(t)?e.exports=t=s(n(0)):(i=[n(0)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return function(t){var n=e,r=n.lib,i=r.WordArray,a=r.Hasher,o=n.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=o.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,i=e[r];e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,o=e[t+0],c=e[t+1],d=e[t+2],h=e[t+3],v=e[t+4],m=e[t+5],y=e[t+6],g=e[t+7],b=e[t+8],k=e[t+9],w=e[t+10],x=e[t+11],S=e[t+12],$=e[t+13],_=e[t+14],M=e[t+15],C=a[0],A=a[1],O=a[2],I=a[3];C=u(C,A,O,I,o,7,s[0]),I=u(I,C,A,O,c,12,s[1]),O=u(O,I,C,A,d,17,s[2]),A=u(A,O,I,C,h,22,s[3]),C=u(C,A,O,I,v,7,s[4]),I=u(I,C,A,O,m,12,s[5]),O=u(O,I,C,A,y,17,s[6]),A=u(A,O,I,C,g,22,s[7]),C=u(C,A,O,I,b,7,s[8]),I=u(I,C,A,O,k,12,s[9]),O=u(O,I,C,A,w,17,s[10]),A=u(A,O,I,C,x,22,s[11]),C=u(C,A,O,I,S,7,s[12]),I=u(I,C,A,O,$,12,s[13]),O=u(O,I,C,A,_,17,s[14]),C=l(C,A=u(A,O,I,C,M,22,s[15]),O,I,c,5,s[16]),I=l(I,C,A,O,y,9,s[17]),O=l(O,I,C,A,x,14,s[18]),A=l(A,O,I,C,o,20,s[19]),C=l(C,A,O,I,m,5,s[20]),I=l(I,C,A,O,w,9,s[21]),O=l(O,I,C,A,M,14,s[22]),A=l(A,O,I,C,v,20,s[23]),C=l(C,A,O,I,k,5,s[24]),I=l(I,C,A,O,_,9,s[25]),O=l(O,I,C,A,h,14,s[26]),A=l(A,O,I,C,b,20,s[27]),C=l(C,A,O,I,$,5,s[28]),I=l(I,C,A,O,d,9,s[29]),O=l(O,I,C,A,g,14,s[30]),C=f(C,A=l(A,O,I,C,S,20,s[31]),O,I,m,4,s[32]),I=f(I,C,A,O,b,11,s[33]),O=f(O,I,C,A,x,16,s[34]),A=f(A,O,I,C,_,23,s[35]),C=f(C,A,O,I,c,4,s[36]),I=f(I,C,A,O,v,11,s[37]),O=f(O,I,C,A,g,16,s[38]),A=f(A,O,I,C,w,23,s[39]),C=f(C,A,O,I,$,4,s[40]),I=f(I,C,A,O,o,11,s[41]),O=f(O,I,C,A,h,16,s[42]),A=f(A,O,I,C,y,23,s[43]),C=f(C,A,O,I,k,4,s[44]),I=f(I,C,A,O,S,11,s[45]),O=f(O,I,C,A,M,16,s[46]),C=p(C,A=f(A,O,I,C,d,23,s[47]),O,I,o,6,s[48]),I=p(I,C,A,O,g,10,s[49]),O=p(O,I,C,A,_,15,s[50]),A=p(A,O,I,C,m,21,s[51]),C=p(C,A,O,I,S,6,s[52]),I=p(I,C,A,O,h,10,s[53]),O=p(O,I,C,A,w,15,s[54]),A=p(A,O,I,C,c,21,s[55]),C=p(C,A,O,I,b,6,s[56]),I=p(I,C,A,O,M,10,s[57]),O=p(O,I,C,A,y,15,s[58]),A=p(A,O,I,C,$,21,s[59]),C=p(C,A,O,I,v,6,s[60]),I=p(I,C,A,O,x,10,s[61]),O=p(O,I,C,A,d,15,s[62]),A=p(A,O,I,C,k,21,s[63]),a[0]=a[0]+C|0,a[1]=a[1]+A|0,a[2]=a[2]+O|0,a[3]=a[3]+I|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;n[i>>>5]|=128<<24-i%32;var a=t.floor(r/4294967296),o=r;n[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),n[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(n.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,r,i,a,o){var s=e+(t&n|~t&r)+i+o;return(s<>>32-a)+t}function l(e,t,n,r,i,a,o){var s=e+(t&r|n&~r)+i+o;return(s<>>32-a)+t}function f(e,t,n,r,i,a,o){var s=e+(t^n^r)+i+o;return(s<>>32-a)+t}function p(e,t,n,r,i,a,o){var s=e+(n^(t|~r))+i+o;return(s<>>32-a)+t}n.MD5=a._createHelper(c),n.HmacMD5=a._createHmacHelper(c)}(Math),e.MD5},"object"===c(t)?e.exports=t=s(n(0)):(i=[n(0)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){"use strict";(function(e){function r(){return"undefined"!=typeof window?window:void 0!==e?e:null}function i(){return!("undefined"!=typeof document&&document.documentMode||/Edge/.test(navigator.userAgent))&&r().crypto&&r().crypto.subtle}function a(){return r().crypto?r().crypto.subtle:null}function o(){var e=r(),t=e.crypto||e.msCrypto;if(t){var n=new Uint32Array(4);t.getRandomValues(n);var i=-1;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){i++;var t=n[i>>3]>>i%8*4&15;return("x"==e?t:3&t|8).toString(16)}))}var a=(new Date).getTime();return e.performance&&"function"==typeof e.performance.now&&(a+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=(a+16*Math.random())%16|0;return a=Math.floor(a/16),("x"==e?t:3&t|8).toString(16)}))}n.d(t,"b",(function(){return r})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return a})),n.d(t,"a",(function(){return o}))}).call(this,n(35))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){var t,n,r,i,a;return n=(t=e).lib,r=n.Base,i=n.WordArray,(a=t.x64={}).Word=r.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,n=[],r=0;r>>31}var f=(r<<5|r>>>27)+c+o[u];f+=u<20?1518500249+(i&a|~i&s):u<40?1859775393+(i^a^s):u<60?(i&a|i&s|a&s)-1894007588:(i^a^s)-899497514,c=s,s=a,a=i<<30|i>>>2,i=r,r=f}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=i._createHelper(s),t.HmacSHA1=i._createHmacHelper(s),e.SHA1},"object"===c(t)?e.exports=t=s(n(0)):(i=[n(0)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){var t,n,r;n=(t=e).lib.Base,r=t.enc.Utf8,t.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),s=a.words,c=o.words,u=0;u>>7)^(h<<14|h>>>18)^h>>>3,m=u[d-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[d]=v+u[d-7]+y+u[d-16]}var g=r&i^r&a^i&a,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),k=p+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&f)+c[d]+u[d];p=f,f=l,l=s,s=o+k|0,o=a,a=i,i=r,r=k+(b+g)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+s|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+p|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=t.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});n.SHA256=a._createHelper(l),n.HmacSHA256=a._createHmacHelper(l)}(Math),e.SHA256},"object"===c(t)?e.exports=t=s(n(0)):(i=[n(0)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return function(){var t=e,n=t.lib.Hasher,r=t.x64,i=r.Word,a=r.WordArray,o=t.algo;function s(){return i.create.apply(i,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var l=o.SHA512=n.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=n[5],f=n[6],p=n[7],d=r.high,h=r.low,v=i.high,m=i.low,y=a.high,g=a.low,b=o.high,k=o.low,w=s.high,x=s.low,S=l.high,$=l.low,_=f.high,M=f.low,C=p.high,A=p.low,O=d,I=h,E=v,D=m,R=y,P=g,T=b,j=k,F=w,N=x,L=S,U=$,B=_,H=M,z=C,V=A,W=0;W<80;W++){var K=u[W];if(W<16)var q=K.high=0|e[t+2*W],J=K.low=0|e[t+2*W+1];else{var G=u[W-15],Y=G.high,Z=G.low,X=(Y>>>1|Z<<31)^(Y>>>8|Z<<24)^Y>>>7,Q=(Z>>>1|Y<<31)^(Z>>>8|Y<<24)^(Z>>>7|Y<<25),ee=u[W-2],te=ee.high,ne=ee.low,re=(te>>>19|ne<<13)^(te<<3|ne>>>29)^te>>>6,ie=(ne>>>19|te<<13)^(ne<<3|te>>>29)^(ne>>>6|te<<26),ae=u[W-7],oe=ae.high,se=ae.low,ce=u[W-16],ue=ce.high,le=ce.low;q=(q=(q=X+oe+((J=Q+se)>>>0>>0?1:0))+re+((J+=ie)>>>0>>0?1:0))+ue+((J+=le)>>>0>>0?1:0),K.high=q,K.low=J}var fe,pe=F&L^~F&B,de=N&U^~N&H,he=O&E^O&R^E&R,ve=I&D^I&P^D&P,me=(O>>>28|I<<4)^(O<<30|I>>>2)^(O<<25|I>>>7),ye=(I>>>28|O<<4)^(I<<30|O>>>2)^(I<<25|O>>>7),ge=(F>>>14|N<<18)^(F>>>18|N<<14)^(F<<23|N>>>9),be=(N>>>14|F<<18)^(N>>>18|F<<14)^(N<<23|F>>>9),ke=c[W],we=ke.high,xe=ke.low,Se=z+ge+((fe=V+be)>>>0>>0?1:0),$e=ye+ve;z=B,V=H,B=L,H=U,L=F,U=N,F=T+(Se=(Se=(Se=Se+pe+((fe+=de)>>>0>>0?1:0))+we+((fe+=xe)>>>0>>0?1:0))+q+((fe+=J)>>>0>>0?1:0))+((N=j+fe|0)>>>0>>0?1:0)|0,T=R,j=P,R=E,P=D,E=O,D=I,O=Se+(me+he+($e>>>0>>0?1:0))+((I=fe+$e|0)>>>0>>0?1:0)|0}h=r.low=h+I,r.high=d+O+(h>>>0>>0?1:0),m=i.low=m+D,i.high=v+E+(m>>>0>>0?1:0),g=a.low=g+P,a.high=y+R+(g>>>0

>>0?1:0),k=o.low=k+j,o.high=b+T+(k>>>0>>0?1:0),x=s.low=x+N,s.high=w+F+(x>>>0>>0?1:0),$=l.low=$+U,l.high=S+L+($>>>0>>0?1:0),M=f.low=M+H,f.high=_+B+(M>>>0>>0?1:0),A=p.low=A+V,p.high=C+z+(A>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(r+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=n._createHelper(l),t.HmacSHA512=n._createHmacHelper(l)}(),e.SHA512},"object"===c(t)?e.exports=t=s(n(0),n(6)):(i=[n(0),n(6)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return e},"object"===c(t)?e.exports=t=s(n(0),n(6),n(12),n(13),n(3),n(4),n(7),n(9),n(14),n(10),n(15),n(16),n(17),n(8),n(18),n(2),n(1),n(19),n(20),n(21),n(22),n(23),n(24),n(25),n(26),n(27),n(28),n(29),n(30),n(31),n(32),n(33),n(34)):(i=[n(0),n(6),n(12),n(13),n(3),n(4),n(7),n(9),n(14),n(10),n(15),n(16),n(17),n(8),n(18),n(2),n(1),n(19),n(20),n(21),n(22),n(23),n(24),n(25),n(26),n(27),n(28),n(29),n(30),n(31),n(32),n(33),n(34)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,n=t.init;(t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,r=[],i=0;i>>2]|=e[i]<<24-i%4*8;n.call(this,r,t)}else n.apply(this,arguments)}).prototype=t}}(),e.lib.WordArray},"object"===c(t)?e.exports=t=s(n(0)):(i=[n(0)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return function(){var t=e,n=t.lib.WordArray,r=t.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i>>2]>>>16-i%4*8&65535;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>1]|=e.charCodeAt(i)<<16-i%2*16;return n.create(r,2*t)}},r.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],a=0;a>>2]>>>16-a%4*8&65535);r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,r=[],a=0;a>>1]|=i(e.charCodeAt(a)<<16-a%2*16);return n.create(r,2*t)}}}(),e.enc.Utf16},"object"===c(t)?e.exports=t=s(n(0)):(i=[n(0)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){var t,n,r,i,a;return n=(t=e).lib.WordArray,r=t.algo,i=r.SHA256,a=r.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=i._createHelper(a),t.HmacSHA224=i._createHmacHelper(a),e.SHA224},"object"===c(t)?e.exports=t=s(n(0),n(9)):(i=[n(0),n(9)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){var t,n,r,i,a,o,s;return n=(t=e).x64,r=n.Word,i=n.WordArray,a=t.algo,o=a.SHA512,s=a.SHA384=o.extend({_doReset:function(){this._hash=new i.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=o._createHelper(s),t.HmacSHA384=o._createHmacHelper(s),e.SHA384},"object"===c(t)?e.exports=t=s(n(0),n(6),n(10)):(i=[n(0),n(6),n(10)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return function(t){var n=e,r=n.lib,i=r.WordArray,a=r.Hasher,o=n.x64.Word,s=n.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,n=0;n<24;n++){c[e+5*t]=(n+1)*(n+2)/2%64;var r=(2*e+3*t)%5;e=t%5,t=r}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,a=0;a<24;a++){for(var s=0,f=0,p=0;p<7;p++){if(1&i){var d=(1<>>24)|4278255360&(a<<24|a>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(A=n[i]).high^=o,A.low^=a}for(var s=0;s<24;s++){for(var p=0;p<5;p++){for(var d=0,h=0,v=0;v<5;v++)d^=(A=n[p+5*v]).high,h^=A.low;var m=f[p];m.high=d,m.low=h}for(p=0;p<5;p++){var y=f[(p+4)%5],g=f[(p+1)%5],b=g.high,k=g.low;for(d=y.high^(b<<1|k>>>31),h=y.low^(k<<1|b>>>31),v=0;v<5;v++)(A=n[p+5*v]).high^=d,A.low^=h}for(var w=1;w<25;w++){var x=(A=n[w]).high,S=A.low,$=c[w];$<32?(d=x<<$|S>>>32-$,h=S<<$|x>>>32-$):(d=S<<$-32|x>>>64-$,h=x<<$-32|S>>>64-$);var _=f[u[w]];_.high=d,_.low=h}var M=f[0],C=n[0];for(M.high=C.high,M.low=C.low,p=0;p<5;p++)for(v=0;v<5;v++){var A=n[w=p+5*v],O=f[w],I=f[(p+1)%5+5*v],E=f[(p+2)%5+5*v];A.high=O.high^~I.high&E.high,A.low=O.low^~I.low&E.low}A=n[0];var D=l[s];A.high^=D.high,A.low^=D.low}},_doFinalize:function(){var e=this._data,n=e.words,r=(this._nDataBytes,8*e.sigBytes),a=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(t.ceil((r+1)/a)*a>>>5)-1]|=128,e.sigBytes=4*n.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,c=s/8,u=[],l=0;l>>24)|4278255360&(p<<24|p>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),u.push(d),u.push(p)}return new i.init(u,s)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),n=0;n<25;n++)t[n]=t[n].clone();return e}});n.SHA3=a._createHelper(p),n.HmacSHA3=a._createHmacHelper(p)}(Math),e.SHA3},"object"===c(t)?e.exports=t=s(n(0),n(6)):(i=[n(0),n(6)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){ -/** @preserve - (c) 2012 by Cédric Mesnil. All rights reserved. - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -return function(t){var n=e,r=n.lib,i=r.WordArray,a=r.Hasher,o=n.algo,s=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),c=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),u=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),f=i.create([0,1518500249,1859775393,2400959708,2840853838]),p=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=a.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,i=e[r];e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a,o,d,k,w,x,S,$,_,M,C,A=this._hash.words,O=f.words,I=p.words,E=s.words,D=c.words,R=u.words,P=l.words;for(x=a=A[0],S=o=A[1],$=d=A[2],_=k=A[3],M=w=A[4],n=0;n<80;n+=1)C=a+e[t+E[n]]|0,C+=n<16?h(o,d,k)+O[0]:n<32?v(o,d,k)+O[1]:n<48?m(o,d,k)+O[2]:n<64?y(o,d,k)+O[3]:g(o,d,k)+O[4],C=(C=b(C|=0,R[n]))+w|0,a=w,w=k,k=b(d,10),d=o,o=C,C=x+e[t+D[n]]|0,C+=n<16?g(S,$,_)+I[0]:n<32?y(S,$,_)+I[1]:n<48?m(S,$,_)+I[2]:n<64?v(S,$,_)+I[3]:h(S,$,_)+I[4],C=(C=b(C|=0,P[n]))+M|0,x=M,M=_,_=b($,10),$=S,S=C;C=A[1]+d+_|0,A[1]=A[2]+k+M|0,A[2]=A[3]+w+x|0,A[3]=A[4]+a+S|0,A[4]=A[0]+o+$|0,A[0]=C},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,a=i.words,o=0;o<5;o++){var s=a[o];a[o]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return i},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function h(e,t,n){return e^t^n}function v(e,t,n){return e&t|~e&n}function m(e,t,n){return(e|~t)^n}function y(e,t,n){return e&n|t&~n}function g(e,t,n){return e^(t|~n)}function b(e,t){return e<>>32-t}n.RIPEMD160=a._createHelper(d),n.HmacRIPEMD160=a._createHmacHelper(d)}(Math),e.RIPEMD160},"object"===c(t)?e.exports=t=s(n(0)):(i=[n(0)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){var t,n,r,i,a,o,s,c;return r=(n=(t=e).lib).Base,i=n.WordArray,o=(a=t.algo).SHA1,s=a.HMAC,c=a.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:o,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,r=s.create(n.hasher,e),a=i.create(),o=i.create([1]),c=a.words,u=o.words,l=n.keySize,f=n.iterations;c.length>24&255)){var t=e>>16&255,n=e>>8&255,r=255&e;255===t?(t=0,255===n?(n=0,255===r?r=0:++r):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=r}else e+=1<<24;return e}var r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),function(e){0===(e[0]=n(e[0]))&&(e[1]=n(e[1]))}(o);var s=o.slice(0);r.encryptBlock(s,0);for(var c=0;c>>2]|=i<<24-a%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923},"object"===c(t)?e.exports=t=s(n(0),n(1)):(i=[n(0),n(1)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return e.pad.Iso10126={pad:function(t,n){var r=4*n,i=r-t.sigBytes%r;t.concat(e.lib.WordArray.random(i-1)).concat(e.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126},"object"===c(t)?e.exports=t=s(n(0),n(1)):(i=[n(0),n(1)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return e.pad.Iso97971={pad:function(t,n){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,n)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971},"object"===c(t)?e.exports=t=s(n(0),n(1)):(i=[n(0),n(1)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return e.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){for(var t=e.words,n=e.sigBytes-1;!(t[n>>>2]>>>24-n%4*8&255);)n--;e.sigBytes=n+1}},e.pad.ZeroPadding},"object"===c(t)?e.exports=t=s(n(0),n(1)):(i=[n(0),n(1)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding},"object"===c(t)?e.exports=t=s(n(0),n(1)):(i=[n(0),n(1)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){var t,n,r;return n=(t=e).lib.CipherParams,r=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var t=r.parse(e);return n.create({ciphertext:t})}},e.format.Hex},"object"===c(t)?e.exports=t=s(n(0),n(1)):(i=[n(0),n(1)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return function(){var t=e,n=t.lib.BlockCipher,r=t.algo,i=[],a=[],o=[],s=[],c=[],u=[],l=[],f=[],p=[],d=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var h=r^r<<1^r<<2^r<<3^r<<4;h=h>>>8^255&h^99,i[n]=h,a[h]=n;var v=e[n],m=e[v],y=e[m],g=257*e[h]^16843008*h;o[n]=g<<24|g>>>8,s[n]=g<<16|g>>>16,c[n]=g<<8|g>>>24,u[n]=g,g=16843009*y^65537*m^257*v^16843008*n,l[h]=g<<24|g>>>8,f[h]=g<<16|g>>>16,p[h]=g<<8|g>>>24,d[h]=g,n?(n=v^e[e[e[y^v]]],r^=e[e[r]]):n=r=1}}();var h=[0,1,2,4,8,16,32,64,128,27,54],v=r.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),a=this._keySchedule=[],o=0;o6&&o%n==4&&(s=i[s>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s]):(s=i[(s=s<<8|s>>>24)>>>24]<<24|i[s>>>16&255]<<16|i[s>>>8&255]<<8|i[255&s],s^=h[o/n|0]<<24),a[o]=a[o-n]^s}for(var c=this._invKeySchedule=[],u=0;u>>24]]^f[i[s>>>16&255]]^p[i[s>>>8&255]]^d[i[255&s]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,c,u,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,f,p,d,a),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,o,s){for(var c=this._nRounds,u=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],p=e[t+3]^n[3],d=4,h=1;h>>24]^i[l>>>16&255]^a[f>>>8&255]^o[255&p]^n[d++],m=r[l>>>24]^i[f>>>16&255]^a[p>>>8&255]^o[255&u]^n[d++],y=r[f>>>24]^i[p>>>16&255]^a[u>>>8&255]^o[255&l]^n[d++],g=r[p>>>24]^i[u>>>16&255]^a[l>>>8&255]^o[255&f]^n[d++];u=v,l=m,f=y,p=g}v=(s[u>>>24]<<24|s[l>>>16&255]<<16|s[f>>>8&255]<<8|s[255&p])^n[d++],m=(s[l>>>24]<<24|s[f>>>16&255]<<16|s[p>>>8&255]<<8|s[255&u])^n[d++],y=(s[f>>>24]<<24|s[p>>>16&255]<<16|s[u>>>8&255]<<8|s[255&l])^n[d++],g=(s[p>>>24]<<24|s[u>>>16&255]<<16|s[l>>>8&255]<<8|s[255&f])^n[d++],e[t]=v,e[t+1]=m,e[t+2]=y,e[t+3]=g},keySize:8});t.AES=n._createHelper(v)}(),e.AES},"object"===c(t)?e.exports=t=s(n(0),n(3),n(4),n(2),n(1)):(i=[n(0),n(3),n(4),n(2),n(1)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return function(){var t=e,n=t.lib,r=n.WordArray,i=n.BlockCipher,a=t.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],f=a.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;n<56;n++){var r=o[n]-1;t[n]=e[r>>>5]>>>31-r%32&1}for(var i=this._subKeys=[],a=0;a<16;a++){var u=i[a]=[],l=c[a];for(n=0;n<24;n++)u[n/6|0]|=t[(s[n]-1+l)%28]<<31-n%6,u[4+(n/6|0)]|=t[28+(s[n+24]-1+l)%28]<<31-n%6;for(u[0]=u[0]<<1|u[0]>>>31,n=1;n<7;n++)u[n]=u[n]>>>4*(n-1)+3;u[7]=u[7]<<5|u[7]>>>27}var f=this._invSubKeys=[];for(n=0;n<16;n++)f[n]=i[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,n){this._lBlock=e[t],this._rBlock=e[t+1],p.call(this,4,252645135),p.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),p.call(this,1,1431655765);for(var r=0;r<16;r++){for(var i=n[r],a=this._lBlock,o=this._rBlock,s=0,c=0;c<8;c++)s|=u[c][((o^i[c])&l[c])>>>0];this._lBlock=o,this._rBlock=a^s}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,p.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<>>2]>>>24-o%4*8&255;a=(a+r[i]+s)%256;var c=r[i];r[i]=r[a],r[a]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=a.call(this)},keySize:8,ivSize:0});function a(){for(var e=this._S,t=this._i,n=this._j,r=0,i=0;i<4;i++){n=(n+e[t=(t+1)%256])%256;var a=e[t];e[t]=e[n],e[n]=a,r|=e[(e[t]+e[n])%256]<<24-8*i}return this._i=t,this._j=n,r}t.RC4=n._createHelper(i);var o=r.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)a.call(this)}});t.RC4Drop=n._createHelper(o)}(),e.RC4},"object"===c(t)?e.exports=t=s(n(0),n(3),n(4),n(2),n(1)):(i=[n(0),n(3),n(4),n(2),n(1)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=[],a=[],o=[],s=r.Rabbit=n.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var a=t.words,o=a[0],s=a[1],u=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=u>>>16|4294901760&l,p=l<<16|65535&u;for(i[0]^=u,i[1]^=f,i[2]^=l,i[3]^=p,i[4]^=u,i[5]^=f,i[6]^=l,i[7]^=p,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)i[r]=16711935&(i[r]<<8|i[r]>>>24)|4278255360&(i[r]<<24|i[r]>>>8),e[t+r]^=i[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)a[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],i=65535&r,s=r>>>16,c=((i*i>>>17)+i*s>>>15)+s*s,u=((4294901760&r)*r|0)+((65535&r)*r|0);o[n]=c^u}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.Rabbit=n._createHelper(s)}(),e.Rabbit},"object"===c(t)?e.exports=t=s(n(0),n(3),n(4),n(2),n(1)):(i=[n(0),n(3),n(4),n(2),n(1)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t,n){var r,i,a,s;function c(e){return(c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}s=function(e){return function(){var t=e,n=t.lib.StreamCipher,r=t.algo,i=[],a=[],o=[],s=r.RabbitLegacy=n.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)c.call(this);for(i=0;i<8;i++)r[i]^=n[i+4&7];if(t){var a=t.words,o=a[0],s=a[1],u=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=u>>>16|4294901760&l,p=l<<16|65535&u;for(r[0]^=u,r[1]^=f,r[2]^=l,r[3]^=p,r[4]^=u,r[5]^=f,r[6]^=l,r[7]^=p,i=0;i<4;i++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)i[r]=16711935&(i[r]<<8|i[r]>>>24)|4278255360&(i[r]<<24|i[r]>>>8),e[t+r]^=i[r]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)a[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,n=0;n<8;n++){var r=e[n]+t[n],i=65535&r,s=r>>>16,c=((i*i>>>17)+i*s>>>15)+s*s,u=((4294901760&r)*r|0)+((65535&r)*r|0);o[n]=c^u}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}t.RabbitLegacy=n._createHelper(s)}(),e.RabbitLegacy},"object"===c(t)?e.exports=t=s(n(0),n(3),n(4),n(2),n(1)):(i=[n(0),n(3),n(4),n(2),n(1)],void 0===(a="function"==typeof(r=s)?r.apply(t,i):r)||(e.exports=a))},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":n(window))&&(r=window)}e.exports=r},function(e,t,n){"use strict";n.r(t);var r=n(5),i=n(11),a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.DefaultPBKDF2Length=768}var t;return(t=[{key:"timingSafeEqual",value:function(e,t){var n=String(e),r=String(t),i=n.length,a=0;i!==r.length&&(r=n,a=1);for(var o=0;o0&&void 0!==l[0]?l[0]:{},t=e.password,n=e.pw_salt,r=e.pw_cost,f.next=3,regeneratorRuntime.awrap(this.pbkdf2(t,n,r,this.DefaultPBKDF2Length));case 3:return i=f.sent,a=i.length,o=a/3,s=i.slice(0,o),c=i.slice(o,2*o),u=i.slice(2*o,3*o),f.abrupt("return",[s,c,u]);case 10:case"end":return f.stop()}}),null,this)}}])&&function(e,t){for(var n=0;n-1&&e%1==0&&e1),t})),s(e,l(e),n),u&&(n=i(n,7,c));for(var f=t.length;f--;)a(n,t[f]);return n}));e.exports=f},function(e,t,n){var r=n(11)(n(7),"Map");e.exports=r},function(e,t,n){var r=n(12),i=n(5);e.exports=function(e){if(!i(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,n){var r=n(114),i=n(121),a=n(123),o=n(124),s=n(125);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e<=9007199254740991}},function(e,t,n){(function(e){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(57),a="object"==r(t)&&t&&!t.nodeType&&t,o=a&&"object"==r(e)&&e&&!e.nodeType&&e,s=o&&o.exports===a&&i.process,c=function(){try{return o&&o.require&&o.require("util").types||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=c}).call(this,n(22)(e))},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(3),a=n(34),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=function(e,t){if(i(e))return!1;var n=r(e);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!a(e))||s.test(e)||!o.test(e)||null!=t&&e in Object(t)}},function(e,t){e.exports=function(e){return e}},function(e,t,n){var r=n(78);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t,n){var r=n(63);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},function(e,t){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n-1:!!l&&r(e,t,n)>-1}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":n(window))&&(r=window)}e.exports=r},function(e,t,n){(function(t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r="object"==(void 0===t?"undefined":n(t))&&t&&t.Object===Object&&t;e.exports=r}).call(this,n(56))},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,n){var r=n(126),i=n(8);e.exports=function e(t,n,a,o,s){return t===n||(null==t||null==n||!i(t)&&!i(n)?t!=t&&n!=n:r(t,n,a,o,e,s))}},function(e,t,n){var r=n(61),i=n(129),a=n(62);e.exports=function(e,t,n,o,s,c){var u=1&n,l=e.length,f=t.length;if(l!=f&&!(u&&f>l))return!1;var p=c.get(e);if(p&&c.get(t))return p==t;var d=-1,h=!0,v=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++d1?n[a-1]:void 0,s=a>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,s&&i(n[0],n[1],s)&&(o=a<3?void 0:o,a=1),t=Object(t);++r-1?s[c?t[u]:u]:void 0}}},function(e,t,n){var r=n(97),i=n(143),a=n(71);e.exports=function(e){var t=i(e);return 1==t.length&&t[0][2]?a(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},function(e,t,n){var r=n(24),i=n(59);e.exports=function(e,t,n,a){var o=n.length,s=o,c=!a;if(null==e)return!s;for(e=Object(e);o--;){var u=n[o];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o-1}},function(e,t,n){var r=n(26);e.exports=function(e,t){var n=this.__data__,i=r(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}},function(e,t,n){var r=n(25);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(25),i=n(37),a=n(39);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var o=n.__data__;if(!i||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new a(o)}return n.set(e,t),this.size=n.size,this}},function(e,t,n){var r=n(38),i=n(111),a=n(5),o=n(58),s=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,f=u.hasOwnProperty,p=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!a(e)||i(e))&&(r(e)?p:s).test(o(e))}},function(e,t,n){var r=n(14),i=Object.prototype,a=i.hasOwnProperty,o=i.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var i=o.call(e);return r&&(t?e[s]=n:delete e[s]),i}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t,n){var r,i=n(112),a=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!a&&a in e}},function(e,t,n){var r=n(7)["__core-js_shared__"];e.exports=r},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,n){var r=n(115),i=n(25),a=n(37);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(a||i),string:new r}}},function(e,t,n){var r=n(116),i=n(117),a=n(118),o=n(119),s=n(120);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ti?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(18),a=n(10),o=n(19),s=n(5);e.exports=function(e,t,n){if(!s(n))return!1;var c=r(t);return!!("number"==c?a(n)&&o(t,n.length):"string"==c&&t in n)&&i(n[t],e)}},function(e,t,n){var r=n(24),i=n(176),a=n(53),o=n(177),s=n(178),c=n(80),u=n(51),l=n(179),f=n(180),p=n(64),d=n(90),h=n(32),v=n(181),m=n(182),y=n(82),g=n(3),b=n(30),k=n(186),w=n(5),x=n(188),S=n(13),$="[object Arguments]",_="[object Function]",M="[object Object]",C={};C[$]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object DataView]"]=C["[object Boolean]"]=C["[object Date]"]=C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Map]"]=C["[object Number]"]=C[M]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object Symbol]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C["[object Error]"]=C[_]=C["[object WeakMap]"]=!1,e.exports=function e(t,n,A,O,I,E){var D,R=1&n,P=2&n,T=4&n;if(A&&(D=I?A(t,O,I,E):A(t)),void 0!==D)return D;if(!w(t))return t;var j=g(t);if(j){if(D=v(t),!R)return u(t,D)}else{var F=h(t),N=F==_||"[object GeneratorFunction]"==F;if(b(t))return c(t,R);if(F==M||F==$||N&&!I){if(D=P||N?{}:y(t),!R)return P?f(t,s(D,t)):l(t,o(D,t))}else{if(!C[F])return I?t:{};D=m(t,F,R)}}E||(E=new r);var L=E.get(t);if(L)return L;E.set(t,D),x(t)?t.forEach((function(r){D.add(e(r,n,A,r,t,E))})):k(t)&&t.forEach((function(r,i){D.set(i,e(r,n,A,i,t,E))}));var U=T?P?d:p:P?keysIn:S,B=j?void 0:U(t);return i(B||t,(function(r,i){B&&(r=t[i=r]),a(D,i,e(r,n,A,i,t,E))})),D}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n0&&a(l)?n>1?e(l,n-1,a,o,s):r(s,l):o||(s[s.length]=l)}return s}},function(e,t,n){var r=n(14),i=n(29),a=n(3),o=r?r.isConcatSpreadable:void 0;e.exports=function(e){return a(e)||i(e)||!!(o&&e&&e[o])}},function(e,t,n){var r=n(195),i=n(72);e.exports=function(e,t){return r(e,t,(function(t,n){return i(e,n)}))}},function(e,t,n){var r=n(33),i=n(196),a=n(15);e.exports=function(e,t,n){for(var o=-1,s=t.length,c={};++o-1;)d!==e&&c.call(d,h,1),c.call(e,h,1);return e}},function(e,t){e.exports=function(e){return e!=e}},function(e,t){e.exports=function(e,t,n){for(var r=n-1,i=e.length;++r=200){var v=t?null:s(e);if(v)return c(v);p=!1,l=o,h=new r}else h=t?[]:d;e:for(;++u-1}},function(e,t){e.exports=function(e,t,n){for(var r=-1,i=null==e?0:e.length;++r0&&void 0!==l[0]?l[0]:{},t=e.ciphertextToAuth,n=e.contentCiphertext,r=e.encryptionKey,i=e.iv,a=e.authHash,o=e.authKey,!(l.length>1?l[1]:void 0)||a){f.next=5;break}return console.error("Auth hash is required."),f.abrupt("return");case 5:if(!a){f.next=12;break}return f.next=8,regeneratorRuntime.awrap(this.crypto.hmac256(t,o));case 8:if(s=f.sent,!1!==this.crypto.timingSafeEqual(a,s)){f.next=12;break}return console.error("Auth hash does not match, returning null."),f.abrupt("return",null);case 12:return f.next=14,regeneratorRuntime.awrap(this.crypto.hexStringToArrayBuffer(r));case 14:return c=f.sent,f.next=17,regeneratorRuntime.awrap(this.crypto.hexStringToArrayBuffer(i||""));case 17:return u=f.sent,f.abrupt("return",this.crypto.aes256CbcDecrypt(n,c,u));case 19:case"end":return f.stop()}}),null,this)}},{key:"encryptText",value:function(e,t,n){var r,i;return regeneratorRuntime.async((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,regeneratorRuntime.awrap(this.crypto.hexStringToArrayBuffer(t));case 2:return r=a.sent,a.next=5,regeneratorRuntime.awrap(this.crypto.hexStringToArrayBuffer(n||""));case 5:return i=a.sent,a.abrupt("return",this.crypto.aes256CbcEncrypt(e,r,i));case 7:case"end":return a.stop()}}),null,this)}}])&&i(t.prototype,n),e}();function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n5e3)||this.crypto instanceof r.SNWebCrypto||this.crypto instanceof r.SNReactNativeCrypto}},{key:"supportedVersions",value:function(){return["001","002","003"]}},{key:"isVersionNewerThanLibraryVersion",value:function(e){var t=this.version();return parseInt(e)>parseInt(t)}},{key:"isProtocolVersionOutdated",value:function(e){var t={"001":Date.parse("2018-01-01"),"002":Date.parse("2020-01-01")}[e];return!!t&&new Date>t}},{key:"costMinimumForVersion",value:function(e){return{"001":f.pwCost(),"002":y.pwCost(),"003":S.pwCost()}[e]}},{key:"defaultPasswordGenerationCost",value:function(){return this.costMinimumForVersion(this.version())}},{key:"versionForItem",value:function(e){return e.content.substring(0,3)}},{key:"createOperatorForLatestVersion",value:function(){return this.createOperatorForVersion(this.version())}},{key:"createOperatorForVersion",value:function(e){if("001"===e)return new f(this.crypto);if("002"===e)return new y(this.crypto);if("003"===e)return new S(this.crypto);if("000"===e)return this.createOperatorForLatestVersion();throw"Unable to find operator for version ".concat(e)}},{key:"operatorForVersion",value:function(e){var t=e,n=this.operators[t];return n||(n=this.createOperatorForVersion(e),this.operators[t]=n),n}},{key:"defaultOperator",value:function(){return this.operatorForVersion(this.version())}},{key:"computeEncryptionKeysForUser",value:function(e,t){var n,r;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:return n=t.version,r=this.operatorForVersion(n),i.abrupt("return",r.computeEncryptionKeysForUser(e,t));case 3:case"end":return i.stop()}}),null,this)}},{key:"generateInitialKeysAndAuthParamsForUser",value:function(e,t){var n;return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:return n=this.defaultOperator(),r.abrupt("return",n.generateInitialKeysAndAuthParamsForUser(e,t));case 2:case"end":return r.stop()}}),null,this)}},{key:"decryptItem",value:function(e,t){var n,r;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:return n=this.versionForItem(e),r=this.operatorForVersion(n),i.abrupt("return",r.decryptItem(e,t));case 3:case"end":return i.stop()}}),null,this)}},{key:"encryptItem",value:function(e,t,n){var r,i;return regeneratorRuntime.async((function(a){for(;;)switch(a.prev=a.next){case 0:return r=n.version,i=this.operatorForVersion(r),a.abrupt("return",i.encryptItem(e,t,n));case 3:case"end":return a.stop()}}),null,this)}},{key:"decryptMultipleItems",value:function(e,t,n){var r,i=this;return regeneratorRuntime.async((function(a){for(;;)switch(a.prev=a.next){case 0:return r=function(e){return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:if(e){r.next=2;break}return r.abrupt("return");case 2:if(!0!==e.deleted||null!==e.content){r.next=4;break}return r.abrupt("return");case 4:if(!("string"==typeof e.content||e.content instanceof String)){r.next=19;break}return r.prev=6,r.next=9,regeneratorRuntime.awrap(i.decryptItem(e,t));case 9:r.next=19;break;case 11:if(r.prev=11,r.t0=r.catch(6),e.errorDecrypting||(e.errorDecryptingValueChanged=!0),e.errorDecrypting=!0,!n){r.next=17;break}throw r.t0;case 17:return console.error("Error decrypting item",e,r.t0),r.abrupt("return");case 19:case"end":return r.stop()}}),null,null,[[6,11]])},a.abrupt("return",Promise.all(e.map((function(e){return r(e)}))));case 2:case"end":return a.stop()}}))}}])&&_(t.prototype,n),e}(),C=new M,A=n(2),O=n.n(A),I=n(0),E=n.n(I),D=n(3),R=n.n(D),P=n(92),T=n.n(P);function j(e,t){for(var n=0;n"==n.operator?v>h:"<="==n.operator?v<=h:">="==n.operator?v>=h:"startsWith"==n.operator?v.startsWith(h):"in"==n.operator?-1!=h.indexOf(v):"includes"==n.operator?this.resolveIncludesPredicate(v,h):"matches"==n.operator&&new RegExp(h).test(v)}},{key:"resolveIncludesPredicate",value:function(t,n){if("string"==typeof n)return t.includes(n);var r;r=Array.isArray(n)?e.fromArray(n):n;var i=!0,a=!1,o=void 0;try{for(var s,c=t[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;if(this.ObjectSatisfiesPredicate(u,r))return!0}}catch(e){a=!0,o=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw o}}return!1}},{key:"ItemSatisfiesPredicate",value:function(t,n){return Array.isArray(n)&&(n=e.fromArray(n)),this.ObjectSatisfiesPredicate(t,n)}},{key:"ItemSatisfiesPredicates",value:function(e,t){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(!this.ItemSatisfiesPredicate(e,s))return!1}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}return!0}},{key:"DateFromString",value:function(e){var t=e.split("."),n=t[1],r=new Date,i=parseInt(t[0]);return"days"==n?r.setDate(r.getDate()-i):"hours"==n&&r.setHours(r.getHours()-i),r}},{key:"IsRecursiveOperator",value:function(e){return["and","or"].includes(e)}}])&&j(t,n),e}();function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.content={},this.referencingObjects=[],this.updateFromJSON(t),this.uuid||Object($.d)()&&(this.uuid=C.crypto.generateUUIDSync()),"object"!==L(this.content)||this.content.references||(this.content.references=[])}var t,n,r;return t=e,r=[{key:"deepMerge",value:function(e,t){return T()(e,t,(function(e,t){if(R()(e))return t})),e}},{key:"AreItemContentsEqual",value:function(t){var n=t.leftContent,r=t.rightContent,i=t.keysToIgnore,a=t.appDataKeysToIgnore,o=function(e,t){if(!e)return e;var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0)delete e[a.value]}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}return e};return(n=JSON.parse(JSON.stringify(n))).appData&&o(n.appData[e.AppDomain],a),n=o(n,i),(r=JSON.parse(JSON.stringify(r))).appData&&o(r.appData[e.AppDomain],a),r=o(r,i),JSON.stringify(n)===JSON.stringify(r)}}],(n=[{key:"initUUID",value:function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.uuid){e.next=4;break}return e.next=3,regeneratorRuntime.awrap(C.crypto.generateUUID());case 3:this.uuid=e.sent;case 4:case"end":return e.stop()}}),null,this)}},{key:"updateFromJSON",value:function(t){if(t){this.deleted=t.deleted,this.uuid=t.uuid,this.enc_item_key=t.enc_item_key,this.auth_hash=t.auth_hash,this.auth_params=t.auth_params;for(var n=0,r=["errorDecrypting","dirty","dirtyCount","dirtiedDate","dummy"];nt.title})).map((function(e,t){return"#"+e.title})).join(" ")}}],(r=[{key:"mapContentToLocalProperties",value:function(e){X(Q(t.prototype),"mapContentToLocalProperties",this).call(this,e),this.title=e.title}},{key:"structureParams",value:function(){var e={title:this.title},n=X(Q(t.prototype),"structureParams",this).call(this);return Object.assign(n,e),n}},{key:"addItemAsRelationship",value:function(e){"Note"==e.content_type&&(Object($.a)(this.notes,"uuid",e.uuid)||(this.notes.push(e),e.tags.push(this))),X(Q(t.prototype),"addItemAsRelationship",this).call(this,e)}},{key:"removeItemAsRelationship",value:function(e){"Note"==e.content_type&&(E()(this.notes,{uuid:e.uuid}),E()(e.tags,{uuid:this.uuid})),X(Q(t.prototype),"removeItemAsRelationship",this).call(this,e)}},{key:"updateLocalRelationships",value:function(){var e=this.content.references.map((function(e){return e.uuid}));this.notes.slice().forEach(function(t){e.includes(t.uuid)||(E()(t.tags,{uuid:this.uuid}),E()(this.notes,{uuid:t.uuid}),t.setIsNoLongerBeingReferencedBy(this))}.bind(this))}},{key:"isBeingRemovedLocally",value:function(){var e=this;this.notes.forEach((function(t){E()(t.tags,{uuid:e.uuid}),t.setIsNoLongerBeingReferencedBy(e)})),this.notes.length=0,X(Q(t.prototype),"isBeingRemovedLocally",this).call(this)}},{key:"informReferencesOfUUIDChange",value:function(e,t){var n=!0,r=!1,i=void 0;try{for(var a,o=this.notes[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;E()(s.tags,{uuid:e}),s.tags.push(this)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}},{key:"didFinishSyncing",value:function(){var e=!0,t=!1,n=void 0;try{for(var r,i=this.notes[Symbol.iterator]();!(e=(r=i.next()).done);e=!0)r.value.tagDidFinishSyncing(this)}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}}},{key:"isSmartTag",value:function(){return"SN|SmartTag"==this.content_type}},{key:"displayName",get:function(){return"Tag"}}])&&Z(n.prototype,r),i&&Z(n,i),t}(B);function ne(e){return(ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function re(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];if(!e.errorDecrypting){var n=e.contentObject;if(e.updateLocalRelationships(),n.references){var r=n.references.slice(),i=r.map((function(e){return e.uuid})),a=!0,o=this.findItems(i,a),s=!0,c=!1,u=void 0;try{for(var l,f=o.entries()[Symbol.iterator]();!(s=(l=f.next()).done);s=!0){var p=yt(l.value,2),d=p[0],h=p[1];if(h)e.addItemAsRelationship(h),t&&this.setItemDirty(h,!0);else{var v=i[d],m=this.missedReferenceBuildKey(v,e.uuid);if(!this.missedReferences[m]){var y={reference_uuid:v,for_item:e};this.missedReferences[m]=y}}}}catch(e){c=!0,u=e}finally{try{s||null==f.return||f.return()}finally{if(c)throw u}}}}}},{key:"notifySyncObserversOfModels",value:function(e,t,n){var r,i,a,o,s,c,u,l=this;return regeneratorRuntime.async((function(f){for(;;)switch(f.prev=f.next){case 0:r=this.itemSyncObservers.sort((function(e,t){return e.priority0)){v.next=25;break}return v.next=25,regeneratorRuntime.awrap(l._callSyncObserverCallbackWithTimeout(r,i,a,o,t,n));case 25:case"end":return v.stop()}}),null,null,[[6,10,14,22],[15,,17,21]])},c=r[Symbol.iterator]();case 7:if(i=(u=c.next()).done){f.next=13;break}return f.next=10,regeneratorRuntime.awrap(s());case 10:i=!0,f.next=7;break;case 13:f.next=19;break;case 15:f.prev=15,f.t0=f.catch(4),a=!0,o=f.t0;case 19:f.prev=19,f.prev=20,i||null==c.return||c.return();case 22:if(f.prev=22,!a){f.next=25;break}throw o;case 25:return f.finish(22);case 26:return f.finish(19);case 27:case"end":return f.stop()}}),null,this,[[4,15,19,27],[20,,22,26]])}},{key:"_callSyncObserverCallbackWithTimeout",value:function(e,t,n,r,i,a){var o=this;return regeneratorRuntime.async((function(s){for(;;)switch(s.prev=s.next){case 0:return s.abrupt("return",new Promise((function(s,c){o.$timeout((function(){try{e.callback(t,n,r,i,a)}catch(e){console.error("Sync observer exception",e)}finally{s()}}))})));case 1:case"end":return s.stop()}}))}},{key:"setItemDirty",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;this.setItemsDirty([e],t,n,r,i)}},{key:"setItemsDirty",value:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,o=!0,s=!1,c=void 0;try{for(var u,l=t[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var f=u.value;f.setDirty(n,r)}}catch(e){s=!0,c=e}finally{try{o||null==l.return||l.return()}finally{if(s)throw c}}this.notifySyncObserversOfModels(t,i||e.MappingSourceLocalDirtied,a)}},{key:"createItem",value:function(t){var n=e.ContentTypeClassMapping&&e.ContentTypeClassMapping[t.content_type];return n||(n=B),new n(t)}},{key:"createDuplicateItemFromResponseItem",value:function(e){var t,n;return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:if("function"!=typeof e.setDirty){r.next=3;break}return console.error("Attempting to create conflicted copy of non-response item."),r.abrupt("return",null);case 3:return t=JSON.parse(JSON.stringify(e)),r.next=6,regeneratorRuntime.awrap(C.crypto.generateUUID());case 6:return t.uuid=r.sent,n=this.createItem(t),r.abrupt("return",n);case 9:case"end":return r.stop()}}),null,this)}},{key:"duplicateItemAndAddAsConflict",value:function(e){return this.duplicateItemWithCustomContentAndAddAsConflict({content:e.content,duplicateOf:e})}},{key:"duplicateItemWithCustomContentAndAddAsConflict",value:function(e){var t=e.content,n=e.duplicateOf,r=this.duplicateItemWithCustomContent({content:t,duplicateOf:n});return this.addDuplicatedItemAsConflict({duplicate:r,duplicateOf:n}),r}},{key:"addDuplicatedItemAsConflict",value:function(e){var t=e.duplicate,n=e.duplicateOf;this.addDuplicatedItem(t,n),t.content.conflict_of=n.uuid}},{key:"duplicateItemWithCustomContent",value:function(e){var t=e.content,n=e.duplicateOf,r=new n.constructor({content:t});return r.created_at=n.created_at,r.content_type||(r.content_type=n.content_type),r}},{key:"duplicateItemAndAdd",value:function(e){var t=this.duplicateItemWithoutAdding(e);return this.addDuplicatedItem(t,e),t}},{key:"duplicateItemWithoutAdding",value:function(e){var t=new e.constructor({content:e.content});return t.created_at=e.created_at,t.content_type||(t.content_type=e.content_type),t}},{key:"addDuplicatedItem",value:function(e,t){this.addItem(e);var n=!0,r=!1,i=void 0;try{for(var a,o=t.referencingObjects[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;s.addItemAsRelationship(e),this.setItemDirty(s,!0)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}this.resolveReferencesForItem(e),this.setItemDirty(e,!0)}},{key:"addItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.addItems([e],t)}},{key:"addItems",value:function(e){var t=this;arguments.length>1&&void 0!==arguments[1]&&arguments[1],e.forEach((function(e){t.itemsHash[e.uuid]||(t.itemsHash[e.uuid]=e,t.items.push(e))}))}},{key:"addItemSyncObserver",value:function(e,t,n){this.addItemSyncObserverWithPriority({id:e,types:t,callback:n,priority:1})}},{key:"addItemSyncObserverWithPriority",value:function(e){var t=e.id,n=e.priority,r=e.types,i=e.callback;Array.isArray(r)||(r=[r]),this.itemSyncObservers.push({id:t,types:r,priority:n,callback:i})}},{key:"removeItemSyncObserver",value:function(e){E()(this.itemSyncObservers,O()(this.itemSyncObservers,{id:e}))}},{key:"getDirtyItems",value:function(){return this.items.filter((function(e){return 1==e.dirty&&!e.dummy&&(!e.errorDecrypting||e.deleted)}))}},{key:"clearDirtyItems",value:function(e){var t=!0,n=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0)i.value.setDirty(!1)}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"removeAndDirtyAllRelationshipsForItem",value:function(e){if(!e.errorDecrypting){var t=!0,n=!1,r=void 0;try{for(var i,a=e.content.references[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value,s=this.findItem(o.uuid);s&&(e.removeItemAsRelationship(s),s.hasRelationshipWithItem(e)&&(s.removeItemAsRelationship(e),this.setItemDirty(s,!0)))}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}}var c=!0,u=!1,l=void 0;try{for(var f,p=e.referencingObjects[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var d=f.value;d.removeItemAsRelationship(e),this.setItemDirty(d,!0)}}catch(e){u=!0,l=e}finally{try{c||null==p.return||p.return()}finally{if(u)throw l}}e.referencingObjects=[]}},{key:"setAllItemsDirty",value:function(){var e=this.allItems;this.setItemsDirty(e,!0)}},{key:"setItemToBeDeleted",value:function(e){e.deleted=!0,e.dummy||this.setItemDirty(e,!0),this.removeAndDirtyAllRelationshipsForItem(e)}},{key:"removeItemLocally",value:function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:E()(this.items,{uuid:e.uuid}),delete this.itemsHash[e.uuid],e.isBeingRemovedLocally();case 3:case"end":return t.stop()}}),null,this)}},{key:"allItemsMatchingTypes",value:function(e){return this.allItems.filter((function(t){return(lt()(e,t.content_type)||lt()(e,"*"))&&!t.dummy}))}},{key:"invalidItems",value:function(){return this.allItems.filter((function(e){return e.errorDecrypting}))}},{key:"validItemsForContentType",value:function(e){return this.allItems.filter((function(t){return t.content_type==e&&!t.errorDecrypting}))}},{key:"findItem",value:function(e){return this.itemsHash[e]}},{key:"findItems",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value,u=this.itemsHash[c];(u||t)&&n.push(u)}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}},{key:"itemsMatchingPredicate",value:function(e){return this.itemsMatchingPredicates([e])}},{key:"itemsMatchingPredicates",value:function(e){return this.filterItemsWithPredicates(this.allItems,e)}},{key:"filterItemsWithPredicates",value:function(e,t){return e.filter((function(e){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(!e.satisfiesPredicate(s))return!1}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}return!0}))}},{key:"importItems",value:function(t){var n,r,i,a,o,s,c,u,l,f,p,d,h,v,m,y,g,b,k,w,x,S,$,_,M,C,A;return regeneratorRuntime.async((function(O){for(;;)switch(O.prev=O.next){case 0:n=[],r={},i=!0,a=!1,o=void 0,O.prev=5,s=t[Symbol.iterator]();case 7:if(i=(c=s.next()).done){O.next=18;break}if(u=c.value,l=this.findItem(u.uuid)){O.next=13;break}return r[u.uuid]={},O.abrupt("continue",15);case 13:f=this.duplicateItemWithoutAdding(l),r[u.uuid]={frozenValue:f,itemRef:l};case 15:i=!0,O.next=7;break;case 18:O.next=24;break;case 20:O.prev=20,O.t0=O.catch(5),a=!0,o=O.t0;case 24:O.prev=24,O.prev=25,i||null==s.return||s.return();case 27:if(O.prev=27,!a){O.next=30;break}throw o;case 30:return O.finish(27);case 31:return O.finish(24);case 32:p=!0,d=!1,h=void 0,O.prev=35,v=t[Symbol.iterator]();case 37:if(p=(m=v.next()).done){O.next=52;break}if(y=m.value,g=r[y.uuid],b=g.frozenValue,k=g.itemRef,!b||k.errorDecrypting){O.next=47;break}return O.next=43,regeneratorRuntime.awrap(this.createDuplicateItemFromResponseItem(y));case 43:w=O.sent,y.deleted||b.isItemContentEqualWith(w)||(this.addDuplicatedItemAsConflict({duplicate:w,duplicateOf:k}),n.push(w)),O.next=49;break;case 47:n.push(y),k&&k.errorDecrypting&&(k.errorDecrypting=!1);case 49:p=!0,O.next=37;break;case 52:O.next=58;break;case 54:O.prev=54,O.t1=O.catch(35),d=!0,h=O.t1;case 58:O.prev=58,O.prev=59,p||null==v.return||v.return();case 61:if(O.prev=61,!d){O.next=64;break}throw h;case 64:return O.finish(61);case 65:return O.finish(58);case 66:return O.next=68,regeneratorRuntime.awrap(this.mapResponseItemsToLocalModels(n,e.MappingSourceFileImport));case 68:for(x=O.sent,S=!0,$=!1,_=void 0,O.prev=72,M=x[Symbol.iterator]();!(S=(C=M.next()).done);S=!0)A=C.value,this.setItemDirty(A,!0,!1),A.deleted=!1;O.next=80;break;case 76:O.prev=76,O.t2=O.catch(72),$=!0,_=O.t2;case 80:O.prev=80,O.prev=81,S||null==M.return||M.return();case 83:if(O.prev=83,!$){O.next=86;break}throw _;case 86:return O.finish(83);case 87:return O.finish(80);case 88:return O.abrupt("return",x);case 89:case"end":return O.stop()}}),null,this,[[5,20,24,32],[25,,27,31],[35,54,58,66],[59,,61,65],[72,76,80,88],[81,,83,87]])}},{key:"getAllItemsJSONData",value:function(e,t,n){return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",this.getJSONDataForItems(this.allItems,e,t,n));case 1:case"end":return r.stop()}}),null,this)}},{key:"getJSONDataForItems",value:function(e,t,n,r){return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",Promise.all(e.map((function(e){return new G(e,t,n).paramsForExportFile()}))).then((function(e){if(r&&0==e.length)return null;var i={items:e};return t&&(i.auth_params=n),JSON.stringify(i,null,2)})));case 1:case"end":return i.stop()}}))}},{key:"computeDataIntegrityHash",value:function(){var e,t,n,r;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,e=this.allNondummyItems.sort((function(e,t){return t.updated_at-e.updated_at})),t=e.map((function(e){return e.updatedAtTimestamp()})),n=t.join(","),i.next=6,regeneratorRuntime.awrap(C.crypto.sha256(n));case 6:return r=i.sent,i.abrupt("return",r);case 10:return i.prev=10,i.t0=i.catch(0),console.error("Error computing data integrity hash",i.t0),i.abrupt("return",null);case 14:case"end":return i.stop()}}),null,this,[[0,10]])}},{key:"allItems",get:function(){return this.items.slice()}},{key:"allNondummyItems",get:function(){return this.items.filter((function(e){return!e.dummy}))}}])&>(t.prototype,n),e}();function kt(e,t){for(var n=0;n0&&i!=bt.MappingSourceRemoteSaved&&e.isDesktop&&e.desktopManager.syncComponentsInstallation(o);var s=!0,c=!1,u=void 0;try{for(var l,f=o[Symbol.iterator]();!(s=(l=f.next()).done);s=!0){var p=l.value,d=O()(e.activeComponents,{uuid:p.uuid});!p.active||p.deleted||d?!p.active&&d&&e.deactivateComponent(p):e.activateComponent(p)}}catch(e){c=!0,u=e}finally{try{s||null==f.return||f.return()}finally{if(c)throw u}}var h=!0,v=!1,m=void 0;try{for(var y,g=function(){var n=y.value;if(a&&a==n.component.uuid)return"continue";var r=t.filter((function(e){return-1!==n.contentTypes.indexOf(e.content_type)}));if(0==r.length)return"continue";var i=[{name:"stream-items",content_types:n.contentTypes.sort()}];e.runWithPermissions(n.component,i,(function(){e.sendItemsInReply(n.component,r,n.originalMessage)}))},b=e.streamObservers[Symbol.iterator]();!(h=(y=b.next()).done);h=!0)g()}catch(e){v=!0,m=e}finally{try{h||null==b.return||b.return()}finally{if(v)throw m}}var k=[{name:"stream-context-item"}],w=!0,x=!1,S=void 0;try{for(var $,_=function(){var n=$.value;if(a&&a==n.component.uuid)return"continue";var r=!0,o=!1,s=void 0;try{for(var c,u=e.handlers[Symbol.iterator]();!(r=(c=u.next()).done);r=!0){var l=c.value;(l.areas.includes(n.component.area)||l.areas.includes("*"))&&l.contextRequestHandler&&(C=l.contextRequestHandler(n.component))&&(A=O()(t,{uuid:C.uuid}))&&e.runWithPermissions(n.component,k,(function(){e.sendContextItemInReply(n.component,A,n.originalMessage,i)}))}}catch(e){o=!0,s=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw s}}},M=e.contextStreamObservers[Symbol.iterator]();!(w=($=M.next()).done);w=!0){var C,A;_()}}catch(e){x=!0,S=e}finally{try{w||null==M.return||M.return()}finally{if(x)throw S}}}))}},{key:"configureForNonMobileUsage",value:function(){var e=this,t=function(t){var n=!0,r=!1,i=void 0;try{for(var a,o=e.activeComponents[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(document.activeElement==e.iframeForComponent(s)){e.$timeout((function(){e.focusChangedForComponent(s)}));break}}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}};window.addEventListener?window.addEventListener("focus",t,!0):window.attachEvent("onfocusout",t),window.addEventListener?window.addEventListener("blur",t,!0):window.attachEvent("onblur",t),this.desktopManager.registerUpdateObserver((function(t){t.active&&t.isTheme()&&e.postActiveThemesToAllComponents()})),window.addEventListener("message",(function(t){e.loggingEnabled&&console.log("Web app: received message",t),t.data.sessionKey&&e.handleMessage(e.componentForSessionKey(t.data.sessionKey),t.data)}),!1)}},{key:"postActiveThemesToAllComponents",value:function(){var e=!0,t=!1,n=void 0;try{for(var r,i=this.components[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var a=r.value;!a.isTheme()&&a.active&&a.window&&this.postActiveThemesToComponent(a)}}catch(e){t=!0,n=e}finally{try{e||null==i.return||i.return()}finally{if(t)throw n}}}},{key:"getActiveThemes",value:function(){return this.componentsForArea("themes").filter((function(e){return e.active}))}},{key:"urlsForActiveThemes",value:function(){var e=this;return this.getActiveThemes().map((function(t){return e.urlForComponent(t)}))}},{key:"postActiveThemesToComponent",value:function(e){var t={themes:this.urlsForActiveThemes()};this.sendMessageToComponent(e,{action:"themes",data:t})}},{key:"contextItemDidChangeInArea",value:function(e){var t=!0,n=!1,r=void 0;try{for(var i,a=this.handlers[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var o=i.value;if(!1!==o.areas.includes(e)||o.areas.includes("*")){var s=this.contextStreamObservers.filter((function(t){return t.component.area===e})),c=!0,u=!1,l=void 0;try{for(var f,p=s[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var d=f.value;if(o.contextRequestHandler){var h=o.contextRequestHandler(d.component);h&&this.sendContextItemInReply(d.component,h,d.originalMessage)}}}catch(e){u=!0,l=e}finally{try{c||null==p.return||p.return()}finally{if(u)throw l}}}}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}}},{key:"setComponentHidden",value:function(e,t){if(t)e.hidden=!0;else if(e.hidden){e.hidden=!1;var n=O()(this.contextStreamObservers,{identifier:e.uuid});n&&this.handleStreamContextItemMessage(e,n.originalMessage);var r=O()(this.streamObservers,{identifier:e.uuid});r&&this.handleStreamItemsMessage(e,r.originalMessage)}}},{key:"jsonForItem",value:function(t,n,r){var i={uuid:t.uuid,content_type:t.content_type,created_at:t.created_at,updated_at:t.updated_at,deleted:t.deleted};return i.content=t.createContentJSONFromProperties(),i.clientData=t.getDomainDataItem(n.getClientDataKey(),e.ClientDataDomain)||{},!r||r!=bt.MappingSourceRemoteSaved&&r!=bt.MappingSourceLocalSaved||(i.isMetadataUpdate=!0),this.removePrivatePropertiesFromResponseItems([i],n,{type:"outgoing"}),i}},{key:"sendItemsInReply",value:function(e,t,n,r){var i=this;this.loggingEnabled&&console.log("Web|componentManager|sendItemsInReply",e,t,n);var a={items:{}},o=t.map((function(t){return i.jsonForItem(t,e,r)}));a.items=o,this.replyToMessage(e,n,a)}},{key:"sendContextItemInReply",value:function(e,t,n,r){this.loggingEnabled&&console.log("Web|componentManager|sendContextItemInReply",e,t,n);var i={item:this.jsonForItem(t,e,r)};this.replyToMessage(e,n,i)}},{key:"replyToMessage",value:function(e,t,n){var r={action:"reply",original:t,data:n};this.sendMessageToComponent(e,r)}},{key:"sendMessageToComponent",value:function(e,t){if(!e.hidden||["component-registered","themes"].includes(t.action)){this.loggingEnabled&&console.log("Web|sendMessageToComponent",e,t);var n=this.urlForComponent(e);n.startsWith("http")||n.startsWith("file")||(n=window.location.href+n),e.window||this.alertManager.alert({text:"Standard Notes is trying to communicate with ".concat(e.name,", but an error is occurring. Please restart this extension and try again.")}),this.isMobile&&(t=JSON.stringify(t)),e.window.postMessage(t,n)}else this.loggingEnabled&&console.log("Component disabled for current item, not sending any messages.",e.name)}},{key:"componentsForArea",value:function(e){return this.components.filter((function(t){return t.area===e}))}},{key:"urlForComponent",value:function(e){if(e.offlineOnly&&!this.isDesktop)return null;if(e.offlineOnly||this.isDesktop&&e.local_url)return e.local_url&&e.local_url.replace("sn://",this.desktopManager.getExtServerHost());var t=e.hosted_url||e.legacy_url;if(this.isMobile){var n="ios"==this.platform?"localhost":"10.0.2.2";t=t.replace("localhost",n).replace("sn.local",n)}return t}},{key:"componentForUrl",value:function(e){return this.components.filter((function(t){return t.hosted_url===e||t.legacy_url===e}))[0]}},{key:"componentForSessionKey",value:function(e){var t=O()(this.components,{sessionKey:e});if(!t){var n=!0,r=!1,i=void 0;try{for(var a,o=this.handlers[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(s.componentForSessionKeyHandler&&(t=s.componentForSessionKeyHandler(e)))break}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}return t}},{key:"handleMessage",value:function(e,t){var n=this;if(!e)return console.log("Component not defined for message, returning",t),void this.alertManager.alert({text:"An extension is trying to communicate with Standard Notes, but there is an error establishing a bridge. Please restart the app and try again."});if(e.readonly&&["save-items","associate-item","deassociate-item","create-item","create-items","delete-items","set-component-data"].includes(t.action))this.alertManager.alert({text:"The extension ".concat(e.name," is trying to save, but it is in a locked state and cannot accept changes.")});else{if("stream-items"===t.action)this.handleStreamItemsMessage(e,t);else if("stream-context-item"===t.action)this.handleStreamContextItemMessage(e,t);else if("set-component-data"===t.action)this.handleSetComponentDataMessage(e,t);else if("delete-items"===t.action)this.handleDeleteItemsMessage(e,t);else if("create-items"===t.action||"create-item"===t.action)this.handleCreateItemsMessage(e,t);else if("save-items"===t.action)this.handleSaveItemsMessage(e,t);else if("toggle-activate-component"===t.action){var r=this.modelManager.findItem(t.data.uuid);this.handleToggleComponentMessage(e,r,t)}else"request-permissions"===t.action?this.handleRequestPermissionsMessage(e,t):"install-local-component"===t.action?this.handleInstallLocalComponentMessage(e,t):"duplicate-item"===t.action&&this.handleDuplicateItemMessage(e,t);var i=!0,a=!1,o=void 0;try{for(var s,c=function(){var r=s.value;r.actionHandler&&(r.areas.includes(e.area)||r.areas.includes("*"))&&n.$timeout((function(){r.actionHandler(e,t.action,t.data)}))},u=this.handlers[Symbol.iterator]();!(i=(s=u.next()).done);i=!0)c()}catch(e){a=!0,o=e}finally{try{i||null==u.return||u.return()}finally{if(a)throw o}}}}},{key:"removePrivatePropertiesFromResponseItems",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("incoming"==n.type){var r=["updated_at"],i=!0,a=!1,o=void 0;try{for(var s,c=e[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;if("function"!=typeof u.setDirty){var l=!0,f=!1,p=void 0;try{for(var d,h=r[Symbol.iterator]();!(l=(d=h.next()).done);l=!0){var v=d.value;delete u[v]}}catch(e){f=!0,p=e}finally{try{l||null==h.return||h.return()}finally{if(f)throw p}}}else console.error("Attempting to pass object. Use JSON.")}}catch(e){a=!0,o=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw o}}}if(!(t&&this.nativeExtManager&&this.nativeExtManager.isSystemExtension(t))){var m=["autoupdateDisabled","permissions","active"];n&&n.includeUrls&&(m=m.concat(["url","hosted_url","local_url"]));var y=!0,g=!1,b=void 0;try{for(var k,w=e[Symbol.iterator]();!(y=(k=w.next()).done);y=!0){var x=k.value;if("function"!=typeof x.setDirty){var S=!0,$=!1,_=void 0;try{for(var M,C=m[Symbol.iterator]();!(S=(M=C.next()).done);S=!0){var A=M.value;delete x.content[A]}}catch(e){$=!0,_=e}finally{try{S||null==C.return||C.return()}finally{if($)throw _}}}else console.error("Attempting to pass object. Use JSON.")}}catch(e){g=!0,b=e}finally{try{y||null==w.return||w.return()}finally{if(g)throw b}}}}},{key:"handleStreamItemsMessage",value:function(e,t){var n=this,r=[{name:"stream-items",content_types:t.data.content_types.sort()}];this.runWithPermissions(e,r,(function(){O()(n.streamObservers,{identifier:e.uuid})||n.streamObservers.push({identifier:e.uuid,component:e,originalMessage:t,contentTypes:t.data.content_types});var r=[],i=!0,a=!1,o=void 0;try{for(var s,c=t.data.content_types[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var u=s.value;r=r.concat(n.modelManager.validItemsForContentType(u))}}catch(e){a=!0,o=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw o}}n.sendItemsInReply(e,r,t)}))}},{key:"handleStreamContextItemMessage",value:function(e,t){var n=this;this.runWithPermissions(e,[{name:"stream-context-item"}],(function(){O()(n.contextStreamObservers,{identifier:e.uuid})||n.contextStreamObservers.push({identifier:e.uuid,component:e,originalMessage:t});var r=!0,i=!1,a=void 0;try{for(var o,s=n.handlersForArea(e.area)[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;if(c.contextRequestHandler){var u=c.contextRequestHandler(e);u&&n.sendContextItemInReply(e,u,t)}}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}}))}},{key:"isItemIdWithinComponentContextJurisdiction",value:function(e,t){return this.itemIdsInContextJurisdictionForComponent(t).includes(e)}},{key:"itemIdsInContextJurisdictionForComponent",value:function(e){var t=[],n=!0,r=!1,i=void 0;try{for(var a,o=this.handlersForArea(e.area)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;if(s.contextRequestHandler){var c=s.contextRequestHandler(e);c&&t.push(c.uuid)}}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}return t}},{key:"handlersForArea",value:function(e){return this.handlers.filter((function(t){return t.areas.includes(e)}))}},{key:"handleSaveItemsMessage",value:function(t,n){var r,i,a,o,s,c,u,l,f,p,d,h=this;return regeneratorRuntime.async((function(v){for(;;)switch(v.prev=v.next){case 0:r=n.data.items,i=[],a=this.itemIdsInContextJurisdictionForComponent(t),o=r.slice(),s=!0,c=!1,u=void 0,v.prev=7,l=r.slice()[Symbol.iterator]();case 9:if(s=(f=l.next()).done){v.next=18;break}if(p=f.value,!a.includes(p.uuid)){v.next=15;break}return i.push({name:"stream-context-item"}),Pe()(o,p),v.abrupt("break",18);case 15:s=!0,v.next=9;break;case 18:v.next=24;break;case 20:v.prev=20,v.t0=v.catch(7),c=!0,u=v.t0;case 24:v.prev=24,v.prev=25,s||null==l.return||l.return();case 27:if(v.prev=27,!c){v.next=30;break}throw u;case 30:return v.finish(27);case 31:return v.finish(24);case 32:o.length>0&&(d=ct()(o.map((function(e){return e.content_type}))).sort(),i.push({name:"stream-items",content_types:d})),this.runWithPermissions(t,i,(function(){var i,a,o,s,c,u,l,f,p,d,v,m,y,g,b,k,w,x,S;return regeneratorRuntime.async((function($){for(;;)switch($.prev=$.next){case 0:for(h.removePrivatePropertiesFromResponseItems(r,t,{includeUrls:!0,type:"incoming"}),i=r.map((function(e){return e.uuid})),a=h.modelManager.findItems(i),o=0,s=!0,c=!1,u=void 0,$.prev=7,l=a[Symbol.iterator]();!(s=(f=l.next()).done);s=!0)(p=f.value).locked&&(E()(r,{uuid:p.uuid}),o++);$.next=15;break;case 11:$.prev=11,$.t0=$.catch(7),c=!0,u=$.t0;case 15:$.prev=15,$.prev=16,s||null==l.return||l.return();case 18:if($.prev=18,!c){$.next=21;break}throw u;case 21:return $.finish(18);case 22:return $.finish(15);case 23:return o>0&&(d=1==o?"item":"items",v=1==o?"is":"are",h.alertManager.alert({title:"Items Locked",text:"".concat(o," ").concat(d," you are attempting to save ").concat(v," locked and cannot be edited.")})),$.next=26,regeneratorRuntime.awrap(h.modelManager.mapResponseItemsToLocalModels(r,bt.MappingSourceComponentRetrieved,t.uuid));case 26:m=$.sent,y=!0,g=!1,b=void 0,$.prev=30,k=r[Symbol.iterator]();case 32:if(y=(w=k.next()).done){$.next=42;break}if(x=w.value,S=O()(m,{uuid:x.uuid})){$.next=38;break}return h.alertManager.alert({text:"The extension ".concat(t.name," is trying to save an item with type ").concat(x.content_type,", but that item does not exist. Please restart this extension and try again.")}),$.abrupt("continue",39);case 38:S.locked||(x.clientData&&S.setDomainDataItem(t.getClientDataKey(),x.clientData,e.ClientDataDomain),h.modelManager.setItemDirty(S,!0,!0,bt.MappingSourceComponentRetrieved,t.uuid));case 39:y=!0,$.next=32;break;case 42:$.next=48;break;case 44:$.prev=44,$.t1=$.catch(30),g=!0,b=$.t1;case 48:$.prev=48,$.prev=49,y||null==k.return||k.return();case 51:if($.prev=51,!g){$.next=54;break}throw b;case 54:return $.finish(51);case 55:return $.finish(48);case 56:h.syncManager.sync().then((function(e){var r=Object.assign({},n);r.action=e&&e.error?"save-error":"save-success",h.replyToMessage(t,n,{error:e&&e.error}),h.handleMessage(t,r)}));case 57:case"end":return $.stop()}}),null,null,[[7,11,15,23],[16,,18,22],[30,44,48,56],[49,,51,55]])}));case 34:case"end":return v.stop()}}),null,this,[[7,20,24,32],[25,,27,31]])}},{key:"handleDuplicateItemMessage",value:function(e,t){var n=this,r=t.data.item,i=this.modelManager.findItem(r.uuid),a=[{name:"stream-items",content_types:[i.content_type]}];this.runWithPermissions(e,a,(function(){var r=n.modelManager.duplicateItemAndAdd(i);n.syncManager.sync(),n.replyToMessage(e,t,{item:n.jsonForItem(r,e)})}))}},{key:"handleCreateItemsMessage",value:function(t,n){var r=this,i=n.data.item?[n.data.item]:n.data.items,a=[{name:"stream-items",content_types:ct()(i.map((function(e){return e.content_type})))}];this.runWithPermissions(t,a,(function(){r.removePrivatePropertiesFromResponseItems(i,t,{type:"incoming"});var a=[],o=!0,s=!1,c=void 0;try{for(var u,l=i[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var f=u.value,p=r.modelManager.createItem(f);f.clientData&&p.setDomainDataItem(t.getClientDataKey(),f.clientData,e.ClientDataDomain),r.modelManager.addItem(p),r.modelManager.resolveReferencesForItem(p,!0),r.modelManager.setItemDirty(p,!0),a.push(p)}}catch(e){s=!0,c=e}finally{try{o||null==l.return||l.return()}finally{if(s)throw c}}r.syncManager.sync();var d="create-item"==n.action?{item:r.jsonForItem(a[0],t)}:{items:a.map((function(e){return r.jsonForItem(e,t)}))};r.replyToMessage(t,n,d)}))}},{key:"handleDeleteItemsMessage",value:function(e,t){var n=this,r=[{name:"stream-items",content_types:ct()(t.data.items.map((function(e){return e.content_type}))).sort()}];this.runWithPermissions(e,r,(function(){var r,i,a,o,s,c,u,l,f,p,d;return regeneratorRuntime.async((function(h){for(;;)switch(h.prev=h.next){case 0:return r=t.data.items,i=1==r.length?"item":"items",a=null,o=!0,h.next=6,regeneratorRuntime.awrap(n.alertManager.confirm({text:"Are you sure you want to delete ".concat(r.length," ").concat(i,"?")}).catch((function(){o=!1})));case 6:if(!o){h.next=42;break}s=!0,c=!1,u=void 0,h.prev=10,l=r[Symbol.iterator]();case 12:if(s=(f=l.next()).done){h.next=24;break}if(p=f.value,d=n.modelManager.findItem(p.uuid)){h.next=18;break}return n.alertManager.alert({text:"The item you are trying to delete cannot be found."}),h.abrupt("continue",21);case 18:["SN|Component","SN|Theme"].includes(d.content_type)&&n.deactivateComponent(d,!0),n.modelManager.setItemToBeDeleted(d),n.modelManager.notifySyncObserversOfModels([d],bt.MappingSourceRemoteSaved);case 21:s=!0,h.next=12;break;case 24:h.next=30;break;case 26:h.prev=26,h.t0=h.catch(10),c=!0,u=h.t0;case 30:h.prev=30,h.prev=31,s||null==l.return||l.return();case 33:if(h.prev=33,!c){h.next=36;break}throw u;case 36:return h.finish(33);case 37:return h.finish(30);case 38:n.syncManager.sync(),a={deleted:!0},h.next=43;break;case 42:a={deleted:!1};case 43:n.replyToMessage(e,t,a);case 44:case"end":return h.stop()}}),null,null,[[10,26,30,38],[31,,33,37]])}))}},{key:"handleRequestPermissionsMessage",value:function(e,t){var n=this;this.runWithPermissions(e,t.data.permissions,(function(){n.replyToMessage(e,t,{approved:!0})}))}},{key:"handleSetComponentDataMessage",value:function(e,t){var n=this;this.runWithPermissions(e,[],(function(){e.componentData=t.data.componentData,n.modelManager.setItemDirty(e,!0),n.syncManager.sync()}))}},{key:"handleToggleComponentMessage",value:function(e,t,n){this.toggleComponent(t)}},{key:"toggleComponent",value:function(e){var t=this;if("modal"==e.area)this.openModalComponent(e);else if(e.active)this.deactivateComponent(e);else if("SN|Theme"==e.content_type){var n=this.getActiveThemes();this.activateComponent(e),e.isLayerable()||setTimeout((function(){var e=!0,r=!1,i=void 0;try{for(var a,o=n[Symbol.iterator]();!(e=(a=o.next()).done);e=!0){var s=a.value;s&&!s.isLayerable()&&t.deactivateComponent(s)}}catch(e){r=!0,i=e}finally{try{e||null==o.return||o.return()}finally{if(r)throw i}}}),10)}else this.activateComponent(e)}},{key:"handleInstallLocalComponentMessage",value:function(e,t){if(!this.nativeExtManager||this.nativeExtManager.isSystemExtension(e)){var n=this.modelManager.findItem(t.data.uuid);this.desktopManager.installComponent(n)}}},{key:"runWithPermissions",value:function(e,t,n){e.permissions||(e.permissions=[]),t=JSON.parse(JSON.stringify(t));var r=e.permissions,i=!0,a=!1,o=void 0;try{for(var s,c=function(){var e=s.value,n=r.find((function(t){return t.name==e.name}));if(!n)return"continue";var i=e.content_types;if(!i)return Pe()(t,e),"continue";var a=!0,o=!1,c=void 0;try{for(var u,l=n.content_types[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){var f=u.value;Pe()(i,f)}}catch(e){o=!0,c=e}finally{try{a||null==l.return||l.return()}finally{if(o)throw c}}0==i.length&&Pe()(t,e)},u=t.slice()[Symbol.iterator]();!(i=(s=u.next()).done);i=!0)c()}catch(e){a=!0,o=e}finally{try{i||null==u.return||u.return()}finally{if(a)throw o}}t.length>0?this.promptForPermissions(e,t,(function(e){e&&n()})):n()}},{key:"promptForPermissions",value:function(e,t,n){var r=this,i={};i.component=e,i.permissions=t,i.permissionsString=this.permissionsStringForPermissions(t,e),i.actionBlock=n,i.callback=function(n){if(n){var a=!0,o=!1,s=void 0;try{for(var c,u=function(){var t=c.value,n=e.permissions.find((function(e){return e.name==t.name}));if(n){var r=n.content_types||[];n.content_types=ct()(r.concat(t.content_types))}else e.permissions.push(t)},l=t[Symbol.iterator]();!(a=(c=l.next()).done);a=!0)u()}catch(e){o=!0,s=e}finally{try{a||null==l.return||l.return()}finally{if(o)throw s}}r.modelManager.setItemDirty(e,!0),r.syncManager.sync()}r.permissionDialogs=r.permissionDialogs.filter((function(r){return r==i?(r.actionBlock&&r.actionBlock(n),!1):!!(r.component!=e||r.permissions!=t&&(a=t,r.permissions.some((function(e){return!a.find((function(t){return JSON.stringify(t)===JSON.stringify(e)}))}))))||(n&&r.actionBlock&&r.actionBlock(n),!1);var a})),r.permissionDialogs.length>0&&r.presentPermissionsDialog(r.permissionDialogs[0])};var a=O()(this.permissionDialogs,{component:e});this.permissionDialogs.push(i),a?console.log("Existing dialog, not presenting."):this.presentPermissionsDialog(i)}},{key:"presentPermissionsDialog",value:function(e){console.error("Must override")}},{key:"openModalComponent",value:function(e){console.error("Must override")}},{key:"registerHandler",value:function(e){this.handlers.push(e)}},{key:"deregisterHandler",value:function(e){var t=O()(this.handlers,{identifier:e});t?this.handlers.splice(this.handlers.indexOf(t),1):console.log("Attempting to deregister non-existing handler")}},{key:"registerComponentWindow",value:function(e,t){return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e.window===t&&this.loggingEnabled&&console.log("Web|componentManager","attempting to re-register same component window."),this.loggingEnabled&&console.log("Web|componentManager|registerComponentWindow",e),e.window=t,n.next=5,regeneratorRuntime.awrap(C.crypto.generateUUID());case 5:e.sessionKey=n.sent,this.sendMessageToComponent(e,{action:"component-registered",sessionKey:e.sessionKey,componentData:e.componentData,data:{uuid:e.uuid,environment:this.environment,platform:this.platform,activeThemeUrls:this.urlsForActiveThemes()}}),this.postActiveThemesToComponent(e),this.desktopManager&&this.desktopManager.notifyComponentActivation(e);case 9:case"end":return n.stop()}}),null,this)}},{key:"activateComponent",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=1!=e.active;e.active=!0;var i=!0,a=!1,o=void 0;try{for(var s,c=function(){var n=s.value;(n.areas.includes(e.area)||n.areas.includes("*"))&&t.$uiRunner((function(){n.activationHandler&&n.activationHandler(e)}))},u=this.handlers[Symbol.iterator]();!(i=(s=u.next()).done);i=!0)c()}catch(e){a=!0,o=e}finally{try{i||null==u.return||u.return()}finally{if(a)throw o}}r&&!n&&(this.modelManager.setItemDirty(e,!0),this.syncManager.sync()),this.activeComponents.includes(e)||this.activeComponents.push(e),"themes"==e.area&&this.postActiveThemesToAllComponents()}},{key:"deactivateComponent",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=0!=e.active;e.active=!1,e.sessionKey=null;var i=!0,a=!1,o=void 0;try{for(var s,c=function(){var n=s.value;(n.areas.includes(e.area)||n.areas.includes("*"))&&t.$uiRunner((function(){n.activationHandler&&n.activationHandler(e)}))},u=this.handlers[Symbol.iterator]();!(i=(s=u.next()).done);i=!0)c()}catch(e){a=!0,o=e}finally{try{i||null==u.return||u.return()}finally{if(a)throw o}}r&&!n&&(this.modelManager.setItemDirty(e,!0),this.syncManager.sync()),Pe()(this.activeComponents,e),this.streamObservers=this.streamObservers.filter((function(t){return t.component!==e})),this.contextStreamObservers=this.contextStreamObservers.filter((function(t){return t.component!==e})),"themes"==e.area&&this.postActiveThemesToAllComponents()}},{key:"reloadComponent",value:function(e){var t,n,r,i,a,o,s=this;return regeneratorRuntime.async((function(c){for(;;)switch(c.prev=c.next){case 0:for(e.active=!1,t=!0,n=!1,r=void 0,c.prev=4,i=function(){var t=o.value;(t.areas.includes(e.area)||t.areas.includes("*"))&&s.$uiRunner((function(){t.activationHandler&&t.activationHandler(e)}))},a=this.handlers[Symbol.iterator]();!(t=(o=a.next()).done);t=!0)i();c.next=13;break;case 9:c.prev=9,c.t0=c.catch(4),n=!0,r=c.t0;case 13:c.prev=13,c.prev=14,t||null==a.return||a.return();case 16:if(c.prev=16,!n){c.next=19;break}throw r;case 19:return c.finish(16);case 20:return c.finish(13);case 21:return this.streamObservers=this.streamObservers.filter((function(t){return t.component!==e})),this.contextStreamObservers=this.contextStreamObservers.filter((function(t){return t.component!==e})),"themes"==e.area&&this.postActiveThemesToAllComponents(),c.abrupt("return",new Promise((function(t,n){s.$timeout((function(){e.active=!0;var n=!0,r=!1,i=void 0;try{for(var a,o=s.handlers[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var c=a.value;(c.areas.includes(e.area)||c.areas.includes("*"))&&s.$uiRunner((function(){c.activationHandler&&c.activationHandler(e),t()}))}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}s.activeComponents.includes(e)||s.activeComponents.push(e),"themes"==e.area&&s.postActiveThemesToAllComponents(),t()}))})));case 25:case"end":return c.stop()}}),null,this,[[4,9,13,21],[14,,16,20]])}},{key:"deleteComponent",value:function(e){this.modelManager.setItemToBeDeleted(e),this.syncManager.sync()}},{key:"isComponentActive",value:function(e){return e.active}},{key:"iframeForComponent",value:function(e){for(var t=0,n=Array.from(document.getElementsByTagName("iframe"));t0?e==t-1?2==t?" and ":", and ":", ":""};return e.forEach((function(e,o){if("stream-items"===e.name){for(var s=e.content_types.map((function(e){var t=n.modelManager.humanReadableDisplayForContentType(e);return t?t+"s":"items of type "+e})),c="",u=0;u=2&&o0&&void 0!==arguments[0]?arguments[0]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.entries||(this.entries=[]),t.entries){var n=!0,r=!1,i=void 0;try{for(var a,o=t.entries[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value,c=this.createEntryForItem(s.item);c.setPreviousEntry(this.getLastEntry()),this.entries.push(c)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}}var t,n;return t=e,(n=[{key:"createEntryForItem",value:function(t){var n=e.HistoryEntryClassMapping&&e.HistoryEntryClassMapping[t.content_type];return n||(n=St),new n(t)}},{key:"getLastEntry",value:function(){return this.entries[this.entries.length-1]}},{key:"addHistoryEntryForItem",value:function(e){var t=this.createEntryForItem(e),n=this.getLastEntry();if(t.setPreviousEntry(n),!t.isSameAsEntry(n))return this.entries.push(t),t}},{key:"clear",value:function(){this.entries.length=0}},{key:"optimize",value:function(){var t=this,n=[],r=function(t){return t.deltaSize()>e.LargeEntryDeltaThreshold},i=function(e,i,a){if(a?n.push(e):-1!==(i=n.indexOf(e))&&n.splice(i,1),a&&r(e)&&-1==e.operationVector()){var o=t.entries[i-1];o&&n.push(o)}};this.entries.forEach((function(e,n){if(0==n||n==t.entries.length-1)i(e,n,!0);else{var a=r(e);i(e,n,a)}})),this.entries=this.entries.filter((function(e,t){return-1!==n.indexOf(e)}))}}])&&$t(t.prototype,n),e}();function Mt(e){return(Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ct(e,t){for(var n=0;nt.LargeItemEntryAmountThreshold&&n.optimize()}}])&&Ct(n.prototype,r),t}(B);function Et(e,t){for(var n=0;n5&&void 0!==s[5]&&s[5],c.abrupt("return",new Promise((function(s,c){var u;return regeneratorRuntime.async((function(l){for(;;)switch(l.prev=l.next){case 0:if((u=new XMLHttpRequest).onreadystatechange=function(){if(4==u.readyState){var e=u.responseText;if(e)try{e=JSON.parse(e)}catch(e){}u.status>=200&&u.status<=299?o.$timeout((function(){r(e),s(e)})):(console.error("Request error:",e),o.$timeout((function(){i(e,u.status),c(e)})))}},"get"==e&&Object.keys(n).length>0&&(t=o.urlForUrlAndParams(t,n)),u.open(e,t,!0),u.setRequestHeader("Content-type","application/json"),!a){l.next=8;break}return l.next=8,regeneratorRuntime.awrap(o.setAuthHeadersForRequest(u));case 8:"post"==e||"patch"==e?u.send(JSON.stringify(n)):u.send();case 9:case"end":return l.stop()}}))})));case 2:case"end":return c.stop()}}))}},{key:"urlForUrlAndParams",value:function(e,t){var n=Object.keys(t).map((function(e){return e+"="+encodeURIComponent(t[e])})).join("&");return e.includes("?")?e+"&"+n:e+"?"+n}}]),e}();function Pt(e,t){for(var n=0;n=this.MaxDiscordanceBeforeOutOfSync&&(this.outOfSync||(this.outOfSync=!0,this.notifyEvent("enter-out-of-sync"))),n.abrupt("return",!1);case 13:return this.outOfSync&&(this.outOfSync=!1,this.notifyEvent("exit-out-of-sync")),this.syncDiscordance=0,n.abrupt("return",!0);case 16:case"end":return n.stop()}}),null,this)}},{key:"isOutOfSync",value:function(){return this.outOfSync}},{key:"getServerURL",value:function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,regeneratorRuntime.awrap(this.storageManager.getItem("server"));case 2:if(e.t0=e.sent,e.t0){e.next=5;break}e.t0=window._default_sf_server;case 5:return e.abrupt("return",e.t0);case 6:case"end":return e.stop()}}),null,this)}},{key:"getSyncURL",value:function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,regeneratorRuntime.awrap(this.getServerURL());case 2:return e.t0=e.sent,e.abrupt("return",e.t0+"/items/sync");case 4:case"end":return e.stop()}}),null,this)}},{key:"registerSyncStatusObserver",value:function(e){var t={key:new Date,callback:e};return this.syncStatusObservers.push(t),t}},{key:"removeSyncStatusObserver",value:function(e){Pe()(this.syncStatusObservers,e)}},{key:"syncStatusDidChange",value:function(){var e=this;this.syncStatusObservers.forEach((function(t){t.callback(e.syncStatus)}))}},{key:"addEventHandler",value:function(e){return this.eventHandlers.push(e),e}},{key:"removeEventHandler",value:function(e){Pe()(this.eventHandlers,e)}},{key:"notifyEvent",value:function(e,t){var n=!0,r=!1,i=void 0;try{for(var a,o=this.eventHandlers[Symbol.iterator]();!(n=(a=o.next()).done);n=!0)(0,a.value)(e,t||{})}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}},{key:"setKeyRequestHandler",value:function(e){this.keyRequestHandler=e}},{key:"getActiveKeyInfo",value:function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.keyRequestHandler(e));case 1:case"end":return t.stop()}}),null,this)}},{key:"initialDataLoaded",value:function(){return!0===this._initialDataLoaded}},{key:"_sortLocalItems",value:function(e){var t=this;return e.sort((function(e,n){var r=new Date(n.updated_at)-new Date(e.updated_at),i=t.contentTypeLoadPriority,a=0,o=0;return i&&(a=i.indexOf(e.content_type),o=i.indexOf(n.content_type),-1==a&&(a=i.length),-1==o&&(o=i.length)),a==o?r:a0&&void 0!==s[0]?s[0]:{},n=t.incrementalCallback,r=t.batchSize,!(i=t.options)||!i.simulateHighLatency){c.next=5;break}return a=i.simulatedLatency||1e3,c.next=5,regeneratorRuntime.awrap(this._awaitSleep(a));case 5:if(!this.loadLocalDataPromise){c.next=7;break}return c.abrupt("return",this.loadLocalDataPromise);case 7:return r||(r=100),this.loadLocalDataPromise=this.storageManager.getAllModels().then((function(t){var i=(t=(t=o._sortLocalItems(t)).filter((function(e){var t=o.modelManager.findItem(e.uuid);return!t||new Date(e.dirtiedDate)>t.dirtiedDate}))).length,a=0,s=[];return function c(){var u,l;return regeneratorRuntime.async((function(f){for(;;)switch(f.prev=f.next){case 0:return u=t.slice(a,a+r),f.next=3,regeneratorRuntime.awrap(o.handleItemsResponse(u,null,bt.MappingSourceLocalRetrieved,e.KeyRequestLoadLocal));case 3:if(l=f.sent,s.push(l),!((a+=u.length)0)){m.next=23;break}return m.next=23,regeneratorRuntime.awrap(Promise.all(s.map((function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",r.storageManager.deleteModel(e));case 1:case"end":return t.stop()}}))}))));case 23:return m.next=25,regeneratorRuntime.awrap(r.getActiveKeyInfo(e.KeyRequestSaveLocal));case 25:if(h=m.sent,!(o.length>0)){m.next=33;break}return m.next=29,regeneratorRuntime.awrap(Promise.all(o.map((function(e){var t;return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:return t=new G(e,h.keys,h.auth_params),r.next=3,regeneratorRuntime.awrap(t.paramsForLocalStorage());case 3:return t=r.sent,n&&delete t.dirty,r.abrupt("return",t);case 6:case"end":return r.stop()}}))}))).catch((function(e){return a(e)})));case 29:return v=m.sent,m.next=32,regeneratorRuntime.awrap(r.storageManager.saveModels(v).catch((function(e){console.error("Error writing items",e),r.syncStatus.localError=e,r.syncStatusDidChange(),a()})));case 32:r.syncStatus.localError&&(r.syncStatus.localError=null,r.syncStatusDidChange());case 33:i();case 34:case"end":return m.stop()}}),null,null,[[4,8,12,20],[13,,15,19]])})));case 3:case"end":return i.stop()}}))}},{key:"syncOffline",value:function(e){var t,n,r,i,a,o=this;return regeneratorRuntime.async((function(s){for(;;)switch(s.prev=s.next){case 0:for(t=!0,n=!1,r=void 0,s.prev=3,i=e[Symbol.iterator]();!(t=(a=i.next()).done);t=!0)a.value.updated_at=new Date;s.next=11;break;case 7:s.prev=7,s.t0=s.catch(3),n=!0,r=s.t0;case 11:s.prev=11,s.prev=12,t||null==i.return||i.return();case 14:if(s.prev=14,!n){s.next=17;break}throw r;case 17:return s.finish(14);case 18:return s.finish(11);case 19:return s.abrupt("return",this.writeItemsToLocalStorage(e,!0).then((function(t){var n=!0,r=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var c=a.value;c.deleted&&o.modelManager.removeItemLocally(c)}}catch(e){r=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw i}}return o.modelManager.clearDirtyItems(e),o.modelManager.didSyncModelsOffline(e),o.notifyEvent("sync:completed",{savedItems:e}),{saved_items:e}})));case 20:case"end":return s.stop()}}),null,this,[[3,7,11,19],[12,,14,18]])}},{key:"markAllItemsDirtyAndSaveOffline",value:function(e){var t,n,r,i,a,o,s,c,u,l,f,p,d;return regeneratorRuntime.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(!e){h.next=28;break}t=this.modelManager.allNondummyItems.filter((function(e){return!e.errorDecrypting})).slice(),n=!0,r=!1,i=void 0,h.prev=5,a=t[Symbol.iterator]();case 7:if(n=(o=a.next()).done){h.next=14;break}return s=o.value,h.next=11,regeneratorRuntime.awrap(this.modelManager.alternateUUIDForItem(s));case 11:n=!0,h.next=7;break;case 14:h.next=20;break;case 16:h.prev=16,h.t0=h.catch(5),r=!0,i=h.t0;case 20:h.prev=20,h.prev=21,n||null==a.return||a.return();case 23:if(h.prev=23,!r){h.next=26;break}throw i;case 26:return h.finish(23);case 27:return h.finish(20);case 28:for(c=this.modelManager.allNondummyItems,u=!0,l=!1,f=void 0,h.prev=32,p=c[Symbol.iterator]();!(u=(d=p.next()).done);u=!0)d.value.setDirty(!0);h.next=40;break;case 36:h.prev=36,h.t1=h.catch(32),l=!0,f=h.t1;case 40:h.prev=40,h.prev=41,u||null==p.return||p.return();case 43:if(h.prev=43,!l){h.next=46;break}throw f;case 46:return h.finish(43);case 47:return h.finish(40);case 48:return h.abrupt("return",this.writeItemsToLocalStorage(c,!1));case 49:case"end":return h.stop()}}),null,this,[[5,16,20,28],[21,,23,27],[32,36,40,48],[41,,43,47]])}},{key:"setSyncToken",value:function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return this._syncToken=e,t.next=3,regeneratorRuntime.awrap(this.storageManager.setItem("syncToken",e));case 3:case"end":return t.stop()}}),null,this)}},{key:"getSyncToken",value:function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._syncToken){e.next=4;break}return e.next=3,regeneratorRuntime.awrap(this.storageManager.getItem("syncToken"));case 3:this._syncToken=e.sent;case 4:return e.abrupt("return",this._syncToken);case 5:case"end":return e.stop()}}),null,this)}},{key:"setCursorToken",value:function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._cursorToken=e,!e){t.next=6;break}return t.next=4,regeneratorRuntime.awrap(this.storageManager.setItem("cursorToken",e));case 4:t.next=8;break;case 6:return t.next=8,regeneratorRuntime.awrap(this.storageManager.removeItem("cursorToken"));case 8:case"end":return t.stop()}}),null,this)}},{key:"getCursorToken",value:function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._cursorToken){e.next=4;break}return e.next=3,regeneratorRuntime.awrap(this.storageManager.getItem("cursorToken"));case 3:this._cursorToken=e.sent;case 4:return e.abrupt("return",this._cursorToken);case 5:case"end":return e.stop()}}),null,this)}},{key:"clearQueuedCallbacks",value:function(){this._queuedCallbacks=[]}},{key:"callQueuedCallbacks",value:function(e){var t=this.queuedCallbacks;if(t.length){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0)(0,a.value)(e)}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}this.clearQueuedCallbacks()}}},{key:"beginCheckingIfSyncIsTakingTooLong",value:function(){this.syncStatus.checker&&this.stopCheckingIfSyncIsTakingTooLong(),this.syncStatus.checker=this.$interval(function(){(new Date-this.syncStatus.syncStart)/1e3>5&&(this.notifyEvent("sync:taking-too-long"),this.stopCheckingIfSyncIsTakingTooLong())}.bind(this),500)}},{key:"stopCheckingIfSyncIsTakingTooLong",value:function(){this.$interval.hasOwnProperty("cancel")?this.$interval.cancel(this.syncStatus.checker):clearInterval(this.syncStatus.checker),this.syncStatus.checker=null}},{key:"lockSyncing",value:function(){this.syncLocked=!0}},{key:"unlockSyncing",value:function(){this.syncLocked=!1}},{key:"sync",value:function(){var t,n=this,r=arguments;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:if(t=r.length>0&&void 0!==r[0]?r[0]:{},!this.syncLocked){i.next=4;break}return console.log("Sync Locked, Returning;"),i.abrupt("return");case 4:return i.abrupt("return",new Promise((function(r,i){var a,o,s,c,u,l,f,p,d,h,v,m,y,g;return regeneratorRuntime.async((function(i){for(;;)switch(i.prev=i.next){case 0:return t||(t={}),a=n.modelManager.getDirtyItems(),o=a.filter((function(e){return!n.lastDirtyItemsSave||e.dirtiedDate>n.lastDirtyItemsSave})),i.next=5,regeneratorRuntime.awrap(n.getActiveKeyInfo(e.KeyRequestLoadSaveAccount));case 5:if(s=i.sent,c=n.syncStatus.syncOpInProgress,u=n.initialDataLoaded(),!c&&u){i.next=16;break}return n.performSyncAgainOnCompletion=!0,n.lastDirtyItemsSave=new Date,i.next=13,regeneratorRuntime.awrap(n.writeItemsToLocalStorage(o,!1));case 13:return c&&(n.queuedCallbacks.push(r),n.loggingEnabled&&console.warn("Attempting to sync while existing sync is in progress.")),u||(n.loggingEnabled&&console.warn("(1) Attempting to perform online sync before local data has loaded"),r()),i.abrupt("return");case 16:if(n.syncStatus.syncOpInProgress=!0,!s.offline){i.next=19;break}return i.abrupt("return",n.syncOffline(a).then((function(e){n.syncStatus.syncOpInProgress=!1,r(e)})).catch((function(e){n.notifyEvent("sync-exception",e)})));case 19:if(n.initialDataLoaded()){i.next=22;break}return console.error("Attempting to perform online sync before local data has loaded"),i.abrupt("return");case 22:return n.loggingEnabled&&console.log("Syncing online user."),l=n.syncStatus.needsMoreSync,n.syncStatus.syncStart=new Date,n.beginCheckingIfSyncIsTakingTooLong(),f=n.PerSyncItemUploadLimit,(p=a.slice(0,f)).lengthn.syncStatus.total&&(n.syncStatus.total=n.syncStatus.current),n.syncStatusDidChange(),i.next=34,regeneratorRuntime.awrap(n.writeItemsToLocalStorage(o,!1));case 34:return n.lastDirtyItemsSave=new Date,t.onPreSyncSave&&t.onPreSyncSave(),n.allRetreivedItems||(n.allRetreivedItems=[]),n.allSavedItems||(n.allSavedItems=[]),(d={}).limit=n.ServerItemDownloadLimit,t.performIntegrityCheck&&(d.compute_integrity=!0),i.prev=41,i.next=44,regeneratorRuntime.awrap(Promise.all(p.map((function(e){var n=new G(e,s.keys,s.auth_params);return n.additionalFields=t.additionalFields,n.paramsForSync()}))).then((function(e){d.items=e})));case 44:i.next=49;break;case 46:i.prev=46,i.t0=i.catch(41),n.notifyEvent("sync-exception",i.t0);case 49:for(h=!0,v=!1,m=void 0,i.prev=52,y=p[Symbol.iterator]();!(h=(g=y.next()).done);h=!0)g.value.dirtyCount=0;i.next=60;break;case 56:i.prev=56,i.t1=i.catch(52),v=!0,m=i.t1;case 60:i.prev=60,i.prev=61,h||null==y.return||y.return();case 63:if(i.prev=63,!v){i.next=66;break}throw m;case 66:return i.finish(63);case 67:return i.finish(60);case 68:return i.next=70,regeneratorRuntime.awrap(n.getSyncToken());case 70:return d.sync_token=i.sent,i.next=73,regeneratorRuntime.awrap(n.getCursorToken());case 73:return d.cursor_token=i.sent,d.api=Rt.getApiVersion(),n.loggingEnabled&&console.log("Syncing with params",d),i.prev=76,i.t2=n.httpManager,i.next=80,regeneratorRuntime.awrap(n.getSyncURL());case 80:i.t3=i.sent,i.t4=d,i.t5=function(e){n.handleSyncSuccess(p,e,t).then((function(){r(e)})).catch((function(e){console.log("Caught sync success exception:",e),n.handleSyncError(e,null,a).then((function(t){n.notifyEvent("sync-exception",e),r(t)}))}))},i.t6=function(e,t){n.handleSyncError(e,t,a).then((function(e){r(e)}))},i.t2.postAuthenticatedAbsolute.call(i.t2,i.t3,i.t4,i.t5,i.t6),i.next=90;break;case 87:i.prev=87,i.t7=i.catch(76),console.log("Sync exception caught:",i.t7);case 90:case"end":return i.stop()}}),null,null,[[41,46],[52,56,60,68],[61,,63,67],[76,87]])})));case 5:case"end":return i.stop()}}),null,this)}},{key:"_awaitSleep",value:function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return console.warn("Simulating high latency sync request",e),t.abrupt("return",new Promise((function(t,n){setTimeout((function(){t()}),e)})));case 2:case"end":return t.stop()}}))}},{key:"handleSyncSuccess",value:function(t,n,r){var i,a,o,s,c,u,l,f,p,d,h,v,m,y,g,b,k,w,x,S,$,_,M,A,O,I,E,D=this;return regeneratorRuntime.async((function(R){for(;;)switch(R.prev=R.next){case 0:if(!r.simulateHighLatency){R.next=4;break}return i=r.simulatedLatency||1e3,R.next=4,regeneratorRuntime.awrap(this._awaitSleep(i));case 4:for(this.syncStatus.error=null,this.loggingEnabled&&console.log("Sync response",n),a=this.allSavedItems.map((function(e){return e.uuid})),o=n.saved_items.map((function(e){return e.uuid})),s=[],n.retrieved_items=n.retrieved_items.filter((function(e){var t=a.includes(e.uuid),n=o.includes(e.uuid);if(t||n)return s.push(e),!1;var r=D.modelManager.findItem(e.uuid);return!r||!r.dirty||(s.push(e),!1)})),c=[],u=!0,l=!1,f=void 0,R.prev=14,p=t[Symbol.iterator]();!(u=(d=p.next()).done);u=!0)0==(h=d.value).dirtyCount&&c.push(h);R.next=22;break;case 18:R.prev=18,R.t0=R.catch(14),l=!0,f=R.t0;case 22:R.prev=22,R.prev=23,u||null==p.return||p.return();case 25:if(R.prev=25,!l){R.next=28;break}throw f;case 28:return R.finish(25);case 29:return R.finish(22);case 30:if(this.modelManager.clearDirtyItems(c),v=[],!(s.length>0)){R.next=72;break}return R.next=35,regeneratorRuntime.awrap(this.getActiveKeyInfo(e.KeyRequestLoadSaveAccount));case 35:return m=R.sent.keys,R.next=38,regeneratorRuntime.awrap(C.decryptMultipleItems(s,m));case 38:y=!0,g=!1,b=void 0,R.prev=41,k=s[Symbol.iterator]();case 43:if(y=(w=k.next()).done){R.next=58;break}if(x=w.value,S=this.modelManager.findItem(x.uuid),$=JSON.parse(x.content),S&&$){R.next=49;break}return R.abrupt("continue",55);case 49:if(!S||S.isContentEqualWithNonItemContent($)){R.next=55;break}return R.next=52,regeneratorRuntime.awrap(this.modelManager.createDuplicateItemFromResponseItem(x));case 52:_=R.sent,this.modelManager.addDuplicatedItemAsConflict({duplicate:_,duplicateOf:S}),v.push(_);case 55:y=!0,R.next=43;break;case 58:R.next=64;break;case 60:R.prev=60,R.t1=R.catch(41),g=!0,b=R.t1;case 64:R.prev=64,R.prev=65,y||null==k.return||k.return();case 67:if(R.prev=67,!g){R.next=70;break}throw b;case 70:return R.finish(67);case 71:return R.finish(64);case 72:return R.next=74,regeneratorRuntime.awrap(this.handleItemsResponse(n.retrieved_items,null,bt.MappingSourceRemoteRetrieved,e.KeyRequestLoadSaveAccount));case 74:return M=R.sent,this.allRetreivedItems=this.allRetreivedItems.concat(M),this.syncStatus.retrievedCount=this.allRetreivedItems.length,A=["content","auth_hash"],R.next=80,regeneratorRuntime.awrap(this.handleItemsResponse(n.saved_items,A,bt.MappingSourceRemoteSaved,e.KeyRequestLoadSaveAccount));case 80:return O=R.sent,this.allSavedItems=this.allSavedItems.concat(O),I=n.unsaved,R.next=85,regeneratorRuntime.awrap(this.deprecated_handleUnsavedItemsResponse(I));case 85:return R.next=87,regeneratorRuntime.awrap(this.handleConflictsResponse(n.conflicts));case 87:if(R.t2=R.sent,R.t2){R.next=90;break}R.t2=[];case 90:if(E=R.t2,!((v=v.concat(E)).length>0)){R.next=95;break}return R.next=95,regeneratorRuntime.awrap(this.writeItemsToLocalStorage(v,!1));case 95:return R.next=97,regeneratorRuntime.awrap(this.writeItemsToLocalStorage(O,!1));case 97:return R.next=99,regeneratorRuntime.awrap(this.writeItemsToLocalStorage(M,!1));case 99:if(!n.integrity_hash||n.cursor_token){R.next=104;break}return R.next=102,regeneratorRuntime.awrap(this.handleServerIntegrityHash(n.integrity_hash));case 102:R.sent||this.syncDiscordance0)){R.next=122;break}return this.performSyncAgainOnCompletion=!1,R.abrupt("return",new Promise((function(e,t){setTimeout((function(){D.sync(r).then(e)}),10)})));case 122:return this.syncStatus.retrievedCount=0,this.syncStatus.current=0,this.syncStatus.total=0,this.syncStatusDidChange(),(this.allRetreivedItems.length>=this.majorDataChangeThreshold||O.length>=this.majorDataChangeThreshold||I&&I.length>=this.majorDataChangeThreshold||v&&v.length>=this.majorDataChangeThreshold)&&this.notifyEvent("major-data-change"),this.callQueuedCallbacks(n),this.notifyEvent("sync:completed",{retrievedItems:this.allRetreivedItems,savedItems:this.allSavedItems}),this.allRetreivedItems=[],this.allSavedItems=[],this.performSyncAgainOnCompletion&&(this.performSyncAgainOnCompletion=!1,setTimeout((function(){D.sync(r)}),10)),R.abrupt("return",n);case 133:case"end":return R.stop()}}),null,this,[[14,18,22,30],[23,,25,29],[41,60,64,72],[65,,67,71]])}},{key:"handleSyncError",value:function(e,t,n){return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:return console.log("Sync error: ",e),401==t&&this.notifyEvent("sync-session-invalid"),e?"string"==typeof e&&(e={error:{message:e}}):e={error:{message:"Could not connect to server."}},this.syncStatus.syncOpInProgress=!1,this.syncStatus.error=e.error,this.syncStatusDidChange(),this.writeItemsToLocalStorage(n,!1),this.modelManager.didSyncModelsOffline(n),this.stopCheckingIfSyncIsTakingTooLong(),this.notifyEvent("sync:error",e.error),this.callQueuedCallbacks({error:"Sync error"}),r.abrupt("return",e);case 12:case"end":return r.stop()}}),null,this)}},{key:"handleItemsResponse",value:function(e,t,n,r){var i,a,o;return regeneratorRuntime.async((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,regeneratorRuntime.awrap(this.getActiveKeyInfo(r));case 2:return i=s.sent.keys,s.next=5,regeneratorRuntime.awrap(C.decryptMultipleItems(e,i));case 5:return s.next=7,regeneratorRuntime.awrap(this.modelManager.mapResponseItemsToLocalModelsOmittingFields(e,t,n));case 7:return a=s.sent,(o=a.filter((function(e){var t=e.errorDecryptingValueChanged;return e.errorDecryptingValueChanged=!1,t}))).length>0&&this.writeItemsToLocalStorage(o,!1),s.abrupt("return",a);case 11:case"end":return s.stop()}}),null,this)}},{key:"refreshErroredItems",value:function(){var t;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:if(!((t=this.modelManager.allNondummyItems.filter((function(e){return 1==e.errorDecrypting}))).length>0)){n.next=3;break}return n.abrupt("return",this.handleItemsResponse(t,null,bt.MappingSourceLocalRetrieved,e.KeyRequestLoadSaveAccount));case 3:case"end":return n.stop()}}),null,this)}},{key:"handleConflictsResponse",value:function(t){var n,r,i,a,o,s,c,u,l,f,p,d,h,v,m,y,g,b,k,w,x,S,$,_,M,A,O,I,E,D,R;return regeneratorRuntime.async((function(P){for(;;)switch(P.prev=P.next){case 0:if(t&&0!=t.length){P.next=2;break}return P.abrupt("return");case 2:this.loggingEnabled&&console.log("Handle Conflicted Items:",t),n={},r=!0,i=!1,a=void 0,P.prev=7,o=t[Symbol.iterator]();case 9:if(r=(s=o.next()).done){P.next=21;break}if(c=s.value,u=c.server_item||c.unsaved_item,l=this.modelManager.findItem(u.uuid)){P.next=16;break}return n[u.uuid]={},P.abrupt("continue",18);case 16:f=l.getContentCopy(),n[u.uuid]={frozenCurrentContent:f,itemRef:l};case 18:r=!0,P.next=9;break;case 21:P.next=27;break;case 23:P.prev=23,P.t0=P.catch(7),i=!0,a=P.t0;case 27:P.prev=27,P.prev=28,r||null==o.return||o.return();case 30:if(P.prev=30,!i){P.next=33;break}throw a;case 33:return P.finish(30);case 34:return P.finish(27);case 35:p=[],d=!0,h=!1,v=void 0,P.prev=39,m=t[Symbol.iterator]();case 41:if(d=(y=m.next()).done){P.next=93;break}return g=y.value,b=g.server_item||g.unsaved_item,P.t1=regeneratorRuntime,P.t2=C,P.t3=[b],P.next=49,regeneratorRuntime.awrap(this.getActiveKeyInfo(e.KeyRequestLoadSaveAccount));case 49:return P.t4=P.sent.keys,P.t5=P.t2.decryptMultipleItems.call(P.t2,P.t3,P.t4),P.next=53,P.t1.awrap.call(P.t1,P.t5);case 53:if(k=n[b.uuid],w=k.frozenCurrentContent,x=k.itemRef){P.next=56;break}return P.abrupt("continue",90);case 56:if(p.push(x),"uuid_conflict"!==g.type){P.next=64;break}return P.next=60,regeneratorRuntime.awrap(this.modelManager.alternateUUIDForItem(x));case 60:S=P.sent,p.push(S),P.next=90;break;case 64:if("sync_conflict"!==g.type){P.next=88;break}return P.next=67,regeneratorRuntime.awrap(this.modelManager.createDuplicateItemFromResponseItem(b));case 67:if($=P.sent,_=this.modelManager.duplicateItemWithCustomContent({content:w,duplicateOf:x}),M=!_.isItemContentEqualWith($),A=!x.isItemContentEqualWith($),O=!1,I=!1,E=!1,D=!1,b.deleted||x.deleted?D=!0:M?(new Date-x.client_updated_at)/1e3<20?(E=!0,I=!0):(O=!0,D=!0):A?SFItem.AreItemContentsEqual({leftContent:x.content,rightContent:$.content,keysToIgnore:x.keysToIgnoreWhenCheckingContentEquality().concat(["references"]),appDataKeysToIgnore:x.appDataKeysToIgnoreWhenCheckingContentEquality()})?E=!0:(O=!0,D=!0):D=!0,!O){P.next=81;break}return P.next=79,regeneratorRuntime.awrap(this.modelManager.duplicateItemWithCustomContentAndAddAsConflict({content:w,duplicateOf:x}));case 79:R=P.sent,p.push(R);case 81:if(I&&(this.modelManager.addDuplicatedItemAsConflict({duplicate:$,duplicateOf:x}),p.push($)),!D){P.next=85;break}return P.next=85,regeneratorRuntime.awrap(this.modelManager.mapResponseItemsToLocalModelsOmittingFields([b],null,bt.MappingSourceRemoteRetrieved));case 85:E&&(x.updated_at=$.updated_at,x.setDirty(!0)),P.next=90;break;case 88:return console.error("Unsupported conflict type",g.type),P.abrupt("continue",90);case 90:d=!0,P.next=41;break;case 93:P.next=99;break;case 95:P.prev=95,P.t6=P.catch(39),h=!0,v=P.t6;case 99:P.prev=99,P.prev=100,d||null==m.return||m.return();case 102:if(P.prev=102,!h){P.next=105;break}throw v;case 105:return P.finish(102);case 106:return P.finish(99);case 107:return P.abrupt("return",p);case 108:case"end":return P.stop()}}),null,this,[[7,23,27,35],[28,,30,34],[39,95,99,107],[100,,102,106]])}},{key:"deprecated_handleUnsavedItemsResponse",value:function(t){var n,r,i,a,o,s,c,u,l,f;return regeneratorRuntime.async((function(p){for(;;)switch(p.prev=p.next){case 0:if(t&&0!=t.length){p.next=2;break}return p.abrupt("return");case 2:this.loggingEnabled&&console.log("Handle Unsaved Items:",t),n=!0,r=!1,i=void 0,p.prev=6,a=t[Symbol.iterator]();case 8:if(n=(o=a.next()).done){p.next=37;break}return s=o.value,c=s.item,p.t0=regeneratorRuntime,p.t1=C,p.t2=[c],p.next=16,regeneratorRuntime.awrap(this.getActiveKeyInfo(e.KeyRequestLoadSaveAccount));case 16:return p.t3=p.sent.keys,p.t4=p.t1.decryptMultipleItems.call(p.t1,p.t2,p.t3),p.next=20,p.t0.awrap.call(p.t0,p.t4);case 20:if(u=this.modelManager.findItem(c.uuid)){p.next=23;break}return p.abrupt("continue",34);case 23:if("uuid_conflict"!==(l=s.error).tag){p.next=29;break}return p.next=27,regeneratorRuntime.awrap(this.modelManager.alternateUUIDForItem(u));case 27:p.next=34;break;case 29:if("sync_conflict"!==l.tag){p.next=34;break}return p.next=32,regeneratorRuntime.awrap(this.modelManager.createDuplicateItemFromResponseItem(c));case 32:f=p.sent,c.deleted||u.isItemContentEqualWith(f)||this.modelManager.addDuplicatedItemAsConflict({duplicate:f,duplicateOf:u});case 34:n=!0,p.next=8;break;case 37:p.next=43;break;case 39:p.prev=39,p.t5=p.catch(6),r=!0,i=p.t5;case 43:p.prev=43,p.prev=44,n||null==a.return||a.return();case 46:if(p.prev=46,!r){p.next=49;break}throw i;case 49:return p.finish(46);case 50:return p.finish(43);case 51:case"end":return p.stop()}}),null,this,[[6,39,43,51],[44,,46,50]])}},{key:"stateless_downloadAllItems",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise((function(r,i){var a;return regeneratorRuntime.async((function(o){for(;;)switch(o.prev=o.next){case 0:return a={limit:n.limit||500,sync_token:n.syncToken,cursor_token:n.cursorToken,content_type:n.contentType,event:n.event,api:Rt.getApiVersion()},o.prev=1,o.t0=t.httpManager,o.next=5,regeneratorRuntime.awrap(t.getSyncURL());case 5:o.t1=o.sent,o.t2=a,o.t3=function(i){var a,o;return regeneratorRuntime.async((function(s){for(;;)switch(s.prev=s.next){case 0:return n.retrievedItems||(n.retrievedItems=[]),a=i.retrieved_items,s.next=4,regeneratorRuntime.awrap(t.getActiveKeyInfo(e.KeyRequestLoadSaveAccount));case 4:return o=s.sent.keys,s.next=7,regeneratorRuntime.awrap(C.decryptMultipleItems(a,o));case 7:n.retrievedItems=n.retrievedItems.concat(a.map((function(e){return t.modelManager.createItem(e)}))),n.syncToken=i.sync_token,n.cursorToken=i.cursor_token,n.cursorToken?t.stateless_downloadAllItems(n).then(r):r(n.retrievedItems);case 11:case"end":return s.stop()}}))},o.t4=function(e,t){i(e)},o.t0.postAuthenticatedAbsolute.call(o.t0,o.t1,o.t2,o.t3,o.t4),o.next=16;break;case 12:o.prev=12,o.t5=o.catch(1),console.log("Download all items exception caught:",o.t5),i(o.t5);case 16:case"end":return o.stop()}}),null,null,[[1,12]])}))}},{key:"resolveOutOfSync",value:function(){var e=this;return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.stateless_downloadAllItems({event:"resolve-out-of-sync"}).then((function(t){var n,r,i,a,o,s,c,u;return regeneratorRuntime.async((function(l){for(;;)switch(l.prev=l.next){case 0:n=[],r=!0,i=!1,a=void 0,l.prev=4,o=t[Symbol.iterator]();case 6:if(r=(s=o.next()).done){l.next=18;break}if(c=s.value,!(u=e.modelManager.findItem(c.uuid))){l.next=14;break}if(c.isItemContentEqualWith(u)){l.next=14;break}return l.next=14,regeneratorRuntime.awrap(e.modelManager.duplicateItemAndAddAsConflict(u));case 14:n.push(c);case 15:r=!0,l.next=6;break;case 18:l.next=24;break;case 20:l.prev=20,l.t0=l.catch(4),i=!0,a=l.t0;case 24:l.prev=24,l.prev=25,r||null==o.return||o.return();case 27:if(l.prev=27,!i){l.next=30;break}throw a;case 30:return l.finish(27);case 31:return l.finish(24);case 32:return l.next=34,regeneratorRuntime.awrap(e.modelManager.mapResponseItemsToLocalModelsWithOptions({items:n,source:bt.MappingSourceRemoteRetrieved}));case 34:return l.next=36,regeneratorRuntime.awrap(e.writeItemsToLocalStorage(e.modelManager.allNondummyItems));case 36:return l.abrupt("return",e.sync({performIntegrityCheck:!0}));case 37:case"end":return l.stop()}}),null,null,[[4,20,24,32],[25,,27,31]])})));case 1:case"end":return t.stop()}}),null,this)}},{key:"handleSignout",value:function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return this.outOfSync=!1,this.loadLocalDataPromise=null,this.performSyncAgainOnCompletion=!1,this.syncStatus.syncOpInProgress=!1,this._queuedCallbacks=[],this.syncStatus={},e.abrupt("return",this.clearSyncToken());case 7:case"end":return e.stop()}}),null,this)}},{key:"clearSyncToken",value:function(){return regeneratorRuntime.async((function(e){for(;;)switch(e.prev=e.next){case 0:return this._syncToken=null,this._cursorToken=null,e.abrupt("return",this.storageManager.removeItem("syncToken"));case 3:case"end":return e.stop()}}),null,this)}},{key:"__setLocalDataNotLoaded",value:function(){this.loadLocalDataPromise=null,this._initialDataLoaded=!1}},{key:"queuedCallbacks",get:function(){return this._queuedCallbacks||(this._queuedCallbacks=[]),this._queuedCallbacks}}])&&jt(t.prototype,n),e}();function Nt(e,t){for(var n=0;n0||o.customHandler)){A.next=77;break}return A.next=75,regeneratorRuntime.awrap(this.runMigration(o,o.items));case 75:A.next=78;break;case 77:this.markMigrationCompleted(o);case 78:g=!0,A.next=70;break;case 81:A.next=87;break;case 83:A.prev=83,A.t3=A.catch(68),b=!0,k=A.t3;case 87:A.prev=87,A.prev=88,g||null==w.return||w.return();case 90:if(A.prev=90,!b){A.next=93;break}throw k;case 93:return A.finish(90);case 94:return A.finish(87);case 95:for(S=!0,$=!1,_=void 0,A.prev=98,M=this.completionHandlers[Symbol.iterator]();!(S=(C=M.next()).done);S=!0)(0,C.value)();A.next=106;break;case 102:A.prev=102,A.t4=A.catch(98),$=!0,_=A.t4;case 106:A.prev=106,A.prev=107,S||null==M.return||M.return();case 109:if(A.prev=109,!$){A.next=112;break}throw _;case 112:return A.finish(109);case 113:return A.finish(106);case 114:case"end":return A.stop()}}),null,this,[[6,10,14,22],[15,,17,21],[25,53,57,65],[32,36,40,48],[41,,43,47],[58,,60,64],[68,83,87,95],[88,,90,94],[98,102,106,114],[107,,109,113]])}},{key:"encode",value:function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",window.btoa(e));case 1:case"end":return t.stop()}}))}},{key:"decode",value:function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",window.atob(e));case 1:case"end":return t.stop()}}))}},{key:"getCompletedMigrations",value:function(){var e;return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._completed){t.next=5;break}return t.next=3,regeneratorRuntime.awrap(this.storageManager.getItem("migrations"));case 3:e=t.sent,this._completed=e?JSON.parse(e):[];case 5:return t.abrupt("return",this._completed);case 6:case"end":return t.stop()}}),null,this)}},{key:"getPendingMigrations",value:function(){var e,t,n,r,i,a,o,s;return regeneratorRuntime.async((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,regeneratorRuntime.awrap(this.getCompletedMigrations());case 2:e=c.sent,t=[],n=!0,r=!1,i=void 0,c.prev=7,a=this.migrations[Symbol.iterator]();case 9:if(n=(o=a.next()).done){c.next=22;break}return s=o.value,c.t0=e,c.next=14,regeneratorRuntime.awrap(this.encode(s.name));case 14:if(c.t1=c.sent,c.t2=c.t0.indexOf.call(c.t0,c.t1),c.t3=-1,c.t2!=c.t3){c.next=19;break}t.push(s);case 19:n=!0,c.next=9;break;case 22:c.next=28;break;case 24:c.prev=24,c.t4=c.catch(7),r=!0,i=c.t4;case 28:c.prev=28,c.prev=29,n||null==a.return||a.return();case 31:if(c.prev=31,!r){c.next=34;break}throw i;case 34:return c.finish(31);case 35:return c.finish(28);case 36:return c.abrupt("return",t);case 37:case"end":return c.stop()}}),null,this,[[7,24,28,36],[29,,31,35]])}},{key:"markMigrationCompleted",value:function(e){var t;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,regeneratorRuntime.awrap(this.getCompletedMigrations());case 2:return t=n.sent,n.t0=t,n.next=6,regeneratorRuntime.awrap(this.encode(e.name));case 6:n.t1=n.sent,n.t0.push.call(n.t0,n.t1),this.storageManager.setItem("migrations",JSON.stringify(t)),e.running=!1;case 10:case"end":return n.stop()}}),null,this)}},{key:"runMigration",value:function(e,t){var n=this;return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:if(!e.running){r.next=2;break}return r.abrupt("return");case 2:if(console.log("Running migration:",e.name),e.running=!0,!e.customHandler){r.next=8;break}return r.abrupt("return",e.customHandler().then((function(){n.markMigrationCompleted(e)})));case 8:return r.abrupt("return",e.handler(t).then((function(){n.markMigrationCompleted(e)})));case 9:case"end":return r.stop()}}))}}])&&zt(t.prototype,n),e}();function Wt(e,t){for(var n=0;n0);case 4:case"end":return t.stop()}}),null,this)}},{key:"actionRequiresPrivilege",value:function(e){var t;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,regeneratorRuntime.awrap(this.getSessionExpirey());case 2:if(!(n.sent>new Date)){n.next=5;break}return n.abrupt("return",!1);case 5:return n.next=7,regeneratorRuntime.awrap(this.netCredentialsForAction(e));case 7:return t=n.sent,n.abrupt("return",t.length>0);case 9:case"end":return n.stop()}}),null,this)}},{key:"savePrivileges",value:function(){var e;return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,regeneratorRuntime.awrap(this.getPrivileges());case 2:e=t.sent,this.modelManager.setItemDirty(e,!0),this.syncManager.sync();case 5:case"end":return t.stop()}}),null,this)}},{key:"authenticateAction",value:function(e,t){var n,r,i,a,o,s,c,u,l;return regeneratorRuntime.async((function(f){for(;;)switch(f.prev=f.next){case 0:return f.next=2,regeneratorRuntime.awrap(this.netCredentialsForAction(e));case 2:n=f.sent,r=[],i=[],a=!0,o=!1,s=void 0,f.prev=7,c=n[Symbol.iterator]();case 9:if(a=(u=c.next()).done){f.next=18;break}return l=u.value,f.next=13,regeneratorRuntime.awrap(this._verifyAuthenticationParameters(l,t[l]));case 13:f.sent?r.push(l):i.push(l);case 15:a=!0,f.next=9;break;case 18:f.next=24;break;case 20:f.prev=20,f.t0=f.catch(7),o=!0,s=f.t0;case 24:f.prev=24,f.prev=25,a||null==c.return||c.return();case 27:if(f.prev=27,!o){f.next=30;break}throw s;case 30:return f.finish(27);case 31:return f.finish(24);case 32:return f.abrupt("return",{success:0==i.length,successfulCredentials:r,failedCredentials:i});case 33:case"end":return f.stop()}}),null,this,[[7,20,24,32],[25,,27,31]])}},{key:"_verifyAuthenticationParameters",value:function(t,n){var r,i,a=this;return regeneratorRuntime.async((function(o){for(;;)switch(o.prev=o.next){case 0:if(r=function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",a.delegate.verifyAccountPassword(e));case 1:case"end":return t.stop()}}))},i=function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",a.delegate.verifyLocalPasscode(e));case 1:case"end":return t.stop()}}))},t!=e.CredentialAccountPassword){o.next=6;break}return o.abrupt("return",r(n));case 6:if(t!=e.CredentialLocalPasscode){o.next=8;break}return o.abrupt("return",i(n));case 8:case"end":return o.stop()}}))}}])&&qt(t.prototype,n),e}();function Gt(e,t){for(var n=0;n0){var s=n.modelManager.itemsMatchingPredicates(i);if(s.length>=2){var c=s.sort((function(e,t){return e.errorDecrypting?1:t.errorDecrypting?-1:e.created_at - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */(function(){var a="Expected a function",o="__lodash_placeholder__",s=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],c="[object Arguments]",u="[object Array]",l="[object Boolean]",f="[object Date]",p="[object Error]",d="[object Function]",h="[object GeneratorFunction]",v="[object Map]",m="[object Number]",y="[object Object]",g="[object RegExp]",b="[object Set]",k="[object String]",w="[object Symbol]",x="[object WeakMap]",S="[object ArrayBuffer]",$="[object DataView]",_="[object Float32Array]",M="[object Float64Array]",C="[object Int8Array]",A="[object Int16Array]",O="[object Int32Array]",I="[object Uint8Array]",E="[object Uint16Array]",D="[object Uint32Array]",R=/\b__p \+= '';/g,P=/\b(__p \+=) '' \+/g,T=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,F=/[&<>"']/g,N=RegExp(j.source),L=RegExp(F.source),U=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/[\\^$.*+?()[\]{}|]/g,q=RegExp(K.source),J=/^\s+|\s+$/g,G=/^\s+/,Y=/\s+$/,Z=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,X=/\{\n\/\* \[wrapped with (.+)\] \*/,Q=/,? & /,ee=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,te=/\\(\\)?/g,ne=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,re=/\w*$/,ie=/^[-+]0x[0-9a-f]+$/i,ae=/^0b[01]+$/i,oe=/^\[object .+?Constructor\]$/,se=/^0o[0-7]+$/i,ce=/^(?:0|[1-9]\d*)$/,ue=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,le=/($^)/,fe=/['\n\r\u2028\u2029\\]/g,pe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",de="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",he="[\\ud800-\\udfff]",ve="["+de+"]",me="["+pe+"]",ye="\\d+",ge="[\\u2700-\\u27bf]",be="[a-z\\xdf-\\xf6\\xf8-\\xff]",ke="[^\\ud800-\\udfff"+de+ye+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",we="\\ud83c[\\udffb-\\udfff]",xe="[^\\ud800-\\udfff]",Se="(?:\\ud83c[\\udde6-\\uddff]){2}",$e="[\\ud800-\\udbff][\\udc00-\\udfff]",_e="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Me="(?:"+be+"|"+ke+")",Ce="(?:"+_e+"|"+ke+")",Ae="(?:"+me+"|"+we+")"+"?",Oe="[\\ufe0e\\ufe0f]?"+Ae+("(?:\\u200d(?:"+[xe,Se,$e].join("|")+")[\\ufe0e\\ufe0f]?"+Ae+")*"),Ie="(?:"+[ge,Se,$e].join("|")+")"+Oe,Ee="(?:"+[xe+me+"?",me,Se,$e,he].join("|")+")",De=RegExp("['’]","g"),Re=RegExp(me,"g"),Pe=RegExp(we+"(?="+we+")|"+Ee+Oe,"g"),Te=RegExp([_e+"?"+be+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[ve,_e,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[ve,_e+Me,"$"].join("|")+")",_e+"?"+Me+"+(?:['’](?:d|ll|m|re|s|t|ve))?",_e+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ye,Ie].join("|"),"g"),je=RegExp("[\\u200d\\ud800-\\udfff"+pe+"\\ufe0e\\ufe0f]"),Fe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ne=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Le=-1,Ue={};Ue[_]=Ue[M]=Ue[C]=Ue[A]=Ue[O]=Ue[I]=Ue["[object Uint8ClampedArray]"]=Ue[E]=Ue[D]=!0,Ue[c]=Ue[u]=Ue[S]=Ue[l]=Ue[$]=Ue[f]=Ue[p]=Ue[d]=Ue[v]=Ue[m]=Ue[y]=Ue[g]=Ue[b]=Ue[k]=Ue[x]=!1;var Be={};Be[c]=Be[u]=Be[S]=Be[$]=Be[l]=Be[f]=Be[_]=Be[M]=Be[C]=Be[A]=Be[O]=Be[v]=Be[m]=Be[y]=Be[g]=Be[b]=Be[k]=Be[w]=Be[I]=Be["[object Uint8ClampedArray]"]=Be[E]=Be[D]=!0,Be[p]=Be[d]=Be[x]=!1;var He={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ze=parseFloat,Ve=parseInt,We="object"==typeof e&&e&&e.Object===Object&&e,Ke="object"==typeof self&&self&&self.Object===Object&&self,qe=We||Ke||Function("return this")(),Je=t&&!t.nodeType&&t,Ge=Je&&"object"==typeof r&&r&&!r.nodeType&&r,Ye=Ge&&Ge.exports===Je,Ze=Ye&&We.process,Xe=function(){try{var e=Ge&&Ge.require&&Ge.require("util").types;return e||Ze&&Ze.binding&&Ze.binding("util")}catch(e){}}(),Qe=Xe&&Xe.isArrayBuffer,et=Xe&&Xe.isDate,tt=Xe&&Xe.isMap,nt=Xe&&Xe.isRegExp,rt=Xe&&Xe.isSet,it=Xe&&Xe.isTypedArray;function at(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function ot(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i-1}function pt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Pt(e,t){for(var n=e.length;n--&&wt(t,e[n],0)>-1;);return n}function Tt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var jt=Mt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Ft=Mt({"&":"&","<":"<",">":">",'"':""","'":"'"});function Nt(e){return"\\"+He[e]}function Lt(e){return je.test(e)}function Ut(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Bt(e,t){return function(n){return e(t(n))}}function Ht(e,t){for(var n=-1,r=e.length,i=0,a=[];++n",""":'"',"'":"'"});var Jt=function e(t){var n,r=(t=null==t?qe:Jt.defaults(qe.Object(),t,Jt.pick(qe,Ne))).Array,i=t.Date,pe=t.Error,de=t.Function,he=t.Math,ve=t.Object,me=t.RegExp,ye=t.String,ge=t.TypeError,be=r.prototype,ke=de.prototype,we=ve.prototype,xe=t["__core-js_shared__"],Se=ke.toString,$e=we.hasOwnProperty,_e=0,Me=(n=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ce=we.toString,Ae=Se.call(ve),Oe=qe._,Ie=me("^"+Se.call($e).replace(K,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ee=Ye?t.Buffer:void 0,Pe=t.Symbol,je=t.Uint8Array,He=Ee?Ee.allocUnsafe:void 0,We=Bt(ve.getPrototypeOf,ve),Ke=ve.create,Je=we.propertyIsEnumerable,Ge=be.splice,Ze=Pe?Pe.isConcatSpreadable:void 0,Xe=Pe?Pe.iterator:void 0,gt=Pe?Pe.toStringTag:void 0,Mt=function(){try{var e=Qi(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),Gt=t.clearTimeout!==qe.clearTimeout&&t.clearTimeout,Yt=i&&i.now!==qe.Date.now&&i.now,Zt=t.setTimeout!==qe.setTimeout&&t.setTimeout,Xt=he.ceil,Qt=he.floor,en=ve.getOwnPropertySymbols,tn=Ee?Ee.isBuffer:void 0,nn=t.isFinite,rn=be.join,an=Bt(ve.keys,ve),on=he.max,sn=he.min,cn=i.now,un=t.parseInt,ln=he.random,fn=be.reverse,pn=Qi(t,"DataView"),dn=Qi(t,"Map"),hn=Qi(t,"Promise"),vn=Qi(t,"Set"),mn=Qi(t,"WeakMap"),yn=Qi(ve,"create"),gn=mn&&new mn,bn={},kn=Ma(pn),wn=Ma(dn),xn=Ma(hn),Sn=Ma(vn),$n=Ma(mn),_n=Pe?Pe.prototype:void 0,Mn=_n?_n.valueOf:void 0,Cn=_n?_n.toString:void 0;function An(e){if(Vo(e)&&!Ro(e)&&!(e instanceof Dn)){if(e instanceof En)return e;if($e.call(e,"__wrapped__"))return Ca(e)}return new En(e)}var On=function(){function e(){}return function(t){if(!zo(t))return{};if(Ke)return Ke(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function In(){}function En(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Dn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Rn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function Yn(e,t,n,r,i,a){var o,s=1&t,u=2&t,p=4&t;if(n&&(o=i?n(e,r,i,a):n(e)),void 0!==o)return o;if(!zo(e))return e;var x=Ro(e);if(x){if(o=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&$e.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!s)return yi(e,o)}else{var R=na(e),P=R==d||R==h;if(Fo(e))return fi(e,s);if(R==y||R==c||P&&!i){if(o=u||P?{}:ia(e),!s)return u?function(e,t){return gi(e,ta(e),t)}(e,function(e,t){return e&&gi(t,ws(t),e)}(o,e)):function(e,t){return gi(e,ea(e),t)}(e,Kn(o,e))}else{if(!Be[R])return i?e:{};o=function(e,t,n){var r=e.constructor;switch(t){case S:return pi(e);case l:case f:return new r(+e);case $:return function(e,t){var n=t?pi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case _:case M:case C:case A:case O:case I:case"[object Uint8ClampedArray]":case E:case D:return di(e,n);case v:return new r;case m:case k:return new r(e);case g:return function(e){var t=new e.constructor(e.source,re.exec(e));return t.lastIndex=e.lastIndex,t}(e);case b:return new r;case w:return i=e,Mn?ve(Mn.call(i)):{}}var i}(e,R,s)}}a||(a=new Fn);var T=a.get(e);if(T)return T;a.set(e,o),Go(e)?e.forEach((function(r){o.add(Yn(r,t,n,r,e,a))})):Wo(e)&&e.forEach((function(r,i){o.set(i,Yn(r,t,n,i,e,a))}));var j=x?void 0:(p?u?Ki:Wi:u?ws:ks)(e);return st(j||e,(function(r,i){j&&(r=e[i=r]),zn(o,i,Yn(r,t,n,i,e,a))})),o}function Zn(e,t,n){var r=n.length;if(null==e)return!r;for(e=ve(e);r--;){var i=n[r],a=t[i],o=e[i];if(void 0===o&&!(i in e)||!a(o))return!1}return!0}function Xn(e,t,n){if("function"!=typeof e)throw new ge(a);return ba((function(){e.apply(void 0,n)}),t)}function Qn(e,t,n,r){var i=-1,a=ft,o=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=dt(t,It(n))),r?(a=pt,o=!1):t.length>=200&&(a=Dt,o=!1,t=new jn(t));e:for(;++i-1},Pn.prototype.set=function(e,t){var n=this.__data__,r=Vn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Tn.prototype.clear=function(){this.size=0,this.__data__={hash:new Rn,map:new(dn||Pn),string:new Rn}},Tn.prototype.delete=function(e){var t=Zi(this,e).delete(e);return this.size-=t?1:0,t},Tn.prototype.get=function(e){return Zi(this,e).get(e)},Tn.prototype.has=function(e){return Zi(this,e).has(e)},Tn.prototype.set=function(e,t){var n=Zi(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},jn.prototype.add=jn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},jn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.clear=function(){this.__data__=new Pn,this.size=0},Fn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Fn.prototype.get=function(e){return this.__data__.get(e)},Fn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Pn){var r=n.__data__;if(!dn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Tn(r)}return n.set(e,t),this.size=n.size,this};var er=wi(cr),tr=wi(ur,!0);function nr(e,t){var n=!0;return er(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function rr(e,t,n){for(var r=-1,i=e.length;++r0&&n(s)?t>1?ar(s,t-1,n,r,i):ht(i,s):r||(i[i.length]=s)}return i}var or=xi(),sr=xi(!0);function cr(e,t){return e&&or(e,t,ks)}function ur(e,t){return e&&sr(e,t,ks)}function lr(e,t){return lt(t,(function(t){return Uo(e[t])}))}function fr(e,t){for(var n=0,r=(t=si(t,e)).length;null!=e&&nt}function vr(e,t){return null!=e&&$e.call(e,t)}function mr(e,t){return null!=e&&t in ve(e)}function yr(e,t,n){for(var i=n?pt:ft,a=e[0].length,o=e.length,s=o,c=r(o),u=1/0,l=[];s--;){var f=e[s];s&&t&&(f=dt(f,It(t))),u=sn(f.length,u),c[s]=!n&&(t||a>=120&&f.length>=120)?new jn(s&&f):void 0}f=e[0];var p=-1,d=c[0];e:for(;++p=s)return c;var u=n[r];return c*("desc"==u?-1:1)}}return e.index-t.index}(e,t,n)}))}function Rr(e,t,n){for(var r=-1,i=t.length,a={};++r-1;)s!==e&&Ge.call(s,c,1),Ge.call(e,c,1);return e}function Tr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;oa(i)?Ge.call(e,i,1):Qr(e,i)}}return e}function jr(e,t){return e+Qt(ln()*(t-e+1))}function Fr(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Qt(t/2))&&(e+=e)}while(t);return n}function Nr(e,t){return ka(ha(e,t,Ks),e+"")}function Lr(e){return Ln(Os(e))}function Ur(e,t){var n=Os(e);return Sa(n,Gn(t,0,n.length))}function Br(e,t,n,r){if(!zo(e))return e;for(var i=-1,a=(t=si(t,e)).length,o=a-1,s=e;null!=s&&++ia?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=r(a);++i>>1,o=e[a];null!==o&&!Zo(o)&&(n?o<=t:o=200){var u=t?null:Fi(e);if(u)return zt(u);o=!1,i=Dt,c=new jn}else c=t?[]:s;e:for(;++r=r?e:Wr(e,t,n)}var li=Gt||function(e){return qe.clearTimeout(e)};function fi(e,t){if(t)return e.slice();var n=e.length,r=He?He(n):new e.constructor(n);return e.copy(r),r}function pi(e){var t=new e.constructor(e.byteLength);return new je(t).set(new je(e)),t}function di(e,t){var n=t?pi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function hi(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,a=Zo(e),o=void 0!==t,s=null===t,c=t==t,u=Zo(t);if(!s&&!u&&!a&&e>t||a&&o&&c&&!s&&!u||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!u&&e1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,o&&sa(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=ve(t);++r-1?i[a?t[o]:o]:void 0}}function Ci(e){return Vi((function(t){var n=t.length,r=n,i=En.prototype.thru;for(e&&t.reverse();r--;){var o=t[r];if("function"!=typeof o)throw new ge(a);if(i&&!s&&"wrapper"==Ji(o))var s=new En([],!0)}for(r=s?r:n;++r1&&b.reverse(),f&&us))return!1;var u=a.get(e),l=a.get(t);if(u&&l)return u==t&&l==e;var f=-1,p=!0,d=2&n?new jn:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Z,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return st(s,(function(n){var r="_."+n[0];t&n[1]&&!ft(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(X);return t?t[1].split(Q):[]}(r),n)))}function xa(e){var t=0,n=0;return function(){var r=cn(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Sa(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,qa(e,n)}));function eo(e){var t=An(e);return t.__chain__=!0,t}function to(e,t){return t(e)}var no=Vi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return Jn(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Dn&&oa(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:to,args:[i],thisArg:void 0}),new En(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(i)}));var ro=bi((function(e,t,n){$e.call(e,n)?++e[n]:qn(e,n,1)}));var io=Mi(Ea),ao=Mi(Da);function oo(e,t){return(Ro(e)?st:er)(e,Yi(t,3))}function so(e,t){return(Ro(e)?ct:tr)(e,Yi(t,3))}var co=bi((function(e,t,n){$e.call(e,n)?e[n].push(t):qn(e,n,[t])}));var uo=Nr((function(e,t,n){var i=-1,a="function"==typeof t,o=To(e)?r(e.length):[];return er(e,(function(e){o[++i]=a?at(t,e,n):gr(e,t,n)})),o})),lo=bi((function(e,t,n){qn(e,n,t)}));function fo(e,t){return(Ro(e)?dt:Cr)(e,Yi(t,3))}var po=bi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var ho=Nr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&sa(e,t[0],t[1])?t=[]:n>2&&sa(t[0],t[1],t[2])&&(t=[t[0]]),Dr(e,ar(t,1),[])})),vo=Yt||function(){return qe.Date.now()};function mo(e,t,n){return t=n?void 0:t,Li(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function yo(e,t){var n;if("function"!=typeof t)throw new ge(a);return e=rs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var go=Nr((function(e,t,n){var r=1;if(n.length){var i=Ht(n,Gi(go));r|=32}return Li(e,r,t,n,i)})),bo=Nr((function(e,t,n){var r=3;if(n.length){var i=Ht(n,Gi(bo));r|=32}return Li(t,r,e,n,i)}));function ko(e,t,n){var r,i,o,s,c,u,l=0,f=!1,p=!1,d=!0;if("function"!=typeof e)throw new ge(a);function h(t){var n=r,a=i;return r=i=void 0,l=t,s=e.apply(a,n)}function v(e){return l=e,c=ba(y,t),f?h(e):s}function m(e){var n=e-u;return void 0===u||n>=t||n<0||p&&e-l>=o}function y(){var e=vo();if(m(e))return g(e);c=ba(y,function(e){var n=t-(e-u);return p?sn(n,o-(e-l)):n}(e))}function g(e){return c=void 0,d&&r?h(e):(r=i=void 0,s)}function b(){var e=vo(),n=m(e);if(r=arguments,i=this,u=e,n){if(void 0===c)return v(u);if(p)return li(c),c=ba(y,t),h(u)}return void 0===c&&(c=ba(y,t)),s}return t=as(t)||0,zo(n)&&(f=!!n.leading,o=(p="maxWait"in n)?on(as(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),b.cancel=function(){void 0!==c&&li(c),l=0,r=u=i=c=void 0},b.flush=function(){return void 0===c?s:g(vo())},b}var wo=Nr((function(e,t){return Xn(e,1,t)})),xo=Nr((function(e,t,n){return Xn(e,as(t)||0,n)}));function So(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(a);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(So.Cache||Tn),n}function $o(e){if("function"!=typeof e)throw new ge(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}So.Cache=Tn;var _o=ci((function(e,t){var n=(t=1==t.length&&Ro(t[0])?dt(t[0],It(Yi())):dt(ar(t,1),It(Yi()))).length;return Nr((function(r){for(var i=-1,a=sn(r.length,n);++i=t})),Do=br(function(){return arguments}())?br:function(e){return Vo(e)&&$e.call(e,"callee")&&!Je.call(e,"callee")},Ro=r.isArray,Po=Qe?It(Qe):function(e){return Vo(e)&&dr(e)==S};function To(e){return null!=e&&Ho(e.length)&&!Uo(e)}function jo(e){return Vo(e)&&To(e)}var Fo=tn||ac,No=et?It(et):function(e){return Vo(e)&&dr(e)==f};function Lo(e){if(!Vo(e))return!1;var t=dr(e);return t==p||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!qo(e)}function Uo(e){if(!zo(e))return!1;var t=dr(e);return t==d||t==h||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Bo(e){return"number"==typeof e&&e==rs(e)}function Ho(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function zo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Vo(e){return null!=e&&"object"==typeof e}var Wo=tt?It(tt):function(e){return Vo(e)&&na(e)==v};function Ko(e){return"number"==typeof e||Vo(e)&&dr(e)==m}function qo(e){if(!Vo(e)||dr(e)!=y)return!1;var t=We(e);if(null===t)return!0;var n=$e.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Se.call(n)==Ae}var Jo=nt?It(nt):function(e){return Vo(e)&&dr(e)==g};var Go=rt?It(rt):function(e){return Vo(e)&&na(e)==b};function Yo(e){return"string"==typeof e||!Ro(e)&&Vo(e)&&dr(e)==k}function Zo(e){return"symbol"==typeof e||Vo(e)&&dr(e)==w}var Xo=it?It(it):function(e){return Vo(e)&&Ho(e.length)&&!!Ue[dr(e)]};var Qo=Pi(Mr),es=Pi((function(e,t){return e<=t}));function ts(e){if(!e)return[];if(To(e))return Yo(e)?Kt(e):yi(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=na(e);return(t==v?Ut:t==b?zt:Os)(e)}function ns(e){return e?(e=as(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function rs(e){var t=ns(e),n=t%1;return t==t?n?t-n:t:0}function is(e){return e?Gn(rs(e),0,4294967295):0}function as(e){if("number"==typeof e)return e;if(Zo(e))return NaN;if(zo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=zo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(J,"");var n=ae.test(e);return n||se.test(e)?Ve(e.slice(2),n?2:8):ie.test(e)?NaN:+e}function os(e){return gi(e,ws(e))}function ss(e){return null==e?"":Zr(e)}var cs=ki((function(e,t){if(fa(t)||To(t))gi(t,ks(t),e);else for(var n in t)$e.call(t,n)&&zn(e,n,t[n])})),us=ki((function(e,t){gi(t,ws(t),e)})),ls=ki((function(e,t,n,r){gi(t,ws(t),e,r)})),fs=ki((function(e,t,n,r){gi(t,ks(t),e,r)})),ps=Vi(Jn);var ds=Nr((function(e,t){e=ve(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&sa(t[0],t[1],i)&&(r=1);++n1),t})),gi(e,Ki(e),n),r&&(n=Yn(n,7,Hi));for(var i=t.length;i--;)Qr(n,t[i]);return n}));var _s=Vi((function(e,t){return null==e?{}:function(e,t){return Rr(e,t,(function(t,n){return ms(e,n)}))}(e,t)}));function Ms(e,t){if(null==e)return{};var n=dt(Ki(e),(function(e){return[e]}));return t=Yi(t),Rr(e,n,(function(e,n){return t(e,n[0])}))}var Cs=Ni(ks),As=Ni(ws);function Os(e){return null==e?[]:Et(e,ks(e))}var Is=$i((function(e,t,n){return t=t.toLowerCase(),e+(n?Es(t):t)}));function Es(e){return Ls(ss(e).toLowerCase())}function Ds(e){return(e=ss(e))&&e.replace(ue,jt).replace(Re,"")}var Rs=$i((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ps=$i((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Ts=Si("toLowerCase");var js=$i((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Fs=$i((function(e,t,n){return e+(n?" ":"")+Ls(t)}));var Ns=$i((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ls=Si("toUpperCase");function Us(e,t,n){return e=ss(e),void 0===(t=n?void 0:t)?function(e){return Fe.test(e)}(e)?function(e){return e.match(Te)||[]}(e):function(e){return e.match(ee)||[]}(e):e.match(t)||[]}var Bs=Nr((function(e,t){try{return at(e,void 0,t)}catch(e){return Lo(e)?e:new pe(e)}})),Hs=Vi((function(e,t){return st(t,(function(t){t=_a(t),qn(e,t,go(e[t],e))})),e}));function zs(e){return function(){return e}}var Vs=Ci(),Ws=Ci(!0);function Ks(e){return e}function qs(e){return Sr("function"==typeof e?e:Yn(e,1))}var Js=Nr((function(e,t){return function(n){return gr(n,e,t)}})),Gs=Nr((function(e,t){return function(n){return gr(e,n,t)}}));function Ys(e,t,n){var r=ks(t),i=lr(t,r);null!=n||zo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=lr(t,ks(t)));var a=!(zo(n)&&"chain"in n&&!n.chain),o=Uo(e);return st(i,(function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__),i=n.__actions__=yi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,ht([this.value()],arguments))})})),e}function Zs(){}var Xs=Ei(dt),Qs=Ei(ut),ec=Ei(yt);function tc(e){return ca(e)?_t(_a(e)):function(e){return function(t){return fr(t,e)}}(e)}var nc=Ri(),rc=Ri(!0);function ic(){return[]}function ac(){return!1}var oc=Ii((function(e,t){return e+t}),0),sc=ji("ceil"),cc=Ii((function(e,t){return e/t}),1),uc=ji("floor");var lc,fc=Ii((function(e,t){return e*t}),1),pc=ji("round"),dc=Ii((function(e,t){return e-t}),0);return An.after=function(e,t){if("function"!=typeof t)throw new ge(a);return e=rs(e),function(){if(--e<1)return t.apply(this,arguments)}},An.ary=mo,An.assign=cs,An.assignIn=us,An.assignInWith=ls,An.assignWith=fs,An.at=ps,An.before=yo,An.bind=go,An.bindAll=Hs,An.bindKey=bo,An.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ro(e)?e:[e]},An.chain=eo,An.chunk=function(e,t,n){t=(n?sa(e,t,n):void 0===t)?1:on(rs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=r(Xt(i/t));ai?0:i+n),(r=void 0===r||r>i?i:rs(r))<0&&(r+=i),r=n>r?0:is(r);n>>0)?(e=ss(e))&&("string"==typeof t||null!=t&&!Jo(t))&&!(t=Zr(t))&&Lt(e)?ui(Kt(e),0,n):e.split(t,n):[]},An.spread=function(e,t){if("function"!=typeof e)throw new ge(a);return t=null==t?0:on(rs(t),0),Nr((function(n){var r=n[t],i=ui(n,0,t);return r&&ht(i,r),at(e,this,i)}))},An.tail=function(e){var t=null==e?0:e.length;return t?Wr(e,1,t):[]},An.take=function(e,t,n){return e&&e.length?Wr(e,0,(t=n||void 0===t?1:rs(t))<0?0:t):[]},An.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?Wr(e,(t=r-(t=n||void 0===t?1:rs(t)))<0?0:t,r):[]},An.takeRightWhile=function(e,t){return e&&e.length?ti(e,Yi(t,3),!1,!0):[]},An.takeWhile=function(e,t){return e&&e.length?ti(e,Yi(t,3)):[]},An.tap=function(e,t){return t(e),e},An.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new ge(a);return zo(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ko(e,t,{leading:r,maxWait:t,trailing:i})},An.thru=to,An.toArray=ts,An.toPairs=Cs,An.toPairsIn=As,An.toPath=function(e){return Ro(e)?dt(e,_a):Zo(e)?[e]:yi($a(ss(e)))},An.toPlainObject=os,An.transform=function(e,t,n){var r=Ro(e),i=r||Fo(e)||Xo(e);if(t=Yi(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:zo(e)&&Uo(a)?On(We(e)):{}}return(i?st:cr)(e,(function(e,r,i){return t(n,e,r,i)})),n},An.unary=function(e){return mo(e,1)},An.union=za,An.unionBy=Va,An.unionWith=Wa,An.uniq=function(e){return e&&e.length?Xr(e):[]},An.uniqBy=function(e,t){return e&&e.length?Xr(e,Yi(t,2)):[]},An.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Xr(e,void 0,t):[]},An.unset=function(e,t){return null==e||Qr(e,t)},An.unzip=Ka,An.unzipWith=qa,An.update=function(e,t,n){return null==e?e:ei(e,t,oi(n))},An.updateWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:ei(e,t,oi(n),r)},An.values=Os,An.valuesIn=function(e){return null==e?[]:Et(e,ws(e))},An.without=Ja,An.words=Us,An.wrap=function(e,t){return Mo(oi(t),e)},An.xor=Ga,An.xorBy=Ya,An.xorWith=Za,An.zip=Xa,An.zipObject=function(e,t){return ii(e||[],t||[],zn)},An.zipObjectDeep=function(e,t){return ii(e||[],t||[],Br)},An.zipWith=Qa,An.entries=Cs,An.entriesIn=As,An.extend=us,An.extendWith=ls,Ys(An,An),An.add=oc,An.attempt=Bs,An.camelCase=Is,An.capitalize=Es,An.ceil=sc,An.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=as(n))==n?n:0),void 0!==t&&(t=(t=as(t))==t?t:0),Gn(as(e),t,n)},An.clone=function(e){return Yn(e,4)},An.cloneDeep=function(e){return Yn(e,5)},An.cloneDeepWith=function(e,t){return Yn(e,5,t="function"==typeof t?t:void 0)},An.cloneWith=function(e,t){return Yn(e,4,t="function"==typeof t?t:void 0)},An.conformsTo=function(e,t){return null==t||Zn(e,t,ks(t))},An.deburr=Ds,An.defaultTo=function(e,t){return null==e||e!=e?t:e},An.divide=cc,An.endsWith=function(e,t,n){e=ss(e),t=Zr(t);var r=e.length,i=n=void 0===n?r:Gn(rs(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},An.eq=Oo,An.escape=function(e){return(e=ss(e))&&L.test(e)?e.replace(F,Ft):e},An.escapeRegExp=function(e){return(e=ss(e))&&q.test(e)?e.replace(K,"\\$&"):e},An.every=function(e,t,n){var r=Ro(e)?ut:nr;return n&&sa(e,t,n)&&(t=void 0),r(e,Yi(t,3))},An.find=io,An.findIndex=Ea,An.findKey=function(e,t){return bt(e,Yi(t,3),cr)},An.findLast=ao,An.findLastIndex=Da,An.findLastKey=function(e,t){return bt(e,Yi(t,3),ur)},An.floor=uc,An.forEach=oo,An.forEachRight=so,An.forIn=function(e,t){return null==e?e:or(e,Yi(t,3),ws)},An.forInRight=function(e,t){return null==e?e:sr(e,Yi(t,3),ws)},An.forOwn=function(e,t){return e&&cr(e,Yi(t,3))},An.forOwnRight=function(e,t){return e&&ur(e,Yi(t,3))},An.get=vs,An.gt=Io,An.gte=Eo,An.has=function(e,t){return null!=e&&ra(e,t,vr)},An.hasIn=ms,An.head=Pa,An.identity=Ks,An.includes=function(e,t,n,r){e=To(e)?e:Os(e),n=n&&!r?rs(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),Yo(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&wt(e,t,n)>-1},An.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:rs(n);return i<0&&(i=on(r+i,0)),wt(e,t,i)},An.inRange=function(e,t,n){return t=ns(t),void 0===n?(n=t,t=0):n=ns(n),function(e,t,n){return e>=sn(t,n)&&e=-9007199254740991&&e<=9007199254740991},An.isSet=Go,An.isString=Yo,An.isSymbol=Zo,An.isTypedArray=Xo,An.isUndefined=function(e){return void 0===e},An.isWeakMap=function(e){return Vo(e)&&na(e)==x},An.isWeakSet=function(e){return Vo(e)&&"[object WeakSet]"==dr(e)},An.join=function(e,t){return null==e?"":rn.call(e,t)},An.kebabCase=Rs,An.last=Na,An.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=rs(n))<0?on(r+i,0):sn(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):kt(e,St,i,!0)},An.lowerCase=Ps,An.lowerFirst=Ts,An.lt=Qo,An.lte=es,An.max=function(e){return e&&e.length?rr(e,Ks,hr):void 0},An.maxBy=function(e,t){return e&&e.length?rr(e,Yi(t,2),hr):void 0},An.mean=function(e){return $t(e,Ks)},An.meanBy=function(e,t){return $t(e,Yi(t,2))},An.min=function(e){return e&&e.length?rr(e,Ks,Mr):void 0},An.minBy=function(e,t){return e&&e.length?rr(e,Yi(t,2),Mr):void 0},An.stubArray=ic,An.stubFalse=ac,An.stubObject=function(){return{}},An.stubString=function(){return""},An.stubTrue=function(){return!0},An.multiply=fc,An.nth=function(e,t){return e&&e.length?Er(e,rs(t)):void 0},An.noConflict=function(){return qe._===this&&(qe._=Oe),this},An.noop=Zs,An.now=vo,An.pad=function(e,t,n){e=ss(e);var r=(t=rs(t))?Wt(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Di(Qt(i),n)+e+Di(Xt(i),n)},An.padEnd=function(e,t,n){e=ss(e);var r=(t=rs(t))?Wt(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var i=ln();return sn(e+i*(t-e+ze("1e-"+((i+"").length-1))),t)}return jr(e,t)},An.reduce=function(e,t,n){var r=Ro(e)?vt:Ct,i=arguments.length<3;return r(e,Yi(t,4),n,i,er)},An.reduceRight=function(e,t,n){var r=Ro(e)?mt:Ct,i=arguments.length<3;return r(e,Yi(t,4),n,i,tr)},An.repeat=function(e,t,n){return t=(n?sa(e,t,n):void 0===t)?1:rs(t),Fr(ss(e),t)},An.replace=function(){var e=arguments,t=ss(e[0]);return e.length<3?t:t.replace(e[1],e[2])},An.result=function(e,t,n){var r=-1,i=(t=si(t,e)).length;for(i||(i=1,e=void 0);++r9007199254740991)return[];var n=4294967295,r=sn(e,4294967295);e-=4294967295;for(var i=Ot(r,t=Yi(t));++n=a)return e;var s=n-Wt(r);if(s<1)return r;var c=o?ui(o,0,s).join(""):e.slice(0,s);if(void 0===i)return c+r;if(o&&(s+=c.length-s),Jo(i)){if(e.slice(s).search(i)){var u,l=c;for(i.global||(i=me(i.source,ss(re.exec(i))+"g")),i.lastIndex=0;u=i.exec(l);)var f=u.index;c=c.slice(0,void 0===f?s:f)}}else if(e.indexOf(Zr(i),s)!=s){var p=c.lastIndexOf(i);p>-1&&(c=c.slice(0,p))}return c+r},An.unescape=function(e){return(e=ss(e))&&N.test(e)?e.replace(j,qt):e},An.uniqueId=function(e){var t=++_e;return ss(e)+t},An.upperCase=Ns,An.upperFirst=Ls,An.each=oo,An.eachRight=so,An.first=Pa,Ys(An,(lc={},cr(An,(function(e,t){$e.call(An.prototype,t)||(lc[t]=e)})),lc),{chain:!1}),An.VERSION="4.17.19",st(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){An[e].placeholder=An})),st(["drop","take"],(function(e,t){Dn.prototype[e]=function(n){n=void 0===n?1:on(rs(n),0);var r=this.__filtered__&&!t?new Dn(this):this.clone();return r.__filtered__?r.__takeCount__=sn(n,r.__takeCount__):r.__views__.push({size:sn(n,4294967295),type:e+(r.__dir__<0?"Right":"")}),r},Dn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),st(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Dn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Yi(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),st(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Dn.prototype[e]=function(){return this[n](1).value()[0]}})),st(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Dn.prototype[e]=function(){return this.__filtered__?new Dn(this):this[n](1)}})),Dn.prototype.compact=function(){return this.filter(Ks)},Dn.prototype.find=function(e){return this.filter(e).head()},Dn.prototype.findLast=function(e){return this.reverse().find(e)},Dn.prototype.invokeMap=Nr((function(e,t){return"function"==typeof e?new Dn(this):this.map((function(n){return gr(n,e,t)}))})),Dn.prototype.reject=function(e){return this.filter($o(Yi(e)))},Dn.prototype.slice=function(e,t){e=rs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Dn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=rs(t))<0?n.dropRight(-t):n.take(t-e)),n)},Dn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Dn.prototype.toArray=function(){return this.take(4294967295)},cr(Dn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=An[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);i&&(An.prototype[t]=function(){var t=this.__wrapped__,o=r?[1]:arguments,s=t instanceof Dn,c=o[0],u=s||Ro(t),l=function(e){var t=i.apply(An,ht([e],o));return r&&f?t[0]:t};u&&n&&"function"==typeof c&&1!=c.length&&(s=u=!1);var f=this.__chain__,p=!!this.__actions__.length,d=a&&!f,h=s&&!p;if(!a&&u){t=h?t:new Dn(this);var v=e.apply(t,o);return v.__actions__.push({func:to,args:[l],thisArg:void 0}),new En(v,f)}return d&&h?e.apply(this,o):(v=this.thru(l),d?r?v.value()[0]:v.value():v)})})),st(["pop","push","shift","sort","splice","unshift"],(function(e){var t=be[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);An.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ro(i)?i:[],e)}return this[n]((function(n){return t.apply(Ro(n)?n:[],e)}))}})),cr(Dn.prototype,(function(e,t){var n=An[t];if(n){var r=n.name+"";$e.call(bn,r)||(bn[r]=[]),bn[r].push({name:t,func:n})}})),bn[Ai(void 0,2).name]=[{name:"wrapper",func:void 0}],Dn.prototype.clone=function(){var e=new Dn(this.__wrapped__);return e.__actions__=yi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=yi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=yi(this.__views__),e},Dn.prototype.reverse=function(){if(this.__filtered__){var e=new Dn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Dn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ro(e),r=t<0,i=n?e.length:0,a=function(e,t,n){var r=-1,i=n.length;for(;++r=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},An.prototype.plant=function(e){for(var t,n=this;n instanceof In;){var r=Ca(n);r.__index__=0,r.__values__=void 0,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},An.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Dn){var t=e;return this.__actions__.length&&(t=new Dn(this)),(t=t.reverse()).__actions__.push({func:to,args:[Ha],thisArg:void 0}),new En(t,this.__chain__)}return this.thru(Ha)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return ni(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,Xe&&(An.prototype[Xe]=function(){return this}),An}();qe._=Jt,void 0===(i=function(){return Jt}.call(t,n,t,r))||(r.exports=i)}).call(this)}).call(this,n(51),n(52)(e))},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty;function i(e,t){return Array.isArray(e)?function(e,t){for(var n,r="",a="",o=Array.isArray(t),s=0;s]/;function c(e){var t=""+e,n=s.exec(t);if(!n)return e;var r,i,a,o="";for(r=n.index,i=0;r ":" ")+n+"| "+e})).join("\n");throw t.path=r,t.message=(r||"Pug")+":"+i+"\n"+o+"\n\n"+t.message,t}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var r=n(73);function i(t,n,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=i=Reflect.get:e.exports=i=function(e,t,n){var i=r(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(n):a.value}},i(t,n,a||t)}e.exports=i},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){var r;window,r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(e,t){for(var n=0;n\n

").concat(e.text,"
\n \n ")}(e,t)})).join("");return"\n
\n ".concat(e,"\n
\n ")}},{key:"templateString",value:function(){var e=this.buttonsString(),t=this.title?"
".concat(this.title,"
"):"",n=this.text?"

".concat(this.text,"

"):"";return'\n
\n
\n
\n
\n
\n
\n
\n '.concat(t,'\n\n
\n ').concat(n,"\n
\n\n
\n ").concat(e,"\n
\n
\n
\n
\n
\n
\n
\n ")}},{key:"dismiss",value:function(){this.onElement.removeChild(this.element),document.removeEventListener("keyup",this.keyupListener)}},{key:"primaryButton",value:function(){var e=this.buttons.find((function(e){return!0===e.primary}));return e||(e=this.buttons[this.buttons.length-1]),e}},{key:"present",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onElement;n||(n=document.body),this.onElement=n,this.element=document.createElement("div"),this.element.className="sn-component",this.element.innerHTML=this.templateString().trim(),document.addEventListener("keyup",this.keyupListener),this.buttons.forEach((function(t,n){e.element.querySelector("#button-".concat(n)).onclick=function(){t.action&&t.action(),e.dismiss()}})),n.appendChild(this.element)}}])&&r(t.prototype,n),i&&r(t,i),e}();n.d(t,"SKAlert",(function(){return i}))}])},e.exports=r()},function(e,t,n){var r=n(48);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(50);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(53);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(54);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(55);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(56);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(57);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(58);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(59);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(60);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(61);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(62);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(63);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(64);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(65);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(66);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(67);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(68);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(69);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(70);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(71);e.exports=(r.default||r).apply(r,[])},function(e,t,n){var r=n(72);e.exports=(r.default||r).apply(r,[])},function(e,t,n){},function(e,t,n){},function(e,t){ -/** - * @license AngularJS v1.7.9 - * (c) 2010-2018 Google, Inc. http://angularjs.org - * License: MIT - */ -!function(e){"use strict";var t={objectMaxDepth:5,urlErrorParamsEnabled:!0};function n(e){if(!L(e))return t;N(e.objectMaxDepth)&&(t.objectMaxDepth=r(e.objectMaxDepth)?e.objectMaxDepth:NaN),N(e.urlErrorParamsEnabled)&&Y(e.urlErrorParamsEnabled)&&(t.urlErrorParamsEnabled=e.urlErrorParamsEnabled)}function r(e){return H(e)&&e>0}function i(e,n){n=n||Error;var r="https://errors.angularjs.org/1.7.9/",i=r.replace(".","\\.")+"[\\s\\S]*",a=new RegExp(i,"g");return function(){var i,o,s=arguments[0],c=arguments[1],u="["+(e?e+":":"")+s+"] ",l=fe(arguments,2).map((function(e){return He(e,t.objectMaxDepth)}));if(u+=c.replace(/\{\d+\}/g,(function(e){var t=+e.slice(1,-1);return t=0&&t-1 in e||"function"==typeof e.item)}function x(e,t,n){var r,i;if(e)if(K(e))for(r in e)"prototype"!==r&&"length"!==r&&"name"!==r&&e.hasOwnProperty(r)&&t.call(n,e[r],r,e);else if(V(e)||w(e)){var a="object"!=typeof e;for(r=0,i=e.length;r=0&&e.splice(n,1),n}function ae(e,t,n){var i,a,o=[],s=[];if(n=r(n)?n:NaN,t){if((a=t)&&H(a.length)&&X.test(m.call(a))||(i=t,"[object ArrayBuffer]"===m.call(i)))throw g("cpta","Can't copy! TypedArray destination cannot be mutated.");if(e===t)throw g("cpi","Can't copy! Source and destination are identical.");return V(t)?t.length=0:x(t,(function(e,n){"$$hashKey"!==n&&delete t[n]})),o.push(e),s.push(t),c(e,t,n)}return u(e,n);function c(e,t,n){if(--n<0)return"...";var r,i=t.$$hashKey;if(V(e))for(var a=0,o=e.length;a2?fe(arguments,2):[];return!K(t)||t instanceof RegExp?t:n.length?function(){return arguments.length?t.apply(e,le(n,arguments,0)):t.apply(e,n)}:function(){return arguments.length?t.apply(e,arguments):t.call(e)}}function de(t,n){var r=n;return"string"==typeof t&&"$"===t.charAt(0)&&"$"===t.charAt(1)?r=void 0:J(n)?r="$WINDOW":n&&e.document===n?r="$DOCUMENT":G(n)&&(r="$SCOPE"),r}function he(e,t){if(!F(e))return H(t)||(t=t?2:null),JSON.stringify(e,de,t)}function ve(e){return B(e)?JSON.parse(e):e}var me=/:/g;function ye(e,t){e=e.replace(me,"");var n=Date.parse("Jan 01, 1970 00:00:00 "+e)/6e4;return E(n)?t:n}function ge(e,t){return(e=new Date(e.getTime())).setMinutes(e.getMinutes()+t),e}function be(e,t,n){n=n?-1:1;var r=e.getTimezoneOffset();return ge(e,n*(ye(t,r)-r))}function ke(e){e=o(e).clone().empty();var t=o("
").append(e).html();try{return e[0].nodeType===Ue?f(t):t.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,(function(e,t){return"<"+f(t)}))}catch(e){return f(t)}}function we(e){try{return decodeURIComponent(e)}catch(e){}}function xe(e){var t={};return x((e||"").split("&"),(function(e){var n,r,i;e&&(r=e=e.replace(/\+/g,"%20"),-1!==(n=e.indexOf("="))&&(r=e.substring(0,n),i=e.substring(n+1)),N(r=we(r))&&(i=!N(i)||we(i),l.call(t,r)?V(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))})),t}function Se(e){return $e(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function $e(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,t?"%20":"+")}var _e=["ng-","data-ng-","ng:","x-ng-"];var Me=function(t){var n=t.currentScript;if(!n)return!0;if(!(n instanceof e.HTMLScriptElement||n instanceof e.SVGScriptElement))return!1;var r=n.attributes;return[r.getNamedItem("src"),r.getNamedItem("href"),r.getNamedItem("xlink:href")].every((function(e){if(!e)return!0;if(!e.value)return!1;var n=t.createElement("a");if(n.href=e.value,t.location.origin===n.origin)return!0;switch(n.protocol){case"http:":case"https:":case"ftp:":case"blob:":case"file:":case"data:":return!0;default:return!1}}))}(e.document);function Ce(t,n){var r,i,a={};if(x(_e,(function(e){var n=e+"app";!r&&t.hasAttribute&&t.hasAttribute(n)&&(r=t,i=t.getAttribute(n))})),x(_e,(function(e){var n,a=e+"app";!r&&(n=t.querySelector("["+a.replace(":","\\:")+"]"))&&(r=n,i=n.getAttribute(a))})),r){if(!Me)return void e.console.error("AngularJS: disabling automatic bootstrap.