diff --git a/README.md b/README.md deleted file mode 100644 index d735ca0..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Channelize-Web-Javascript -Channelize.io web javascript sample apps diff --git a/react-native-redux/.gitignore b/react-native-redux/.gitignore new file mode 100644 index 0000000..ad572e6 --- /dev/null +++ b/react-native-redux/.gitignore @@ -0,0 +1,59 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + +# BUCK +buck-out/ +\.buckd/ +*.keystore +!debug.keystore + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/ + +*/fastlane/report.xml +*/fastlane/Preview.html +*/fastlane/screenshots + +# Bundle artifact +*.jsbundle + +# CocoaPods +/ios/Pods/ diff --git a/react-native-redux/App.js b/react-native-redux/App.js new file mode 100644 index 0000000..f168422 --- /dev/null +++ b/react-native-redux/App.js @@ -0,0 +1,43 @@ +import React, { Component } from 'react'; +import { Provider } from 'react-redux'; + +import { store } from './src/store'; +import Connect from './src/components/Connect'; +import ConversationWindow from './src/components/ConversationWindow'; +import { Channelize } from 'channelize-websdk/dist/index'; + +if (process.env.NODE_ENV === 'development') { + GLOBAL.XMLHttpRequest = GLOBAL.originalXMLHttpRequest || GLOBAL.XMLHttpRequest; + console.disableYellowBox = true; +} + +//PUBLIC_KEY => Channelize.io public key +//LOGGEDIN_USER_ID => User id of loggedin user +//CH_ACCESS_TOKEN => Channelize access token of loggedin userid +//ANOTHER_USER_ID => The user id of another user to start chat + +export default class App extends Component { + constructor(props) { + super(props); + } + + componentDidMount() { + console.log('app is launched'); + } + + componentWillUnmount() { + console.log('app is killed'); + } + + render() { + var client = new Channelize.client({publicKey: "PUBLIC_KEY"}); + + return ( + + + + + + ); + } +} diff --git a/react-native-redux/__tests__/App-test.js b/react-native-redux/__tests__/App-test.js new file mode 100644 index 0000000..1784766 --- /dev/null +++ b/react-native-redux/__tests__/App-test.js @@ -0,0 +1,14 @@ +/** + * @format + */ + +import 'react-native'; +import React from 'react'; +import App from '../App'; + +// Note: test renderer must be required after react-native. +import renderer from 'react-test-renderer'; + +it('renders correctly', () => { + renderer.create(); +}); diff --git a/react-native-redux/android/app/_BUCK b/react-native-redux/android/app/_BUCK new file mode 100644 index 0000000..f286808 --- /dev/null +++ b/react-native-redux/android/app/_BUCK @@ -0,0 +1,55 @@ +# To learn about Buck see [Docs](https://buckbuild.com/). +# To run your application with Buck: +# - install Buck +# - `npm start` - to start the packager +# - `cd android` +# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` +# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck +# - `buck install -r android/app` - compile, install and run application +# + +load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") + +lib_deps = [] + +create_aar_targets(glob(["libs/*.aar"])) + +create_jar_targets(glob(["libs/*.jar"])) + +android_library( + name = "all-libs", + exported_deps = lib_deps, +) + +android_library( + name = "app-code", + srcs = glob([ + "src/main/java/**/*.java", + ]), + deps = [ + ":all-libs", + ":build_config", + ":res", + ], +) + +android_build_config( + name = "build_config", + package = "com.awesomeproject", +) + +android_resource( + name = "res", + package = "com.awesomeproject", + res = "src/main/res", +) + +android_binary( + name = "app", + keystore = "//android/keystores:debug", + manifest = "src/main/AndroidManifest.xml", + package_type = "debug", + deps = [ + ":app-code", + ], +) diff --git a/react-native-redux/android/app/build.gradle b/react-native-redux/android/app/build.gradle new file mode 100644 index 0000000..834d468 --- /dev/null +++ b/react-native-redux/android/app/build.gradle @@ -0,0 +1,225 @@ +apply plugin: "com.android.application" + +import com.android.build.OutputFile + +/** + * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets + * and bundleReleaseJsAndAssets). + * These basically call `react-native bundle` with the correct arguments during the Android build + * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the + * bundle directly from the development server. Below you can see all the possible configurations + * and their defaults. If you decide to add a configuration block, make sure to add it before the + * `apply from: "../../node_modules/react-native/react.gradle"` line. + * + * project.ext.react = [ + * // the name of the generated asset file containing your JS bundle + * bundleAssetName: "index.android.bundle", + * + * // the entry file for bundle generation. If none specified and + * // "index.android.js" exists, it will be used. Otherwise "index.js" is + * // default. Can be overridden with ENTRY_FILE environment variable. + * entryFile: "index.android.js", + * + * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format + * bundleCommand: "ram-bundle", + * + * // whether to bundle JS and assets in debug mode + * bundleInDebug: false, + * + * // whether to bundle JS and assets in release mode + * bundleInRelease: true, + * + * // whether to bundle JS and assets in another build variant (if configured). + * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants + * // The configuration property can be in the following formats + * // 'bundleIn${productFlavor}${buildType}' + * // 'bundleIn${buildType}' + * // bundleInFreeDebug: true, + * // bundleInPaidRelease: true, + * // bundleInBeta: true, + * + * // whether to disable dev mode in custom build variants (by default only disabled in release) + * // for example: to disable dev mode in the staging build type (if configured) + * devDisabledInStaging: true, + * // The configuration property can be in the following formats + * // 'devDisabledIn${productFlavor}${buildType}' + * // 'devDisabledIn${buildType}' + * + * // the root of your project, i.e. where "package.json" lives + * root: "../../", + * + * // where to put the JS bundle asset in debug mode + * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", + * + * // where to put the JS bundle asset in release mode + * jsBundleDirRelease: "$buildDir/intermediates/assets/release", + * + * // where to put drawable resources / React Native assets, e.g. the ones you use via + * // require('./image.png')), in debug mode + * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", + * + * // where to put drawable resources / React Native assets, e.g. the ones you use via + * // require('./image.png')), in release mode + * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", + * + * // by default the gradle tasks are skipped if none of the JS files or assets change; this means + * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to + * // date; if you have any other folders that you want to ignore for performance reasons (gradle + * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ + * // for example, you might want to remove it from here. + * inputExcludes: ["android/**", "ios/**"], + * + * // override which node gets called and with what additional arguments + * nodeExecutableAndArgs: ["node"], + * + * // supply additional arguments to the packager + * extraPackagerArgs: [] + * ] + */ + +project.ext.react = [ + enableHermes: false, // clean and rebuild if changing +] + +apply from: "../../node_modules/react-native/react.gradle" + +/** + * Set this to true to create two separate APKs instead of one: + * - An APK that only works on ARM devices + * - An APK that only works on x86 devices + * The advantage is the size of the APK is reduced by about 4MB. + * Upload all the APKs to the Play Store and people will download + * the correct one based on the CPU architecture of their device. + */ +def enableSeparateBuildPerCPUArchitecture = false + +/** + * Run Proguard to shrink the Java bytecode in release builds. + */ +def enableProguardInReleaseBuilds = false + +/** + * The preferred build flavor of JavaScriptCore. + * + * For example, to use the international variant, you can use: + * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` + * + * The international variant includes ICU i18n library and necessary data + * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that + * give correct results when using with locales other than en-US. Note that + * this variant is about 6MiB larger per architecture than default. + */ +def jscFlavor = 'org.webkit:android-jsc:+' + +/** + * Whether to enable the Hermes VM. + * + * This should be set on project.ext.react and mirrored here. If it is not set + * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode + * and the benefits of using Hermes will therefore be sharply reduced. + */ +def enableHermes = project.ext.react.get("enableHermes", false); + +android { + compileSdkVersion rootProject.ext.compileSdkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + defaultConfig { + applicationId "com.awesomeproject" + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + versionCode 1 + versionName "1.0" + } + splits { + abi { + reset() + enable enableSeparateBuildPerCPUArchitecture + universalApk false // If true, also generate a universal APK + include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" + } + } + signingConfigs { + debug { + storeFile file('debug.keystore') + storePassword 'android' + keyAlias 'androiddebugkey' + keyPassword 'android' + } + } + buildTypes { + debug { + signingConfig signingConfigs.debug + } + release { + // Caution! In production, you need to generate your own keystore file. + // see https://facebook.github.io/react-native/docs/signed-apk-android. + signingConfig signingConfigs.debug + minifyEnabled enableProguardInReleaseBuilds + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + } + } + + packagingOptions { + pickFirst "lib/armeabi-v7a/libc++_shared.so" + pickFirst "lib/arm64-v8a/libc++_shared.so" + pickFirst "lib/x86/libc++_shared.so" + pickFirst "lib/x86_64/libc++_shared.so" + } + + // applicationVariants are e.g. debug, release + applicationVariants.all { variant -> + variant.outputs.each { output -> + // For each separate APK per architecture, set a unique version code as described here: + // https://developer.android.com/studio/build/configure-apk-splits.html + def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] + def abi = output.getFilter(OutputFile.ABI) + if (abi != null) { // null for the universal-debug, universal-release variants + output.versionCodeOverride = + versionCodes.get(abi) * 1048576 + defaultConfig.versionCode + } + + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + //noinspection GradleDynamicVersion + implementation "com.facebook.react:react-native:+" // From node_modules + + implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" + + debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { + exclude group:'com.facebook.fbjni' + } + + debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { + exclude group:'com.facebook.flipper' + } + + debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { + exclude group:'com.facebook.flipper' + } + + if (enableHermes) { + def hermesPath = "../../node_modules/hermes-engine/android/"; + debugImplementation files(hermesPath + "hermes-debug.aar") + releaseImplementation files(hermesPath + "hermes-release.aar") + } else { + implementation jscFlavor + } +} + +// Run this once to be able to run the application with BUCK +// puts all compile dependencies into folder libs for BUCK to use +task copyDownloadableDepsToLibs(type: Copy) { + from configurations.compile + into 'libs' +} + +apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) diff --git a/react-native-redux/android/app/build_defs.bzl b/react-native-redux/android/app/build_defs.bzl new file mode 100644 index 0000000..fff270f --- /dev/null +++ b/react-native-redux/android/app/build_defs.bzl @@ -0,0 +1,19 @@ +"""Helper definitions to glob .aar and .jar targets""" + +def create_aar_targets(aarfiles): + for aarfile in aarfiles: + name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] + lib_deps.append(":" + name) + android_prebuilt_aar( + name = name, + aar = aarfile, + ) + +def create_jar_targets(jarfiles): + for jarfile in jarfiles: + name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] + lib_deps.append(":" + name) + prebuilt_jar( + name = name, + binary_jar = jarfile, + ) diff --git a/react-native-redux/android/app/debug.keystore b/react-native-redux/android/app/debug.keystore new file mode 100644 index 0000000..364e105 Binary files /dev/null and b/react-native-redux/android/app/debug.keystore differ diff --git a/react-native-redux/android/app/proguard-rules.pro b/react-native-redux/android/app/proguard-rules.pro new file mode 100644 index 0000000..11b0257 --- /dev/null +++ b/react-native-redux/android/app/proguard-rules.pro @@ -0,0 +1,10 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: diff --git a/react-native-redux/android/app/src/debug/AndroidManifest.xml b/react-native-redux/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..fa26aa5 --- /dev/null +++ b/react-native-redux/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/react-native-redux/android/app/src/debug/java/com/awesomeproject/ReactNativeFlipper.java b/react-native-redux/android/app/src/debug/java/com/awesomeproject/ReactNativeFlipper.java new file mode 100644 index 0000000..24e473e --- /dev/null +++ b/react-native-redux/android/app/src/debug/java/com/awesomeproject/ReactNativeFlipper.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + *

This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + */ +package com.awesomeproject; + +import android.content.Context; +import com.facebook.flipper.android.AndroidFlipperClient; +import com.facebook.flipper.android.utils.FlipperUtils; +import com.facebook.flipper.core.FlipperClient; +import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; +import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; +import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; +import com.facebook.flipper.plugins.inspector.DescriptorMapping; +import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; +import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; +import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; +import com.facebook.flipper.plugins.react.ReactFlipperPlugin; +import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; +import com.facebook.react.ReactInstanceManager; +import com.facebook.react.bridge.ReactContext; +import com.facebook.react.modules.network.NetworkingModule; +import okhttp3.OkHttpClient; + +public class ReactNativeFlipper { + public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { + if (FlipperUtils.shouldEnableFlipper(context)) { + final FlipperClient client = AndroidFlipperClient.getInstance(context); + + client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); + client.addPlugin(new ReactFlipperPlugin()); + client.addPlugin(new DatabasesFlipperPlugin(context)); + client.addPlugin(new SharedPreferencesFlipperPlugin(context)); + client.addPlugin(CrashReporterPlugin.getInstance()); + + NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); + NetworkingModule.setCustomClientBuilder( + new NetworkingModule.CustomClientBuilder() { + @Override + public void apply(OkHttpClient.Builder builder) { + builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); + } + }); + client.addPlugin(networkFlipperPlugin); + client.start(); + + // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized + // Hence we run if after all native modules have been initialized + ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); + if (reactContext == null) { + reactInstanceManager.addReactInstanceEventListener( + new ReactInstanceManager.ReactInstanceEventListener() { + @Override + public void onReactContextInitialized(ReactContext reactContext) { + reactInstanceManager.removeReactInstanceEventListener(this); + reactContext.runOnNativeModulesQueueThread( + new Runnable() { + @Override + public void run() { + client.addPlugin(new FrescoFlipperPlugin()); + } + }); + } + }); + } else { + client.addPlugin(new FrescoFlipperPlugin()); + } + } + } +} diff --git a/react-native-redux/android/app/src/main/AndroidManifest.xml b/react-native-redux/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..70c335d --- /dev/null +++ b/react-native-redux/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + diff --git a/react-native-redux/android/app/src/main/assets/fonts/AntDesign.ttf b/react-native-redux/android/app/src/main/assets/fonts/AntDesign.ttf new file mode 100644 index 0000000..2abf035 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/AntDesign.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/Entypo.ttf b/react-native-redux/android/app/src/main/assets/fonts/Entypo.ttf new file mode 100644 index 0000000..1c8f5e9 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/Entypo.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/EvilIcons.ttf b/react-native-redux/android/app/src/main/assets/fonts/EvilIcons.ttf new file mode 100644 index 0000000..6868f7b Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/EvilIcons.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/Feather.ttf b/react-native-redux/android/app/src/main/assets/fonts/Feather.ttf new file mode 100644 index 0000000..852c713 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/Feather.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/FontAwesome.ttf b/react-native-redux/android/app/src/main/assets/fonts/FontAwesome.ttf new file mode 100644 index 0000000..35acda2 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/FontAwesome.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf b/react-native-redux/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf new file mode 100644 index 0000000..5f72e91 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf b/react-native-redux/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf new file mode 100644 index 0000000..a309313 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf b/react-native-redux/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf new file mode 100644 index 0000000..7ece328 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/Fontisto.ttf b/react-native-redux/android/app/src/main/assets/fonts/Fontisto.ttf new file mode 100644 index 0000000..96e2e81 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/Fontisto.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/Foundation.ttf b/react-native-redux/android/app/src/main/assets/fonts/Foundation.ttf new file mode 100644 index 0000000..6cce217 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/Foundation.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/Ionicons.ttf b/react-native-redux/android/app/src/main/assets/fonts/Ionicons.ttf new file mode 100644 index 0000000..67bd842 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/Ionicons.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf b/react-native-redux/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf new file mode 100644 index 0000000..9cc8db1 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/MaterialIcons.ttf b/react-native-redux/android/app/src/main/assets/fonts/MaterialIcons.ttf new file mode 100644 index 0000000..7015564 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/MaterialIcons.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/Octicons.ttf b/react-native-redux/android/app/src/main/assets/fonts/Octicons.ttf new file mode 100644 index 0000000..ceac75d Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/Octicons.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/SimpleLineIcons.ttf b/react-native-redux/android/app/src/main/assets/fonts/SimpleLineIcons.ttf new file mode 100644 index 0000000..6ecb686 Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/SimpleLineIcons.ttf differ diff --git a/react-native-redux/android/app/src/main/assets/fonts/Zocial.ttf b/react-native-redux/android/app/src/main/assets/fonts/Zocial.ttf new file mode 100644 index 0000000..e4ae46c Binary files /dev/null and b/react-native-redux/android/app/src/main/assets/fonts/Zocial.ttf differ diff --git a/react-native-redux/android/app/src/main/java/com/awesomeproject/MainActivity.java b/react-native-redux/android/app/src/main/java/com/awesomeproject/MainActivity.java new file mode 100644 index 0000000..2a39cb8 --- /dev/null +++ b/react-native-redux/android/app/src/main/java/com/awesomeproject/MainActivity.java @@ -0,0 +1,15 @@ +package com.awesomeproject; + +import com.facebook.react.ReactActivity; + +public class MainActivity extends ReactActivity { + + /** + * Returns the name of the main component registered from JavaScript. This is used to schedule + * rendering of the component. + */ + @Override + protected String getMainComponentName() { + return "AwesomeProject"; + } +} diff --git a/react-native-redux/android/app/src/main/java/com/awesomeproject/MainApplication.java b/react-native-redux/android/app/src/main/java/com/awesomeproject/MainApplication.java new file mode 100644 index 0000000..a090fda --- /dev/null +++ b/react-native-redux/android/app/src/main/java/com/awesomeproject/MainApplication.java @@ -0,0 +1,81 @@ +package com.awesomeproject; + +import android.app.Application; +import android.content.Context; +import com.facebook.react.PackageList; +import com.facebook.react.ReactApplication; +import com.oblador.vectoricons.VectorIconsPackage; +import com.facebook.react.ReactInstanceManager; +import com.facebook.react.ReactNativeHost; +import com.facebook.react.ReactPackage; +import com.facebook.soloader.SoLoader; +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +public class MainApplication extends Application implements ReactApplication { + + private final ReactNativeHost mReactNativeHost = + new ReactNativeHost(this) { + @Override + public boolean getUseDeveloperSupport() { + return BuildConfig.DEBUG; + } + + @Override + protected List getPackages() { + @SuppressWarnings("UnnecessaryLocalVariable") + List packages = new PackageList(this).getPackages(); + // Packages that cannot be autolinked yet can be added manually here, for example: + // packages.add(new MyReactNativePackage()); + return packages; + } + + @Override + protected String getJSMainModuleName() { + return "index"; + } + }; + + @Override + public ReactNativeHost getReactNativeHost() { + return mReactNativeHost; + } + + @Override + public void onCreate() { + super.onCreate(); + SoLoader.init(this, /* native exopackage */ false); + initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); + } + + /** + * Loads Flipper in React Native templates. Call this in the onCreate method with something like + * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); + * + * @param context + * @param reactInstanceManager + */ + private static void initializeFlipper( + Context context, ReactInstanceManager reactInstanceManager) { + if (BuildConfig.DEBUG) { + try { + /* + We use reflection here to pick up the class that initializes Flipper, + since Flipper library is not available in release mode + */ + Class aClass = Class.forName("com.awesomeproject.ReactNativeFlipper"); + aClass + .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) + .invoke(null, context, reactInstanceManager); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + } + } +} diff --git a/react-native-redux/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/react-native-redux/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a2f5908 Binary files /dev/null and b/react-native-redux/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/react-native-redux/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/react-native-redux/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..1b52399 Binary files /dev/null and b/react-native-redux/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/react-native-redux/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/react-native-redux/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..ff10afd Binary files /dev/null and b/react-native-redux/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/react-native-redux/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/react-native-redux/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..115a4c7 Binary files /dev/null and b/react-native-redux/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/react-native-redux/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/react-native-redux/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..dcd3cd8 Binary files /dev/null and b/react-native-redux/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/react-native-redux/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/react-native-redux/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..459ca60 Binary files /dev/null and b/react-native-redux/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/react-native-redux/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/react-native-redux/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..8ca12fe Binary files /dev/null and b/react-native-redux/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/react-native-redux/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/react-native-redux/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..8e19b41 Binary files /dev/null and b/react-native-redux/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/react-native-redux/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/react-native-redux/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..b824ebd Binary files /dev/null and b/react-native-redux/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/react-native-redux/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/react-native-redux/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..4c19a13 Binary files /dev/null and b/react-native-redux/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/react-native-redux/android/app/src/main/res/values/strings.xml b/react-native-redux/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..cad480c --- /dev/null +++ b/react-native-redux/android/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + AwesomeProject + diff --git a/react-native-redux/android/app/src/main/res/values/styles.xml b/react-native-redux/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..62fe59f --- /dev/null +++ b/react-native-redux/android/app/src/main/res/values/styles.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/react-native-redux/android/build.gradle b/react-native-redux/android/build.gradle new file mode 100644 index 0000000..5d5d188 --- /dev/null +++ b/react-native-redux/android/build.gradle @@ -0,0 +1,38 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + ext { + buildToolsVersion = "28.0.3" + minSdkVersion = 16 + compileSdkVersion = 28 + targetSdkVersion = 28 + } + repositories { + google() + jcenter() + } + dependencies { + classpath("com.android.tools.build:gradle:3.5.2") + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + mavenLocal() + maven { + // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm + url("$rootDir/../node_modules/react-native/android") + } + maven { + // Android JSC is installed from npm + url("$rootDir/../node_modules/jsc-android/dist") + } + + google() + jcenter() + maven { url 'https://www.jitpack.io' } + } +} diff --git a/react-native-redux/android/gradle.properties b/react-native-redux/android/gradle.properties new file mode 100644 index 0000000..1bbc8cc --- /dev/null +++ b/react-native-redux/android/gradle.properties @@ -0,0 +1,28 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true + +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true + +# Version of flipper SDK to use with React Native +FLIPPER_VERSION=0.33.1 diff --git a/react-native-redux/android/gradle/wrapper/gradle-wrapper.jar b/react-native-redux/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..5c2d1cf Binary files /dev/null and b/react-native-redux/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/react-native-redux/android/gradle/wrapper/gradle-wrapper.properties b/react-native-redux/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..1ba7206 --- /dev/null +++ b/react-native-redux/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/react-native-redux/android/gradlew b/react-native-redux/android/gradlew new file mode 100644 index 0000000..83f2acf --- /dev/null +++ b/react-native-redux/android/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/react-native-redux/android/gradlew.bat b/react-native-redux/android/gradlew.bat new file mode 100644 index 0000000..24467a1 --- /dev/null +++ b/react-native-redux/android/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/react-native-redux/android/settings.gradle b/react-native-redux/android/settings.gradle new file mode 100644 index 0000000..6ba5d7b --- /dev/null +++ b/react-native-redux/android/settings.gradle @@ -0,0 +1,5 @@ +rootProject.name = 'AwesomeProject' +include ':react-native-vector-icons' +project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') +apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) +include ':app' diff --git a/react-native-redux/app.json b/react-native-redux/app.json new file mode 100644 index 0000000..af2b546 --- /dev/null +++ b/react-native-redux/app.json @@ -0,0 +1,4 @@ +{ + "name": "AwesomeProject", + "displayName": "AwesomeProject" +} \ No newline at end of file diff --git a/react-native-redux/babel.config.js b/react-native-redux/babel.config.js new file mode 100644 index 0000000..f842b77 --- /dev/null +++ b/react-native-redux/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + presets: ['module:metro-react-native-babel-preset'], +}; diff --git a/react-native-redux/channelize-websdk/dist/browser.js b/react-native-redux/channelize-websdk/dist/browser.js new file mode 100644 index 0000000..3b3993f --- /dev/null +++ b/react-native-redux/channelize-websdk/dist/browser.js @@ -0,0 +1,32 @@ +window.Channelize=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=129)}([function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(126),i=r.n(n),o=r(26),s=r(10);function a(e,t){for(var r=0;r2?e(Array.prototype.slice.call(arguments,1)):void e(n)}))}))}r.d(t,"a",(function(){return n}))}).call(this,r(6))},function(e,t,r){var n={util:r(7)};({}).toString(),e.exports=n,n.util.update(n,{VERSION:"2.656.0",Signers:{},Protocol:{Json:r(70),Query:r(112),Rest:r(48),RestJson:r(114),RestXml:r(115)},XML:{Builder:r(272),Parser:null},JSON:{Builder:r(71),Parser:r(72)},Model:{Api:r(116),Operation:r(117),Shape:r(39),Paginator:r(118),ResourceWaiter:r(119)},apiLoader:r(277),EndpointCache:r(278).EndpointCache}),r(121),r(280),r(283),r(124),r(284),r(286),r(288),r(289),r(290),r(297),n.events=new n.SequentialExecutor,n.util.memoizedProperty(n,"endpointCache",(function(){return new n.EndpointCache(n.config.endpointCacheSize)}),!0)},function(e,t,r){var n;e.exports=(n=n||function(e,t){var r={},n=r.lib={},i=n.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var r=new e;return t&&r.mixIn(t),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=n.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(o=0;o>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){t=t;var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},s=0;s>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},c=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)))}},l=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,s=this.blockSize,a=i/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,c=e.min(4*u,i);if(u){for(var l=0;l1)for(var r=1;r=e.length)return t.push(null);var i=r+n;i>e.length&&(i=e.length),t.push(e.slice(r,i)),r=i},t},concat:function(e){var t,r,n=0,i=0;for(r=0;r>>8^t[255&(r^e.readUInt8(n))]}return(-1^r)>>>0},hmac:function(e,t,r,n){return r||(r="binary"),"buffer"===r&&(r=void 0),n||(n="sha256"),"string"==typeof t&&(t=o.buffer.toBuffer(t)),o.crypto.lib.createHmac(n,e).update(t).digest(r)},md5:function(e,t,r){return o.crypto.hash("md5",e,t,r)},sha256:function(e,t,r){return o.crypto.hash("sha256",e,t,r)},hash:function(e,t,r,n){var i=o.crypto.createHash(e);r||(r="binary"),"buffer"===r&&(r=void 0),"string"==typeof t&&(t=o.buffer.toBuffer(t));var s=o.arraySliceFn(t),a=o.Buffer.isBuffer(t);if(o.isBrowser()&&"undefined"!=typeof ArrayBuffer&&t&&t.buffer instanceof ArrayBuffer&&(a=!0),n&&"object"==typeof t&&"function"==typeof t.on&&!a)t.on("data",(function(e){i.update(e)})),t.on("error",(function(e){n(e)})),t.on("end",(function(){n(null,i.digest(r))}));else{if(!n||!s||a||"undefined"==typeof FileReader){o.isBrowser()&&"object"==typeof t&&!a&&(t=new o.Buffer(new Uint8Array(t)));var u=i.update(t).digest(r);return n&&n(null,u),u}var c=0,l=new FileReader;l.onerror=function(){n(new Error("Failed to read data."))},l.onload=function(){var e=new o.Buffer(new Uint8Array(l.result));i.update(e),c+=e.length,l._continueReading()},l._continueReading=function(){if(c>=t.size)n(null,i.digest(r));else{var e=c+524288;e>t.size&&(e=t.size),l.readAsArrayBuffer(s.call(t,c,e))}},l._continueReading()}},toHex:function(e){for(var t=[],r=0;r=3e5,!1),i.config.isClockSkewed},applyClockOffset:function(e){e&&(i.config.systemClockOffset=e-(new Date).getTime())},extractRequestId:function(e){var t=e.httpResponse.headers["x-amz-request-id"]||e.httpResponse.headers["x-amzn-requestid"];!t&&e.data&&e.data.ResponseMetadata&&(t=e.data.ResponseMetadata.RequestId),t&&(e.requestId=t),e.error&&(e.error.requestId=t)},addPromises:function(e,t){var r=!1;void 0===t&&i&&i.config&&(t=i.config.getPromisesDependency()),void 0===t&&"undefined"!=typeof Promise&&(t=Promise),"function"!=typeof t&&(r=!0),Array.isArray(e)||(e=[e]);for(var n=0;n=0?(a++,setTimeout(c,i+(e.retryAfter||0))):r(e)},c=function(){var t="";n.handleRequest(e,s,(function(e){e.on("data",(function(e){t+=e.toString()})),e.on("end",(function(){var n=e.statusCode;if(n<300)r(null,t);else{var i=1e3*parseInt(e.headers["retry-after"],10)||0,s=o.error(new Error,{statusCode:n,retryable:n>=500||429===n});i&&s.retryable&&(s.retryAfter=i),u(s)}}))}),u)};i.util.defer(c)},uuid:{v4:function(){return r(81).v4()}},convertPayloadToString:function(e){var t=e.request,r=t.operation,n=t.service.api.operations[r].output||{};n.payload&&e.data[n.payload]&&(e.data[n.payload]=e.data[n.payload].toString())},defer:function(e){"object"==typeof t&&"function"==typeof t.nextTick?t.nextTick(e):"function"==typeof n?n(e):setTimeout(e,0)},getRequestPayloadShape:function(e){var t=e.service.api.operations;if(t){var r=(t||{})[e.operation];if(r&&r.input&&r.input.payload)return r.input.members[r.input.payload]}},getProfilesFromSharedConfig:function(e,r){var n={},i={};if(t.env[o.configOptInEnv])i=e.loadFrom({isConfig:!0,filename:t.env[o.sharedConfigFileEnv]});for(var s=e.loadFrom({filename:r||t.env[o.configOptInEnv]&&t.env[o.sharedCredentialsFileEnv]}),a=0,u=Object.keys(i);a=6},parse:function(e){var t=e.split(":");return{partition:t[1],service:t[2],region:t[3],accountId:t[4],resource:t.slice(5).join(":")}},build:function(e){if(void 0===e.service||void 0===e.region||void 0===e.accountId||void 0===e.resource)throw o.error(new Error("Input ARN object is invalid"));return"arn:"+(e.partition||"aws")+":"+e.service+":"+e.region+":"+e.accountId+":"+e.resource}},defaultProfile:"default",configOptInEnv:"AWS_SDK_LOAD_CONFIG",sharedCredentialsFileEnv:"AWS_SHARED_CREDENTIALS_FILE",sharedConfigFileEnv:"AWS_CONFIG_FILE",imdsDisabledEnv:"AWS_EC2_METADATA_DISABLED"};e.exports=o}).call(this,r(6),r(90).setImmediate)},function(e,t,r){"use strict";r.d(t,"a",(function(){return v}));var n=r(33),i=r(10),o=r(5),s=r(1),a=r(12),u=r(0),c=r(2);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 f(e,t){for(var r=0;r>>2];e.sigBytes-=t}},o.BlockCipher=h.extend({cfg:h.cfg.extend({mode:y,padding:m}),reset:function(){h.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else n=r.createDecryptor,this._minBufferSize=1;this._mode=n.call(r,this,t&&t.words)},_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}),v=o.CipherParams=s.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(i.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=a.create([1398893684,1701076831]).concat(r).concat(t);else n=t;return n.toString(l)},parse:function(e){var t=l.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=a.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return v.create({ciphertext:t,salt:n})}},b=o.SerializableCipher=s.extend({cfg:s.extend({format:g}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),s=i.cfg;return v.create({ciphertext:o,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),_=(i.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=a.random(8));var i=f.create({keySize:t+r}).compute(e,n),o=a.create(i.words.slice(t),4*r);return i.sigBytes=4*t,v.create({key:i,iv:o,salt:n})}},w=o.PasswordBasedCipher=b.extend({cfg:b.cfg.extend({kdf:_}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var o=b.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=i.iv,b.decrypt.call(this,e,t,i.key,n)}}))))},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return b}));var n=r(50),i=r(8),o=r(52),s=r(35),a=r(55),u=r(56),c=r(128),l=r(1),f=r(5),h=r(0),p=r(2);function d(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null;return Object.keys(t).forEach((function(t){e.includes(t)||(r=t)})),r},getRequiedFilter:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[],n=Object.keys(t);return e.forEach((function(e){n.includes(e)||r.push(e)})),r}}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(15),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";(function(e){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var n=r(154),i=r(155),o=r(86);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(n)return B(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var f=!0,h=0;hi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(n,i),l=e.slice(t,r),f=0;fi)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function L(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function D(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,o){return o||D(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function M(e,t,r,n,o){return o||D(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||O(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||O(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return M(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return M(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(13))},function(e,t,r){"use strict";var n=r(29),i=r(97),o=r(61),s=r(98),a=r(99);(e.exports=function(e,t){var r,i,u,c,l;return arguments.length<2||"string"!=typeof e?(c=t,t=e,e=null):c=arguments[2],n(e)?(r=a.call(e,"c"),i=a.call(e,"e"),u=a.call(e,"w")):(r=u=!0,i=!1),l={value:t,configurable:r,enumerable:i,writable:u},c?o(s(c),l):l}).gs=function(e,t,r){var u,c,l,f;return"string"!=typeof e?(l=r,r=t,t=e,e=null):l=arguments[3],n(t)?i(t)?n(r)?i(r)||(l=r,r=void 0):r=void 0:(l=t,t=r=void 0):t=void 0,n(e)?(u=a.call(e,"c"),c=a.call(e,"e")):(u=!0,c=!1),f={get:t,set:r,configurable:u,enumerable:c},l?o(s(l),f):f}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n=r(33),i=(r(1),r(5)),o=(r(10),r(0)),s=r(2);function a(e){return(a="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 r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=m(u,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},a.prototype.listenerCount=y,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var n=r(28);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,r){"use strict";r.d(t,"a",(function(){return _}));var n=r(33),i=(r(18),r(35)),o=r(10),s=r(5),a=r(1),u=(r(12),r(53)),c=(r(81),r(0)),l=r(2);function f(e){return(f="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 h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:null,t={typing_events:!0,read_events:!0,push_notification:!0},r=this.config||{};return r=p({},t,{},r),e?r[e]:r}},{key:"join",value:function(e){var t=this;return Object(l.a)(e,(function(e){return t.isGroup?"public"!=t.type?function(e){throw e}(new Error(a.a.PUBLIC_CONVERSATION_REQUIRED)):void c.a.request(b.basePath+"/"+t.id+"/join",{method:"post"}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))})):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"addAdmin",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){return r.isGroup?e&&"string"==typeof e?void c.a.request(b.basePath+"/"+r.id+"/add_admin",{method:"put",data:{userId:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(c.a.error(e))})):function(e){throw e}(new Error(a.a.INVALID_USER_ID)):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"addMembers",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){return r.isGroup?Array.isArray(e)?void c.a.request(b.basePath+"/"+r.id+"/add_members",{method:"post",data:{members:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(c.a.error(e))})):function(e){throw e}(new Error(a.a.INVALID_MEMBER_IDS)):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"removeMembers",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){return r.isGroup?Array.isArray(e)?void c.a.request(b.basePath+"/"+r.id+"/remove_members",{method:"post",data:{members:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(c.a.error(e))})):function(e){throw e}(new Error(a.a.INVALID_MEMBER_IDS)):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"clear",value:function(e){var t=this;return Object(l.a)(e,(function(e){if("private"!=t.type)return e(new Error(a.a.CAN_NOT_CLEAR_CONVERSATION));c.a.request(b.basePath+"/"+t.id+"/clear",{method:"delete"}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"delete",value:function(e){var t=this;return Object(l.a)(e,(function(e){c.a.request(b.basePath+"/"+t.id+"/delete",{method:"delete"}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"leave",value:function(e){var t=this;return Object(l.a)(e,(function(e){c.a.request(b.basePath+"/"+t.id+"/leave",{method:"post"}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"markAsRead",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){if(!r.getConfig("read_events"))return t(new Error(a.a.CONVERSATION_NOT_CONFIGURED_READ_EVENTS));var n;if(e)n=e;else{var i=new Date;n=i.toISOString()}c.a.request(b.basePath+"/"+r.id+"/mark_as_read",{method:"put",data:{timestamp:n}}).then((function(e){var i=o.a.getInstance();return r.lastReadAt.hasOwnProperty(i.loginUser.id)&&(r.lastReadAt[i.loginUser.id]=n),t(null,e.data)})).catch((function(e){return t(c.a.error(e))}))}))}},{key:"updateTitle",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){return r.isGroup?"string"!=typeof e?function(e){throw e}(new Error(a.a.INVALID_TITLE)):void c.a.request(b.basePath+"/"+r.id+"/update_title",{method:"put",data:{title:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(c.a.error(e))})):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"muteConversation",value:function(e){var t=this;return Object(l.a)(e,(function(e){c.a.request(b.basePath+"/"+t.id+"/update_settings",{method:"put",data:{mute:!0}}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"unmuteConversation",value:function(e){var t=this;return Object(l.a)(e,(function(e){c.a.request(b.basePath+"/"+t.id+"/update_settings",{method:"put",data:{mute:!1}}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"updateProfilePhoto",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){return r.isGroup?"object"!=f(e)?function(e){throw e}(new Error(a.a.INVALID_PROFILE_IMG)):void o.a.getInstance().File.upload(e,"image",!1,(function(e,n){if(e)return t(e);var i={profileImageUrl:n.fileUrl};c.a.request(b.basePath+"/"+r.id+"/update_profile",{method:"put",data:i}).then((function(e){return t(null,e.data)})).catch((function(e){return t(e,null)}))})):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"sendMessage",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){e.conversationId=r.id,e.isGroup=r.isGroup,r.messageService._sendMessage(e,(function(e,r){return e?t(c.a.error(e)):t(null,r)}))}))}},{key:"startTyping",value:function(e){var t=this;return Object(l.a)(e,(function(e){if(!t.getConfig("typing_events"))return e(new Error(a.a.CONVERSATION_NOT_CONFIGURED_TYPING_EVENTS));c.a.request(b.basePath+"/"+t.id+"/send_typing_status",{method:"post",data:{isTyping:!0}}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"stopTyping",value:function(e){var t=this;return Object(l.a)(e,(function(e){if(!t.getConfig("typing_events"))return e(new Error(a.a.CONVERSATION_NOT_CONFIGURED_TYPING_EVENTS));c.a.request(b.basePath+"/"+t.id+"/send_typing_status",{method:"post",data:{isTyping:!1}}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"getMembers",value:function(e){var t=this;if(this.members.length)return e(null,this.members);c.a.request(b.basePath+"/"+this.id+"/members").then((function(r){return t.members=r.data,e(null,r.data)})).catch((function(t){return e(c.a.error(t))}))}},{key:"getReadMembers",value:function(e){var t=this;if("object"!=f(e))return function(e){throw e}(new Error(a.a.INVALID_MESSAGE_OBJECT));var r={};return Object.keys(this.lastReadAt).forEach((function(n){e.createdAt<=t.lastReadAt[n]&&(r[n]=t.lastReadAt[n])})),r}},{key:"readByAllMembers",value:function(e){var t=this;if("object"!=f(e))return function(e){throw e}(new Error(a.a.INVALID_MESSAGE_OBJECT));var r=!0;return Object.keys(this.lastReadAt).forEach((function(n){e.createdAt>=t.lastReadAt[n]&&e.ownerId!=n&&(r=!1)})),r}},{key:"createMessageListQuery",value:function(){return new u.a(this.id)}}])&&d(r.prototype,n),s&&d(r,s),b}(n.a);b(_,"__properties",{id:null,type:null,config:{},customType:null,metaData:{},lastMessage:{},lastReadAt:{},title:null,isGroup:null,createdAt:null,memberCount:0,ownerId:null,members:[],profileImageUrl:null,isActive:null,isAdmin:null,isDeleted:null,mute:null,unreadMessageCount:null,updatedAt:null,user:{}}),b(_,"basePath",s.a.BASEPATH_CONVERSATIONS)},function(e,t,r){"use strict";e.exports=r(186)()?r(43).Symbol:r(189)},function(e,t,r){"use strict";var n=r(37),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=f;var o=Object.create(r(38));o.inherits=r(20);var s=r(85),a=r(89);o.inherits(f,s);for(var u=i(a.prototype),c=0;c>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,r=this._map,n=r.charAt(64);if(n){var o=e.indexOf(n);-1!=o&&(t=o)}for(var s=[],a=0,u=0;u>>6-u%4*2;s[a>>>2]|=c<<24-a%4*8,a++}return i.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,r){var n;e.exports=(n=r(4),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=e[t+0],u=e[t+1],p=e[t+2],d=e[t+3],y=e[t+4],m=e[t+5],v=e[t+6],g=e[t+7],b=e[t+8],_=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],I=e[t+13],A=e[t+14],k=e[t+15],C=o[0],x=o[1],T=o[2],R=o[3];C=c(C,x,T,R,s,7,a[0]),R=c(R,C,x,T,u,12,a[1]),T=c(T,R,C,x,p,17,a[2]),x=c(x,T,R,C,d,22,a[3]),C=c(C,x,T,R,y,7,a[4]),R=c(R,C,x,T,m,12,a[5]),T=c(T,R,C,x,v,17,a[6]),x=c(x,T,R,C,g,22,a[7]),C=c(C,x,T,R,b,7,a[8]),R=c(R,C,x,T,_,12,a[9]),T=c(T,R,C,x,w,17,a[10]),x=c(x,T,R,C,S,22,a[11]),C=c(C,x,T,R,E,7,a[12]),R=c(R,C,x,T,I,12,a[13]),T=c(T,R,C,x,A,17,a[14]),C=l(C,x=c(x,T,R,C,k,22,a[15]),T,R,u,5,a[16]),R=l(R,C,x,T,v,9,a[17]),T=l(T,R,C,x,S,14,a[18]),x=l(x,T,R,C,s,20,a[19]),C=l(C,x,T,R,m,5,a[20]),R=l(R,C,x,T,w,9,a[21]),T=l(T,R,C,x,k,14,a[22]),x=l(x,T,R,C,y,20,a[23]),C=l(C,x,T,R,_,5,a[24]),R=l(R,C,x,T,A,9,a[25]),T=l(T,R,C,x,d,14,a[26]),x=l(x,T,R,C,b,20,a[27]),C=l(C,x,T,R,I,5,a[28]),R=l(R,C,x,T,p,9,a[29]),T=l(T,R,C,x,g,14,a[30]),C=f(C,x=l(x,T,R,C,E,20,a[31]),T,R,m,4,a[32]),R=f(R,C,x,T,b,11,a[33]),T=f(T,R,C,x,S,16,a[34]),x=f(x,T,R,C,A,23,a[35]),C=f(C,x,T,R,u,4,a[36]),R=f(R,C,x,T,y,11,a[37]),T=f(T,R,C,x,g,16,a[38]),x=f(x,T,R,C,w,23,a[39]),C=f(C,x,T,R,I,4,a[40]),R=f(R,C,x,T,s,11,a[41]),T=f(T,R,C,x,d,16,a[42]),x=f(x,T,R,C,v,23,a[43]),C=f(C,x,T,R,_,4,a[44]),R=f(R,C,x,T,E,11,a[45]),T=f(T,R,C,x,k,16,a[46]),C=h(C,x=f(x,T,R,C,p,23,a[47]),T,R,s,6,a[48]),R=h(R,C,x,T,g,10,a[49]),T=h(T,R,C,x,A,15,a[50]),x=h(x,T,R,C,m,21,a[51]),C=h(C,x,T,R,E,6,a[52]),R=h(R,C,x,T,d,10,a[53]),T=h(T,R,C,x,w,15,a[54]),x=h(x,T,R,C,u,21,a[55]),C=h(C,x,T,R,b,6,a[56]),R=h(R,C,x,T,k,10,a[57]),T=h(T,R,C,x,v,15,a[58]),x=h(x,T,R,C,I,21,a[59]),C=h(C,x,T,R,y,6,a[60]),R=h(R,C,x,T,S,10,a[61]),T=h(T,R,C,x,p,15,a[62]),x=h(x,T,R,C,_,21,a[63]),o[0]=o[0]+C|0,o[1]=o[1]+x|0,o[2]=o[2]+T|0,o[3]=o[3]+R|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,u=a.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,n,i,o,s){var a=e+(t&r|~t&n)+i+s;return(a<>>32-o)+t}function l(e,t,r,n,i,o,s){var a=e+(t&n|r&~n)+i+s;return(a<>>32-o)+t}function f(e,t,r,n,i,o,s){var a=e+(t^r^n)+i+s;return(a<>>32-o)+t}function h(e,t,r,n,i,o,s){var a=e+(r^(t|~n))+i+s;return(a<>>32-o)+t}t.MD5=o._createHelper(u),t.HmacMD5=o._createHmacHelper(u)}(Math),n.MD5)},function(e,t,r){var n,i,o,s,a,u,c,l;e.exports=(l=r(4),r(66),r(67),i=(n=l).lib,o=i.Base,s=i.WordArray,a=n.algo,u=a.MD5,c=a.EvpKDF=o.extend({cfg:o.extend({keySize:4,hasher:u,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),i=s.create(),o=i.words,a=r.keySize,u=r.iterations;o.length=0;t--)if(u.a.getRequiedFilter(["userId","order","wordCount"],e.mentionedUsers[t]).length)return function(e){throw e}(new Error(a.a.INVALID_MESSAGE_MENTIONED_USERS))}e.parentId&&!e.type?e.type="reply":e.type=e.type?e.type:"normal"}}],(n=null)&&p(r.prototype,n),s&&p(r,s),b}(n.a);g=w,b="basePath",_=s.a.BASEPATH_MESSAGES,b in g?Object.defineProperty(g,b,{value:_,enumerable:!0,configurable:!0,writable:!0}):g[b]=_},function(e,t,r){(function(e){var n=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),u=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&t._extend(n,r),g(n.showHidden)&&(n.showHidden=!1),g(n.depth)&&(n.depth=2),g(n.colors)&&(n.colors=!1),g(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function l(e,r,n){if(e.customInspect&&r&&E(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return v(i)||(i=l(e,i,n)),i}var o=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(v(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(m(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(y(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),S(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(r);if(0===s.length){if(E(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(b(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(S(r))return f(r)}var c,_="",I=!1,A=["{","}"];(p(r)&&(I=!0,A=["[","]"]),E(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(_=" "+RegExp.prototype.toString.call(r)),w(r)&&(_=" "+Date.prototype.toUTCString.call(r)),S(r)&&(_=" "+f(r)),0!==s.length||I&&0!=r.length?n<0?b(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=I?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,_,A)):A[0]+_+A[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),x(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=y(r)?l(e,u.value,null):l(e,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),g(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function y(e){return null===e}function m(e){return"number"==typeof e}function v(e){return"string"==typeof e}function g(e){return void 0===e}function b(e){return _(e)&&"[object RegExp]"===I(e)}function _(e){return"object"==typeof e&&null!==e}function w(e){return _(e)&&"[object Date]"===I(e)}function S(e){return _(e)&&("[object Error]"===I(e)||e instanceof Error)}function E(e){return"function"==typeof e}function I(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(g(o)&&(o=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!s[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var n=e.pid;s[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,n,e)}}else s[r]=function(){};return s[r]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=d,t.isNull=y,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=v,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=g,t.isRegExp=b,t.isObject=_,t.isDate=w,t.isError=S,t.isFunction=E,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(150);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),k[e.getMonth()],t].join(" ")}function x(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",C(),t.format.apply(t,arguments))},t.inherits=r(151),t._extend=function(e,t){if(!t||!_(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var T="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(T&&e[T]){var t;if("function"!=typeof(t=e[T]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,T,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o-1?t||"":t,this.isJsonValue?JSON.parse(t):t&&"function"==typeof t.toString?t.toString():t},this.toWireFormat=function(e){return this.isJsonValue?JSON.stringify(e):e}}function p(){a.apply(this,arguments),this.toType=function(e){var t=i.base64.decode(e);if(this.isSensitive&&i.isNode()&&"function"==typeof i.Buffer.alloc){var r=i.Buffer.alloc(t.length,t);t.fill(0),t=r}return t},this.toWireFormat=i.base64.encode}function d(){p.apply(this,arguments)}function y(){a.apply(this,arguments),this.toType=function(e){return"boolean"==typeof e?e:null==e?null:"true"===e}}a.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"},a.types={structure:c,list:l,map:f,boolean:y,timestamp:function(e){var t=this;if(a.apply(this,arguments),e.timestampFormat)o(this,"timestampFormat",e.timestampFormat);else if(t.isTimestampFormatSet&&this.timestampFormat)o(this,"timestampFormat",this.timestampFormat);else if("header"===this.location)o(this,"timestampFormat","rfc822");else if("querystring"===this.location)o(this,"timestampFormat","iso8601");else if(this.api)switch(this.api.protocol){case"json":case"rest-json":o(this,"timestampFormat","unixTimestamp");break;case"rest-xml":case"query":case"ec2":o(this,"timestampFormat","iso8601")}this.toType=function(e){return null==e?null:"function"==typeof e.toUTCString?e:"string"==typeof e||"number"==typeof e?i.date.parseTimestamp(e):null},this.toWireFormat=function(e){return i.date.format(e,t.timestampFormat)}},float:function(){a.apply(this,arguments),this.toType=function(e){return null==e?null:parseFloat(e)},this.toWireFormat=this.toType},integer:function(){a.apply(this,arguments),this.toType=function(e){return null==e?null:parseInt(e,10)},this.toWireFormat=this.toType},string:h,base64:d,binary:p},a.resolve=function(e,t){if(e.shape){var r=t.api.shapes[e.shape];if(!r)throw new Error("Cannot find shape reference: "+e.shape);return r}return null},a.create=function(e,t,r){if(e.isShape)return e;var n=a.resolve(e,t);if(n){var i=Object.keys(e);t.documentation||(i=i.filter((function(e){return!e.match(/documentation/)})));var o=function(){n.constructor.call(this,e,t,r)};return o.prototype=n,new o}e.type||(e.members?e.type="structure":e.member?e.type="list":e.key?e.type="map":e.type="string");var s=e.type;if(a.normalizedTypes[e.type]&&(e.type=a.normalizedTypes[e.type]),a.types[e.type])return new a.types[e.type](e,t,r);throw new Error("Unrecognized shape type: "+s)},a.shapes={StructureShape:c,ListShape:l,MapShape:f,StringShape:h,BooleanShape:y,Base64Shape:d},e.exports=a},function(e,t,r){r(69);var n=r(3),i=n.Service,o=n.apiLoader;o.services.sts={},n.STS=i.defineService("sts",["2011-06-15"]),r(311),Object.defineProperty(o.services.sts,"2011-06-15",{get:function(){var e=r(313);return e.paginators=r(314).pagination,e},enumerable:!0,configurable:!0}),e.exports=n.STS},function(e,t,r){(t=e.exports=r(85)).Stream=t,t.Readable=t,t.Writable=r(89),t.Duplex=r(24),t.Transform=r(92),t.PassThrough=r(161)},function(e,t,r){"use strict";e.exports=r(95)()?Object.setPrototypeOf:r(96)},function(e,t,r){"use strict";e.exports=r(187)()?globalThis:r(188)},function(e,t,r){"use strict";var n=Object.prototype.toString,i=n.call(function(){return arguments}());e.exports=function(e){return n.call(e)===i}},function(e,t,r){"use strict";var n=Object.prototype.toString,i=n.call("");e.exports=function(e){return"string"==typeof e||e&&"object"==typeof e&&(e instanceof String||n.call(e)===i)||!1}},function(e,t,r){var n,i,o,s,a,u;e.exports=(u=r(4),i=(n=u).lib,o=i.Base,s=i.WordArray,(a=n.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=o.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,r=[],n=0;n=0?"&":"?";var u=[];n.arrayEach(Object.keys(s).sort(),(function(e){Array.isArray(s[e])||(s[e]=[s[e]]);for(var t=0;t-1});var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object DataView]"];e.exports={isEmptyData:function(e){return"string"==typeof e?0===e.length:0===e.byteLength},convertToBuffer:function(e){return"string"==typeof e&&(e=new n(e,"utf8")),ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return _}));var n=r(17),i=r(8),o=r(5),s=r(1),a=r(51),u=r(0),c=r(2);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 f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(o)})),e.exports=u}).call(this,r(6))},function(e,t,r){(function(t){var n=r(19),i=r(36).inherits,o=r(152),s=r(238),a=r(262),u=r(47),c=r(263),l=r(265),f=r(68);function h(e){return e>9?e:"0"+e}function p(e,t,r,n,i,o,a,c,l,f,h,p,d,y){var m=e+"\n"+n+"\n"+i+"\n"+("host:"+r.toLowerCase()+"\n")+"\nhost\n"+s.SHA256(f,{asBytes:!0});!0===d&&console.log("canonical request: "+m+"\n");var v=s.SHA256(m,{asBytes:!0});!0===d&&console.log("hashed canonical request: "+v+"\n");var g="AWS4-HMAC-SHA256\n"+p+"\n"+h+"/"+c+"/"+l+"/aws4_request\n"+v;!0===d&&console.log("string to sign: "+g+"\n");var b=function(e,t,r,n){var i=s.HmacSHA256(t,"AWS4"+e,{asBytes:!0}),o=s.HmacSHA256(r,i,{asBytes:!0}),a=s.HmacSHA256(n,o,{asBytes:!0});return s.HmacSHA256("aws4_request",a,{asBytes:!0})}(a,h,c,l);!0===d&&console.log("signing key: "+b+"\n");var _=s.HmacSHA256(g,b,{asBytes:!0});!0===d&&console.log("signature: "+_+"\n");var w=i+"&X-Amz-Signature="+_;u(y)||(w+="&X-Amz-Security-Token="+encodeURIComponent(y));var S=t+r+n+"?"+w;return!0===d&&console.log("url: "+S+"\n"),S}function d(e,t,r,n){var i,o,s=(i=new Date).getUTCFullYear()+""+h(i.getUTCMonth()+1)+h(i.getUTCDate())+"T"+h(i.getUTCHours())+h(i.getUTCMinutes())+h(i.getUTCSeconds())+"Z",a=(o=s).substring(0,o.indexOf("T")),c="X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential="+t+"%2F"+a+"%2F"+e.region+"%2Fiotdevicegateway%2Faws4_request&X-Amz-Date="+s+"&X-Amz-SignedHeaders=host",l=e.host;return u(e.port)||443===e.port||(l=e.host+":"+e.port),p("GET","wss://",l,"/mqtt",c,0,r,e.region,"iotdevicegateway","",a,s,e.debug,n)}function y(e){var t=e.host;return u(e.port)||443===e.port||(t=e.host+":"+e.port),"wss://"+t+"/mqtt"}function m(e){var t={},r={};return function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(this,e[r],parseInt(r,10))}(e.split(/\r?\n/),(function(e){var n=(e=e.split(/(^|\s)[;#]/)[0]).match(/^\s*\[([^\[\]]+)\]\s*$/);if(n)r=n[1];else if(r){var i=e.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);i&&(t[r]=t[r]||{},t[r][i[1]]=i[2])}})),t}function v(e){if(!(this instanceof v))return new v(e);var n=this,i=[],s=!0,h=0,p="oldest";i.length=0;var g=[];g.length=0;var b=[],_=!0;b.length=0;var w=[];w.length=0;var S,E,I,A,k,C="inactive",x=null,T=250,R=1e3,O=2e4,P=128e3,N=null,L="?SDK=JavaScript&Version="+r(266).version;if(u(e)||0===Object.keys(e).length)throw new Error(a.INVALID_CONNECT_OPTIONS);if(u(e.keepalive)&&(e.keepalive=300),(u(e.enableMetrics)||!0===e.enableMetrics)&&(u(e.username)?e.username=L:e.username+=L),u(e.baseReconnectTimeMs)||(R=e.baseReconnectTimeMs),u(e.minimumConnectionTimeMs)||(O=e.minimumConnectionTimeMs),u(e.maximumReconnectTimeMs)||(P=e.maximumReconnectTimeMs),u(e.drainTimeMs)||(T=e.drainTimeMs),u(e.autoResubscribe)||(_=e.autoResubscribe),u(e.offlineQueueing)||(s=e.offlineQueueing),u(e.offlineQueueMaxSize)||(h=e.offlineQueueMaxSize),u(e.offlineQueueDropBehavior)||(p=e.offlineQueueDropBehavior),S=R,e.reconnectPeriod=S,e.fastDisconnectDetection=!0,e.resubscribe=!1,e.baseReconnectTimeMs<=0)throw new Error(a.INVALID_RECONNECT_TIMING);if(P0&&i.length>=h&&("oldest"===p?i.shift():o=!1),o&&i.push({topic:e,message:t,options:r,callback:n}))},this.subscribe=function(e,t,r){V()&&!1!==_?g.length<50?g.push({type:"subscribe",topics:e,options:t,callback:r}):n.emit("error",new Error("Maximum queued offline subscription reached")):(H("subscribe",e,t),u(r)?z.subscribe(e,t):z.subscribe(e,t,r))},this.unsubscribe=function(t,r){V()&&!1!==_?g.length<50&&g.push({type:"unsubscribe",topics:t,options:e,callback:r}):(H("unsubscribe",t),z.unsubscribe(t,r))},this.end=function(e,t){z.end(e,t)},this.handleMessage=z.handleMessage.bind(z),z.handleMessage=function(e,t){n.handleMessage(e,t)},this.updateWebSocketCredentials=function(e,t,r,n){E=e,I=t,A=r},this.getWebsocketHeaders=function(){return e.websocketOptions.headers},this.updateCustomAuthHeaders=function(t){e.websocketOptions.headers=t},this.simulateNetworkFailure=function(){z.stream.emit("error",new Error("simulated connection error")),z.stream.end()}}i(v,n.EventEmitter),e.exports=v,e.exports.DeviceClient=v,e.exports.prepareWebSocketUrl=d,e.exports.prepareWebSocketCustomAuthUrl=y}).call(this,r(6))},function(e,t){e.exports=function(){for(var e={},t=0;t=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach((function(t,r){t>=e&&(this.__redo__[r]=++t)}),this),this.__redo__.push(e)):f(this,"__redo__",u("c",[e])))})),_onDelete:u((function(e){var t;e>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(-1!==(t=this.__redo__.indexOf(e))&&this.__redo__.splice(t,1),this.__redo__.forEach((function(t,r){t>e&&(this.__redo__[r]=--t)}),this)))})),_onClear:u((function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0}))}))),f(n.prototype,l.iterator,u((function(){return this})))},function(e,t,r){"use strict";var n=r(228),i=r(230);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),h=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=r(106);function b(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?N+="x":N+=P[L];if(!N.match(p)){var j=R.slice(0,C),M=R.slice(C+1),q=P.match(d);q&&(j.push(q[1]),M.unshift(q[2])),M.length&&(b="/"+M.join(".")+b),this.hostname=j.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),T||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+U,this.href+=this.host,T&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[S])for(C=0,O=l.length;C0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=E.slice(-1)[0],k=(r.host||e.host||E.length>1)&&("."===A||".."===A)||""===A,C=0,x=E.length;x>=0;x--)"."===(A=E[x])?E.splice(x,1):".."===A?(E.splice(x,1),C++):C&&(E.splice(x,1),C--);if(!w&&!S)for(;C--;C)E.unshift("..");!w||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),k&&"/"!==E.join("/").substr(-1)&&E.push("");var T,R=""===E[0]||E[0]&&"/"===E[0].charAt(0);I&&(r.hostname=r.host=R?"":E.length?E.shift():"",(T=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift()));return(w=w||r.host&&E.length)&&!R&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,r){"use strict";var n=r(234);e.exports=function(e,t){var r;function i(n){t.rejectUnauthorized&&e.emit("error",n),r.end()}return t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,(r=n.connect(t)).on("secureConnect",(function(){t.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",i)})),r.on("error",i),r}},function(e,t,r){"use strict";(function(t,n){var i=r(41).Transform,o=r(235),s=r(237),a=r(14).Buffer;e.exports=function(e,r,u){var c,l,f="browser"===t.title,h=!!n.WebSocket,p=f?function e(t,r,n){if(l.bufferedAmount>y)return void setTimeout(e,m,t,r,n);g&&"string"==typeof t&&(t=a.from(t,"utf8"));try{l.send(t)}catch(e){return n(e)}n()}:function(e,t,r){if(l.readyState!==l.OPEN)return void r();g&&"string"==typeof e&&(e=a.from(e,"utf8"));l.send(e,r)};r&&!Array.isArray(r)&&"object"==typeof r&&(u=r,r=null,("string"==typeof u.protocol||Array.isArray(u.protocol))&&(r=u.protocol));u||(u={});void 0===u.objectMode&&(u.objectMode=!(!0===u.binary||void 0===u.binary));var d=function(e,t,r){var n=new i({objectMode:e.objectMode});return n._write=t,n._flush=r,n}(u,p,(function(e){l.close(),e()}));u.objectMode||(d._writev=E);var y=u.browserBufferSize||524288,m=u.browserBufferTimeout||1e3;"object"==typeof e?l=e:(l=h&&f?new s(e,r):new s(e,r,u)).binaryType="arraybuffer";var v=void 0===l.addEventListener;l.readyState===l.OPEN?c=d:(c=c=o(void 0,void 0,u),u.objectMode||(c._writev=E),v?l.addEventListener("open",b):l.onopen=b);c.socket=l,v?(l.addEventListener("close",_),l.addEventListener("error",w),l.addEventListener("message",S)):(l.onclose=_,l.onerror=w,l.onmessage=S);d.on("close",(function(){l.close()}));var g=!u.objectMode;function b(){c.setReadable(d),c.setWritable(d),c.emit("connect")}function _(){c.end(),c.destroy()}function w(e){c.destroy(e)}function S(e){var t=e.data;t=t instanceof ArrayBuffer?a.from(t):a.from(t,"utf8"),d.push(t)}function E(e,t){for(var r=new Array(e.length),n=0;n>>31}var f=(n<<5|n>>>27)+a+u[c];f+=c<20?1518500249+(i&o|~i&s):c<40?1859775393+(i^o^s):c<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,a=s,s=o,o=i<<30|i>>>2,i=n,n=f}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=s._createHelper(c),n.HmacSHA1=s._createHmacHelper(c),l.SHA1)},function(e,t,r){var n,i,o,s;e.exports=(n=r(4),o=(i=n).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,u=o.words,c=0;c0)try{var i=JSON.parse(r.body.toString());(i.__type||i.code)&&(t.code=(i.__type||i.code).split("#").pop()),"RequestEntityTooLarge"===t.code?t.message="Request body must be less than 1 MB":t.message=i.message||i.Message||null}catch(i){t.statusCode=r.statusCode,t.message=r.statusMessage}else t.statusCode=r.statusCode,t.message=r.statusCode.toString();e.error=n.error(new Error,t)},extractData:function(e){var t=e.httpResponse.body.toString()||"{}";if(!1===e.request.service.config.convertResponseTypes)e.data=JSON.parse(t);else{var r=e.request.service.api.operations[e.request.operation].output||{},n=new o;e.data=n.parse(t,r)}}}},function(e,t,r){var n=r(7);function i(){}function o(e,t){if(t&&null!=e)switch(t.type){case"structure":return function(e,t){var r={};return n.each(e,(function(e,n){var i=t.members[e];if(i){if("body"!==i.location)return;var s=i.isLocationName?i.name:e,a=o(n,i);void 0!==a&&(r[s]=a)}})),r}(e,t);case"map":return function(e,t){var r={};return n.each(e,(function(e,n){var i=o(n,t.value);void 0!==i&&(r[e]=i)})),r}(e,t);case"list":return function(e,t){var r=[];return n.arrayEach(e,(function(e){var n=o(e,t.member);void 0!==n&&r.push(n)})),r}(e,t);default:return function(e,t){return t.toWireFormat(e)}(e,t)}}i.prototype.build=function(e,t){return JSON.stringify(o(e,t))},e.exports=i},function(e,t,r){var n=r(7);function i(){}function o(e,t){if(t&&void 0!==e)switch(t.type){case"structure":return function(e,t){if(null==e)return;var r={},i=t.members;return n.each(i,(function(t,n){var i=n.isLocationName?n.name:t;if(Object.prototype.hasOwnProperty.call(e,i)){var s=o(e[i],n);void 0!==s&&(r[t]=s)}})),r}(e,t);case"map":return function(e,t){if(null==e)return;var r={};return n.each(e,(function(e,n){var i=o(n,t.value);r[e]=void 0===i?null:i})),r}(e,t);case"list":return function(e,t){if(null==e)return;var r=[];return n.arrayEach(e,(function(e){var n=o(e,t.member);void 0===n?r.push(null):r.push(n)})),r}(e,t);default:return function(e,t){return t.toType(e)}(e,t)}}i.prototype.parse=function(e,t){return o(JSON.parse(e),t)},e.exports=i},function(e,t,r){var n=r(7),i=r(3);e.exports={populateHostPrefix:function(e){if(!e.service.config.hostPrefixEnabled)return e;var t,r,o,s=e.service.api.operations[e.operation];if(function(e){var t=e.service.api,r=t.operations[e.operation],i=t.endpointOperation&&t.endpointOperation===n.string.lowerFirst(r.name);return"NULL"!==r.endpointDiscoveryRequired||!0===i}(e))return e;if(s.endpoint&&s.endpoint.hostPrefix){var a=function(e,t,r){return n.each(r.members,(function(r,i){if(!0===i.hostLabel){if("string"!=typeof t[r]||""===t[r])throw n.error(new Error,{message:"Parameter "+r+" should be a non-empty string.",code:"InvalidParameter"});var o=new RegExp("\\{"+r+"\\}","g");e=e.replace(o,t[r])}})),e}(s.endpoint.hostPrefix,e.params,s.input);!function(e,t){e.host&&(e.host=t+e.host);e.hostname&&(e.hostname=t+e.hostname)}(e.httpRequest.endpoint,a),t=e.httpRequest.endpoint.hostname,r=t.split("."),o=/^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/,n.arrayEach(r,(function(e){if(!e.length||e.length<1||e.length>63)throw n.error(new Error,{code:"ValidationError",message:"Hostname label length should be between 1 to 63 characters, inclusive."});if(!o.test(e))throw i.util.error(new Error,{code:"ValidationError",message:e+" is not hostname compatible."})}))}return e}}},function(e,t,r){!function(e){"use strict";function t(e){return null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function n(e,i){if(e===i)return!0;if(Object.prototype.toString.call(e)!==Object.prototype.toString.call(i))return!1;if(!0===t(e)){if(e.length!==i.length)return!1;for(var o=0;o":!0,"=":!0,"!":!0},l={" ":!0,"\t":!0,"\n":!0};function f(e){return e>="0"&&e<="9"||"-"===e}function h(){}h.prototype={tokenize:function(e){var t,r,n,i,o=[];for(this._current=0;this._current="a"&&i<="z"||i>="A"&&i<="Z"||"_"===i)t=this._current,r=this._consumeUnquotedIdentifier(e),o.push({type:"UnquotedIdentifier",value:r,start:t});else if(void 0!==u[e[this._current]])o.push({type:u[e[this._current]],value:e[this._current],start:this._current}),this._current++;else if(f(e[this._current]))n=this._consumeNumber(e),o.push(n);else if("["===e[this._current])n=this._consumeLBracket(e),o.push(n);else if('"'===e[this._current])t=this._current,r=this._consumeQuotedIdentifier(e),o.push({type:"QuotedIdentifier",value:r,start:t});else if("'"===e[this._current])t=this._current,r=this._consumeRawStringLiteral(e),o.push({type:"Literal",value:r,start:t});else if("`"===e[this._current]){t=this._current;var s=this._consumeLiteral(e);o.push({type:"Literal",value:s,start:t})}else if(void 0!==c[e[this._current]])o.push(this._consumeOperator(e));else if(void 0!==l[e[this._current]])this._current++;else if("&"===e[this._current])t=this._current,this._current++,"&"===e[this._current]?(this._current++,o.push({type:"And",value:"&&",start:t})):o.push({type:"Expref",value:"&",start:t});else{if("|"!==e[this._current]){var a=new Error("Unknown character:"+e[this._current]);throw a.name="LexerError",a}t=this._current,this._current++,"|"===e[this._current]?(this._current++,o.push({type:"Or",value:"||",start:t})):o.push({type:"Pipe",value:"|",start:t})}return o},_consumeUnquotedIdentifier:function(e){var t,r=this._current;for(this._current++;this._current="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t);)this._current++;return e.slice(r,this._current)},_consumeQuotedIdentifier:function(e){var t=this._current;this._current++;for(var r=e.length;'"'!==e[this._current]&&this._current"===r?"="===e[this._current]?(this._current++,{type:"GTE",value:">=",start:t}):{type:"GT",value:">",start:t}:"="===r&&"="===e[this._current]?(this._current++,{type:"EQ",value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t,r=this._current,n=e.length;"`"!==e[this._current]&&this._current=0)return!0;if(["true","false","null"].indexOf(e)>=0)return!0;if(!("-0123456789".indexOf(e[0])>=0))return!1;try{return JSON.parse(e),!0}catch(e){return!1}}};var p={};function d(){}function y(e){this.runtime=e}function m(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[s]}]},avg:{_func:this._functionAvg,_signature:[{types:[8]}]},ceil:{_func:this._functionCeil,_signature:[{types:[s]}]},contains:{_func:this._functionContains,_signature:[{types:[a,3]},{types:[1]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[a]},{types:[a]}]},floor:{_func:this._functionFloor,_signature:[{types:[s]}]},length:{_func:this._functionLength,_signature:[{types:[a,3,4]}]},map:{_func:this._functionMap,_signature:[{types:[6]},{types:[3]}]},max:{_func:this._functionMax,_signature:[{types:[8,9]}]},merge:{_func:this._functionMerge,_signature:[{types:[4],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[3]},{types:[6]}]},sum:{_func:this._functionSum,_signature:[{types:[8]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[a]},{types:[a]}]},min:{_func:this._functionMin,_signature:[{types:[8,9]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[3]},{types:[6]}]},type:{_func:this._functionType,_signature:[{types:[1]}]},keys:{_func:this._functionKeys,_signature:[{types:[4]}]},values:{_func:this._functionValues,_signature:[{types:[4]}]},sort:{_func:this._functionSort,_signature:[{types:[9,8]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[3]},{types:[6]}]},join:{_func:this._functionJoin,_signature:[{types:[a]},{types:[9]}]},reverse:{_func:this._functionReverse,_signature:[{types:[a,3]}]},to_array:{_func:this._functionToArray,_signature:[{types:[1]}]},to_string:{_func:this._functionToString,_signature:[{types:[1]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[1]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[1],variadic:!0}]}}}p.EOF=0,p.UnquotedIdentifier=0,p.QuotedIdentifier=0,p.Rbracket=0,p.Rparen=0,p.Comma=0,p.Rbrace=0,p.Number=0,p.Current=0,p.Expref=0,p.Pipe=1,p.Or=2,p.And=3,p.EQ=5,p.GT=5,p.LT=5,p.GTE=5,p.LTE=5,p.NE=5,p.Flatten=9,p.Star=20,p.Filter=21,p.Dot=40,p.Not=45,p.Lbrace=50,p.Lbracket=55,p.Lparen=60,d.prototype={parse:function(e){this._loadTokens(e),this.index=0;var t=this.expression(0);if("EOF"!==this._lookahead(0)){var r=this._lookaheadToken(0),n=new Error("Unexpected token type: "+r.type+", value: "+r.value);throw n.name="ParserError",n}return t},_loadTokens:function(e){var t=(new h).tokenize(e);t.push({type:"EOF",value:"",start:e.length}),this.tokens=t},expression:function(e){var t=this._lookaheadToken(0);this._advance();for(var r=this.nud(t),n=this._lookahead(0);e=0?this.expression(e):"Lbracket"===t?(this._match("Lbracket"),this._parseMultiselectList()):"Lbrace"===t?(this._match("Lbrace"),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(p[this._lookahead(0)]<10)t={type:"Identity"};else if("Lbracket"===this._lookahead(0))t=this.expression(e);else if("Filter"===this._lookahead(0))t=this.expression(e);else{if("Dot"!==this._lookahead(0)){var r=this._lookaheadToken(0),n=new Error("Sytanx error, unexpected token: "+r.value+"("+r.type+")");throw n.name="ParserError",n}this._match("Dot"),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){for(var e=[];"Rbracket"!==this._lookahead(0);){var t=this.expression(0);if(e.push(t),"Comma"===this._lookahead(0)&&(this._match("Comma"),"Rbracket"===this._lookahead(0)))throw new Error("Unexpected token Rbracket")}return this._match("Rbracket"),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t,r,n=[],i=["UnquotedIdentifier","QuotedIdentifier"];;){if(e=this._lookaheadToken(0),i.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(t=e.value,this._advance(),this._match("Colon"),r={type:"KeyValuePair",name:t,value:this.expression(0)},n.push(r),"Comma"===this._lookahead(0))this._match("Comma");else if("Rbrace"===this._lookahead(0)){this._match("Rbrace");break}}return{type:"MultiSelectHash",children:n}}},y.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,o){var s,a,u,c,l,f,h,p,d;switch(e.type){case"Field":return null===o?null:r(o)?void 0===(f=o[e.name])?null:f:null;case"Subexpression":for(u=this.visit(e.children[0],o),d=1;d0)for(d=g;db;d+=_)u.push(o[d]);return u;case"Projection":var w=this.visit(e.children[0],o);if(!t(w))return null;for(p=[],d=0;dl;break;case"GTE":u=c>=l;break;case"LT":u=c=e&&(t=r<0?e-1:e),t}},m.prototype={callFunction:function(e,t){var r=this.functionTable[e];if(void 0===r)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,r._signature),r._func.call(this,t)},_validateArgs:function(e,t,r){var n,i,o,s;if(r[r.length-1].variadic){if(t.length=0;n--)r+=t[n];return r}var i=e[0].slice(0);return i.reverse(),i},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,r=e[0],n=0;n=0},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return r(e[0])?Object.keys(e[0]).length:e[0].length},_functionMap:function(e){for(var t=[],r=this._interpreter,n=e[0],i=e[1],o=0;o0){if(this._getTypeName(e[0][0])===s)return Math.max.apply(Math,e[0]);for(var t=e[0],r=t[0],n=1;n0){if(this._getTypeName(e[0][0])===s)return Math.min.apply(Math,e[0]);for(var t=e[0],r=t[0],n=1;na?1:su&&(u=r,t=i[c]);return t},_functionMinBy:function(e){for(var t,r,n=e[1],i=e[0],o=this.createKeyFunction(n,[s,a]),u=1/0,c=0;c>>((3&t)<<3)&255;return i}}},function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,i=r;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}},function(e,t,r){"use strict";(function(t){var n=r(59),i=r(41).Readable,o={objectMode:!0},s={clean:!0},a=r(162);function u(e){if(!(this instanceof u))return new u(e);this.options=e||{},this.options=n(s,e),this._inflights=new a}u.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},u.prototype.createStream=function(){var e=new i(o),r=!1,n=[],s=0;return this._inflights.forEach((function(e,t){n.push(e)})),e._read=function(){!r&&s0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?w(e,s,t,!1):A(e,s)):w(e,s,t,!1))):n||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function E(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(I,e):I(e))}function I(e){p("emit readable"),e.emit("readable"),T(e)}function A(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(k,e,t))}function k(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0===(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function O(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function N(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):E(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&O(this),null;var n,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?R(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&O(this)),null!==n&&this.emit("data",n),n},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:b;function c(t,n){p("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),e.removeListener("close",v),e.removeListener("finish",g),e.removeListener("drain",f),e.removeListener("error",m),e.removeListener("unpipe",c),r.removeListener("end",l),r.removeListener("end",b),r.removeListener("data",y),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){p("onend"),e.end()}o.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",c);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,T(e))}}(r);e.on("drain",f);var h=!1;var d=!1;function y(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==N(o.pipes,e))&&!h&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function m(t){p("onerror",t),b(),e.removeListener("error",m),0===a(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",g),b()}function g(){p("onfinish"),e.removeListener("close",v),b()}function b(){p("unpipe"),r.unpipe(e)}return r.on("data",y),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",m),e.once("close",v),e.once("finish",g),e.emit("pipe",r),o.flowing||(p("pipe resume"),r.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?n:o.nextTick;g.WritableState=v;var c=Object.create(r(38));c.inherits=r(20);var l={deprecate:r(160)},f=r(87),h=r(14).Buffer,p=i.Uint8Array||function(){};var d,y=r(88);function m(){}function v(e,t){a=a||r(24),e=e||{};var n=t instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,c=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(o.nextTick(i,n),o.nextTick(I,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),I(e,t))}(e,r,n,t,i);else{var s=S(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),n?u(_,e,r,s,i):_(e,r,s,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function g(e){if(a=a||r(24),!(d.call(g,this)||this instanceof a))return new g(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function b(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function _(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),I(e,t)}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,b(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(b(e,t,!1,t.objectMode?1:c.length,c,l,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function E(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),I(e,t)}))}function I(e,t){var r=S(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(E,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}c.inherits(g,f),v.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(v.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===g&&(e&&e._writableState instanceof v)}})):d=function(e){return e instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(e,t,r){var n,i=this._writableState,s=!1,a=!i.objectMode&&(n=e,h.isBuffer(n)||n instanceof p);return a&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=m),i.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),o.nextTick(t,r)}(this,r):(a||function(e,t,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),o.nextTick(n,s),i=!1),i}(this,i,e,r))&&(i.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,I(e,t),r&&(t.finished?o.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),g.prototype.destroy=y.destroy,g.prototype._undestroy=y.undestroy,g.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(6),r(90).setImmediate,r(13))},function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(159),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(13))},function(e,t,r){"use strict";var n=r(14).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(e.lastNeed=i-1),i;if(--n=0)return i>0&&(e.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=s;var n=r(24),i=Object.create(r(38));function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length65535||c%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;d+=2;if(d+=1,a){if("object"!=typeof a)return t.emit("error",new Error("Invalid will")),!1;if(!a.topic||"string"!=typeof a.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(d+=i.byteLength(a.topic)+2,a.payload&&a.payload){if(!(a.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof a.payload?d+=i.byteLength(a.payload)+2:d+=a.payload.length+2}else d+=2}var y=!1;if(null!=f){if(!E(f))return t.emit("error",new Error("Invalid username")),!1;y=!0,d+=i.byteLength(f)+2}if(null!=p){if(!y)return t.emit("error",new Error("Username is required to use password")),!1;if(!E(p))return t.emit("error",new Error("Invalid password")),!1;d+=S(p)+2}t.write(n.CONNECT_HEADER),v(t,d),w(t,o),t.write(4===s?n.VERSION4:n.VERSION3);var m=0;m|=null!=f?n.USERNAME_MASK:0,m|=null!=p?n.PASSWORD_MASK:0,m|=a&&a.retain?n.WILL_RETAIN_MASK:0,m|=a&&a.qos?a.qos<0&&h(t,l);return t.write(c)}(e,t);case"puback":case"pubrec":case"pubrel":case"pubcomp":case"unsuback":return function(e,t){var r=e||{},i=r.cmd||"puback",o=r.messageId,s=r.dup&&"pubrel"===i?n.DUP_MASK:0,a=0;"pubrel"===i&&(a=1);if("number"!=typeof o)return t.emit("error",new Error("Invalid messageId")),!1;return t.write(n.ACKS[i][a][s][0]),v(t,2),h(t,o)}(e,t);case"subscribe":return function(e,t){var r=e||{},o=r.dup?n.DUP_MASK:0,s=r.messageId,a=r.subscriptions,u=0;if("number"!=typeof s)return t.emit("error",new Error("Invalid messageId")),!1;u+=2;if("object"!=typeof a||!a.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(var c=0;c=0&&e<128?1:e>=128&&e<16384?2:e>=16384&&e<2097152?3:e>=2097152&&e<268435456?4:0}(e));do{t=e%128|0,(e=e/128|0)>0&&(t|=128),n.writeUInt8(t,r++)}while(e>0);return n}(t),t<16384&&(m[t]=r)),e.write(r)}function g(e,t){var r=i.byteLength(t);h(e,r),e.write(t,"utf8")}function b(e,t){return e.write(c[t])}function _(e,t){return e.write(l(t))}function w(e,t){"string"==typeof t?g(e,t):t?(h(e,t.length),e.write(t)):h(e,0)}function S(e){return e?e instanceof i?e.length:i.byteLength(e):0}function E(e){return"string"==typeof e||e instanceof i}e.exports=d},function(e,t,r){"use strict";t.decode=t.parse=r(231),t.encode=t.stringify=r(232)},function(e,t,r){"use strict";var n=r(233);e.exports=function(e,t){var r,i;return t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost",r=t.port,i=t.hostname,n.createConnection(r,i)}},function(e,t,r){"use strict";var n=!1,i=[];function o(e){n?wx.sendSocketMessage({data:e.buffer||e}):i.push(e)}var s=r(65);function a(e,t){var r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);var a=function(e,t){var r="wxs"===e.protocol?"wss":"ws",n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return s(function(e,t){var r={OPEN:1,CLOSING:2,CLOSED:3,readyState:n?1:0,send:o,close:wx.closeSocket,onopen:null,onmessage:null,onclose:null,onerror:null};return wx.connectSocket({url:e,protocols:t}),wx.onSocketOpen((function(e){r.readyState=r.OPEN,n=!0;for(var t=0;t>>7)^(d<<14|d>>>18)^d>>>3,m=c[p-2],v=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;c[p]=y+c[p-7]+v+c[p-16]}var g=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),_=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[p]+c[p];h=f,f=l,l=a,a=s+_|0,s=o,o=i,i=n,n=_+(b+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)},function(e,t,r){var n;e.exports=(n=r(4),r(46),function(){var e=n,t=e.lib.Hasher,r=e.x64,i=r.Word,o=r.WordArray,s=e.algo;function a(){return i.create.apply(i,arguments)}var u=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=a()}();var l=s.SHA512=t.extend({_doReset:function(){this._hash=new o.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 r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],f=r[6],h=r[7],p=n.high,d=n.low,y=i.high,m=i.low,v=o.high,g=o.low,b=s.high,_=s.low,w=a.high,S=a.low,E=l.high,I=l.low,A=f.high,k=f.low,C=h.high,x=h.low,T=p,R=d,O=y,P=m,N=v,L=g,D=b,j=_,M=w,q=S,U=E,B=I,F=A,H=k,V=C,z=x,K=0;K<80;K++){var W=c[K];if(K<16)var G=W.high=0|e[t+2*K],X=W.low=0|e[t+2*K+1];else{var Y=c[K-15],Q=Y.high,J=Y.low,$=(Q>>>1|J<<31)^(Q>>>8|J<<24)^Q>>>7,Z=(J>>>1|Q<<31)^(J>>>8|Q<<24)^(J>>>7|Q<<25),ee=c[K-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=c[K-7],se=oe.high,ae=oe.low,ue=c[K-16],ce=ue.high,le=ue.low;G=(G=(G=$+se+((X=Z+ae)>>>0>>0?1:0))+ne+((X+=ie)>>>0>>0?1:0))+ce+((X+=le)>>>0>>0?1:0),W.high=G,W.low=X}var fe,he=M&U^~M&F,pe=q&B^~q&H,de=T&O^T&N^O&N,ye=R&P^R&L^P&L,me=(T>>>28|R<<4)^(T<<30|R>>>2)^(T<<25|R>>>7),ve=(R>>>28|T<<4)^(R<<30|T>>>2)^(R<<25|T>>>7),ge=(M>>>14|q<<18)^(M>>>18|q<<14)^(M<<23|q>>>9),be=(q>>>14|M<<18)^(q>>>18|M<<14)^(q<<23|M>>>9),_e=u[K],we=_e.high,Se=_e.low,Ee=V+ge+((fe=z+be)>>>0>>0?1:0),Ie=ve+ye;V=F,z=H,F=U,H=B,U=M,B=q,M=D+(Ee=(Ee=(Ee=Ee+he+((fe+=pe)>>>0>>0?1:0))+we+((fe+=Se)>>>0>>0?1:0))+G+((fe+=X)>>>0>>0?1:0))+((q=j+fe|0)>>>0>>0?1:0)|0,D=N,j=L,N=O,L=P,O=T,P=R,T=Ee+(me+de+(Ie>>>0>>0?1:0))+((R=fe+Ie|0)>>>0>>0?1:0)|0}d=n.low=d+R,n.high=p+T+(d>>>0>>0?1:0),m=i.low=m+P,i.high=y+O+(m>>>0

>>0?1:0),g=o.low=g+L,o.high=v+N+(g>>>0>>0?1:0),_=s.low=_+j,s.high=b+D+(_>>>0>>0?1:0),S=a.low=S+q,a.high=w+M+(S>>>0>>0?1:0),I=l.low=I+B,l.high=E+U+(I>>>0>>0?1:0),k=f.low=k+H,f.high=A+F+(k>>>0>>0?1:0),x=h.low=x+z,h.high=C+V+(x>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),n.SHA512)},function(e,t,r){var n=r(3),i=r(7),o=r(271),s=r(39),a=r(73).populateHostPrefix;e.exports={buildRequest:function(e){var t=e.service.api.operations[e.operation],r=e.httpRequest;r.headers["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8",r.params={Version:e.service.api.apiVersion,Action:t.name},(new o).serialize(e.params,t.input,(function(e,t){r.params[e]=t})),r.body=i.queryParamsToString(r.params),a(e)},extractError:function(e){var t,r=e.httpResponse.body.toString();if(r.match("0){var f=(t=new n.XML.Parser).parse(s.toString(),u);i.update(e.data,f)}}}},function(e,t,r){var n=r(113),i=r(117),o=r(39),s=r(118),a=r(119),u=r(120),c=r(7),l=c.property,f=c.memoizedProperty;e.exports=function(e,t){var r=this;e=e||{},(t=t||{}).api=this,e.metadata=e.metadata||{};var h=t.serviceIdentifier;delete t.serviceIdentifier,l(this,"isApi",!0,!1),l(this,"apiVersion",e.metadata.apiVersion),l(this,"endpointPrefix",e.metadata.endpointPrefix),l(this,"signingName",e.metadata.signingName),l(this,"globalEndpoint",e.metadata.globalEndpoint),l(this,"signatureVersion",e.metadata.signatureVersion),l(this,"jsonVersion",e.metadata.jsonVersion),l(this,"targetPrefix",e.metadata.targetPrefix),l(this,"protocol",e.metadata.protocol),l(this,"timestampFormat",e.metadata.timestampFormat),l(this,"xmlNamespaceUri",e.metadata.xmlNamespace),l(this,"abbreviation",e.metadata.serviceAbbreviation),l(this,"fullName",e.metadata.serviceFullName),l(this,"serviceId",e.metadata.serviceId),h&&u[h]&&l(this,"xmlNoDefaultLists",u[h].xmlNoDefaultLists,!1),f(this,"className",(function(){var t=e.metadata.serviceAbbreviation||e.metadata.serviceFullName;return t?("ElasticLoadBalancing"===(t=t.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g,""))&&(t="ELB"),t):null})),l(this,"operations",new n(e.operations,t,(function(e,r){return new i(e,r,t)}),c.string.lowerFirst,(function(e,t){!0===t.endpointoperation&&l(r,"endpointOperation",c.string.lowerFirst(e))}))),l(this,"shapes",new n(e.shapes,t,(function(e,r){return o.create(r,t)}))),l(this,"paginators",new n(e.paginators,t,(function(e,r){return new s(e,r,t)}))),l(this,"waiters",new n(e.waiters,t,(function(e,r){return new a(e,r,t)}),c.string.lowerFirst)),t.documentation&&(l(this,"documentation",e.documentation),l(this,"documentationUrl",e.documentationUrl))}},function(e,t,r){var n=r(39),i=r(7),o=i.property,s=i.memoizedProperty;e.exports=function(e,t,r){var i=this;r=r||{},o(this,"name",t.name||e),o(this,"api",r.api,!1),t.http=t.http||{},o(this,"endpoint",t.endpoint),o(this,"httpMethod",t.http.method||"POST"),o(this,"httpPath",t.http.requestUri||"/"),o(this,"authtype",t.authtype||""),o(this,"endpointDiscoveryRequired",t.endpointdiscovery?t.endpointdiscovery.required?"REQUIRED":"OPTIONAL":"NULL"),s(this,"input",(function(){return t.input?n.create(t.input,r):new n.create({type:"structure"},r)})),s(this,"output",(function(){return t.output?n.create(t.output,r):new n.create({type:"structure"},r)})),s(this,"errors",(function(){var e=[];if(!t.errors)return null;for(var i=0;i-1&&r.splice(i,1)}return this},removeAllListeners:function(e){return e?delete this._events[e]:this._events={},this},emit:function(e,t,r){r||(r=function(){});var n=this.listeners(e),i=n.length;return this.callListeners(n,t,r),i>0},callListeners:function(e,t,r,i){var o=this,s=i||null;function a(i){if(i&&(s=n.util.error(s||new Error,i),o._haltHandlersOnError))return r.call(o,s);o.callListeners(e,t,r,s)}for(;e.length>0;){var u=e.shift();if(u._isAsync)return void u.apply(o,t.concat([a]));try{u.apply(o,t)}catch(e){s=n.util.error(s||new Error,e)}if(s&&o._haltHandlersOnError)return void r.call(o,s)}r.call(o,s)},addListeners:function(e){var t=this;return e._events&&(e=e._events),n.util.each(e,(function(e,r){"function"==typeof r&&(r=[r]),n.util.arrayEach(r,(function(r){t.on(e,r)}))})),t},addNamedListener:function(e,t,r,n){return this[e]=r,this.addListener(t,r,n),this},addNamedAsyncListener:function(e,t,r,n){return r._isAsync=!0,this.addNamedListener(e,t,r,n)},addNamedListeners:function(e){var t=this;return e((function(){t.addNamedListener.apply(t,arguments)}),(function(){t.addNamedAsyncListener.apply(t,arguments)})),this}}),n.SequentialExecutor.prototype.addListener=n.SequentialExecutor.prototype.on,e.exports=n.SequentialExecutor},function(e,t,r){var n=r(3);n.Credentials=n.util.inherit({constructor:function(){if(n.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof arguments[0]){var e=arguments[0].credentials||arguments[0];this.accessKeyId=e.accessKeyId,this.secretAccessKey=e.secretAccessKey,this.sessionToken=e.sessionToken}else this.accessKeyId=arguments[0],this.secretAccessKey=arguments[1],this.sessionToken=arguments[2]},expiryWindow:15,needsRefresh:function(){var e=n.util.date.getDate().getTime(),t=new Date(e+1e3*this.expiryWindow);return!!(this.expireTime&&t>this.expireTime)||(this.expired||!this.accessKeyId||!this.secretAccessKey)},get:function(e){var t=this;this.needsRefresh()?this.refresh((function(r){r||(t.expired=!1),e&&e(r)})):e&&e()},refresh:function(e){this.expired=!1,e()},coalesceRefresh:function(e,t){var r=this;1===r.refreshCallbacks.push(e)&&r.load((function(e){n.util.arrayEach(r.refreshCallbacks,(function(r){t?r(e):n.util.defer((function(){r(e)}))})),r.refreshCallbacks.length=0}))},load:function(e){e()}}),n.Credentials.addPromisesToClass=function(e){this.prototype.getPromise=n.util.promisifyMethod("get",e),this.prototype.refreshPromise=n.util.promisifyMethod("refresh",e)},n.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise},n.util.addPromises(n.Credentials)},function(e,t,r){var n=r(3);n.CredentialProviderChain=n.util.inherit(n.Credentials,{constructor:function(e){this.providers=e||n.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(e){var t=this;if(0===t.providers.length)return e(new Error("No providers")),t;if(1===t.resolveCallbacks.push(e)){var r=0,i=t.providers.slice(0);!function e(o,s){if(!o&&s||r===i.length)return n.util.arrayEach(t.resolveCallbacks,(function(e){e(o,s)})),void(t.resolveCallbacks.length=0);var a=i[r++];(s="function"==typeof a?a.call():a).get?s.get((function(t){e(t,t?null:s)})):e(null,s)}()}return t}}),n.CredentialProviderChain.defaultProviders=[],n.CredentialProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=n.util.promisifyMethod("resolve",e)},n.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise},n.util.addPromises(n.CredentialProviderChain)},function(e,t,r){var n=r(3),i=n.util.inherit;n.Endpoint=i({constructor:function(e,t){if(n.util.hideProperties(this,["slashes","auth","hash","search","query"]),null==e)throw new Error("Invalid endpoint: "+e);if("string"!=typeof e)return n.util.copy(e);e.match(/^http/)||(e=((t&&void 0!==t.sslEnabled?t.sslEnabled:n.config.sslEnabled)?"https":"http")+"://"+e);n.util.update(this,n.util.urlParse(e)),this.port?this.port=parseInt(this.port,10):this.port="https:"===this.protocol?443:80}}),n.HttpRequest=i({constructor:function(e,t){e=new n.Endpoint(e),this.method="POST",this.path=e.path||"/",this.headers={},this.body="",this.endpoint=e,this.region=t,this._userAgent="",this.setUserAgent()},setUserAgent:function(){this._userAgent=this.headers[this.getUserAgentHeaderName()]=n.util.userAgent()},getUserAgentHeaderName:function(){return(n.util.isBrowser()?"X-Amz-":"")+"User-Agent"},appendToUserAgent:function(e){"string"==typeof e&&e&&(this._userAgent+=" "+e),this.headers[this.getUserAgentHeaderName()]=this._userAgent},getUserAgent:function(){return this._userAgent},pathname:function(){return this.path.split("?",1)[0]},search:function(){var e=this.path.split("?",2)[1];return e?(e=n.util.queryStringParse(e),n.util.queryParamsToString(e)):""},updateEndpoint:function(e){var t=new n.Endpoint(e);this.endpoint=t,this.path=t.path||"/",this.headers.Host&&(this.headers.Host=t.host)}}),n.HttpResponse=i({constructor:function(){this.statusCode=void 0,this.headers={},this.body=void 0,this.streaming=!1,this.stream=null},createUnbufferedStream:function(){return this.streaming=!0,this.stream}}),n.HttpClient=i({}),n.HttpClient.getInstance=function(){return void 0===this.singleton&&(this.singleton=new this),this.singleton}},function(e,t,r){var n=r(3),i=n.util.inherit;n.Signers.V3=i(n.Signers.RequestSigner,{addAuthorization:function(e,t){var r=n.util.date.rfc822(t);this.request.headers["X-Amz-Date"]=r,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken),this.request.headers["X-Amzn-Authorization"]=this.authorization(e,r)},authorization:function(e){return"AWS3 AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,SignedHeaders="+this.signedHeaders()+",Signature="+this.signature(e)},signedHeaders:function(){var e=[];return n.util.arrayEach(this.headersToSign(),(function(t){e.push(t.toLowerCase())})),e.sort().join(";")},canonicalHeaders:function(){var e=this.request.headers,t=[];return n.util.arrayEach(this.headersToSign(),(function(r){t.push(r.toLowerCase().trim()+":"+String(e[r]).trim())})),t.sort().join("\n")+"\n"},headersToSign:function(){var e=[];return n.util.each(this.request.headers,(function(t){("Host"===t||"Content-Encoding"===t||t.match(/^X-Amz/i))&&e.push(t)})),e},signature:function(e){return n.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push("/"),e.push(""),e.push(this.canonicalHeaders()),e.push(this.request.body),n.util.crypto.sha256(e.join("\n"))}}),e.exports=n.Signers.V3},function(e,t,r){e.exports=r(130)},function(e,t,r){"use strict";r.d(t,"a",(function(){return y}));var n=r(10),i=r(50),o=r(52),s=r(35),a=r(55),u=r(8),c=r(22),l=r(18),f=r(51),h=r(54),p=r(53),d=r(56),y={User:{Service:i.a,Model:u.a,ListQuery:f.a},Conversation:{Service:o.a,Model:c.a,ListQuery:h.a},Message:{Service:s.a,Model:l.a,ListQuery:p.a},File:{Service:d.a},PushNotification:{Service:a.a},Client:n.a}},function(e,t,r){"use strict";r.d(t,"a",(function(){return g}));var n=r(26),i=r(2),o=r(27);function s(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};y(this,e),v(this,"__socketClass",u),v(this,"__socket",void 0),v(this,"__events",{connected:{topic:"connected"},disconnected:{topic:"disconnected"},reconnected:{topic:"reconnected"},"conversation.updated":{topic:"users/[login_user]/conversation/updated"},"conversation.members_added":{topic:"users/[login_user]/conversation/members_added"},"conversation.members_removed":{topic:"users/[login_user]/conversation/members_removed"},"conversation.admin_added":{topic:"users/[login_user]/conversation/admin_added"},"conversation.typing":{topic:"users/[login_user]/conversation_typing"},"conversation.mark_as_read":{topic:"users/[login_user]/conversation/mark_as_read"},"message.deleted_for_everyone":{topic:"users/[login_user]/messages/deleted_for_everyone"},"user.friends_added":{topic:"users/[login_user]/friends_added"},"user.friends_removed":{topic:"users/[login_user]/friends_removed"},"user.blocked":{topic:"users/[login_user]/blocked"},"user.unblocked":{topic:"users/[login_user]/unblocked"},"user.conversation_deleted":{topic:"users/[login_user]/conversation_deleted"},"user.conversation_cleared":{topic:"users/[login_user]/conversation_cleared"},"user.mute_updated":{topic:"users/[login_user]/mute_updated"},"user.joined":{topic:"users/[login_user]/joined"},"user.removed":{topic:"users/[login_user]/removed"},"user.message_created":{topic:"users/[login_user]/message_created"},"user.message_deleted":{topic:"users/[login_user]/message_deleted"},"user.total_unread_message_count_updated":{topic:"users/[login_user]/total_unread_message_count_updated"},"user.status_updated":{topic:"users/status_updated"},"user.updated":{topic:"users/updated"}}),v(this,"allowForceResubscribe",!1),v(this,"__baseEvents",["connected","disconnected","reconnected"]),v(this,"__subscribedTopics",{}),v(this,"__preConnectEvents",[]),this.__socket=new this.__socketClass(this),this.__connected=!1,this.__autoSubscribed=!1,this.__publicKey=t.publicKey}var t,r,n;return t=e,(r=[{key:"connect",value:function(e,t,r){var n=this;return Object(i.a)(r,(function(r){n.__userId=e,n.__socket.connect(e,t,r)}))}},{key:"__onConnected",value:function(e){this.__connected=!0,e?this.__trigger("reconnected",null):this.__trigger("connected",null),this.allowForceResubscribe&&e&&this.__autoSubscribed?this.__resubscribe():this.__autoSubscribed||this.__subscribeAll(),this.__preConnectSubscribe(),this.__setUserOnline()}},{key:"__onConnectionLost",value:function(e){this.__connected=!1,this.__trigger("disconnected",e)}},{key:"__disconnect",value:function(){this.__socket.__disconnect()}},{key:"__validate",value:function(e,t,r){if(!this.__isSupported(e))return function(e){throw e}(new Error(l.a.sprintf(c.a.INVALID_EVENT,e)));if(!this.__hasDependencyVars(e))return!0;this.__events[e].vars.forEach((function(r){if(!t[r])return function(e){throw e}(new Error(l.a.sprintf(c.a.REQUIRED_SOCKET_EVENT_PARAM,r,e)))}));var n="__validate"+this.__capitalize(e);if("function"==typeof this[n]){var i=this[n](e,t);if(i.error)return function(e){throw e}(new Error(i.message))}}},{key:"on",value:function(){var e=Array.prototype.slice.call(arguments,0,arguments.length),t=e.shift(),r=e.pop(),n={};e.length&&this.__hasDependencyVars(t)&&this.__events[t].vars.forEach((function(t){n[t]=e.shift()})),this.__validate(t,n,r),this.__isConnected()||this.__isBaseEvent(t)?this.__subscribe(t,n,r):this.__preConnectAdd(t,n,r)}},{key:"__preConnectAdd",value:function(e,t,r){this.__preConnectEvents.push({event:e,params:t,cb:r})}},{key:"__isBaseEvent",value:function(e){return this.__baseEvents.includes(e)}},{key:"__isConnected",value:function(){return this.__connected}},{key:"__preConnectSubscribe",value:function(){for(var e;e=this.__preConnectEvents.shift();)this.__subscribe(e.event,e.params,e.cb)}},{key:"__getEventTopic",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.__events[e].topic,i=this.__events[e].vars;return Array.isArray(n)?n.map((function(e){return t.__replaceTopicVar(e,i,r)})):this.__replaceTopicVar(n,i,r)}},{key:"__isSubscribed",value:function(e){return this.__subscribedTopics.hasOwnProperty(e)}},{key:"__isSupported",value:function(e){return this.__events.hasOwnProperty(e)}},{key:"__hasDependencyVars",value:function(e){return this.__events[e]&&this.__events[e].hasOwnProperty("vars")&&this.__events[e].vars.length}},{key:"__subscribe",value:function(e,t,r){var n=this,i=this.__getEventTopic(e,t);(Array.isArray(i)?i:[i]).forEach((function(t){n.__isSubscribed(t)||(n.__isBaseEvent(e)||n.__subscribeSocket(t),n.__subscribedTopics[t]={event:e,cb:[]}),r&&"function"==typeof r&&n.__subscribedTopics[t].cb.push(r)}))}},{key:"__subscribeSocket",value:function(e){this.__socket.__subscribe(this.__publicKey+"/"+e)}},{key:"__publishSocket",value:function(e,t){t=this.__addDefaultProperties(t),e=e.replace("[login_user]",this.__userId),this.__socket.__publish(this.__publicKey+"/"+e,JSON.stringify(t))}},{key:"__addDefaultProperties",value:function(e){return Object.assign(e,{version:"v2"})}},{key:"__subscribeAll",value:function(){var e=this;Object.keys(this.__events).forEach((function(t){e.__hasDependencyVars(t)||e.__subscribe(t,null)})),this.__autoSubscribed=!0}},{key:"__resubscribe",value:function(){var e=this;Object.keys(this.__subscribedTopics).forEach((function(t){var r=e.__subscribedTopics[t].event;e.__isBaseEvent(r)||e.__subscribeSocket(t)}))}},{key:"__trigger",value:function(e,t){e=e.replace(this.__publicKey+"/",""),this.__isSubscribed(e)&&this.__subscribedTopics[e].cb.forEach((function(e){e(t)}))}},{key:"__processPayload",value:function(e,t){var r=this.__subscribedTopics[e].event;return"function"==typeof d[r]?d[r](e,t):[t]}},{key:"__replaceTopicVar",value:function(e,t,r){return e=e.replace("[login_user]",this.__userId),t&&t.length?(t.forEach((function(t){e=e.replace("["+t+"]",r[t])})),e):e}},{key:"__capitalize",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}},{key:"__validateUserUpdated",value:function(e,t){return{error:"string"!=typeof t.user_id,message:"User Id should be string"}}},{key:"__setUserOnline",value:function(){this.__publishSocket("users/server/online",{userId:this.__userId})}}])&&m(t.prototype,r),n&&m(t,n),e}()},function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"Channelize",(function(){return o})),r.d(t,"core",(function(){return a})),r.d(t,"client",(function(){return u}));var n=r(10),i=r(127);e.Channelize?console.error("ERROR: It appears that you have multiple copies of the Channelize WebSDK in your build!"):e.Channelize={core:i.a,client:n.a};var o=e.Channelize,s=e.Channelize,a=s.core,u=s.client}.call(this,r(13))},function(e,t,r){"use strict";var n=r(11),i=r(76),o=r(132),s=r(57);function a(e){var t=new o(e),r=i(o.prototype.request,t);return n.extend(r,o.prototype,t),n.extend(r,t),r}var u=a(s);u.Axios=o,u.create=function(e){return a(n.merge(s,e))},u.Cancel=r(80),u.CancelToken=r(145),u.isCancel=r(79),u.all=function(e){return Promise.all(e)},u.spread=r(146),e.exports=u,e.exports.default=u},function(e,t){ +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ +e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";var n=r(57),i=r(11),o=r(140),s=r(141);function a(e){this.defaults=e,this.interceptors={request:new o,response:new o}}a.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),(e=i.merge(n,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[s,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},i.forEach(["delete","get","head","options"],(function(e){a.prototype[e]=function(t,r){return this.request(i.merge(r||{},{method:e,url:t}))}})),i.forEach(["post","put","patch"],(function(e){a.prototype[e]=function(t,r,n){return this.request(i.merge(n||{},{method:e,url:t,data:r}))}})),e.exports=a},function(e,t,r){"use strict";var n=r(11);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},function(e,t,r){"use strict";var n=r(78);e.exports=function(e,t,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e}},function(e,t,r){"use strict";var n=r(11);function i(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var s=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}return o&&(e+=(-1===e.indexOf("?")?"?":"&")+o),e}},function(e,t,r){"use strict";var n=r(11),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,s={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([r]):s[t]?s[t]+", "+r:r}})),s):s}},function(e,t,r){"use strict";var n=r(11);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(11);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(i)&&a.push("path="+i),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";var n=r(11);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,r){"use strict";var n=r(11),i=r(142),o=r(79),s=r(57),a=r(143),u=r(144);function c(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return c(e),e.baseURL&&!a(e.url)&&(e.url=u(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return c(e),t.data=i(t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(c(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var n=r(11);e.exports=function(e,t,r){return n.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var n=r(80);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){var n,i,o=r(82),s=r(83),a=0,u=0;e.exports=function(e,t,r){var c=t&&r||0,l=t||[],f=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==h){var p=o();null==f&&(f=n=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==h&&(h=i=16383&(p[6]<<8|p[7]))}var d=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:u+1,m=d-a+(y-u)/1e4;if(m<0&&void 0===e.clockseq&&(h=h+1&16383),(m<0||d>a)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=d,u=y,i=h;var v=(1e4*(268435455&(d+=122192928e5))+y)%4294967296;l[c++]=v>>>24&255,l[c++]=v>>>16&255,l[c++]=v>>>8&255,l[c++]=255&v;var g=d/4294967296*1e4&268435455;l[c++]=g>>>8&255,l[c++]=255&g,l[c++]=g>>>24&15|16,l[c++]=g>>>16&255,l[c++]=h>>>8|128,l[c++]=255&h;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,r){var n=r(82),i=r(83);e.exports=function(e,t,r){var o=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||n)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,r){e.exports.device=r(58),e.exports.thingShadow=r(269),e.exports.jobs=r(270)},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){"use strict";(function(t){var n=r(153),i=r(84),o=r(63),s=r(59),a={};function u(e,t){if("object"!=typeof e||t||(t=e,e=null),t=t||{},e){var r=o.parse(e,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(t=s(r,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(function(e){var t;e.auth&&((t=e.auth.match(/^(.+):(.+)$/))?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!a[t.protocol]){var i=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs"].filter((function(e,t){return(!i||t%2!=0)&&"function"==typeof a[e]}))[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");return t.protocol&&(t.defaultProtocol=t.protocol),new n((function(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),a[t.protocol](e,t)}),t)}"browser"!==t.title?(a.mqtt=r(107),a.tcp=r(107),a.ssl=r(64),a.tls=r(64),a.mqtts=r(64)):(a.wx=r(108),a.wxs=r(108)),a.ws=r(109),a.wss=r(109),e.exports=u,e.exports.connect=u,e.exports.MqttClient=n,e.exports.Store=i}).call(this,r(6))},function(e,t,r){"use strict";(function(t,n){var i=r(19),o=r(84),s=r(103),a=r(219),u=r(41).Writable,c=r(20),l=r(226),f=r(227),h=r(59),p=t.setImmediate||function(e){n.nextTick(e)},d={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0};function y(e,t,r){e.emit("packetsend",t),!a.writeToStream(t,e.stream)&&r?e.stream.once("drain",r):r&&r()}function m(e,t,r){e.outgoingStore.put(t,(function(n){if(n)return r&&r(n);y(e,t,r)}))}function v(){}function g(e,t){var r,n=this;if(!(this instanceof g))return new g(e,t);for(r in this.options=t||{},d)void 0===this.options[r]?this.options[r]=d[r]:this.options[r]=t[r];this.options.clientId="string"==typeof this.options.clientId?this.options.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),this.streamBuilder=e,this.outgoingStore=this.options.outgoingStore||new o,this.incomingStore=this.options.incomingStore||new o,this.queueQoSZero=void 0===this.options.queueQoSZero||this.options.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this.nextId=Math.max(1,Math.floor(65535*Math.random())),this.outgoing={},this.on("connect",(function(){if(!this.disconnected){this.connected=!0;var e=this.outgoingStore.createStream();this.once("close",t),e.on("end",(function(){n.removeListener("close",t)})),e.on("error",(function(e){n.removeListener("close",t),n.emit("error",e)})),function t(){if(e){var r,i=e.read(1);i?n.disconnecting||n.reconnectTimer?e.destroy&&e.destroy():(r=n.outgoing[i.messageId],n.outgoing[i.messageId]=function(e,n){r&&r(e,n),t()},n._sendPacket(i)):e.once("readable",t)}}()}function t(){e.destroy(),e=null}})),this.on("close",(function(){this.connected=!1,clearTimeout(this.connackTimer)})),this.on("connect",this._setupPingTimer),this.on("connect",(function(){var e=this.queue;!function t(){var r,i=e.shift();i&&(r=i.packet,n._sendPacket(r,(function(e){i.cb&&i.cb(e),t()})))}()}));var s=!0;this.on("connect",(function(){!s&&this.options.clean&&Object.keys(this._resubscribeTopics).length>0&&(this.options.resubscribe?(this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics)):this._resubscribeTopics={}),s=!1})),this.on("close",(function(){null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null)})),this.on("close",this._setupReconnect),i.EventEmitter.call(this),this._setupStream()}c(g,i.EventEmitter),g.prototype._setupStream=function(){var e,t=this,r=new u,i=a.parser(this.options),o=null,c=[];function l(){n.nextTick(f)}function f(){var e=c.shift(),r=o;e?t._handlePacket(e,l):(o=null,r())}this._clearReconnect(),this.stream=this.streamBuilder(this),i.on("packet",(function(e){c.push(e)})),r._write=function(e,t,r){o=r,i.parse(e),f()},this.stream.pipe(r),this.stream.on("error",v),s(this.stream,this.emit.bind(this,"close")),(e=Object.create(this.options)).cmd="connect",y(this,e),i.on("error",this.emit.bind(this,"error")),this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){t._cleanUp(!0)}),this.options.connectTimeout)},g.prototype._handlePacket=function(e,t){switch(this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"pingresp":this._handlePingresp(e),t()}},g.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},g.prototype.publish=function(e,t,r,n){var i;"function"==typeof r&&(n=r,r=null);if(r=h({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;switch(i={cmd:"publish",topic:e,payload:t,qos:r.qos,retain:r.retain,messageId:this._nextId(),dup:r.dup},r.qos){case 1:case 2:this.outgoing[i.messageId]=n||v,this._sendPacket(i);break;default:this._sendPacket(i,n)}return this},g.prototype.subscribe=function(){var e,t,r=Array.prototype.slice.call(arguments),n=[],i=r.shift(),o=i.resubscribe,s=r.pop()||v,a=r.pop(),u=this;if(delete i.resubscribe,"string"==typeof i&&(i=[i]),"function"!=typeof s&&(a=s,s=v),null!==(t=f.validateTopics(i)))return p(s,new Error("Invalid topic "+t)),this;if(this._checkDisconnecting(s))return this;var c={qos:0};if(a=h(c,a),Array.isArray(i)?i.forEach((function(e){(u._resubscribeTopics[e]0&&(u._resubscribeTopics[e.topic]=e.qos,l.push(e.topic))})),u.messageIdToTopic[e.messageId]=l}return this.outgoing[e.messageId]=function(e,t){if(!e)for(var r=t.granted,i=0;i0?this.once("outgoingEmpty",setTimeout.bind(null,i,10)):i()),this},g.prototype.removeOutgoingMessage=function(e){var t=this.outgoing[e];return delete this.outgoing[e],this.outgoingStore.del({messageId:e},(function(){t(new Error("Message removed"))})),this},g.prototype.reconnect=function(e){var t=this,r=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new o,t.outgoingStore=t.options.outgoingStore||new o,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},g.prototype._reconnect=function(){this.emit("reconnect"),this._setupStream()},g.prototype._setupReconnect=function(){var e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0&&(this.reconnecting||(this.emit("offline"),this.reconnecting=!0),e.reconnectTimer=setInterval((function(){e._reconnect()}),e.options.reconnectPeriod))},g.prototype._clearReconnect=function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},g.prototype._cleanUp=function(e,t){var r;t&&this.stream.on("close",t),e?(0===this.options.reconnectPeriod&&this.options.clean&&(r=this.outgoing)&&Object.keys(r).forEach((function(e){"function"==typeof r[e]&&(r[e](new Error("Connection closed")),delete r[e])})),this.stream.destroy()):this._sendPacket({cmd:"disconnect"},p.bind(null,this.stream.end.bind(this.stream))),this.disconnecting||(this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(this.stream.removeListener("close",t),t())},g.prototype._sendPacket=function(e,t){if(this.connected){switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void m(this,e,t);default:return void y(this,e,t)}switch(e.qos){case 2:case 1:m(this,e,t);break;case 0:default:y(this,e,t)}}else 0===(e.qos||0)&&this.queueQoSZero||"publish"!==e.cmd?this.queue.push({packet:e,cb:t}):e.qos>0?(t=this.outgoing[e.messageId],this.outgoingStore.put(e,(function(e){if(e)return t&&t(e)}))):t&&t(new Error("No connection to broker"))},g.prototype._setupPingTimer=function(){var e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=l((function(){e._checkPing()}),1e3*this.options.keepalive))},g.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},g.prototype._checkPing=function(){this.pingResp?(this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):this._cleanUp(!0)},g.prototype._handlePingresp=function(){this.pingResp=!0},g.prototype._handleConnack=function(e){var t=e.returnCode;if(clearTimeout(this.connackTimer),0===t)this.reconnecting=!1,this.emit("connect",e);else if(t>0){var r=new Error("Connection refused: "+["","Unacceptable protocol version","Identifier rejected","Server unavailable","Bad username or password","Not authorized"][t]);r.code=t,this.emit("error",r)}},g.prototype._handlePublish=function(e,t){t=void 0!==t?t:v;var r=e.topic.toString(),n=e.payload,i=e.qos,o=e.messageId,s=this;switch(i){case 2:this.incomingStore.put(e,(function(e){if(e)return t(e);s._sendPacket({cmd:"pubrec",messageId:o},t)}));break;case 1:this.emit("message",r,n,e),this.handleMessage(e,(function(e){if(e)return t(e);s._sendPacket({cmd:"puback",messageId:o},t)}));break;case 0:this.emit("message",r,n,e),this.handleMessage(e,t)}},g.prototype.handleMessage=function(e,t){t()},g.prototype._handleAck=function(e){var t=e.messageId,r=e.cmd,n=null,i=this.outgoing[t],o=this;if(i){switch(r){case"pubcomp":case"puback":delete this.outgoing[t],this.outgoingStore.del(e,i);break;case"pubrec":n={cmd:"pubrel",qos:2,messageId:t},this._sendPacket(n);break;case"suback":if(delete this.outgoing[t],1===e.granted.length&&0!=(128&e.granted[0])){var s=this.messageIdToTopic[t];s&&s.forEach((function(e){delete o._resubscribeTopics[e]}))}i(null,e);break;case"unsuback":delete this.outgoing[t],i(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}},g.prototype._handlePubrel=function(e,t){t=void 0!==t?t:v;var r=e.messageId,n=this,i={cmd:"pubcomp",messageId:r};n.incomingStore.get(e,(function(r,o){r||"pubrel"===o.cmd?n._sendPacket(i,t):(n.emit("message",o.topic,o.payload,o),n.incomingStore.put(e,(function(e){if(e)return t(e);n.handleMessage(o,(function(e){if(e)return t(e);n._sendPacket(i,t)}))})))}))},g.prototype._nextId=function(){var e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},g.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},e.exports=g}).call(this,r(13),r(6))},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),s=n[0],a=n[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),l=0,f=a>0?s-4:s;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,o,s=[],a=t;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,l=-7,f=r?i-1:0,h=r?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[r+p]=255&s,p+=d,s/=256,c-=8);e[r+p-d]|=128*y}},function(e,t){},function(e,t,r){"use strict";var n=r(14).Buffer,i=r(158);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t,r,i,o=n.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=o,i=a,t.copy(r,i),a+=s.data.length,s=s.next;return o},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i,o,s,a,u=1,c={},l=!1,f=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){d(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){d(e.data)},n=function(e){o.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,n=function(e){var t=f.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):n=function(e){setTimeout(d,0,e)}:(s="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&d(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),n=function(t){e.postMessage(s+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r=0?c(l):i(this.length)-c(u(l));t0?1:-1}},function(e,t,r){"use strict";var n=r(28),i={function:!0,object:!0};e.exports=function(e){return n(e)&&i[typeof e]||!1}},function(e,t,r){"use strict";var n,i,o,s,a=Object.create;r(95)()||(n=r(96)),e.exports=n?1!==n.level?a:(i={},o={},s={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach((function(e){o[e]="__proto__"!==e?s:{configurable:!0,enumerable:!1,writable:!0,value:void 0}})),Object.defineProperties(i,o),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:i}),function(e,t){return a(null===e?i:e,t)}):a},function(e,t,r){"use strict";var n=r(177);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!n(e)}},function(e,t,r){"use strict";var n=r(60);e.exports=function(e){if(!n(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},function(e,t,r){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,r){"use strict";var n=r(180),i=r(21),o=Math.max;e.exports=function(e,t){var r,s,a,u=o(arguments.length,2);for(e=Object(i(e)),a=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},s=1;s-1}},function(e,t,r){"use strict";var n,i,o,s,a,u,c,l=r(16),f=r(25),h=Function.prototype.apply,p=Function.prototype.call,d=Object.create,y=Object.defineProperty,m=Object.defineProperties,v=Object.prototype.hasOwnProperty,g={configurable:!0,enumerable:!1,writable:!0};i=function(e,t){var r,i;return f(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),h.call(t,this,arguments)}),r.__eeOnceListener__=t,this},a={on:n=function(e,t){var r;return f(t),v.call(this,"__ee__")?r=this.__ee__:(r=g.value=d(null),y(this,"__ee__",g),g.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},once:i,off:o=function(e,t){var r,n,i,o;if(f(t),!v.call(this,"__ee__"))return this;if(!(r=this.__ee__)[e])return this;if("object"==typeof(n=r[e]))for(o=0;i=n[o];++o)i!==t&&i.__eeOnceListener__!==t||(2===n.length?r[e]=n[o?0:1]:n.splice(o,1));else n!==t&&n.__eeOnceListener__!==t||delete r[e];return this},emit:s=function(e){var t,r,n,i,o;if(v.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"==typeof i){for(r=arguments.length,o=new Array(r-1),t=1;t=55296&&m<=56319&&(y+=e[++p]),u.call(t,v,y,f),!h);++p);else c.call(e,(function(e){return u.call(t,v,e,f),h}))}},function(e,t,r){"use strict";var n=r(44),i=r(45),o=r(197),s=r(212),a=r(101),u=r(23).iterator;e.exports=function(e){return"function"==typeof a(e)[u]?e[u]():n(e)?new o(e):i(e)?new s(e):new o(e)}},function(e,t,r){"use strict";var n,i=r(42),o=r(99),s=r(16),a=r(23),u=r(62),c=Object.defineProperty;n=e.exports=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,e),t=t?o.call(t,"key+value")?"key+value":o.call(t,"key")?"key":"value":"value",c(this,"__kind__",s("",t))},i&&i(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:s((function(e){return"value"===this.__kind__?this.__list__[e]:"key+value"===this.__kind__?[e,this.__list__[e]]:e}))}),c(n.prototype,a.toStringTag,s("c","Array Iterator"))},function(e,t,r){"use strict";var n,i=r(29),o=r(199),s=r(203),a=r(204),u=r(98),c=r(209),l=Function.prototype.bind,f=Object.defineProperty,h=Object.prototype.hasOwnProperty;n=function(e,t,r){var n,i=o(t)&&s(t.value);return delete(n=a(t)).writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&h.call(this,e)?i:(t.value=l.call(i,r.resolveContext?r.resolveContext(this):this),f(this,e,t),this[e])},n},e.exports=function(e){var t=u(arguments[1]);return i(t.resolveContext)&&s(t.resolveContext),c(e,(function(e,r){return n(r,e,t)}))}},function(e,t,r){"use strict";var n=r(102),i=r(29);e.exports=function(e){return i(e)?e:n(e,"Cannot use %v",arguments[1])}},function(e,t,r){"use strict";var n=r(29),i=r(60),o=Object.prototype.toString;e.exports=function(e){if(!n(e))return null;if(i(e)){var t=e.toString;if("function"!=typeof t)return null;if(t===o)return null}try{return""+e}catch(e){return null}}},function(e,t,r){"use strict";var n=r(202),i=/[\n\r\u2028\u2029]/g;e.exports=function(e){var t=n(e);return null===t?"":(t.length>100&&(t=t.slice(0,99)+"…"),t=t.replace(i,(function(e){switch(e){case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}})))}},function(e,t,r){"use strict";e.exports=function(e){try{return e.toString()}catch(t){try{return String(e)}catch(e){return null}}}},function(e,t,r){"use strict";var n=r(102),i=r(97);e.exports=function(e){return i(e)?e:n(e,"%v is not a plain function",arguments[1])}},function(e,t,r){"use strict";var n=r(205),i=r(61),o=r(21);e.exports=function(e){var t=Object(o(e)),r=arguments[1],s=Object(arguments[2]);if(t!==e&&!r)return t;var a={};return r?n(r,(function(t){(s.ensure||t in e)&&(a[t]=e[t])})):i(a,e),a}},function(e,t,r){"use strict";e.exports=r(206)()?Array.from:r(207)},function(e,t,r){"use strict";e.exports=function(){var e,t,r=Array.from;return"function"==typeof r&&(t=r(e=["raz","dwa"]),Boolean(t&&t!==e&&"dwa"===t[1]))}},function(e,t,r){"use strict";var n=r(23).iterator,i=r(44),o=r(208),s=r(94),a=r(25),u=r(21),c=r(28),l=r(45),f=Array.isArray,h=Function.prototype.call,p={configurable:!0,enumerable:!0,writable:!0,value:null},d=Object.defineProperty;e.exports=function(e){var t,r,y,m,v,g,b,_,w,S,E=arguments[1],I=arguments[2];if(e=Object(u(e)),c(E)&&a(E),this&&this!==Array&&o(this))t=this;else{if(!E){if(i(e))return 1!==(v=e.length)?Array.apply(null,e):((m=new Array(1))[0]=e[0],m);if(f(e)){for(m=new Array(v=e.length),r=0;r=55296&&g<=56319&&(S+=e[++r]),S=E?h.call(E,I,S,y):S,t?(p.value=S,d(m,y,p)):m[y]=S,++y;v=y}if(void 0===v)for(v=s(e.length),t&&(m=new t(v)),r=0;r=55296&&t<=56319?r+this.__list__[this.__nextIndex__++]:r}))}),u(n.prototype,s.toStringTag,o("c","String Iterator"))},function(e,t,r){"use strict";var n,i=r(42),o=r(16),s=r(62),a=r(23).toStringTag,u=r(214),c=Object.defineProperties,l=s.prototype._unBind;n=e.exports=function(e,t){if(!(this instanceof n))return new n(e,t);s.call(this,e.__mapKeysData__,e),t&&u[t]||(t="key+value"),c(this,{__kind__:o("",t),__values__:o("w",e.__mapValuesData__)})},i&&i(n,s),n.prototype=Object.create(s.prototype,{constructor:o(n),_resolve:o((function(e){return"value"===this.__kind__?this.__values__[e]:"key"===this.__kind__?this.__list__[e]:[this.__list__[e],this.__values__[e]]})),_unBind:o((function(){this.__values__=null,l.call(this)})),toString:o((function(){return"[object Map Iterator]"}))}),Object.defineProperty(n.prototype,a,o("c","Map Iterator"))},function(e,t,r){"use strict";e.exports=r(215)("key","value","key+value")},function(e,t,r){"use strict";var n=Array.prototype.forEach,i=Object.create;e.exports=function(e){var t=i(null);return n.call(arguments,(function(e){t[e]=!0})),t}},function(e,t,r){"use strict";e.exports="undefined"!=typeof Map&&"[object Map]"===Object.prototype.toString.call(new Map)},function(e,t,r){var n=r(218);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}e.exports=n(i),e.exports.strict=n(o),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},function(e,t){e.exports=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){n[e]=t[e]})),n;function n(){for(var e=new Array(arguments.length),r=0;r0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,this._stateCounter>=this._states.length&&(this._stateCounter=0);return this._list.length},u.prototype._parseHeader=function(){var e=this._list.readUInt8(0);return this.packet.cmd=a.types[e>>a.CMD_SHIFT],this.packet.retain=0!=(e&a.RETAIN_MASK),this.packet.qos=e>>a.QOS_SHIFT&a.QOS_MASK,this.packet.dup=0!=(e&a.DUP_MASK),this._list.consume(1),!0},u.prototype._parseLength=function(){for(var e,t=0,r=1,n=0,i=!0;t<5&&(n+=r*((e=this._list.readUInt8(t++))&a.LENGTH_MASK),r*=128,0!=(e&a.LENGTH_FIN_MASK));)if(this._list.length<=t){i=!1;break}return i&&(this.packet.length=n,this._list.consume(t)),i},u.prototype._parsePayload=function(){var e=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseMessageId();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":case"disconnect":break;default:this._emitError(new Error("Not supported"))}e=!0}return e},u.prototype._parseConnect=function(){var e,t,r,n,i,o,s={},u=this.packet;if(null===(e=this._parseString()))return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==e&&"MQIsdp"!==e)return this._emitError(new Error("Invalid protocolId"));if(u.protocolId=e,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(u.protocolVersion=this._list.readUInt8(this._pos),3!==u.protocolVersion&&4!==u.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.username=this._list.readUInt8(this._pos)&a.USERNAME_MASK,s.password=this._list.readUInt8(this._pos)&a.PASSWORD_MASK,s.will=this._list.readUInt8(this._pos)&a.WILL_FLAG_MASK,s.will&&(u.will={},u.will.retain=0!=(this._list.readUInt8(this._pos)&a.WILL_RETAIN_MASK),u.will.qos=(this._list.readUInt8(this._pos)&a.WILL_QOS_MASK)>>a.WILL_QOS_SHIFT),u.clean=0!=(this._list.readUInt8(this._pos)&a.CLEAN_SESSION_MASK),this._pos++,u.keepalive=this._parseNum(),-1===u.keepalive)return this._emitError(new Error("Packet too short"));if(null===(t=this._parseString()))return this._emitError(new Error("Packet too short"));if(u.clientId=t,s.will){if(null===(r=this._parseString()))return this._emitError(new Error("Cannot parse will topic"));if(u.will.topic=r,null===(n=this._parseBuffer()))return this._emitError(new Error("Cannot parse will payload"));u.will.payload=n}if(s.username){if(null===(o=this._parseString()))return this._emitError(new Error("Cannot parse username"));u.username=o}if(s.password){if(null===(i=this._parseBuffer()))return this._emitError(new Error("Cannot parse password"));u.password=i}return u},u.prototype._parseConnack=function(){var e=this.packet;return this._list.length<2?null:(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&a.SESSIONPRESENT_MASK),e.returnCode=this._list.readUInt8(this._pos),-1===e.returnCode?this._emitError(new Error("Cannot parse return code")):void 0)},u.prototype._parsePublish=function(){var e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));e.qos>0&&!this._parseMessageId()||(e.payload=this._list.slice(this._pos,e.length))},u.prototype._parseSubscribe=function(){var e,t,r=this.packet;if(1!==r.qos)return this._emitError(new Error("Wrong subscribe header"));if(r.subscriptions=[],this._parseMessageId())for(;this._pos=r.length)return this._emitError(new Error("Malformed Subscribe Payload"));t=this._list.readUInt8(this._pos++),r.subscriptions.push({topic:e,qos:t})}},u.prototype._parseSuback=function(){if(this.packet.granted=[],this._parseMessageId())for(;this._posthis._list.length||n>this.packet.length?null:(t=this._list.toString("utf8",this._pos,n),this._pos+=r,t)},u.prototype._parseBuffer=function(){var e,t=this._parseNum(),r=t+this._pos;return-1===t||r>this._list.length||r>this.packet.length?null:(e=this._list.slice(this._pos,r),this._pos+=t,e)},u.prototype._parseNum=function(){if(this._list.length-this._pos<2)return-1;var e=this._list.readUInt16BE(this._pos);return this._pos+=2,e},u.prototype._newPacket=function(){return this.packet&&(this._list.consume(this.packet.length),this.emit("packet",this.packet)),this.packet=new s,!0},u.prototype._emitError=function(e){this.error=e,this.emit("error",e)},e.exports=u},function(e,t,r){var n=r(222),i=r(36),o=r(14).Buffer;function s(e){if(!(this instanceof s))return new s(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)}))}else this.append(e);n.call(this)}i.inherits(s,n),s.prototype._offset=function(e){var t,r=0,n=0;if(0===e)return[0,0];for(;nthis.length)&&(n=this.length),r>=this.length)return e||o.alloc(0);if(n<=0)return e||o.alloc(0);var i,s,a=!!e,u=this._offset(r),c=n-r,l=c,f=a&&t||0,h=u[1];if(0===r&&n==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:o.concat(this._bufs,this.length);for(s=0;s(i=this._bufs[s].length-h))){this._bufs[s].copy(e,f,h,h+l);break}this._bufs[s].copy(e,f,h),f+=i,l-=i,h&&(h=0)}return e},s.prototype.shallowSlice=function(e,t){e=e||0,t=t||this.length,e<0&&(e+=this.length),t<0&&(t+=this.length);var r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0==n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!=r[1]&&(i[0]=i[0].slice(r[1])),new s(i)},s.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},s.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){for(var e=0,t=new s;e>8,0),t.writeUInt8(255&e,1),t}e.exports={cache:i,generateCache:function(){for(var e=0;e<65536;e++)i[e]=o(e)},generateNumber:o}},function(e,t,r){"use strict";function n(e,t,r){var n=this;this._callback=e,this._args=r,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=n._interval),n._interval&&clearInterval(n._interval),n._interval=setInterval(n._callback,e,n._args)},this.clear=function(){n._interval&&(clearInterval(n._interval),n._interval=void 0)},this.destroy=function(){n._interval&&clearInterval(n._interval),n._callback=void 0,n._interval=void 0,n._args=void 0}}e.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,d=String.fromCharCode;function y(e){throw RangeError(h[e])}function m(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function v(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+m((e=e.replace(f,".")).split("."),t).join(".")}function g(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=d((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=d(e)})).join("")}function _(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,r){var n=0;for(e=r?p(e/700):e>>1,e+=p(e/t);e>455;n+=36)e=p(e/35);return p(n+36*e/(e+38))}function S(e){var t,r,n,i,o,s,a,c,l,f,h,d=[],m=e.length,v=0,g=128,_=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&y("not-basic"),d.push(e.charCodeAt(n));for(i=r>0?r+1:0;i=m&&y("invalid-input"),((c=(h=e.charCodeAt(i++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||c>p((u-v)/s))&&y("overflow"),v+=c*s,!(c<(l=a<=_?1:a>=_+26?26:a-_));a+=36)s>p(u/(f=36-l))&&y("overflow"),s*=f;_=w(v-o,t=d.length+1,0==o),p(v/t)>u-g&&y("overflow"),g+=p(v/t),v%=t,d.splice(v++,0,g)}return b(d)}function E(e){var t,r,n,i,o,s,a,c,l,f,h,m,v,b,S,E=[];for(m=(e=g(e)).length,t=128,r=0,o=72,s=0;s=t&&hp((u-r)/(v=n+1))&&y("overflow"),r+=(a-t)*v,t=a,s=0;su&&y("overflow"),h==t){for(c=r,l=36;!(c<(f=l<=o?1:l>=o+26?26:l-o));l+=36)S=c-f,b=36-f,E.push(d(_(f+S%b,0))),c=p(S/b);E.push(d(_(c,0))),o=w(r,v,n==i),r=0,++n}++r,++t}return E.join("")}a={version:"1.3.2",ucs2:{decode:g,encode:b},decode:S,encode:E,toASCII:function(e){return v(e,(function(e){return l.test(e)?"xn--"+E(e):e}))},toUnicode:function(e){return v(e,(function(e){return c.test(e)?S(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,r,t,e))||(e.exports=i)}()}).call(this,r(229)(e),r(13))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,o){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l=0?(f=y.substr(0,m),h=y.substr(m+1)):(f=y,h=""),p=decodeURIComponent(f),d=decodeURIComponent(h),n(s,p)?i(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(n(s))+r;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(n(e))})).join(t):a+encodeURIComponent(n(e[s]))})).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)}).prototype=e}}(),n.lib.WordArray)},function(e,t,r){var n;e.exports=(n=r(4),function(){var e=n,t=e.lib.WordArray,r=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var r=e.length,n=[],i=0;i>>1]|=e.charCodeAt(i)<<16-i%2*16;return t.create(n,2*r)}},r.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return t.create(n,2*r)}}}(),n.enc.Utf16)},function(e,t,r){var n,i,o,s,a,u;e.exports=(u=r(4),r(110),i=(n=u).lib.WordArray,o=n.algo,s=o.SHA256,a=o.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),n.SHA224=s._createHelper(a),n.HmacSHA224=s._createHmacHelper(a),u.SHA224)},function(e,t,r){var n,i,o,s,a,u,c,l;e.exports=(l=r(4),r(46),r(111),i=(n=l).x64,o=i.Word,s=i.WordArray,a=n.algo,u=a.SHA512,c=a.SHA384=u.extend({_doReset:function(){this._hash=new s.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=u._doFinalize.call(this);return e.sigBytes-=16,e}}),n.SHA384=u._createHelper(c),n.HmacSHA384=u._createHmacHelper(c),l.SHA384)},function(e,t,r){var n;e.exports=(n=r(4),r(46),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.x64.Word,a=t.algo,u=[],c=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){u[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var a=0,f=0,h=0;h<7;h++){if(1&i){var p=(1<>>24)|4278255360&(o<<24|o>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(x=r[i]).high^=s,x.low^=o}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var p=0,d=0,y=0;y<5;y++)p^=(x=r[h+5*y]).high,d^=x.low;var m=f[h];m.high=p,m.low=d}for(h=0;h<5;h++){var v=f[(h+4)%5],g=f[(h+1)%5],b=g.high,_=g.low;for(p=v.high^(b<<1|_>>>31),d=v.low^(_<<1|b>>>31),y=0;y<5;y++)(x=r[h+5*y]).high^=p,x.low^=d}for(var w=1;w<25;w++){var S=(x=r[w]).high,E=x.low,I=u[w];I<32?(p=S<>>32-I,d=E<>>32-I):(p=E<>>64-I,d=S<>>64-I);var A=f[c[w]];A.high=p,A.low=d}var k=f[0],C=r[0];for(k.high=C.high,k.low=C.low,h=0;h<5;h++)for(y=0;y<5;y++){var x=r[w=h+5*y],T=f[w],R=f[(h+1)%5+5*y],O=f[(h+2)%5+5*y];x.high=T.high^~R.high&O.high,x.low=T.low^~R.low&O.low}x=r[0];var P=l[a];x.high^=P.high,x.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,u=a/8,c=[],l=0;l>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),c.push(p),c.push(h)}return new i.init(c,a)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=o._createHelper(h),t.HmacSHA3=o._createHmacHelper(h)}(Math),n.SHA3)},function(e,t,r){var n;e.exports=(n=r(4), +/** @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. + */ +function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=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]),u=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]),c=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]),h=i.create([1352829926,1548603684,1836072691,2053994217,0]),p=s.RIPEMD160=o.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,s,p,_,w,S,E,I,A,k,C,x=this._hash.words,T=f.words,R=h.words,O=a.words,P=u.words,N=c.words,L=l.words;for(S=o=x[0],E=s=x[1],I=p=x[2],A=_=x[3],k=w=x[4],r=0;r<80;r+=1)C=o+e[t+O[r]]|0,C+=r<16?d(s,p,_)+T[0]:r<32?y(s,p,_)+T[1]:r<48?m(s,p,_)+T[2]:r<64?v(s,p,_)+T[3]:g(s,p,_)+T[4],C=(C=b(C|=0,N[r]))+w|0,o=w,w=_,_=b(p,10),p=s,s=C,C=S+e[t+P[r]]|0,C+=r<16?g(E,I,A)+R[0]:r<32?v(E,I,A)+R[1]:r<48?m(E,I,A)+R[2]:r<64?y(E,I,A)+R[3]:d(E,I,A)+R[4],C=(C=b(C|=0,L[r]))+k|0,S=k,k=A,A=b(I,10),I=E,E=C;C=x[1]+p+A|0,x[1]=x[2]+_+k|0,x[2]=x[3]+w+S|0,x[3]=x[4]+o+E|0,x[4]=x[0]+s+I|0,x[0]=C},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,s=0;s<5;s++){var a=o[s];o[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,r){return e^t^r}function y(e,t,r){return e&t|~e&r}function m(e,t,r){return(e|~t)^r}function v(e,t,r){return e&r|t&~r}function g(e,t,r){return e^(t|~r)}function b(e,t){return e<>>32-t}t.RIPEMD160=o._createHelper(p),t.HmacRIPEMD160=o._createHmacHelper(p)}(Math),n.RIPEMD160)},function(e,t,r){var n,i,o,s,a,u,c,l,f;e.exports=(f=r(4),r(66),r(67),i=(n=f).lib,o=i.Base,s=i.WordArray,a=n.algo,u=a.SHA1,c=a.HMAC,l=a.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:u,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=c.create(r.hasher,e),i=s.create(),o=s.create([1]),a=i.words,u=o.words,l=r.keySize,f=r.iterations;a.length>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}var r=e.Encryptor=e.extend({processBlock:function(e,r){var n=this._cipher,i=n.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),function(e){0===(e[0]=t(e[0]))&&(e[1]=t(e[1]))}(s);var a=s.slice(0);n.encryptBlock(a,0);for(var u=0;u>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n.pad.Ansix923)},function(e,t,r){var n;e.exports=(n=r(4),r(9),n.pad.Iso10126={pad:function(e,t){var r=4*t,i=r-e.sigBytes%r;e.concat(n.lib.WordArray.random(i-1)).concat(n.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n.pad.Iso10126)},function(e,t,r){var n;e.exports=(n=r(4),r(9),n.pad.Iso97971={pad:function(e,t){e.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(e,t)},unpad:function(e){n.pad.ZeroPadding.unpad(e),e.sigBytes--}},n.pad.Iso97971)},function(e,t,r){var n;e.exports=(n=r(4),r(9),n.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){for(var t=e.words,r=e.sigBytes-1;!(t[r>>>2]>>>24-r%4*8&255);)r--;e.sigBytes=r+1}},n.pad.ZeroPadding)},function(e,t,r){var n;e.exports=(n=r(4),r(9),n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding)},function(e,t,r){var n,i,o,s;e.exports=(s=r(4),r(9),i=(n=s).lib.CipherParams,o=n.enc.Hex,n.format.Hex={stringify:function(e){return e.ciphertext.toString(o)},parse:function(e){var t=o.parse(e);return i.create({ciphertext:t})}},s.format.Hex)},function(e,t,r){var n;e.exports=(n=r(4),r(30),r(31),r(32),r(9),function(){var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],o=[],s=[],a=[],u=[],c=[],l=[],f=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var d=n^n<<1^n<<2^n<<3^n<<4;d=d>>>8^255&d^99,i[r]=d,o[d]=r;var y=e[r],m=e[y],v=e[m],g=257*e[d]^16843008*d;s[r]=g<<24|g>>>8,a[r]=g<<16|g>>>16,u[r]=g<<8|g>>>24,c[r]=g,g=16843009*v^65537*m^257*y^16843008*r,l[d]=g<<24|g>>>8,f[d]=g<<16|g>>>16,h[d]=g<<8|g>>>24,p[d]=g,r?(r=y^e[e[e[v^y]]],n^=e[e[n]]):r=n=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],y=r.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],s=0;s6&&s%r==4&&(a=i[a>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a]):(a=i[(a=a<<8|a>>>24)>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a],a^=d[s/r|0]<<24),o[s]=o[s-r]^a}for(var u=this._invKeySchedule=[],c=0;c>>24]]^f[i[a>>>16&255]]^h[i[a>>>8&255]]^p[i[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,u,c,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,f,h,p,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,s,a){for(var u=this._nRounds,c=e[t]^r[0],l=e[t+1]^r[1],f=e[t+2]^r[2],h=e[t+3]^r[3],p=4,d=1;d>>24]^i[l>>>16&255]^o[f>>>8&255]^s[255&h]^r[p++],m=n[l>>>24]^i[f>>>16&255]^o[h>>>8&255]^s[255&c]^r[p++],v=n[f>>>24]^i[h>>>16&255]^o[c>>>8&255]^s[255&l]^r[p++],g=n[h>>>24]^i[c>>>16&255]^o[l>>>8&255]^s[255&f]^r[p++];c=y,l=m,f=v,h=g}y=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&h])^r[p++],m=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^r[p++],v=(a[f>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^r[p++],g=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^r[p++],e[t]=y,e[t+1]=m,e[t+2]=v,e[t+3]=g},keySize:8});e.AES=t._createHelper(y)}(),n.AES)},function(e,t,r){var n;e.exports=(n=r(4),r(30),r(31),r(32),r(9),function(){var e=n,t=e.lib,r=t.WordArray,i=t.BlockCipher,o=e.algo,s=[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],a=[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],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{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=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=s[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var c=i[o]=[],l=u[o];for(r=0;r<24;r++)c[r/6|0]|=t[(a[r]-1+l)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(a[r+24]-1+l)%28]<<31-r%6;for(c[0]=c[0]<<1|c[0]>>>31,r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}var f=this._invSubKeys=[];for(r=0;r<16;r++)f[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,u=0;u<8;u++)a|=c[u][((s^i[u])&l[u])>>>0];this._lBlock=s,this._rBlock=o^a}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<>>2]>>>24-s%4*8&255;o=(o+n[i]+a)%256;var u=n[i];n[i]=n[o],n[o]=u}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}e.RC4=t._createHelper(i);var s=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--)o.call(this)}});e.RC4Drop=t._createHelper(s)}(),n.RC4)},function(e,t,r){var n;e.exports=(n=r(4),r(30),r(31),r(32),r(9),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=[],o=[],s=[],a=r.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var 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],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,r=0;r<4;r++)u.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,s=o[0],a=o[1],c=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=c>>>16|4294901760&l,h=l<<16|65535&c;for(i[0]^=c,i[1]^=f,i[2]^=l,i[3]^=h,i[4]^=c,i[5]^=f,i[6]^=l,i[7]^=h,r=0;r<4;r++)u.call(this)}},_doProcessBlock:function(e,t){var r=this._X;u.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function u(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];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,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,a=n>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=u^c}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=t._createHelper(a)}(),n.Rabbit)},function(e,t,r){var n;e.exports=(n=r(4),r(30),r(31),r(32),r(9),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=[],o=[],s=[],a=r.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,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],n=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++)u.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var o=t.words,s=o[0],a=o[1],c=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=c>>>16|4294901760&l,h=l<<16|65535&c;for(n[0]^=c,n[1]^=f,n[2]^=l,n[3]^=h,n[4]^=c,n[5]^=f,n[6]^=l,n[7]^=h,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(e,t){var r=this._X;u.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function u(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];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,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,a=n>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=u^c}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=t._createHelper(a)}(),n.RabbitLegacy)},function(e,t){e.exports={INVALID_CONNECT_OPTIONS:"Invalid connect options supplied.",INVALID_CLIENT_ID_OPTION:'Invalid "clientId" (mqtt client id) option supplied.',INVALID_RECONNECT_TIMING:"Invalid reconnect timing options supplied.",INVALID_OFFLINE_QUEUEING_PARAMETERS:"Invalid offline queueing options supplied."}},function(e,t,r){(function(t){var n=r(68),i=r(47),o=r(264);e.exports=function(e){if(i(e.keyPath)&&i(e.privateKey))throw new Error(o.NO_KEY_OPTION);if(i(e.certPath)&&i(e.clientCert))throw new Error(o.NO_CERT_OPTION);if(i(e.caPath)&&i(e.caCert))throw new Error(o.NO_CA_OPTION);if(!i(e.caCert))if(t.isBuffer(e.caCert))e.ca=e.caCert;else{if(!n.existsSync(e.caCert))throw new Error(o.INVALID_CA_CERT_OPTION);e.ca=n.readFileSync(e.caCert)}if(!i(e.privateKey))if(t.isBuffer(e.privateKey))e.key=e.privateKey;else{if(!n.existsSync(e.privateKey))throw new Error(o.INVALID_PRIVATE_KEY_OPTION);e.key=n.readFileSync(e.privateKey)}if(!i(e.clientCert))if(t.isBuffer(e.clientCert))e.cert=e.clientCert;else{if(!n.existsSync(e.clientCert))throw new Error(o.INVALID_CLIENT_CERT_OPTION);e.cert=n.readFileSync(e.clientCert)}if(n.existsSync(e.keyPath))e.key=n.readFileSync(e.keyPath);else if(!i(e.keyPath))throw new Error(o.INVALID_KEY_PATH_OPTION);if(n.existsSync(e.certPath))e.cert=n.readFileSync(e.certPath);else if(!i(e.certPath))throw new Error(o.INVALID_CERT_PATH_OPTION);if(n.existsSync(e.caPath))e.ca=n.readFileSync(e.caPath);else if(!i(e.caPath))throw new Error(o.INVALID_CA_PATH_OPTION);e.requestCert=!0,e.rejectUnauthorized=!0}}).call(this,r(15).Buffer)},function(e,t){e.exports={NO_KEY_OPTION:'No "keyPath" or "privateKey" option supplied.',NO_CERT_OPTION:'No "certPath" or "clientCert" option supplied.',NO_CA_OPTION:'No "caPath" or "caCert" option supplied.',INVALID_KEY_PATH_OPTION:'Invalid "keyPath" option supplied.',INVALID_CERT_PATH_OPTION:'Invalid "certPath" option supplied.',INVALID_CA_PATH_OPTION:'Invalid "caPath" option supplied.',INVALID_CLIENT_CERT_OPTION:'Invalid "clientCert" option supplied.',INVALID_PRIVATE_KEY_OPTION:'Invalid "privateKey" option supplied.',INVALID_CA_CERT_OPTION:'Invalid "caCert" option supplied.'}},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,i="/"===s.charAt(0))}return(i?"/":"")+(t=r(n(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var o=t.isAbsolute(e),s="/"===i(e,-1);return(e=r(n(e.split("/"),(function(e){return!!e})),!o).join("/"))||o||(e="."),e&&s&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u=1;--o)if(47===(t=e.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":e.slice(0,n)},t.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,n=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){r=t+1;break}}else-1===n&&(i=!1,n=t+1);return-1===n?"":e.slice(r,n)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,n=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===n&&(i=!1,n=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){r=s+1;break}}return-1===t||-1===n||0===o||1===o&&t===n-1&&t===r+1?"":e.slice(t,n)};var i="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,r(6))},function(e){e.exports=JSON.parse('{"_from":"aws-iot-device-sdk@^2.2.1","_id":"aws-iot-device-sdk@2.2.4","_inBundle":false,"_integrity":"sha512-DgNVTPQMVHxC1o6SENWDjio2Ku8gz70XPi5CoS31Q4ndWpx3zwq3QKBvGdRm02SF4Xb4ft5cd9tXQCeIjgkqlQ==","_location":"/aws-iot-device-sdk","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"aws-iot-device-sdk@^2.2.1","name":"aws-iot-device-sdk","escapedName":"aws-iot-device-sdk","rawSpec":"^2.2.1","saveSpec":null,"fetchSpec":"^2.2.1"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/aws-iot-device-sdk/-/aws-iot-device-sdk-2.2.4.tgz","_shasum":"ce21632833e72ee1d6051c425ce8b4822069bf05","_spec":"aws-iot-device-sdk@^2.2.1","_where":"/opt/lampp/htdocs/channelize-js-sdk/channelize-websdk","author":{"name":"Amazon Web Services","url":"http://aws.amazon.com"},"bugs":{"url":"http://github.com/aws/aws-iot-device-sdk-js/issues"},"bundleDependencies":false,"dependencies":{"crypto-js":"3.1.6","minimist":"1.2.5","mqtt":"2.18.8","websocket-stream":"^5.0.1"},"deprecated":false,"description":"AWS IoT Node.js SDK for Embedded Devices","devDependencies":{"gulp":"^3.9.0","gulp-beautify":"^2.0.0","gulp-concat":"^2.6.0","gulp-coverage":"^0.3.38","gulp-jscs":"^4.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^3.0.1","jshint":"^2.9.1","jshint-stylish":"^2.2.1","rewire":"^2.5.1","sinon":"^1.17.3"},"engines":{"node":">=4.0.0"},"homepage":"https://github.com/aws/aws-iot-device-sdk-js","keywords":["api","amazon","aws","iot","mqtt"],"license":"Apache-2.0","main":"index.js","name":"aws-iot-device-sdk","repository":{"type":"git","url":"git://github.com/aws/aws-iot-device-sdk-js.git"},"scripts":{"beautify":"node ./node_modules/gulp/bin/gulp.js beautify","browserize":"./scripts/browserize.sh","test":"node ./node_modules/gulp/bin/gulp.js test --verbose"},"version":"2.2.4"}')},function(e,t,r){var n=r(68);e.exports=function(e,t){var r;function i(t){e.emit("error",t),r.end()}return(r=n.connect(t)).on("secureConnect",(function(){r.authorized?r.removeListener("error",i):r.emit("error",new Error("TLS not authorized"))})),r.on("error",i),r}},function(e,t,r){const n=r(65);e.exports=function(e,t){return n(t.url,["mqttv3.1"],t.websocketOptions)}},function(e,t,r){var n=r(19),i=r(36).inherits,o=r(58),s=r(47);function a(e,t,r){return s(r)?"$aws/things/"+e+"/shadow/"+t:"$aws/things/"+e+"/shadow/"+t+"/"+r}function u(e){return"$aws/things/"===e.substring(0,12)}function c(e,t){if(!(this instanceof c))return new c(e,t);var r=this,i=[{}],l=0,f=1e4,h=!0,p=o.DeviceClient(e);s(t)||s(t.operationTimeout)||(f=t.operationTimeout),this._handleSubscriptions=function(e,t,r,n){for(var o=[],u=0,c=t.length;u0)return void n("Not all subscriptions were granted",r);n()}}))):s(n)||y.push(n),p[r].apply(p,y)},this._handleMessages=function(t,r,n,o){var a={};try{a=JSON.parse(o.toString())}catch(t){return void(!0===e.debug&&console.error("failed parsing JSON '"+o.toString()+"', "+t))}var u=a.clientToken,c=a.version;if(delete a.clientToken,!s(c)&&"rejected"!==n)if(s(i[t].version)||c>=i[t].version)i[t].version=c;else if("delete"!==r&&!0===i[t].discardStale)return void(!0===e.debug&&console.warn("out-of-date version '"+c+"' on '"+t+"' (local version '"+i[t].version+"')"));"delta"!==n?s(i[t].clientToken)||i[t].clientToken!==u?"accepted"===n&&"get"!==r&&this.emit("foreignStateChange",t,r,a):(clearTimeout(i[t].timeout),delete i[t].timeout,delete i[t].clientToken,i[t].pending=!1,!1===i[t].persistentSubscribe&&this._handleSubscriptions(t,[{operations:[r],statii:["accepted","rejected"]}],"unsubscribe"),this.emit("status",t,n,u,a)):this.emit("delta",t,a)},p.on("connect",(function(){r.emit("connect")})),p.on("close",(function(){r.emit("close")})),p.on("reconnect",(function(){r.emit("reconnect")})),p.on("offline",(function(){r.emit("offline")})),p.on("error",(function(e){r.emit("error",e)})),p.on("packetsend",(function(e){r.emit("packetsend",e)})),p.on("packetreceive",(function(e){r.emit("packetreceive",e)})),p.on("message",(function(e,t){if(!0===h){var n=e.split("/");!function(e,t){var r=!1;return"$aws"===e[0]&&("things"!==e[1]||"shadow"!==e[3]||"update"!==e[4]&&"get"!==e[4]&&"delete"!==e[4]||("subscribe"===t?"accepted"!==e[5]&&"rejected"!==e[5]&&"delta"!==e[5]||6!==e.length||(r=!0):5===e.length&&(r=!0))),r}(n,"subscribe")?r.emit("message",e,t):i.hasOwnProperty(n[2])&&r._handleMessages(n[2],n[4],n[5],t)}})),this._thingOperation=function(t,n,o){var u=null;if(i.hasOwnProperty(t))if(!1===i[t].pending){var c;if(i[t].pending=!0,s(o.clientToken)){var h=e.clientId.length;c=h>48?e.clientId.substr(h-48)+"-"+l++:e.clientId+"-"+l++}else c=o.clientToken;i[t].clientToken=c;var d=a(t,n);i[t].timeout=setTimeout((function(e,t){!1===i[e].persistentSubscribe&&r._handleSubscriptions(e,[{operations:[n],statii:["accepted","rejected"]}],"unsubscribe"),i[e].pending=!1,delete i[e].timeout,delete i[e].clientToken,r.emit("timeout",e,t)}),f,t,c),!1===i[t].persistentSubscribe?this._handleSubscriptions(t,[{operations:[n],statii:["accepted","rejected"]}],"subscribe",(function(e,r){s(e)&&s(r)?s(o)||(!s(i[t].version)&&i[t].enableVersioning&&(o.version=i[t].version),o.clientToken=c,p.publish(d,JSON.stringify(o),{qos:i[t].qos}),s(i[t])||!0!==i[t].debug||console.log("publishing '"+JSON.stringify(o)+" on '"+d+"'")):console.warn("failed subscription to accepted/rejected topics")})):(!s(i[t].version)&&i[t].enableVersioning&&(o.version=i[t].version),o.clientToken=c,p.publish(d,JSON.stringify(o),{qos:i[t].qos}),!0===i[t].debug&&console.log("publishing '"+JSON.stringify(o)+" on '"+d+"'")),u=c}else!0===e.debug&&console.error(n+" still in progress on thing: ",t);else!0===e.debug&&console.error("attempting to "+n+" unknown thing: ",t);return u},this.register=function(t,r,n){if(i.hasOwnProperty(t))!0===e.debug&&console.error("thing already registered: ",t);else{var o=!1,a=[];i[t]={persistentSubscribe:!0,debug:!1,discardStale:!0,enableVersioning:!0,qos:0,pending:!0},"function"==typeof r&&(n=r,r=null),s(r)||(s(r.ignoreDeltas)||(o=r.ignoreDeltas),s(r.persistentSubscribe)||(i[t].persistentSubscribe=r.persistentSubscribe),s(r.debug)||(i[t].debug=r.debug),s(r.discardStale)||(i[t].discardStale=r.discardStale),s(r.enableVersioning)||(i[t].enableVersioning=r.enableVersioning),s(r.qos)||(i[t].qos=r.qos)),!1===o&&a.push({operations:["update"],statii:["delta"]}),!0===i[t].persistentSubscribe&&a.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),a.length>0?this._handleSubscriptions(t,a,"subscribe",(function(e,r){s(e)&&s(r)&&(i[t].pending=!1),s(n)||n(e,r)})):(i[t].pending=!1,s(n)||n())}},this.unregister=function(t){if(i.hasOwnProperty(t)){var r=[];r.push({operations:["update"],statii:["delta"]}),!0===i[t].persistentSubscribe&&r.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),this._handleSubscriptions(t,r,"unsubscribe"),s(i[t].timeout)||clearTimeout(i[t].timeout),delete i[t]}else!0===e.debug&&console.error("attempting to unregister unknown thing: ",t)},this.update=function(e,t){var n=null;return s(t.version)?n=r._thingOperation(e,"update",t):console.error("message can't contain 'version' property"),n},this.get=function(e,t){var n={};return s(t)||(n.clientToken=t),r._thingOperation(e,"get",n)},this.delete=function(e,t){var n={};return s(t)||(n.clientToken=t),r._thingOperation(e,"delete",n)},this.publish=function(e,t,r,n){if(u(e))throw"cannot publish to reserved topic '"+e+"'";p.publish(e,t,r,n)},this.subscribe=function(e,t,r){var n=[];"string"==typeof e?n.push(e):"object"==typeof e&&e.length&&(n=e);for(var i=0;i0||n?o.toString():""},e.exports=s},function(e,t,r){var n=r(274).escapeAttribute;function i(e,t){void 0===t&&(t=[]),this.name=e,this.children=t,this.attributes={}}i.prototype.addAttribute=function(e,t){return this.attributes[e]=t,this},i.prototype.addChildNode=function(e){return this.children.push(e),this},i.prototype.removeAttribute=function(e){return delete this.attributes[e],this},i.prototype.toString=function(){for(var e=Boolean(this.children.length),t="<"+this.name,r=this.attributes,i=0,o=Object.keys(r);i"+this.children.map((function(e){return e.toString()})).join("")+"":"/>")},e.exports={XmlNode:i}},function(e,t){e.exports={escapeAttribute:function(e){return e.replace(/&/g,"&").replace(/'/g,"'").replace(//g,">").replace(/"/g,""")}}},function(e,t,r){var n=r(276).escapeElement;function i(e){this.value=e}i.prototype.toString=function(){return n(""+this.value)},e.exports={XmlText:i}},function(e,t){e.exports={escapeElement:function(e){return e.replace(/&/g,"&").replace(//g,">")}}},function(e,t){function r(e,t){if(!r.services.hasOwnProperty(e))throw new Error("InvalidService: Failed to load api for "+e);return r.services[e][t]}r.services={},e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(279),i=function(){function e(e){void 0===e&&(e=1e3),this.maxSize=e,this.cache=new n.LRUCache(e)}return Object.defineProperty(e.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),e.prototype.put=function(t,r){var n="string"!=typeof t?e.getKeyString(t):t,i=this.populateValue(r);this.cache.put(n,i)},e.prototype.get=function(t){var r="string"!=typeof t?e.getKeyString(t):t,n=Date.now(),i=this.cache.get(r);if(i)for(var o=0;o=0;i--)if("*"!==t[i][t[i].length-1]&&(r=t[i]),t[i].substr(0,10)<=e)return r;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+e+"'")},api:{},defaultRetryCount:3,customizeRequests:function(e){if(e){if("function"!=typeof e)throw new Error("Invalid callback type '"+typeof e+"' provided in customizeRequests");this.customRequestHandler=e}else this.customRequestHandler=null},makeRequest:function(e,t,r){if("function"==typeof t&&(r=t,t=null),t=t||{},this.config.params){var i=this.api.operations[e];i&&(t=n.util.copy(t),n.util.each(this.config.params,(function(e,r){i.input.members[e]&&(void 0!==t[e]&&null!==t[e]||(t[e]=r))})))}var o=new n.Request(this,e,t);return this.addAllRequestListeners(o),this.attachMonitoringEmitter(o),r&&o.send(r),o},makeUnauthenticatedRequest:function(e,t,r){"function"==typeof t&&(r=t,t={});var n=this.makeRequest(e,t).toUnauthenticated();return r?n.send(r):n},waitFor:function(e,t,r){return new n.ResourceWaiter(this,e).wait(t,r)},addAllRequestListeners:function(e){for(var t=[n.events,n.EventListeners.Core,this.serviceInterface(),n.EventListeners.CorePost],r=0;r299?(i.code&&(r.FinalAwsException=i.code),i.message&&(r.FinalAwsExceptionMessage=i.message)):((i.code||i.name)&&(r.FinalSdkException=i.code||i.name),i.message&&(r.FinalSdkExceptionMessage=i.message))}return r},apiAttemptEvent:function(e){var t=e.service.api.operations[e.operation],r={Type:"ApiCallAttempt",Api:t?t.name:e.operation,Version:1,Service:e.service.api.serviceId||e.service.api.endpointPrefix,Fqdn:e.httpRequest.endpoint.hostname,UserAgent:e.httpRequest.getUserAgent()},n=e.response;return n.httpResponse.statusCode&&(r.HttpStatusCode=n.httpResponse.statusCode),!e._unAuthenticated&&e.service.config.credentials&&e.service.config.credentials.accessKeyId&&(r.AccessKey=e.service.config.credentials.accessKeyId),n.httpResponse.headers?(e.httpRequest.headers["x-amz-security-token"]&&(r.SessionToken=e.httpRequest.headers["x-amz-security-token"]),n.httpResponse.headers["x-amzn-requestid"]&&(r.XAmznRequestId=n.httpResponse.headers["x-amzn-requestid"]),n.httpResponse.headers["x-amz-request-id"]&&(r.XAmzRequestId=n.httpResponse.headers["x-amz-request-id"]),n.httpResponse.headers["x-amz-id-2"]&&(r.XAmzId2=n.httpResponse.headers["x-amz-id-2"]),r):r},attemptFailEvent:function(e){var t=this.apiAttemptEvent(e),r=e.response,n=r.error;return r.httpResponse.statusCode>299?(n.code&&(t.AwsException=n.code),n.message&&(t.AwsExceptionMessage=n.message)):((n.code||n.name)&&(t.SdkException=n.code||n.name),n.message&&(t.SdkExceptionMessage=n.message)),t},attachMonitoringEmitter:function(e){var t,r,i,o,s,a,u=0,c=this;e.on("validate",(function(){o=n.util.realClock.now(),a=Date.now()}),!0),e.on("sign",(function(){r=n.util.realClock.now(),t=Date.now(),s=e.httpRequest.region,u++}),!0),e.on("validateResponse",(function(){i=Math.round(n.util.realClock.now()-r)})),e.addNamedListener("API_CALL_ATTEMPT","success",(function(){var r=c.apiAttemptEvent(e);r.Timestamp=t,r.AttemptLatency=i>=0?i:0,r.Region=s,c.emit("apiCallAttempt",[r])})),e.addNamedListener("API_CALL_ATTEMPT_RETRY","retry",(function(){var o=c.attemptFailEvent(e);o.Timestamp=t,i=i||Math.round(n.util.realClock.now()-r),o.AttemptLatency=i>=0?i:0,o.Region=s,c.emit("apiCallAttempt",[o])})),e.addNamedListener("API_CALL","complete",(function(){var t=c.apiCallEvent(e);if(t.AttemptCount=u,!(t.AttemptCount<=0)){t.Timestamp=a;var r=Math.round(n.util.realClock.now()-o);t.Latency=r>=0?r:0;var i=e.response;i.error&&i.error.retryable&&"number"==typeof i.retryCount&&"number"==typeof i.maxRetries&&i.retryCount>=i.maxRetries&&(t.MaxRetriesExceeded=1),c.emit("apiCall",[t])}}))},setupRequestListeners:function(e){},getSignerClass:function(e){var t,r=null,i="";e&&(i=(r=(e.service.api.operations||{})[e.operation]||null)?r.authtype:"");return t=this.config.signatureVersion?this.config.signatureVersion:"v4"===i||"v4-unsigned-body"===i?"v4":this.api.signatureVersion,n.Signers.RequestSigner.getVersion(t)},serviceInterface:function(){switch(this.api.protocol){case"ec2":case"query":return n.EventListeners.Query;case"json":return n.EventListeners.Json;case"rest-json":return n.EventListeners.RestJson;case"rest-xml":return n.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(e){return e.httpResponse.statusCode<300},numRetries:function(){return void 0!==this.config.maxRetries?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(e,t){return n.util.calculateRetryDelay(e,this.config.retryDelayOptions,t)},retryableError:function(e){return!!this.timeoutError(e)||(!!this.networkingError(e)||(!!this.expiredCredentialsError(e)||(!!this.throttledError(e)||e.statusCode>=500)))},networkingError:function(e){return"NetworkingError"===e.code},timeoutError:function(e){return"TimeoutError"===e.code},expiredCredentialsError:function(e){return"ExpiredTokenException"===e.code},clockSkewError:function(e){switch(e.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},getSkewCorrectedDate:function(){return new Date(Date.now()+this.config.systemClockOffset)},applyClockOffset:function(e){e&&(this.config.systemClockOffset=e-Date.now())},isClockSkewed:function(e){if(e)return Math.abs(this.getSkewCorrectedDate().getTime()-e)>=3e5},throttledError:function(e){if(429===e.statusCode)return!0;switch(e.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":case"RequestThrottledException":case"TooManyRequestsException":case"TransactionInProgressException":case"EC2ThrottledException":return!0;default:return!1}},endpointFromTemplate:function(e){if("string"!=typeof e)return e;var t=e;return t=(t=(t=t.replace(/\{service\}/g,this.api.endpointPrefix)).replace(/\{region\}/g,this.config.region)).replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(e){this.endpoint=new n.Endpoint(e,this.config)},paginationConfig:function(e,t){var r=this.api.operations[e].paginator;if(!r){if(t){var i=new Error;throw n.util.error(i,"No pagination configuration for "+e)}return null}return r}}),n.util.update(n.Service,{defineMethods:function(e){n.util.each(e.prototype.api.operations,(function(t){e.prototype[t]||("none"===e.prototype.api.operations[t].authtype?e.prototype[t]=function(e,r){return this.makeUnauthenticatedRequest(t,e,r)}:e.prototype[t]=function(e,r){return this.makeRequest(t,e,r)})}))},defineService:function(e,t,r){n.Service._serviceMap[e]=!0,Array.isArray(t)||(r=t,t=[]);var i=s(n.Service,r||{});if("string"==typeof e){n.Service.addVersions(i,t);var o=i.serviceIdentifier||e;i.serviceIdentifier=o}else i.prototype.api=e,n.Service.defineMethods(i);if(n.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&n.util.clientSideMonitoring){var a=n.util.clientSideMonitoring.Publisher,u=(0,n.util.clientSideMonitoring.configProvider)();this.prototype.publisher=new a(u),u.enabled&&(n.Service._clientSideMonitoring=!0)}return n.SequentialExecutor.call(i.prototype),n.Service.addDefaultMonitoringListeners(i.prototype),i},addVersions:function(e,t){Array.isArray(t)||(t=[t]),e.services=e.services||{};for(var r=0;r=0)return e.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",t();n.util.computeSha256(o,(function(r,n){r?t(r):(e.httpRequest.headers["X-Amz-Content-Sha256"]=n,t())}))}else t()}})),e("SET_CONTENT_LENGTH","afterBuild",(function(e){var t=function(e){if(!e.service.api.operations)return"";var t=e.service.api.operations[e.operation];return t?t.authtype:""}(e),r=n.util.getRequestPayloadShape(e);if(void 0===e.httpRequest.headers["Content-Length"])try{var i=n.util.string.byteLength(e.httpRequest.body);e.httpRequest.headers["Content-Length"]=i}catch(n){if(r&&r.isStreaming){if(r.requiresLength)throw n;if(t.indexOf("unsigned-body")>=0)return void(e.httpRequest.headers["Transfer-Encoding"]="chunked");throw n}throw n}})),e("SET_HTTP_HOST","afterBuild",(function(e){e.httpRequest.headers.Host=e.httpRequest.endpoint.host})),e("RESTART","restart",(function(){var e=this.response.error;e&&e.retryable&&(this.httpRequest=new n.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount=600?this.emit("sign",[this],(function(e){e?t(e):o()})):o()})),e("HTTP_HEADERS","httpHeaders",(function(e,t,r,i){r.httpResponse.statusCode=e,r.httpResponse.statusMessage=i,r.httpResponse.headers=t,r.httpResponse.body=n.util.buffer.toBuffer(""),r.httpResponse.buffers=[],r.httpResponse.numBytes=0;var o=t.date||t.Date,s=r.request.service;if(o){var a=Date.parse(o);s.config.correctClockSkew&&s.isClockSkewed(a)&&s.applyClockOffset(a)}})),e("HTTP_DATA","httpData",(function(e,t){if(e){if(n.util.isNode()){t.httpResponse.numBytes+=e.length;var r=t.httpResponse.headers["content-length"],i={loaded:t.httpResponse.numBytes,total:r};t.request.emit("httpDownloadProgress",[i,t])}t.httpResponse.buffers.push(n.util.buffer.toBuffer(e))}})),e("HTTP_DONE","httpDone",(function(e){if(e.httpResponse.buffers&&e.httpResponse.buffers.length>0){var t=n.util.buffer.concat(e.httpResponse.buffers);e.httpResponse.body=t}delete e.httpResponse.numBytes,delete e.httpResponse.buffers})),e("FINALIZE_ERROR","retry",(function(e){e.httpResponse.statusCode&&(e.error.statusCode=e.httpResponse.statusCode,void 0===e.error.retryable&&(e.error.retryable=this.service.retryableError(e.error,this)))})),e("INVALIDATE_CREDENTIALS","retry",(function(e){if(e.error)switch(e.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":e.error.retryable=!0,e.request.service.config.credentials.expired=!0}})),e("EXPIRED_SIGNATURE","retry",(function(e){var t=e.error;t&&"string"==typeof t.code&&"string"==typeof t.message&&t.code.match(/Signature/)&&t.message.match(/expired/)&&(e.error.retryable=!0)})),e("CLOCK_SKEWED","retry",(function(e){e.error&&this.service.clockSkewError(e.error)&&this.service.config.correctClockSkew&&(e.error.retryable=!0)})),e("REDIRECT","retry",(function(e){e.error&&e.error.statusCode>=300&&e.error.statusCode<400&&e.httpResponse.headers.location&&(this.httpRequest.endpoint=new n.Endpoint(e.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,e.error.redirect=!0,e.error.retryable=!0)})),e("RETRY_CHECK","retry",(function(e){e.error&&(e.error.redirect&&e.redirectCount=0?(e.error=null,setTimeout(t,r)):t()}))})),CorePost:(new i).addNamedListeners((function(e){e("EXTRACT_REQUEST_ID","extractData",n.util.extractRequestId),e("EXTRACT_REQUEST_ID","extractError",n.util.extractRequestId),e("ENOTFOUND_ERROR","httpError",(function(e){if("NetworkingError"===e.code&&"ENOTFOUND"===e.errno){var t="Inaccessible host: `"+e.hostname+"'. This service may not be available in the `"+e.region+"' region.";this.response.error=n.util.error(new Error(t),{code:"UnknownEndpoint",region:e.region,hostname:e.hostname,retryable:!0,originalError:e})}}))})),Logger:(new i).addNamedListeners((function(e){e("LOG_REQUEST","complete",(function(e){var t=e.request,i=t.service.config.logger;if(i){var o=function(){var o=(e.request.service.getSkewCorrectedDate().getTime()-t.startTime.getTime())/1e3,s=!!i.isTTY,a=e.httpResponse.statusCode,u=t.params;t.service.api.operations&&t.service.api.operations[t.operation]&&t.service.api.operations[t.operation].input&&(u=function e(t,r){if(!r)return r;switch(t.type){case"structure":var i={};return n.util.each(r,(function(r,n){Object.prototype.hasOwnProperty.call(t.members,r)?i[r]=e(t.members[r],n):i[r]=n})),i;case"list":var o=[];return n.util.arrayEach(r,(function(r,n){o.push(e(t.member,r))})),o;case"map":var s={};return n.util.each(r,(function(r,n){s[r]=e(t.value,n)})),s;default:return t.isSensitive?"***SensitiveInformation***":r}}(t.service.api.operations[t.operation].input,t.params));var c=r(36).inspect(u,!0,null),l="";return s&&(l+=""),l+="[AWS "+t.service.serviceIdentifier+" "+a,l+=" "+o.toString()+"s "+e.retryCount+" retries]",s&&(l+=""),l+=" "+n.util.string.lowerFirst(t.operation),l+="("+c+")",s&&(l+=""),l}();"function"==typeof i.log?i.log(o):"function"==typeof i.write&&i.write(o+"\n")}}))})),Json:(new i).addNamedListeners((function(e){var t=r(70);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})),Rest:(new i).addNamedListeners((function(e){var t=r(48);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})),RestJson:(new i).addNamedListeners((function(e){var t=r(114);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})),RestXml:(new i).addNamedListeners((function(e){var t=r(115);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})),Query:(new i).addNamedListeners((function(e){var t=r(112);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}))}},function(e,t,r){(function(t){var n=r(3),i=r(7),o=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function s(e){var t=e.service,r=t.api||{},n=(r.operations,{});return t.config.region&&(n.region=t.config.region),r.serviceId&&(n.serviceId=r.serviceId),t.config.credentials.accessKeyId&&(n.accessKeyId=t.config.credentials.accessKeyId),n}function a(e,t){var r={};return function e(t,r,n){n&&null!=r&&"structure"===n.type&&n.required&&n.required.length>0&&i.arrayEach(n.required,(function(i){var o=n.members[i];if(!0===o.endpointDiscoveryId){var s=o.isLocationName?o.name:i;t[s]=String(r[i])}else e(t,r[i],o)}))}(r,e.params,t),r}function u(e){var t=e.service,r=t.api,o=r.operations?r.operations[e.operation]:void 0,u=a(e,o?o.input:void 0),c=s(e);Object.keys(u).length>0&&(c=i.update(c,u),o&&(c.operation=o.name));var l=n.endpointCache.get(c);if(!l||1!==l.length||""!==l[0].Address)if(l&&l.length>0)e.httpRequest.updateEndpoint(l[0].Address);else{var h=t.makeRequest(r.endpointOperation,{Operation:o.name,Identifiers:u});f(h),h.removeListener("validate",n.EventListeners.Core.VALIDATE_PARAMETERS),h.removeListener("retry",n.EventListeners.Core.RETRY_CHECK),n.endpointCache.put(c,[{Address:"",CachePeriodInMinutes:1}]),h.send((function(e,t){t&&t.Endpoints?n.endpointCache.put(c,t.Endpoints):e&&n.endpointCache.put(c,[{Address:"",CachePeriodInMinutes:1}])}))}}var c={};function l(e,t){var r=e.service,o=r.api,u=o.operations?o.operations[e.operation]:void 0,l=u?u.input:void 0,h=a(e,l),p=s(e);Object.keys(h).length>0&&(p=i.update(p,h),u&&(p.operation=u.name));var d=n.EndpointCache.getKeyString(p),y=n.endpointCache.get(d);if(y&&1===y.length&&""===y[0].Address)return c[d]||(c[d]=[]),void c[d].push({request:e,callback:t});if(y&&y.length>0)e.httpRequest.updateEndpoint(y[0].Address),t();else{var m=r.makeRequest(o.endpointOperation,{Operation:u.name,Identifiers:h});m.removeListener("validate",n.EventListeners.Core.VALIDATE_PARAMETERS),f(m),n.endpointCache.put(d,[{Address:"",CachePeriodInMinutes:60}]),m.send((function(r,o){if(r){var s={code:"EndpointDiscoveryException",message:"Request cannot be fulfilled without specifying an endpoint",retryable:!1};if(e.response.error=i.error(r,s),n.endpointCache.remove(p),c[d]){var a=c[d];i.arrayEach(a,(function(e){e.request.response.error=i.error(r,s),e.callback()})),delete c[d]}}else if(o&&(n.endpointCache.put(d,o.Endpoints),e.httpRequest.updateEndpoint(o.Endpoints[0].Address),c[d])){a=c[d];i.arrayEach(a,(function(e){e.request.httpRequest.updateEndpoint(o.Endpoints[0].Address),e.callback()})),delete c[d]}t()}))}}function f(e){var t=e.service.api.apiVersion;t&&!e.httpRequest.headers["x-amz-api-version"]&&(e.httpRequest.headers["x-amz-api-version"]=t)}function h(e){var t=e.error,r=e.httpResponse;if(t&&("InvalidEndpointException"===t.code||421===r.statusCode)){var o=e.request,u=o.service.api.operations||{},c=a(o,u[o.operation]?u[o.operation].input:void 0),l=s(o);Object.keys(c).length>0&&(l=i.update(l,c),u[o.operation]&&(l.operation=u[o.operation].name)),n.endpointCache.remove(l)}}function p(e){return["false","0"].indexOf(e)>=0}e.exports={discoverEndpoint:function(e,r){var s=e.service||{};if(function(e){if(e._originalConfig&&e._originalConfig.endpoint&&!0===e._originalConfig.endpointDiscoveryEnabled)throw i.error(new Error,{code:"ConfigurationException",message:"Custom endpoint is supplied; endpointDiscoveryEnabled must not be true."});var t=n.config[e.serviceIdentifier]||{};return Boolean(n.config.endpoint||t.endpoint||e._originalConfig&&e._originalConfig.endpoint)}(s)||e.isPresigned())return r();var a=(s.api.operations||{})[e.operation],c=a?a.endpointDiscoveryRequired:"NULL";if(!function(e){if(!0===(e.service||{}).config.endpointDiscoveryEnabled)return!0;if(i.isBrowser())return!1;for(var r=0;r=0){u=!0;var c=0}var l=function(){u&&c!==a?i.emit("error",t.util.error(new Error("Stream content length mismatch. Received "+c+" of "+a+" bytes."),{code:"StreamContentLengthMismatch"})):2===t.HttpClient.streamsApiVersion?i.end():i.emit("end")},f=s.httpResponse.createUnbufferedStream();if(2===t.HttpClient.streamsApiVersion)if(u){var h=new r.PassThrough;h._write=function(e){return e&&e.length&&(c+=e.length),r.PassThrough.prototype._write.apply(this,arguments)},h.on("end",l),i.on("error",(function(e){u=!1,f.unpipe(h),h.emit("end"),h.end()})),f.pipe(h).pipe(i,{end:!1})}else f.pipe(i);else u&&f.on("data",(function(e){e&&e.length&&(c+=e.length)})),f.on("data",(function(e){i.emit("data",e)})),f.on("end",l);f.on("error",(function(e){u=!1,i.emit("error",e)}))}})),i},emitEvent:function(e,r,n){"function"==typeof r&&(n=r,r=null),n||(n=function(){}),r||(r=this.eventParameters(e,this.response)),t.SequentialExecutor.prototype.emit.call(this,e,r,(function(e){e&&(this.response.error=e),n.call(this,e)}))},eventParameters:function(e){switch(e){case"restart":case"validate":case"sign":case"build":case"afterValidate":case"afterBuild":return[this];case"error":return[this.response.error,this.response];default:return[this.response]}},presign:function(e,r){return r||"function"!=typeof e||(r=e,e=null),(new t.Signers.Presign).sign(this.toGet(),e,r)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this._unAuthenticated=!0,this.removeListener("validate",t.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",t.EventListeners.Core.SIGN),this},toGet:function(){return"query"!==this.service.api.protocol&&"ec2"!==this.service.api.protocol||(this.removeListener("build",this.buildAsGet),this.addListener("build",this.buildAsGet)),this},buildAsGet:function(e){e.httpRequest.method="GET",e.httpRequest.path=e.service.endpoint.path+"?"+e.httpRequest.body,e.httpRequest.body="",delete e.httpRequest.headers["Content-Length"],delete e.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}}),t.Request.addPromisesToClass=function(e){this.prototype.promise=function(){var t=this;return this.httpRequest.appendToUserAgent("promise"),new e((function(e,r){t.on("complete",(function(t){t.error?r(t.error):e(Object.defineProperty(t.data||{},"$response",{value:t}))})),t.runTo()}))}},t.Request.deletePromisesFromClass=function(){delete this.prototype.promise},t.util.addPromises(t.Request),t.util.mixin(t.Request,t.SequentialExecutor)}).call(this,r(6))},function(e,t){function r(e,t){this.currentState=t||null,this.states=e||{}}r.prototype.runTo=function(e,t,r,n){"function"==typeof e&&(n=r,r=t,t=e,e=null);var i=this,o=i.states[i.currentState];o.fn.call(r||i,n,(function(n){if(n){if(!o.fail)return t?t.call(r,n):null;i.currentState=o.fail}else{if(!o.accept)return t?t.call(r):null;i.currentState=o.accept}if(i.currentState===e)return t?t.call(r,n):null;i.runTo(e,t,r,n)}))},r.prototype.addState=function(e,t,r,n){return"function"==typeof t?(n=t,t=null,r=null):"function"==typeof r&&(n=r,r=null),this.currentState||(this.currentState=e),this.states[e]={accept:t,fail:r,fn:n},this},e.exports=r},function(e,t,r){var n=r(3),i=n.util.inherit,o=r(74);n.Response=i({constructor:function(e){this.request=e,this.data=null,this.error=null,this.retryCount=0,this.redirectCount=0,this.httpResponse=new n.HttpResponse,e&&(this.maxRetries=e.service.numRetries(),this.maxRedirects=e.service.config.maxRedirects)},nextPage:function(e){var t,r=this.request.service,i=this.request.operation;try{t=r.paginationConfig(i,!0)}catch(e){this.error=e}if(!this.hasNextPage()){if(e)e(this.error,null);else if(this.error)throw this.error;return null}var o=n.util.copy(this.request.params);if(this.nextPageTokens){var s=t.inputToken;"string"==typeof s&&(s=[s]);for(var a=0;a=0?"&":"?";this.request.path+=o+n.util.queryParamsToString(i)},authorization:function(e,t){var r=[],n=this.credentialString(t);return r.push(this.algorithm+" Credential="+e.accessKeyId+"/"+n),r.push("SignedHeaders="+this.signedHeaders()),r.push("Signature="+this.signature(e,t)),r.join(", ")},signature:function(e,t){var r=i.getSigningKey(e,t.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return n.util.crypto.hmac(r,this.stringToSign(t),"hex")},stringToSign:function(e){var t=[];return t.push("AWS4-HMAC-SHA256"),t.push(e),t.push(this.credentialString(e)),t.push(this.hexEncodedHash(this.canonicalString())),t.join("\n")},canonicalString:function(){var e=[],t=this.request.pathname();return"s3"!==this.serviceName&&"s3v4"!==this.signatureVersion&&(t=n.util.uriEscapePath(t)),e.push(this.request.method),e.push(t),e.push(this.request.search()),e.push(this.canonicalHeaders()+"\n"),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join("\n")},canonicalHeaders:function(){var e=[];n.util.each.call(this,this.request.headers,(function(t,r){e.push([t,r])})),e.sort((function(e,t){return e[0].toLowerCase()50&&delete i[o.shift()]),p},emptyCache:function(){i={},o=[]}}},function(e,t,r){var n=r(3),i=n.util.inherit;n.Signers.S3=i(n.Signers.RequestSigner,{subResources:{acl:1,accelerate:1,analytics:1,cors:1,lifecycle:1,delete:1,inventory:1,location:1,logging:1,metrics:1,notification:1,partNumber:1,policy:1,requestPayment:1,replication:1,restore:1,tagging:1,torrent:1,uploadId:1,uploads:1,versionId:1,versioning:1,versions:1,website:1},responseHeaders:{"response-content-type":1,"response-content-language":1,"response-expires":1,"response-cache-control":1,"response-content-disposition":1,"response-content-encoding":1},addAuthorization:function(e,t){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=n.util.date.rfc822(t)),e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken);var r=this.sign(e.secretAccessKey,this.stringToSign()),i="AWS "+e.accessKeyId+":"+r;this.request.headers.Authorization=i},stringToSign:function(){var e=this.request,t=[];t.push(e.method),t.push(e.headers["Content-MD5"]||""),t.push(e.headers["Content-Type"]||""),t.push(e.headers["presigned-expires"]||"");var r=this.canonicalizedAmzHeaders();return r&&t.push(r),t.push(this.canonicalizedResource()),t.join("\n")},canonicalizedAmzHeaders:function(){var e=[];n.util.each(this.request.headers,(function(t){t.match(/^x-amz-/i)&&e.push(t)})),e.sort((function(e,t){return e.toLowerCase()604800){throw n.util.error(new Error,{code:"InvalidExpiryTime",message:"Presigning does not support expiry time greater than a week with SigV4 signing.",retryable:!1})}e.httpRequest.headers[o]=t}else{if(r!==n.Signers.S3)throw n.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1});var i=e.service?e.service.getSkewCorrectedDate():n.util.date.getDate();e.httpRequest.headers[o]=parseInt(n.util.date.unixTimestamp(i)+t,10).toString()}}function a(e){var t=e.httpRequest.endpoint,r=n.util.urlParse(e.httpRequest.path),i={};r.search&&(i=n.util.queryStringParse(r.search.substr(1)));var s=e.httpRequest.headers.Authorization.split(" ");if("AWS"===s[0])s=s[1].split(":"),i.AWSAccessKeyId=s[0],i.Signature=s[1],n.util.each(e.httpRequest.headers,(function(e,t){e===o&&(e="Expires"),0===e.indexOf("x-amz-meta-")&&(delete i[e],e=e.toLowerCase()),i[e]=t})),delete e.httpRequest.headers[o],delete i.Authorization,delete i.Host;else if("AWS4-HMAC-SHA256"===s[0]){s.shift();var a=s.join(" ").match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];i["X-Amz-Signature"]=a,delete i.Expires}t.pathname=r.pathname,t.search=n.util.queryParamsToString(i)}n.Signers.Presign=i({sign:function(e,t,r){if(e.httpRequest.headers[o]=t||3600,e.on("build",s),e.on("sign",a),e.removeListener("afterBuild",n.EventListeners.Core.SET_CONTENT_LENGTH),e.removeListener("afterBuild",n.EventListeners.Core.COMPUTE_SHA256),e.emit("beforePresign",[e]),!r){if(e.build(),e.response.error)throw e.response.error;return n.util.urlFormat(e.httpRequest.endpoint)}e.build((function(){this.response.error?r(this.response.error):r(null,n.util.urlFormat(e.httpRequest.endpoint))}))}}),e.exports=n.Signers.Presign},function(e,t,r){var n=r(3);n.ParamValidator=n.util.inherit({constructor:function(e){!0!==e&&void 0!==e||(e={min:!0}),this.validation=e},validate:function(e,t,r){if(this.errors=[],this.validateMember(e,t||{},r||"params"),this.errors.length>1){var i=this.errors.join("\n* ");throw i="There were "+this.errors.length+" validation errors:\n* "+i,n.util.error(new Error(i),{code:"MultipleValidationErrors",errors:this.errors})}if(1===this.errors.length)throw this.errors[0];return!0},fail:function(e,t){this.errors.push(n.util.error(new Error(t),{code:e}))},validateStructure:function(e,t,r){var n;this.validateType(t,r,["object"],"structure");for(var i=0;e.required&&i= 1, but found "'+t+'" for '+r)},validatePattern:function(e,t,r){this.validation.pattern&&void 0!==e.pattern&&(new RegExp(e.pattern).test(t)||this.fail("PatternMatchError",'Provided value "'+t+'" does not match regex pattern /'+e.pattern+"/ for "+r))},validateRange:function(e,t,r,n){this.validation.min&&void 0!==e.min&&t= "+e.min+", but found "+t+" for "+r),this.validation.max&&void 0!==e.max&&t>e.max&&this.fail("MaxRangeError","Expected "+n+" <= "+e.max+", but found "+t+" for "+r)},validateEnum:function(e,t,r){this.validation.enum&&void 0!==e.enum&&-1===e.enum.indexOf(t)&&this.fail("EnumError","Found string value of "+t+", but expected "+e.enum.join("|")+" for "+r)},validateType:function(e,t,r,i){if(null==e)return!1;for(var o=!1,s=0;se.BLOCK_SIZE){var i=new e;i.update(r),r=i.digest()}var o=new Uint8Array(e.BLOCK_SIZE);return o.set(r),o}(e,t),i=new Uint8Array(e.BLOCK_SIZE);i.set(r);for(var o=0;o>>32-i)+r&4294967295}function a(e,t,r,n,i,o,a){return s(t&r|~t&n,e,t,i,o,a)}function u(e,t,r,n,i,o,a){return s(t&n|r&~n,e,t,i,o,a)}function c(e,t,r,n,i,o,a){return s(t^r^n,e,t,i,o,a)}function l(e,t,r,n,i,o,a){return s(r^(t|~n),e,t,i,o,a)}e.exports=o,o.BLOCK_SIZE=64,o.prototype.update=function(e){if(n.isEmptyData(e))return this;if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=n.convertToBuffer(e),r=0,i=t.byteLength;for(this.bytesHashed+=i;i>0;)this.buffer.setUint8(this.bufferLength++,t[r++]),i--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},o.prototype.digest=function(e){if(!this.finished){var t=this.buffer,r=this.bufferLength,n=8*this.bytesHashed;if(t.setUint8(this.bufferLength++,128),r%64>=56){for(var o=this.bufferLength;o<64;o++)t.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(o=this.bufferLength;o<56;o++)t.setUint8(o,0);t.setUint32(56,n>>>0,!0),t.setUint32(60,Math.floor(n/4294967296),!0),this.hashBuffer(),this.finished=!0}var s=new DataView(new ArrayBuffer(16));for(o=0;o<4;o++)s.setUint32(4*o,this.state[o],!0);var a=new i(s.buffer,s.byteOffset,s.byteLength);return e?a.toString(e):a},o.prototype.hashBuffer=function(){var e=this.buffer,t=this.state,r=t[0],n=t[1],i=t[2],o=t[3];r=a(r,n,i,o,e.getUint32(0,!0),7,3614090360),o=a(o,r,n,i,e.getUint32(4,!0),12,3905402710),i=a(i,o,r,n,e.getUint32(8,!0),17,606105819),n=a(n,i,o,r,e.getUint32(12,!0),22,3250441966),r=a(r,n,i,o,e.getUint32(16,!0),7,4118548399),o=a(o,r,n,i,e.getUint32(20,!0),12,1200080426),i=a(i,o,r,n,e.getUint32(24,!0),17,2821735955),n=a(n,i,o,r,e.getUint32(28,!0),22,4249261313),r=a(r,n,i,o,e.getUint32(32,!0),7,1770035416),o=a(o,r,n,i,e.getUint32(36,!0),12,2336552879),i=a(i,o,r,n,e.getUint32(40,!0),17,4294925233),n=a(n,i,o,r,e.getUint32(44,!0),22,2304563134),r=a(r,n,i,o,e.getUint32(48,!0),7,1804603682),o=a(o,r,n,i,e.getUint32(52,!0),12,4254626195),i=a(i,o,r,n,e.getUint32(56,!0),17,2792965006),r=u(r,n=a(n,i,o,r,e.getUint32(60,!0),22,1236535329),i,o,e.getUint32(4,!0),5,4129170786),o=u(o,r,n,i,e.getUint32(24,!0),9,3225465664),i=u(i,o,r,n,e.getUint32(44,!0),14,643717713),n=u(n,i,o,r,e.getUint32(0,!0),20,3921069994),r=u(r,n,i,o,e.getUint32(20,!0),5,3593408605),o=u(o,r,n,i,e.getUint32(40,!0),9,38016083),i=u(i,o,r,n,e.getUint32(60,!0),14,3634488961),n=u(n,i,o,r,e.getUint32(16,!0),20,3889429448),r=u(r,n,i,o,e.getUint32(36,!0),5,568446438),o=u(o,r,n,i,e.getUint32(56,!0),9,3275163606),i=u(i,o,r,n,e.getUint32(12,!0),14,4107603335),n=u(n,i,o,r,e.getUint32(32,!0),20,1163531501),r=u(r,n,i,o,e.getUint32(52,!0),5,2850285829),o=u(o,r,n,i,e.getUint32(8,!0),9,4243563512),i=u(i,o,r,n,e.getUint32(28,!0),14,1735328473),r=c(r,n=u(n,i,o,r,e.getUint32(48,!0),20,2368359562),i,o,e.getUint32(20,!0),4,4294588738),o=c(o,r,n,i,e.getUint32(32,!0),11,2272392833),i=c(i,o,r,n,e.getUint32(44,!0),16,1839030562),n=c(n,i,o,r,e.getUint32(56,!0),23,4259657740),r=c(r,n,i,o,e.getUint32(4,!0),4,2763975236),o=c(o,r,n,i,e.getUint32(16,!0),11,1272893353),i=c(i,o,r,n,e.getUint32(28,!0),16,4139469664),n=c(n,i,o,r,e.getUint32(40,!0),23,3200236656),r=c(r,n,i,o,e.getUint32(52,!0),4,681279174),o=c(o,r,n,i,e.getUint32(0,!0),11,3936430074),i=c(i,o,r,n,e.getUint32(12,!0),16,3572445317),n=c(n,i,o,r,e.getUint32(24,!0),23,76029189),r=c(r,n,i,o,e.getUint32(36,!0),4,3654602809),o=c(o,r,n,i,e.getUint32(48,!0),11,3873151461),i=c(i,o,r,n,e.getUint32(60,!0),16,530742520),r=l(r,n=c(n,i,o,r,e.getUint32(8,!0),23,3299628645),i,o,e.getUint32(0,!0),6,4096336452),o=l(o,r,n,i,e.getUint32(28,!0),10,1126891415),i=l(i,o,r,n,e.getUint32(56,!0),15,2878612391),n=l(n,i,o,r,e.getUint32(20,!0),21,4237533241),r=l(r,n,i,o,e.getUint32(48,!0),6,1700485571),o=l(o,r,n,i,e.getUint32(12,!0),10,2399980690),i=l(i,o,r,n,e.getUint32(40,!0),15,4293915773),n=l(n,i,o,r,e.getUint32(4,!0),21,2240044497),r=l(r,n,i,o,e.getUint32(32,!0),6,1873313359),o=l(o,r,n,i,e.getUint32(60,!0),10,4264355552),i=l(i,o,r,n,e.getUint32(24,!0),15,2734768916),n=l(n,i,o,r,e.getUint32(52,!0),21,1309151649),r=l(r,n,i,o,e.getUint32(16,!0),6,4149444226),o=l(o,r,n,i,e.getUint32(44,!0),10,3174756917),i=l(i,o,r,n,e.getUint32(8,!0),15,718787259),n=l(n,i,o,r,e.getUint32(36,!0),21,3951481745),t[0]=r+t[0]&4294967295,t[1]=n+t[1]&4294967295,t[2]=i+t[2]&4294967295,t[3]=o+t[3]&4294967295}},function(e,t,r){var n=r(15).Buffer,i=r(49);new Uint32Array([1518500249,1859775393,-1894007588,-899497514]),Math.pow(2,53);function o(){this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=new Uint32Array(80),this.offset=0,this.shift=24,this.totalLength=0}e.exports=o,o.BLOCK_SIZE=64,o.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(i.isEmptyData(e))return this;var t=(e=i.convertToBuffer(e)).length;this.totalLength+=8*t;for(var r=0;r14||14===this.offset&&this.shift<24)&&this.processBlock(),this.offset=14,this.shift=24,this.write(0),this.write(0),this.write(this.totalLength>0xffffffffff?this.totalLength/1099511627776:0),this.write(this.totalLength>4294967295?this.totalLength/4294967296:0);for(var t=24;t>=0;t-=8)this.write(this.totalLength>>t);var r=new n(20),i=new DataView(r.buffer);return i.setUint32(0,this.h0,!1),i.setUint32(4,this.h1,!1),i.setUint32(8,this.h2,!1),i.setUint32(12,this.h3,!1),i.setUint32(16,this.h4,!1),e?r.toString(e):r},o.prototype.processBlock=function(){for(var e=16;e<80;e++){var t=this.block[e-3]^this.block[e-8]^this.block[e-14]^this.block[e-16];this.block[e]=t<<1|t>>>31}var r,n,i=this.h0,o=this.h1,s=this.h2,a=this.h3,u=this.h4;for(e=0;e<80;e++){e<20?(r=a^o&(s^a),n=1518500249):e<40?(r=o^s^a,n=1859775393):e<60?(r=o&s|a&(o|s),n=2400959708):(r=o^s^a,n=3395469782);var c=(i<<5|i>>>27)+r+u+n+(0|this.block[e]);u=a,a=s,s=o<<30|o>>>2,o=i,i=c}for(this.h0=this.h0+i|0,this.h1=this.h1+o|0,this.h2=this.h2+s|0,this.h3=this.h3+a|0,this.h4=this.h4+u|0,this.offset=0,e=0;e<16;e++)this.block[e]=0}},function(e,t,r){var n=r(15).Buffer,i=r(49),o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=Math.pow(2,53)-1;function a(){this.state=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}e.exports=a,a.BLOCK_SIZE=64,a.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(i.isEmptyData(e))return this;var t=0,r=(e=i.convertToBuffer(e)).byteLength;if(this.bytesHashed+=r,8*this.bytesHashed>s)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},a.prototype.digest=function(e){if(!this.finished){var t=8*this.bytesHashed,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),i=this.bufferLength;if(r.setUint8(this.bufferLength++,128),i%64>=56){for(var o=this.bufferLength;o<64;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(o=this.bufferLength;o<56;o++)r.setUint8(o,0);r.setUint32(56,Math.floor(t/4294967296),!0),r.setUint32(60,t),this.hashBuffer(),this.finished=!0}var s=new n(32);for(o=0;o<8;o++)s[4*o]=this.state[o]>>>24&255,s[4*o+1]=this.state[o]>>>16&255,s[4*o+2]=this.state[o]>>>8&255,s[4*o+3]=this.state[o]>>>0&255;return e?s.toString(e):s},a.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],n=t[1],i=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<64;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var h=this.temp[f-2],p=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,d=((h=this.temp[f-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[f]=(p+this.temp[f-7]|0)+(d+this.temp[f-16]|0)}var y=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(o[f]+this.temp[f]|0)|0)|0,m=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&n^r&i^n&i)|0;l=c,c=u,u=a,a=s+y|0,s=i,i=n,n=r,r=y+m|0}t[0]+=r,t[1]+=n,t[2]+=i,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l}},function(e,t){e.exports={now:function(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}}},function(e,t,r){var n=r(305).eventMessageChunker,i=r(306).parseEvent;e.exports={createEventStream:function(e,t,r){for(var o=n(e),s=[],a=0;a-1&&(e[t]++,0===e[t]);t--);}o.fromNumber=function(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(e+" is too large (or, if negative, too small) to represent as an Int64");for(var t=new Uint8Array(8),r=7,n=Math.abs(Math.round(e));r>-1&&n>0;r--,n/=256)t[r]=n;return e<0&&s(t),new o(t)},o.prototype.valueOf=function(){var e=this.bytes.slice(0),t=128&e[0];return t&&s(e),parseInt(e.toString("hex"),16)*(t?-1:1)},o.prototype.toString=function(){return String(this.valueOf())},e.exports={Int64:o}},function(e,t,r){var n=r(3).util,i=n.buffer.toBuffer;e.exports={splitMessage:function(e){if(n.Buffer.isBuffer(e)||(e=i(e)),e.length<16)throw new Error("Provided message too short to accommodate event stream message overhead");if(e.length!==e.readUInt32BE(0))throw new Error("Reported message length does not match received message length");var t=e.readUInt32BE(8);if(t!==n.crypto.crc32(e.slice(0,8)))throw new Error("The prelude checksum specified in the message ("+t+") does not match the calculated CRC32 checksum.");var r=e.readUInt32BE(e.length-4);if(r!==n.crypto.crc32(e.slice(0,e.length-4)))throw new Error("The message checksum did not match the expected value of "+r);var o=12+e.readUInt32BE(4);return{headers:e.slice(12,o),body:e.slice(o,e.length-4)}}}},function(e,t,r){var n=r(3),i=r(40);n.TemporaryCredentials=n.util.inherit(n.Credentials,{constructor:function(e,t){n.Credentials.call(this),this.loadMasterCredentials(t),this.expired=!0,this.params=e||{},this.params.RoleArn&&(this.params.RoleSessionName=this.params.RoleSessionName||"temporary-credentials")},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.masterCredentials.get((function(){t.service.config.credentials=t.masterCredentials,(t.params.RoleArn?t.service.assumeRole:t.service.getSessionToken).call(t.service,(function(r,n){r||t.service.credentialsFrom(n,t),e(r)}))}))},loadMasterCredentials:function(e){for(this.masterCredentials=e||n.config.credentials;this.masterCredentials.masterCredentials;)this.masterCredentials=this.masterCredentials.masterCredentials;"function"!=typeof this.masterCredentials.get&&(this.masterCredentials=new n.Credentials(this.masterCredentials))},createClients:function(){this.service=this.service||new i({params:this.params})}})},function(e,t,r){var n=r(3),i=r(312);n.util.update(n.STS.prototype,{credentialsFrom:function(e,t){return e?(t||(t=new n.TemporaryCredentials),t.expired=!1,t.accessKeyId=e.Credentials.AccessKeyId,t.secretAccessKey=e.Credentials.SecretAccessKey,t.sessionToken=e.Credentials.SessionToken,t.expireTime=e.Credentials.Expiration,t):null},assumeRoleWithWebIdentity:function(e,t){return this.makeUnauthenticatedRequest("assumeRoleWithWebIdentity",e,t)},assumeRoleWithSAML:function(e,t){return this.makeUnauthenticatedRequest("assumeRoleWithSAML",e,t)},setupRequestListeners:function(e){e.addListener("validate",this.optInRegionalEndpoint,!0)},optInRegionalEndpoint:function(e){var t=e.service,r=t.config;if(r.stsRegionalEndpoints=i(t._originalConfig,{env:"AWS_STS_REGIONAL_ENDPOINTS",sharedConfig:"sts_regional_endpoints",clientConfig:"stsRegionalEndpoints"}),"regional"===r.stsRegionalEndpoints&&t.isGlobalEndpoint){if(!r.region)throw n.util.error(new Error,{code:"ConfigError",message:"Missing region in config"});var o=r.endpoint.indexOf(".amazonaws.com"),s=r.endpoint.substring(0,o)+"."+r.region+r.endpoint.substring(o);e.httpRequest.updateEndpoint(s),e.httpRequest.region=r.region}}})},function(e,t,r){(function(t){var n=r(3);function i(e,t){if("string"==typeof e){if(["legacy","regional"].indexOf(e.toLowerCase())>=0)return e.toLowerCase();throw n.util.error(new Error,t)}}e.exports=function(e,r){var o;if((e=e||{})[r.clientConfig]&&(o=i(e[r.clientConfig],{code:"InvalidConfiguration",message:'invalid "'+r.clientConfig+'" configuration. Expect "legacy" or "regional". Got "'+e[r.clientConfig]+'".'})))return o;if(!n.util.isNode())return o;if(Object.prototype.hasOwnProperty.call(t.env,r.env)&&(o=i(t.env[r.env],{code:"InvalidEnvironmentalVariable",message:"invalid "+r.env+' environmental variable. Expect "legacy" or "regional". Got "'+t.env[r.env]+'".'})))return o;var s={};try{s=n.util.getProfilesFromSharedConfig(n.util.iniLoader)[t.env.AWS_PROFILE||n.util.defaultProfile]}catch(e){}return s&&Object.prototype.hasOwnProperty.call(s,r.sharedConfig)&&(o=i(s[r.sharedConfig],{code:"InvalidConfiguration",message:"invalid "+r.sharedConfig+' profile config. Expect "legacy" or "regional". Got "'+s[r.sharedConfig]+'".'})),o}}).call(this,r(6))},function(e){e.exports=JSON.parse('{"version":"2.0","metadata":{"apiVersion":"2011-06-15","endpointPrefix":"sts","globalEndpoint":"sts.amazonaws.com","protocol":"query","serviceAbbreviation":"AWS STS","serviceFullName":"AWS Security Token Service","serviceId":"STS","signatureVersion":"v4","uid":"sts-2011-06-15","xmlNamespace":"https://sts.amazonaws.com/doc/2011-06-15/"},"operations":{"AssumeRole":{"input":{"type":"structure","required":["RoleArn","RoleSessionName"],"members":{"RoleArn":{},"RoleSessionName":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"},"Tags":{"shape":"S8"},"TransitiveTagKeys":{"type":"list","member":{}},"ExternalId":{},"SerialNumber":{},"TokenCode":{}}},"output":{"resultWrapper":"AssumeRoleResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"}}}},"AssumeRoleWithSAML":{"input":{"type":"structure","required":["RoleArn","PrincipalArn","SAMLAssertion"],"members":{"RoleArn":{},"PrincipalArn":{},"SAMLAssertion":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"}}},"output":{"resultWrapper":"AssumeRoleWithSAMLResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"},"Subject":{},"SubjectType":{},"Issuer":{},"Audience":{},"NameQualifier":{}}}},"AssumeRoleWithWebIdentity":{"input":{"type":"structure","required":["RoleArn","RoleSessionName","WebIdentityToken"],"members":{"RoleArn":{},"RoleSessionName":{},"WebIdentityToken":{},"ProviderId":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"}}},"output":{"resultWrapper":"AssumeRoleWithWebIdentityResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"SubjectFromWebIdentityToken":{},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"},"Provider":{},"Audience":{}}}},"DecodeAuthorizationMessage":{"input":{"type":"structure","required":["EncodedMessage"],"members":{"EncodedMessage":{}}},"output":{"resultWrapper":"DecodeAuthorizationMessageResult","type":"structure","members":{"DecodedMessage":{}}}},"GetAccessKeyInfo":{"input":{"type":"structure","required":["AccessKeyId"],"members":{"AccessKeyId":{}}},"output":{"resultWrapper":"GetAccessKeyInfoResult","type":"structure","members":{"Account":{}}}},"GetCallerIdentity":{"input":{"type":"structure","members":{}},"output":{"resultWrapper":"GetCallerIdentityResult","type":"structure","members":{"UserId":{},"Account":{},"Arn":{}}}},"GetFederationToken":{"input":{"type":"structure","required":["Name"],"members":{"Name":{},"Policy":{},"PolicyArns":{"shape":"S4"},"DurationSeconds":{"type":"integer"},"Tags":{"shape":"S8"}}},"output":{"resultWrapper":"GetFederationTokenResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"FederatedUser":{"type":"structure","required":["FederatedUserId","Arn"],"members":{"FederatedUserId":{},"Arn":{}}},"PackedPolicySize":{"type":"integer"}}}},"GetSessionToken":{"input":{"type":"structure","members":{"DurationSeconds":{"type":"integer"},"SerialNumber":{},"TokenCode":{}}},"output":{"resultWrapper":"GetSessionTokenResult","type":"structure","members":{"Credentials":{"shape":"Sh"}}}}},"shapes":{"S4":{"type":"list","member":{"type":"structure","members":{"arn":{}}}},"S8":{"type":"list","member":{"type":"structure","required":["Key","Value"],"members":{"Key":{},"Value":{}}}},"Sh":{"type":"structure","required":["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],"members":{"AccessKeyId":{},"SecretAccessKey":{},"SessionToken":{},"Expiration":{"type":"timestamp"}}},"Sm":{"type":"structure","required":["AssumedRoleId","Arn"],"members":{"AssumedRoleId":{},"Arn":{}}}}}')},function(e){e.exports=JSON.parse('{"pagination":{}}')},function(e,t,r){var n=r(3),i=r(40);n.ChainableTemporaryCredentials=n.util.inherit(n.Credentials,{constructor:function(e){n.Credentials.call(this),e=e||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var t=n.util.copy(e.params)||{};if(t.RoleArn&&(t.RoleSessionName=t.RoleSessionName||"temporary-credentials"),t.SerialNumber){if(!e.tokenCodeFn||"function"!=typeof e.tokenCodeFn)throw new n.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=e.tokenCodeFn}var r=n.util.merge({params:t,credentials:e.masterCredentials||n.config.credentials},e.stsConfig||{});this.service=new i(r)},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this,r=t.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode((function(n,i){var o={};n?e(n):(i&&(o.TokenCode=i),t.service[r](o,(function(r,n){r||t.service.credentialsFrom(n,t),e(r)})))}))},getTokenCode:function(e){var t=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,(function(r,i){if(r){var o=r;return r instanceof Error&&(o=r.message),void e(n.util.error(new Error("Error fetching MFA token: "+o),{code:t.errorCode}))}e(null,i)})):e(null)}})},function(e,t,r){var n=r(3),i=r(40);n.WebIdentityCredentials=n.util.inherit(n.Credentials,{constructor:function(e,t){n.Credentials.call(this),this.expired=!0,this.params=e,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=n.util.copy(t||{})},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.service.assumeRoleWithWebIdentity((function(r,n){t.data=null,r||(t.data=n,t.service.credentialsFrom(n,t)),e(r)}))},createClients:function(){if(!this.service){var e=n.util.merge({},this._clientConfig);e.params=this.params,this.service=new i(e)}}})},function(e,t,r){var n=r(3),i=r(318),o=r(40);n.CognitoIdentityCredentials=n.util.inherit(n.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(e,t){n.Credentials.call(this),this.expired=!0,this.params=e,this.data=null,this._identityId=null,this._clientConfig=n.util.copy(t||{}),this.loadCachedId();var r=this;Object.defineProperty(this,"identityId",{get:function(){return r.loadCachedId(),r._identityId||r.params.IdentityId},set:function(e){r._identityId=e}})},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.data=null,t._identityId=null,t.getId((function(r){r?(t.clearIdOnNotAuthorized(r),e(r)):t.params.RoleArn?t.getCredentialsFromSTS(e):t.getCredentialsForIdentity(e)}))},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var e=this.params.IdentityPoolId,t=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+e+t],delete this.storage[this.localStorageKey.providers+e+t]},clearIdOnNotAuthorized:function(e){"NotAuthorizedException"==e.code&&this.clearCachedId()},getId:function(e){var t=this;if("string"==typeof t.params.IdentityId)return e(null,t.params.IdentityId);t.cognito.getId((function(r,n){!r&&n.IdentityId?(t.params.IdentityId=n.IdentityId,e(null,n.IdentityId)):e(r)}))},loadCredentials:function(e,t){e&&t&&(t.expired=!1,t.accessKeyId=e.Credentials.AccessKeyId,t.secretAccessKey=e.Credentials.SecretKey,t.sessionToken=e.Credentials.SessionToken,t.expireTime=e.Credentials.Expiration)},getCredentialsForIdentity:function(e){var t=this;t.cognito.getCredentialsForIdentity((function(r,n){r?t.clearIdOnNotAuthorized(r):(t.cacheId(n),t.data=n,t.loadCredentials(t.data,t)),e(r)}))},getCredentialsFromSTS:function(e){var t=this;t.cognito.getOpenIdToken((function(r,n){r?(t.clearIdOnNotAuthorized(r),e(r)):(t.cacheId(n),t.params.WebIdentityToken=n.Token,t.webIdentityCredentials.refresh((function(r){r||(t.data=t.webIdentityCredentials.data,t.sts.credentialsFrom(t.data,t)),e(r)})))}))},loadCachedId:function(){if(n.util.isBrowser()&&!this.params.IdentityId){var e=this.getStorage("id");if(e&&this.params.Logins){var t=Object.keys(this.params.Logins);0!==(this.getStorage("providers")||"").split(",").filter((function(e){return-1!==t.indexOf(e)})).length&&(this.params.IdentityId=e)}else e&&(this.params.IdentityId=e)}},createClients:function(){var e=this._clientConfig;if(this.webIdentityCredentials=this.webIdentityCredentials||new n.WebIdentityCredentials(this.params,e),!this.cognito){var t=n.util.merge({},e);t.params=this.params,this.cognito=new i(t)}this.sts=this.sts||new o(e)},cacheId:function(e){this._identityId=e.IdentityId,this.params.IdentityId=this._identityId,n.util.isBrowser()&&(this.setStorage("id",e.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(e){return this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(e,t){try{this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]=t}catch(e){}},storage:function(){try{var e=n.util.isBrowser()&&null!==window.localStorage&&"object"==typeof window.localStorage?window.localStorage:{};return e["aws.test-storage"]="foobar",delete e["aws.test-storage"],e}catch(e){return{}}}()})},function(e,t,r){r(69);var n=r(3),i=n.Service,o=n.apiLoader;o.services.cognitoidentity={},n.CognitoIdentity=i.defineService("cognitoidentity",["2014-06-30"]),r(319),Object.defineProperty(o.services.cognitoidentity,"2014-06-30",{get:function(){var e=r(320);return e.paginators=r(321).pagination,e},enumerable:!0,configurable:!0}),e.exports=n.CognitoIdentity},function(e,t,r){var n=r(3);n.util.update(n.CognitoIdentity.prototype,{getOpenIdToken:function(e,t){return this.makeUnauthenticatedRequest("getOpenIdToken",e,t)},getId:function(e,t){return this.makeUnauthenticatedRequest("getId",e,t)},getCredentialsForIdentity:function(e,t){return this.makeUnauthenticatedRequest("getCredentialsForIdentity",e,t)}})},function(e){e.exports=JSON.parse('{"version":"2.0","metadata":{"apiVersion":"2014-06-30","endpointPrefix":"cognito-identity","jsonVersion":"1.1","protocol":"json","serviceFullName":"Amazon Cognito Identity","serviceId":"Cognito Identity","signatureVersion":"v4","targetPrefix":"AWSCognitoIdentityService","uid":"cognito-identity-2014-06-30"},"operations":{"CreateIdentityPool":{"input":{"type":"structure","required":["IdentityPoolName","AllowUnauthenticatedIdentities"],"members":{"IdentityPoolName":{},"AllowUnauthenticatedIdentities":{"type":"boolean"},"AllowClassicFlow":{"type":"boolean"},"SupportedLoginProviders":{"shape":"S5"},"DeveloperProviderName":{},"OpenIdConnectProviderARNs":{"shape":"S9"},"CognitoIdentityProviders":{"shape":"Sb"},"SamlProviderARNs":{"shape":"Sg"},"IdentityPoolTags":{"shape":"Sh"}}},"output":{"shape":"Sk"}},"DeleteIdentities":{"input":{"type":"structure","required":["IdentityIdsToDelete"],"members":{"IdentityIdsToDelete":{"type":"list","member":{}}}},"output":{"type":"structure","members":{"UnprocessedIdentityIds":{"type":"list","member":{"type":"structure","members":{"IdentityId":{},"ErrorCode":{}}}}}}},"DeleteIdentityPool":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}}},"DescribeIdentity":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{}}},"output":{"shape":"Sv"}},"DescribeIdentityPool":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}},"output":{"shape":"Sk"}},"GetCredentialsForIdentity":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{},"Logins":{"shape":"S10"},"CustomRoleArn":{}}},"output":{"type":"structure","members":{"IdentityId":{},"Credentials":{"type":"structure","members":{"AccessKeyId":{},"SecretKey":{},"SessionToken":{},"Expiration":{"type":"timestamp"}}}}}},"GetId":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"AccountId":{},"IdentityPoolId":{},"Logins":{"shape":"S10"}}},"output":{"type":"structure","members":{"IdentityId":{}}}},"GetIdentityPoolRoles":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}},"output":{"type":"structure","members":{"IdentityPoolId":{},"Roles":{"shape":"S1c"},"RoleMappings":{"shape":"S1e"}}}},"GetOpenIdToken":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{},"Logins":{"shape":"S10"}}},"output":{"type":"structure","members":{"IdentityId":{},"Token":{}}}},"GetOpenIdTokenForDeveloperIdentity":{"input":{"type":"structure","required":["IdentityPoolId","Logins"],"members":{"IdentityPoolId":{},"IdentityId":{},"Logins":{"shape":"S10"},"TokenDuration":{"type":"long"}}},"output":{"type":"structure","members":{"IdentityId":{},"Token":{}}}},"ListIdentities":{"input":{"type":"structure","required":["IdentityPoolId","MaxResults"],"members":{"IdentityPoolId":{},"MaxResults":{"type":"integer"},"NextToken":{},"HideDisabled":{"type":"boolean"}}},"output":{"type":"structure","members":{"IdentityPoolId":{},"Identities":{"type":"list","member":{"shape":"Sv"}},"NextToken":{}}}},"ListIdentityPools":{"input":{"type":"structure","required":["MaxResults"],"members":{"MaxResults":{"type":"integer"},"NextToken":{}}},"output":{"type":"structure","members":{"IdentityPools":{"type":"list","member":{"type":"structure","members":{"IdentityPoolId":{},"IdentityPoolName":{}}}},"NextToken":{}}}},"ListTagsForResource":{"input":{"type":"structure","required":["ResourceArn"],"members":{"ResourceArn":{}}},"output":{"type":"structure","members":{"Tags":{"shape":"Sh"}}}},"LookupDeveloperIdentity":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{},"IdentityId":{},"DeveloperUserIdentifier":{},"MaxResults":{"type":"integer"},"NextToken":{}}},"output":{"type":"structure","members":{"IdentityId":{},"DeveloperUserIdentifierList":{"type":"list","member":{}},"NextToken":{}}}},"MergeDeveloperIdentities":{"input":{"type":"structure","required":["SourceUserIdentifier","DestinationUserIdentifier","DeveloperProviderName","IdentityPoolId"],"members":{"SourceUserIdentifier":{},"DestinationUserIdentifier":{},"DeveloperProviderName":{},"IdentityPoolId":{}}},"output":{"type":"structure","members":{"IdentityId":{}}}},"SetIdentityPoolRoles":{"input":{"type":"structure","required":["IdentityPoolId","Roles"],"members":{"IdentityPoolId":{},"Roles":{"shape":"S1c"},"RoleMappings":{"shape":"S1e"}}}},"TagResource":{"input":{"type":"structure","required":["ResourceArn","Tags"],"members":{"ResourceArn":{},"Tags":{"shape":"Sh"}}},"output":{"type":"structure","members":{}}},"UnlinkDeveloperIdentity":{"input":{"type":"structure","required":["IdentityId","IdentityPoolId","DeveloperProviderName","DeveloperUserIdentifier"],"members":{"IdentityId":{},"IdentityPoolId":{},"DeveloperProviderName":{},"DeveloperUserIdentifier":{}}}},"UnlinkIdentity":{"input":{"type":"structure","required":["IdentityId","Logins","LoginsToRemove"],"members":{"IdentityId":{},"Logins":{"shape":"S10"},"LoginsToRemove":{"shape":"Sw"}}}},"UntagResource":{"input":{"type":"structure","required":["ResourceArn","TagKeys"],"members":{"ResourceArn":{},"TagKeys":{"type":"list","member":{}}}},"output":{"type":"structure","members":{}}},"UpdateIdentityPool":{"input":{"shape":"Sk"},"output":{"shape":"Sk"}}},"shapes":{"S5":{"type":"map","key":{},"value":{}},"S9":{"type":"list","member":{}},"Sb":{"type":"list","member":{"type":"structure","members":{"ProviderName":{},"ClientId":{},"ServerSideTokenCheck":{"type":"boolean"}}}},"Sg":{"type":"list","member":{}},"Sh":{"type":"map","key":{},"value":{}},"Sk":{"type":"structure","required":["IdentityPoolId","IdentityPoolName","AllowUnauthenticatedIdentities"],"members":{"IdentityPoolId":{},"IdentityPoolName":{},"AllowUnauthenticatedIdentities":{"type":"boolean"},"AllowClassicFlow":{"type":"boolean"},"SupportedLoginProviders":{"shape":"S5"},"DeveloperProviderName":{},"OpenIdConnectProviderARNs":{"shape":"S9"},"CognitoIdentityProviders":{"shape":"Sb"},"SamlProviderARNs":{"shape":"Sg"},"IdentityPoolTags":{"shape":"Sh"}}},"Sv":{"type":"structure","members":{"IdentityId":{},"Logins":{"shape":"Sw"},"CreationDate":{"type":"timestamp"},"LastModifiedDate":{"type":"timestamp"}}},"Sw":{"type":"list","member":{}},"S10":{"type":"map","key":{},"value":{}},"S1c":{"type":"map","key":{},"value":{}},"S1e":{"type":"map","key":{},"value":{"type":"structure","required":["Type"],"members":{"Type":{},"AmbiguousRoleResolution":{},"RulesConfiguration":{"type":"structure","required":["Rules"],"members":{"Rules":{"type":"list","member":{"type":"structure","required":["Claim","MatchType","Value","RoleARN"],"members":{"Claim":{},"MatchType":{},"Value":{},"RoleARN":{}}}}}}}}}}}')},function(e){e.exports=JSON.parse('{"pagination":{}}')},function(e,t,r){var n=r(3),i=r(40);n.SAMLCredentials=n.util.inherit(n.Credentials,{constructor:function(e){n.Credentials.call(this),this.expired=!0,this.params=e},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.service.assumeRoleWithSAML((function(r,n){r||t.service.credentialsFrom(n,t),e(r)}))},createClients:function(){this.service=this.service||new i({params:this.params})}})},function(e,t,r){var n=r(7),i=r(39);function o(){}function s(e,t){for(var r=e.getElementsByTagName(t),n=0,i=r.length;n=this.HEADERS_RECEIVED&&!f&&(u.statusCode=l.status,u.headers=s.parseHeaders(l.getAllResponseHeaders()),u.emit("headers",u.statusCode,u.headers,l.statusText),f=!0),this.readyState===this.DONE&&s.finishRequest(l,u)}),!1),l.upload.addEventListener("progress",(function(e){u.emit("sendProgress",e)})),l.addEventListener("progress",(function(e){u.emit("receiveProgress",e)}),!1),l.addEventListener("timeout",(function(){o(n.util.error(new Error("Timeout"),{code:"TimeoutError"}))}),!1),l.addEventListener("error",(function(){o(n.util.error(new Error("Network Failure"),{code:"NetworkingError"}))}),!1),l.addEventListener("abort",(function(){o(n.util.error(new Error("Request aborted"),{code:"RequestAbortedError"}))}),!1),r(u),l.open(e.method,c,!1!==t.xhrAsync),n.util.each(e.headers,(function(e,t){"Content-Length"!==e&&"User-Agent"!==e&&"Host"!==e&&l.setRequestHeader(e,t)})),t.timeout&&!1!==t.xhrAsync&&(l.timeout=t.timeout),t.xhrWithCredentials&&(l.withCredentials=!0);try{l.responseType="arraybuffer"}catch(e){}try{e.body?l.send(e.body):l.send()}catch(t){if(!e.body||"object"!=typeof e.body.buffer)throw t;l.send(e.body.buffer)}return u},parseHeaders:function(e){var t={};return n.util.arrayEach(e.split(/\r?\n/),(function(e){var r=e.split(":",1)[0],n=e.substring(r.length+2);r.length>0&&(t[r.toLowerCase()]=n)})),t},finishRequest:function(e,t){var r;if("arraybuffer"===e.responseType&&e.response){var i=e.response;r=new n.util.Buffer(i.byteLength);for(var o=new Uint8Array(i),s=0;s2?e(Array.prototype.slice.call(arguments,1)):void e(n)}))}))}r.d(t,"a",(function(){return n}))}).call(this,r(6))},function(e,t,r){var n={util:r(7)};({}).toString(),e.exports=n,n.util.update(n,{VERSION:"2.656.0",Signers:{},Protocol:{Json:r(70),Query:r(112),Rest:r(48),RestJson:r(114),RestXml:r(115)},XML:{Builder:r(272),Parser:null},JSON:{Builder:r(71),Parser:r(72)},Model:{Api:r(116),Operation:r(117),Shape:r(39),Paginator:r(118),ResourceWaiter:r(119)},apiLoader:r(277),EndpointCache:r(278).EndpointCache}),r(121),r(280),r(283),r(124),r(284),r(286),r(288),r(289),r(290),r(297),n.events=new n.SequentialExecutor,n.util.memoizedProperty(n,"endpointCache",(function(){return new n.EndpointCache(n.config.endpointCacheSize)}),!0)},function(e,t,r){var n;e.exports=(n=n||function(e,t){var r={},n=r.lib={},i=n.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var r=new e;return t&&r.mixIn(t),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=n.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(o=0;o>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],i=function(t){t=t;var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},s=0;s>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(r,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(r,t)}},c=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)))}},l=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,s=this.blockSize,a=i/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,c=e.min(4*u,i);if(u){for(var l=0;l1)for(var r=1;r=e.length)return t.push(null);var i=r+n;i>e.length&&(i=e.length),t.push(e.slice(r,i)),r=i},t},concat:function(e){var t,r,n=0,i=0;for(r=0;r>>8^t[255&(r^e.readUInt8(n))]}return(-1^r)>>>0},hmac:function(e,t,r,n){return r||(r="binary"),"buffer"===r&&(r=void 0),n||(n="sha256"),"string"==typeof t&&(t=o.buffer.toBuffer(t)),o.crypto.lib.createHmac(n,e).update(t).digest(r)},md5:function(e,t,r){return o.crypto.hash("md5",e,t,r)},sha256:function(e,t,r){return o.crypto.hash("sha256",e,t,r)},hash:function(e,t,r,n){var i=o.crypto.createHash(e);r||(r="binary"),"buffer"===r&&(r=void 0),"string"==typeof t&&(t=o.buffer.toBuffer(t));var s=o.arraySliceFn(t),a=o.Buffer.isBuffer(t);if(o.isBrowser()&&"undefined"!=typeof ArrayBuffer&&t&&t.buffer instanceof ArrayBuffer&&(a=!0),n&&"object"==typeof t&&"function"==typeof t.on&&!a)t.on("data",(function(e){i.update(e)})),t.on("error",(function(e){n(e)})),t.on("end",(function(){n(null,i.digest(r))}));else{if(!n||!s||a||"undefined"==typeof FileReader){o.isBrowser()&&"object"==typeof t&&!a&&(t=new o.Buffer(new Uint8Array(t)));var u=i.update(t).digest(r);return n&&n(null,u),u}var c=0,l=new FileReader;l.onerror=function(){n(new Error("Failed to read data."))},l.onload=function(){var e=new o.Buffer(new Uint8Array(l.result));i.update(e),c+=e.length,l._continueReading()},l._continueReading=function(){if(c>=t.size)n(null,i.digest(r));else{var e=c+524288;e>t.size&&(e=t.size),l.readAsArrayBuffer(s.call(t,c,e))}},l._continueReading()}},toHex:function(e){for(var t=[],r=0;r=3e5,!1),i.config.isClockSkewed},applyClockOffset:function(e){e&&(i.config.systemClockOffset=e-(new Date).getTime())},extractRequestId:function(e){var t=e.httpResponse.headers["x-amz-request-id"]||e.httpResponse.headers["x-amzn-requestid"];!t&&e.data&&e.data.ResponseMetadata&&(t=e.data.ResponseMetadata.RequestId),t&&(e.requestId=t),e.error&&(e.error.requestId=t)},addPromises:function(e,t){var r=!1;void 0===t&&i&&i.config&&(t=i.config.getPromisesDependency()),void 0===t&&"undefined"!=typeof Promise&&(t=Promise),"function"!=typeof t&&(r=!0),Array.isArray(e)||(e=[e]);for(var n=0;n=0?(a++,setTimeout(c,i+(e.retryAfter||0))):r(e)},c=function(){var t="";n.handleRequest(e,s,(function(e){e.on("data",(function(e){t+=e.toString()})),e.on("end",(function(){var n=e.statusCode;if(n<300)r(null,t);else{var i=1e3*parseInt(e.headers["retry-after"],10)||0,s=o.error(new Error,{statusCode:n,retryable:n>=500||429===n});i&&s.retryable&&(s.retryAfter=i),u(s)}}))}),u)};i.util.defer(c)},uuid:{v4:function(){return r(81).v4()}},convertPayloadToString:function(e){var t=e.request,r=t.operation,n=t.service.api.operations[r].output||{};n.payload&&e.data[n.payload]&&(e.data[n.payload]=e.data[n.payload].toString())},defer:function(e){"object"==typeof t&&"function"==typeof t.nextTick?t.nextTick(e):"function"==typeof n?n(e):setTimeout(e,0)},getRequestPayloadShape:function(e){var t=e.service.api.operations;if(t){var r=(t||{})[e.operation];if(r&&r.input&&r.input.payload)return r.input.members[r.input.payload]}},getProfilesFromSharedConfig:function(e,r){var n={},i={};if(t.env[o.configOptInEnv])i=e.loadFrom({isConfig:!0,filename:t.env[o.sharedConfigFileEnv]});for(var s=e.loadFrom({filename:r||t.env[o.configOptInEnv]&&t.env[o.sharedCredentialsFileEnv]}),a=0,u=Object.keys(i);a=6},parse:function(e){var t=e.split(":");return{partition:t[1],service:t[2],region:t[3],accountId:t[4],resource:t.slice(5).join(":")}},build:function(e){if(void 0===e.service||void 0===e.region||void 0===e.accountId||void 0===e.resource)throw o.error(new Error("Input ARN object is invalid"));return"arn:"+(e.partition||"aws")+":"+e.service+":"+e.region+":"+e.accountId+":"+e.resource}},defaultProfile:"default",configOptInEnv:"AWS_SDK_LOAD_CONFIG",sharedCredentialsFileEnv:"AWS_SHARED_CREDENTIALS_FILE",sharedConfigFileEnv:"AWS_CONFIG_FILE",imdsDisabledEnv:"AWS_EC2_METADATA_DISABLED"};e.exports=o}).call(this,r(6),r(90).setImmediate)},function(e,t,r){"use strict";r.d(t,"a",(function(){return v}));var n=r(33),i=r(10),o=r(5),s=r(1),a=r(12),u=r(0),c=r(2);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 f(e,t){for(var r=0;r>>2];e.sigBytes-=t}},o.BlockCipher=h.extend({cfg:h.cfg.extend({mode:y,padding:m}),reset:function(){h.reset.call(this);var e=this.cfg,t=e.iv,r=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else n=r.createDecryptor,this._minBufferSize=1;this._mode=n.call(r,this,t&&t.words)},_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}),v=o.CipherParams=s.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(i.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;if(r)var n=a.create([1398893684,1701076831]).concat(r).concat(t);else n=t;return n.toString(l)},parse:function(e){var t=l.parse(e),r=t.words;if(1398893684==r[0]&&1701076831==r[1]){var n=a.create(r.slice(2,4));r.splice(0,4),t.sigBytes-=16}return v.create({ciphertext:t,salt:n})}},b=o.SerializableCipher=s.extend({cfg:s.extend({format:g}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),s=i.cfg;return v.create({ciphertext:o,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),_=(i.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=a.random(8));var i=f.create({keySize:t+r}).compute(e,n),o=a.create(i.words.slice(t),4*r);return i.sigBytes=4*t,v.create({key:i,iv:o,salt:n})}},w=o.PasswordBasedCipher=b.extend({cfg:b.cfg.extend({kdf:_}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var o=b.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=i.iv,b.decrypt.call(this,e,t,i.key,n)}}))))},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return b}));var n=r(50),i=r(8),o=r(52),s=r(35),a=r(55),u=r(56),c=r(128),l=r(1),f=r(5),h=r(0),p=r(2);function d(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null;return Object.keys(t).forEach((function(t){e.includes(t)||(r=t)})),r},getRequiedFilter:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[],n=Object.keys(t);return e.forEach((function(e){n.includes(e)||r.push(e)})),r}}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n=r(15),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";(function(e){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var n=r(154),i=r(155),o=r(86);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(e).length;default:if(n)return B(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return x(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var f=!0,h=0;hi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(n,i),l=e.slice(t,r),f=0;fi)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function L(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function D(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,o){return o||D(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function M(e,t,r,n,o){return o||D(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||O(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||O(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||P(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return M(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return M(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function H(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(13))},function(e,t,r){"use strict";var n=r(29),i=r(97),o=r(61),s=r(98),a=r(99);(e.exports=function(e,t){var r,i,u,c,l;return arguments.length<2||"string"!=typeof e?(c=t,t=e,e=null):c=arguments[2],n(e)?(r=a.call(e,"c"),i=a.call(e,"e"),u=a.call(e,"w")):(r=u=!0,i=!1),l={value:t,configurable:r,enumerable:i,writable:u},c?o(s(c),l):l}).gs=function(e,t,r){var u,c,l,f;return"string"!=typeof e?(l=r,r=t,t=e,e=null):l=arguments[3],n(t)?i(t)?n(r)?i(r)||(l=r,r=void 0):r=void 0:(l=t,t=r=void 0):t=void 0,n(e)?(u=a.call(e,"c"),c=a.call(e,"e")):(u=!0,c=!1),f={get:t,set:r,configurable:u,enumerable:c},l?o(s(l),f):f}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n=r(33),i=(r(1),r(5)),o=(r(10),r(0)),s=r(2);function a(e){return(a="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 r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=m(u,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},a.prototype.listenerCount=y,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){"use strict";var n=r(28);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,r){"use strict";r.d(t,"a",(function(){return _}));var n=r(33),i=(r(18),r(35)),o=r(10),s=r(5),a=r(1),u=(r(12),r(53)),c=(r(81),r(0)),l=r(2);function f(e){return(f="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 h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:null,t={typing_events:!0,read_events:!0,push_notification:!0},r=this.config||{};return r=p({},t,{},r),e?r[e]:r}},{key:"join",value:function(e){var t=this;return Object(l.a)(e,(function(e){return t.isGroup?"public"!=t.type?function(e){throw e}(new Error(a.a.PUBLIC_CONVERSATION_REQUIRED)):void c.a.request(b.basePath+"/"+t.id+"/join",{method:"post"}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))})):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"addAdmin",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){return r.isGroup?e&&"string"==typeof e?void c.a.request(b.basePath+"/"+r.id+"/add_admin",{method:"put",data:{userId:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(c.a.error(e))})):function(e){throw e}(new Error(a.a.INVALID_USER_ID)):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"addMembers",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){return r.isGroup?Array.isArray(e)?void c.a.request(b.basePath+"/"+r.id+"/add_members",{method:"post",data:{members:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(c.a.error(e))})):function(e){throw e}(new Error(a.a.INVALID_MEMBER_IDS)):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"removeMembers",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){return r.isGroup?Array.isArray(e)?void c.a.request(b.basePath+"/"+r.id+"/remove_members",{method:"post",data:{members:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(c.a.error(e))})):function(e){throw e}(new Error(a.a.INVALID_MEMBER_IDS)):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"clear",value:function(e){var t=this;return Object(l.a)(e,(function(e){if("private"!=t.type)return e(new Error(a.a.CAN_NOT_CLEAR_CONVERSATION));c.a.request(b.basePath+"/"+t.id+"/clear",{method:"delete"}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"delete",value:function(e){var t=this;return Object(l.a)(e,(function(e){c.a.request(b.basePath+"/"+t.id+"/delete",{method:"delete"}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"leave",value:function(e){var t=this;return Object(l.a)(e,(function(e){c.a.request(b.basePath+"/"+t.id+"/leave",{method:"post"}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"markAsRead",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){if(!r.getConfig("read_events"))return t(new Error(a.a.CONVERSATION_NOT_CONFIGURED_READ_EVENTS));var n;if(e)n=e;else{var i=new Date;n=i.toISOString()}c.a.request(b.basePath+"/"+r.id+"/mark_as_read",{method:"put",data:{timestamp:n}}).then((function(e){var i=o.a.getInstance();return r.lastReadAt.hasOwnProperty(i.loginUser.id)&&(r.lastReadAt[i.loginUser.id]=n),t(null,e.data)})).catch((function(e){return t(c.a.error(e))}))}))}},{key:"updateTitle",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){return r.isGroup?"string"!=typeof e?function(e){throw e}(new Error(a.a.INVALID_TITLE)):void c.a.request(b.basePath+"/"+r.id+"/update_title",{method:"put",data:{title:e}}).then((function(e){return t(null,e.data)})).catch((function(e){return t(c.a.error(e))})):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"muteConversation",value:function(e){var t=this;return Object(l.a)(e,(function(e){c.a.request(b.basePath+"/"+t.id+"/update_settings",{method:"put",data:{mute:!0}}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"unmuteConversation",value:function(e){var t=this;return Object(l.a)(e,(function(e){c.a.request(b.basePath+"/"+t.id+"/update_settings",{method:"put",data:{mute:!1}}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"updateProfilePhoto",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){return r.isGroup?"object"!=f(e)?function(e){throw e}(new Error(a.a.INVALID_PROFILE_IMG)):void o.a.getInstance().File.upload(e,"image",!1,(function(e,n){if(e)return t(e);var i={profileImageUrl:n.fileUrl};c.a.request(b.basePath+"/"+r.id+"/update_profile",{method:"put",data:i}).then((function(e){return t(null,e.data)})).catch((function(e){return t(e,null)}))})):function(e){throw e}(new Error(a.a.GROUP_CONVERSATION_REQUIRED))}))}},{key:"sendMessage",value:function(e,t){var r=this;return Object(l.a)(t,(function(t){e.conversationId=r.id,e.isGroup=r.isGroup,r.messageService._sendMessage(e,(function(e,r){return e?t(c.a.error(e)):t(null,r)}))}))}},{key:"startTyping",value:function(e){var t=this;return Object(l.a)(e,(function(e){if(!t.getConfig("typing_events"))return e(new Error(a.a.CONVERSATION_NOT_CONFIGURED_TYPING_EVENTS));c.a.request(b.basePath+"/"+t.id+"/send_typing_status",{method:"post",data:{isTyping:!0}}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"stopTyping",value:function(e){var t=this;return Object(l.a)(e,(function(e){if(!t.getConfig("typing_events"))return e(new Error(a.a.CONVERSATION_NOT_CONFIGURED_TYPING_EVENTS));c.a.request(b.basePath+"/"+t.id+"/send_typing_status",{method:"post",data:{isTyping:!1}}).then((function(t){return e(null,t.data)})).catch((function(t){return e(c.a.error(t))}))}))}},{key:"getMembers",value:function(e){var t=this;if(this.members.length)return e(null,this.members);c.a.request(b.basePath+"/"+this.id+"/members").then((function(r){return t.members=r.data,e(null,r.data)})).catch((function(t){return e(c.a.error(t))}))}},{key:"getReadMembers",value:function(e){var t=this;if("object"!=f(e))return function(e){throw e}(new Error(a.a.INVALID_MESSAGE_OBJECT));var r={};return Object.keys(this.lastReadAt).forEach((function(n){e.createdAt<=t.lastReadAt[n]&&(r[n]=t.lastReadAt[n])})),r}},{key:"readByAllMembers",value:function(e){var t=this;if("object"!=f(e))return function(e){throw e}(new Error(a.a.INVALID_MESSAGE_OBJECT));var r=!0;return Object.keys(this.lastReadAt).forEach((function(n){e.createdAt>=t.lastReadAt[n]&&e.ownerId!=n&&(r=!1)})),r}},{key:"createMessageListQuery",value:function(){return new u.a(this.id)}}])&&d(r.prototype,n),s&&d(r,s),b}(n.a);b(_,"__properties",{id:null,type:null,config:{},customType:null,metaData:{},lastMessage:{},lastReadAt:{},title:null,isGroup:null,createdAt:null,memberCount:0,ownerId:null,members:[],profileImageUrl:null,isActive:null,isAdmin:null,isDeleted:null,mute:null,unreadMessageCount:null,updatedAt:null,user:{}}),b(_,"basePath",s.a.BASEPATH_CONVERSATIONS)},function(e,t,r){"use strict";e.exports=r(186)()?r(43).Symbol:r(189)},function(e,t,r){"use strict";var n=r(37),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=f;var o=Object.create(r(38));o.inherits=r(20);var s=r(85),a=r(89);o.inherits(f,s);for(var u=i(a.prototype),c=0;c>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,r=this._map,n=r.charAt(64);if(n){var o=e.indexOf(n);-1!=o&&(t=o)}for(var s=[],a=0,u=0;u>>6-u%4*2;s[a>>>2]|=c<<24-a%4*8,a++}return i.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,r){var n;e.exports=(n=r(4),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=e[t+0],u=e[t+1],p=e[t+2],d=e[t+3],y=e[t+4],m=e[t+5],v=e[t+6],g=e[t+7],b=e[t+8],_=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],I=e[t+13],A=e[t+14],k=e[t+15],C=o[0],x=o[1],T=o[2],R=o[3];C=c(C,x,T,R,s,7,a[0]),R=c(R,C,x,T,u,12,a[1]),T=c(T,R,C,x,p,17,a[2]),x=c(x,T,R,C,d,22,a[3]),C=c(C,x,T,R,y,7,a[4]),R=c(R,C,x,T,m,12,a[5]),T=c(T,R,C,x,v,17,a[6]),x=c(x,T,R,C,g,22,a[7]),C=c(C,x,T,R,b,7,a[8]),R=c(R,C,x,T,_,12,a[9]),T=c(T,R,C,x,w,17,a[10]),x=c(x,T,R,C,S,22,a[11]),C=c(C,x,T,R,E,7,a[12]),R=c(R,C,x,T,I,12,a[13]),T=c(T,R,C,x,A,17,a[14]),C=l(C,x=c(x,T,R,C,k,22,a[15]),T,R,u,5,a[16]),R=l(R,C,x,T,v,9,a[17]),T=l(T,R,C,x,S,14,a[18]),x=l(x,T,R,C,s,20,a[19]),C=l(C,x,T,R,m,5,a[20]),R=l(R,C,x,T,w,9,a[21]),T=l(T,R,C,x,k,14,a[22]),x=l(x,T,R,C,y,20,a[23]),C=l(C,x,T,R,_,5,a[24]),R=l(R,C,x,T,A,9,a[25]),T=l(T,R,C,x,d,14,a[26]),x=l(x,T,R,C,b,20,a[27]),C=l(C,x,T,R,I,5,a[28]),R=l(R,C,x,T,p,9,a[29]),T=l(T,R,C,x,g,14,a[30]),C=f(C,x=l(x,T,R,C,E,20,a[31]),T,R,m,4,a[32]),R=f(R,C,x,T,b,11,a[33]),T=f(T,R,C,x,S,16,a[34]),x=f(x,T,R,C,A,23,a[35]),C=f(C,x,T,R,u,4,a[36]),R=f(R,C,x,T,y,11,a[37]),T=f(T,R,C,x,g,16,a[38]),x=f(x,T,R,C,w,23,a[39]),C=f(C,x,T,R,I,4,a[40]),R=f(R,C,x,T,s,11,a[41]),T=f(T,R,C,x,d,16,a[42]),x=f(x,T,R,C,v,23,a[43]),C=f(C,x,T,R,_,4,a[44]),R=f(R,C,x,T,E,11,a[45]),T=f(T,R,C,x,k,16,a[46]),C=h(C,x=f(x,T,R,C,p,23,a[47]),T,R,s,6,a[48]),R=h(R,C,x,T,g,10,a[49]),T=h(T,R,C,x,A,15,a[50]),x=h(x,T,R,C,m,21,a[51]),C=h(C,x,T,R,E,6,a[52]),R=h(R,C,x,T,d,10,a[53]),T=h(T,R,C,x,w,15,a[54]),x=h(x,T,R,C,u,21,a[55]),C=h(C,x,T,R,b,6,a[56]),R=h(R,C,x,T,k,10,a[57]),T=h(T,R,C,x,v,15,a[58]),x=h(x,T,R,C,I,21,a[59]),C=h(C,x,T,R,y,6,a[60]),R=h(R,C,x,T,S,10,a[61]),T=h(T,R,C,x,p,15,a[62]),x=h(x,T,R,C,_,21,a[63]),o[0]=o[0]+C|0,o[1]=o[1]+x|0,o[2]=o[2]+T|0,o[3]=o[3]+R|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,u=a.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,n,i,o,s){var a=e+(t&r|~t&n)+i+s;return(a<>>32-o)+t}function l(e,t,r,n,i,o,s){var a=e+(t&n|r&~n)+i+s;return(a<>>32-o)+t}function f(e,t,r,n,i,o,s){var a=e+(t^r^n)+i+s;return(a<>>32-o)+t}function h(e,t,r,n,i,o,s){var a=e+(r^(t|~n))+i+s;return(a<>>32-o)+t}t.MD5=o._createHelper(u),t.HmacMD5=o._createHmacHelper(u)}(Math),n.MD5)},function(e,t,r){var n,i,o,s,a,u,c,l;e.exports=(l=r(4),r(66),r(67),i=(n=l).lib,o=i.Base,s=i.WordArray,a=n.algo,u=a.MD5,c=a.EvpKDF=o.extend({cfg:o.extend({keySize:4,hasher:u,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=r.hasher.create(),i=s.create(),o=i.words,a=r.keySize,u=r.iterations;o.length=0;t--)if(u.a.getRequiedFilter(["userId","order","wordCount"],e.mentionedUsers[t]).length)return function(e){throw e}(new Error(a.a.INVALID_MESSAGE_MENTIONED_USERS))}e.parentId&&!e.type?e.type="reply":e.type=e.type?e.type:"normal"}}],(n=null)&&p(r.prototype,n),s&&p(r,s),b}(n.a);g=w,b="basePath",_=s.a.BASEPATH_MESSAGES,b in g?Object.defineProperty(g,b,{value:_,enumerable:!0,configurable:!0,writable:!0}):g[b]=_},function(e,t,r){(function(e){var n=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),u=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&t._extend(n,r),g(n.showHidden)&&(n.showHidden=!1),g(n.depth)&&(n.depth=2),g(n.colors)&&(n.colors=!1),g(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function l(e,r,n){if(e.customInspect&&r&&E(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return v(i)||(i=l(e,i,n)),i}var o=function(e,t){if(g(t))return e.stylize("undefined","undefined");if(v(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(m(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(y(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),S(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(r);if(0===s.length){if(E(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(b(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(S(r))return f(r)}var c,_="",I=!1,A=["{","}"];(p(r)&&(I=!0,A=["[","]"]),E(r))&&(_=" [Function"+(r.name?": "+r.name:"")+"]");return b(r)&&(_=" "+RegExp.prototype.toString.call(r)),w(r)&&(_=" "+Date.prototype.toUTCString.call(r)),S(r)&&(_=" "+f(r)),0!==s.length||I&&0!=r.length?n<0?b(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=I?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,_,A)):A[0]+_+A[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),x(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=y(r)?l(e,u.value,null):l(e,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),g(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function y(e){return null===e}function m(e){return"number"==typeof e}function v(e){return"string"==typeof e}function g(e){return void 0===e}function b(e){return _(e)&&"[object RegExp]"===I(e)}function _(e){return"object"==typeof e&&null!==e}function w(e){return _(e)&&"[object Date]"===I(e)}function S(e){return _(e)&&("[object Error]"===I(e)||e instanceof Error)}function E(e){return"function"==typeof e}function I(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(g(o)&&(o=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!s[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var n=e.pid;s[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,n,e)}}else s[r]=function(){};return s[r]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=d,t.isNull=y,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=v,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=g,t.isRegExp=b,t.isObject=_,t.isDate=w,t.isError=S,t.isFunction=E,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(150);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),k[e.getMonth()],t].join(" ")}function x(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",C(),t.format.apply(t,arguments))},t.inherits=r(151),t._extend=function(e,t){if(!t||!_(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var T="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(T&&e[T]){var t;if("function"!=typeof(t=e[T]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,T,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o-1?t||"":t,this.isJsonValue?JSON.parse(t):t&&"function"==typeof t.toString?t.toString():t},this.toWireFormat=function(e){return this.isJsonValue?JSON.stringify(e):e}}function p(){a.apply(this,arguments),this.toType=function(e){var t=i.base64.decode(e);if(this.isSensitive&&i.isNode()&&"function"==typeof i.Buffer.alloc){var r=i.Buffer.alloc(t.length,t);t.fill(0),t=r}return t},this.toWireFormat=i.base64.encode}function d(){p.apply(this,arguments)}function y(){a.apply(this,arguments),this.toType=function(e){return"boolean"==typeof e?e:null==e?null:"true"===e}}a.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"},a.types={structure:c,list:l,map:f,boolean:y,timestamp:function(e){var t=this;if(a.apply(this,arguments),e.timestampFormat)o(this,"timestampFormat",e.timestampFormat);else if(t.isTimestampFormatSet&&this.timestampFormat)o(this,"timestampFormat",this.timestampFormat);else if("header"===this.location)o(this,"timestampFormat","rfc822");else if("querystring"===this.location)o(this,"timestampFormat","iso8601");else if(this.api)switch(this.api.protocol){case"json":case"rest-json":o(this,"timestampFormat","unixTimestamp");break;case"rest-xml":case"query":case"ec2":o(this,"timestampFormat","iso8601")}this.toType=function(e){return null==e?null:"function"==typeof e.toUTCString?e:"string"==typeof e||"number"==typeof e?i.date.parseTimestamp(e):null},this.toWireFormat=function(e){return i.date.format(e,t.timestampFormat)}},float:function(){a.apply(this,arguments),this.toType=function(e){return null==e?null:parseFloat(e)},this.toWireFormat=this.toType},integer:function(){a.apply(this,arguments),this.toType=function(e){return null==e?null:parseInt(e,10)},this.toWireFormat=this.toType},string:h,base64:d,binary:p},a.resolve=function(e,t){if(e.shape){var r=t.api.shapes[e.shape];if(!r)throw new Error("Cannot find shape reference: "+e.shape);return r}return null},a.create=function(e,t,r){if(e.isShape)return e;var n=a.resolve(e,t);if(n){var i=Object.keys(e);t.documentation||(i=i.filter((function(e){return!e.match(/documentation/)})));var o=function(){n.constructor.call(this,e,t,r)};return o.prototype=n,new o}e.type||(e.members?e.type="structure":e.member?e.type="list":e.key?e.type="map":e.type="string");var s=e.type;if(a.normalizedTypes[e.type]&&(e.type=a.normalizedTypes[e.type]),a.types[e.type])return new a.types[e.type](e,t,r);throw new Error("Unrecognized shape type: "+s)},a.shapes={StructureShape:c,ListShape:l,MapShape:f,StringShape:h,BooleanShape:y,Base64Shape:d},e.exports=a},function(e,t,r){r(69);var n=r(3),i=n.Service,o=n.apiLoader;o.services.sts={},n.STS=i.defineService("sts",["2011-06-15"]),r(311),Object.defineProperty(o.services.sts,"2011-06-15",{get:function(){var e=r(313);return e.paginators=r(314).pagination,e},enumerable:!0,configurable:!0}),e.exports=n.STS},function(e,t,r){(t=e.exports=r(85)).Stream=t,t.Readable=t,t.Writable=r(89),t.Duplex=r(24),t.Transform=r(92),t.PassThrough=r(161)},function(e,t,r){"use strict";e.exports=r(95)()?Object.setPrototypeOf:r(96)},function(e,t,r){"use strict";e.exports=r(187)()?globalThis:r(188)},function(e,t,r){"use strict";var n=Object.prototype.toString,i=n.call(function(){return arguments}());e.exports=function(e){return n.call(e)===i}},function(e,t,r){"use strict";var n=Object.prototype.toString,i=n.call("");e.exports=function(e){return"string"==typeof e||e&&"object"==typeof e&&(e instanceof String||n.call(e)===i)||!1}},function(e,t,r){var n,i,o,s,a,u;e.exports=(u=r(4),i=(n=u).lib,o=i.Base,s=i.WordArray,(a=n.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=o.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,r=[],n=0;n=0?"&":"?";var u=[];n.arrayEach(Object.keys(s).sort(),(function(e){Array.isArray(s[e])||(s[e]=[s[e]]);for(var t=0;t-1});var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object DataView]"];e.exports={isEmptyData:function(e){return"string"==typeof e?0===e.length:0===e.byteLength},convertToBuffer:function(e){return"string"==typeof e&&(e=new n(e,"utf8")),ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return _}));var n=r(17),i=r(8),o=r(5),s=r(1),a=r(51),u=r(0),c=r(2);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 f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(o)})),e.exports=u}).call(this,r(6))},function(e,t,r){(function(t){var n=r(19),i=r(36).inherits,o=r(152),s=r(238),a=r(262),u=r(47),c=r(263),l=r(265),f=r(68);function h(e){return e>9?e:"0"+e}function p(e,t,r,n,i,o,a,c,l,f,h,p,d,y){var m=e+"\n"+n+"\n"+i+"\n"+("host:"+r.toLowerCase()+"\n")+"\nhost\n"+s.SHA256(f,{asBytes:!0});!0===d&&console.log("canonical request: "+m+"\n");var v=s.SHA256(m,{asBytes:!0});!0===d&&console.log("hashed canonical request: "+v+"\n");var g="AWS4-HMAC-SHA256\n"+p+"\n"+h+"/"+c+"/"+l+"/aws4_request\n"+v;!0===d&&console.log("string to sign: "+g+"\n");var b=function(e,t,r,n){var i=s.HmacSHA256(t,"AWS4"+e,{asBytes:!0}),o=s.HmacSHA256(r,i,{asBytes:!0}),a=s.HmacSHA256(n,o,{asBytes:!0});return s.HmacSHA256("aws4_request",a,{asBytes:!0})}(a,h,c,l);!0===d&&console.log("signing key: "+b+"\n");var _=s.HmacSHA256(g,b,{asBytes:!0});!0===d&&console.log("signature: "+_+"\n");var w=i+"&X-Amz-Signature="+_;u(y)||(w+="&X-Amz-Security-Token="+encodeURIComponent(y));var S=t+r+n+"?"+w;return!0===d&&console.log("url: "+S+"\n"),S}function d(e,t,r,n){var i,o,s=(i=new Date).getUTCFullYear()+""+h(i.getUTCMonth()+1)+h(i.getUTCDate())+"T"+h(i.getUTCHours())+h(i.getUTCMinutes())+h(i.getUTCSeconds())+"Z",a=(o=s).substring(0,o.indexOf("T")),c="X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential="+t+"%2F"+a+"%2F"+e.region+"%2Fiotdevicegateway%2Faws4_request&X-Amz-Date="+s+"&X-Amz-SignedHeaders=host",l=e.host;return u(e.port)||443===e.port||(l=e.host+":"+e.port),p("GET","wss://",l,"/mqtt",c,0,r,e.region,"iotdevicegateway","",a,s,e.debug,n)}function y(e){var t=e.host;return u(e.port)||443===e.port||(t=e.host+":"+e.port),"wss://"+t+"/mqtt"}function m(e){var t={},r={};return function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(this,e[r],parseInt(r,10))}(e.split(/\r?\n/),(function(e){var n=(e=e.split(/(^|\s)[;#]/)[0]).match(/^\s*\[([^\[\]]+)\]\s*$/);if(n)r=n[1];else if(r){var i=e.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);i&&(t[r]=t[r]||{},t[r][i[1]]=i[2])}})),t}function v(e){if(!(this instanceof v))return new v(e);var n=this,i=[],s=!0,h=0,p="oldest";i.length=0;var g=[];g.length=0;var b=[],_=!0;b.length=0;var w=[];w.length=0;var S,E,I,A,k,C="inactive",x=null,T=250,R=1e3,O=2e4,P=128e3,N=null,L="?SDK=JavaScript&Version="+r(266).version;if(u(e)||0===Object.keys(e).length)throw new Error(a.INVALID_CONNECT_OPTIONS);if(u(e.keepalive)&&(e.keepalive=300),(u(e.enableMetrics)||!0===e.enableMetrics)&&(u(e.username)?e.username=L:e.username+=L),u(e.baseReconnectTimeMs)||(R=e.baseReconnectTimeMs),u(e.minimumConnectionTimeMs)||(O=e.minimumConnectionTimeMs),u(e.maximumReconnectTimeMs)||(P=e.maximumReconnectTimeMs),u(e.drainTimeMs)||(T=e.drainTimeMs),u(e.autoResubscribe)||(_=e.autoResubscribe),u(e.offlineQueueing)||(s=e.offlineQueueing),u(e.offlineQueueMaxSize)||(h=e.offlineQueueMaxSize),u(e.offlineQueueDropBehavior)||(p=e.offlineQueueDropBehavior),S=R,e.reconnectPeriod=S,e.fastDisconnectDetection=!0,e.resubscribe=!1,e.baseReconnectTimeMs<=0)throw new Error(a.INVALID_RECONNECT_TIMING);if(P0&&i.length>=h&&("oldest"===p?i.shift():o=!1),o&&i.push({topic:e,message:t,options:r,callback:n}))},this.subscribe=function(e,t,r){V()&&!1!==_?g.length<50?g.push({type:"subscribe",topics:e,options:t,callback:r}):n.emit("error",new Error("Maximum queued offline subscription reached")):(H("subscribe",e,t),u(r)?z.subscribe(e,t):z.subscribe(e,t,r))},this.unsubscribe=function(t,r){V()&&!1!==_?g.length<50&&g.push({type:"unsubscribe",topics:t,options:e,callback:r}):(H("unsubscribe",t),z.unsubscribe(t,r))},this.end=function(e,t){z.end(e,t)},this.handleMessage=z.handleMessage.bind(z),z.handleMessage=function(e,t){n.handleMessage(e,t)},this.updateWebSocketCredentials=function(e,t,r,n){E=e,I=t,A=r},this.getWebsocketHeaders=function(){return e.websocketOptions.headers},this.updateCustomAuthHeaders=function(t){e.websocketOptions.headers=t},this.simulateNetworkFailure=function(){z.stream.emit("error",new Error("simulated connection error")),z.stream.end()}}i(v,n.EventEmitter),e.exports=v,e.exports.DeviceClient=v,e.exports.prepareWebSocketUrl=d,e.exports.prepareWebSocketCustomAuthUrl=y}).call(this,r(6))},function(e,t){e.exports=function(){for(var e={},t=0;t=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach((function(t,r){t>=e&&(this.__redo__[r]=++t)}),this),this.__redo__.push(e)):f(this,"__redo__",u("c",[e])))})),_onDelete:u((function(e){var t;e>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(-1!==(t=this.__redo__.indexOf(e))&&this.__redo__.splice(t,1),this.__redo__.forEach((function(t,r){t>e&&(this.__redo__[r]=--t)}),this)))})),_onClear:u((function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0}))}))),f(n.prototype,l.iterator,u((function(){return this})))},function(e,t,r){"use strict";var n=r(228),i=r(230);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof o?e.format():o.prototype.format.call(e)},t.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),h=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=r(106);function b(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=-1!==o&&o127?N+="x":N+=P[L];if(!N.match(p)){var j=R.slice(0,C),M=R.slice(C+1),q=P.match(d);q&&(j.push(q[1]),M.unshift(q[2])),M.length&&(b="/"+M.join(".")+b),this.hostname=j.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),T||(this.hostname=n.toASCII(this.hostname));var U=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+U,this.href+=this.host,T&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[S])for(C=0,O=l.length;C0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift());return r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var A=E.slice(-1)[0],k=(r.host||e.host||E.length>1)&&("."===A||".."===A)||""===A,C=0,x=E.length;x>=0;x--)"."===(A=E[x])?E.splice(x,1):".."===A?(E.splice(x,1),C++):C&&(E.splice(x,1),C--);if(!w&&!S)for(;C--;C)E.unshift("..");!w||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),k&&"/"!==E.join("/").substr(-1)&&E.push("");var T,R=""===E[0]||E[0]&&"/"===E[0].charAt(0);I&&(r.hostname=r.host=R?"":E.length?E.shift():"",(T=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift()));return(w=w||r.host&&E.length)&&!R&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,r){"use strict";var n=r(234);e.exports=function(e,t){var r;function i(n){t.rejectUnauthorized&&e.emit("error",n),r.end()}return t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,(r=n.connect(t)).on("secureConnect",(function(){t.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",i)})),r.on("error",i),r}},function(e,t,r){"use strict";(function(t,n){var i=r(41).Transform,o=r(235),s=r(237),a=r(14).Buffer;e.exports=function(e,r,u){var c,l,f="browser"===t.title,h=!!n.WebSocket,p=f?function e(t,r,n){if(l.bufferedAmount>y)return void setTimeout(e,m,t,r,n);g&&"string"==typeof t&&(t=a.from(t,"utf8"));try{l.send(t)}catch(e){return n(e)}n()}:function(e,t,r){if(l.readyState!==l.OPEN)return void r();g&&"string"==typeof e&&(e=a.from(e,"utf8"));l.send(e,r)};r&&!Array.isArray(r)&&"object"==typeof r&&(u=r,r=null,("string"==typeof u.protocol||Array.isArray(u.protocol))&&(r=u.protocol));u||(u={});void 0===u.objectMode&&(u.objectMode=!(!0===u.binary||void 0===u.binary));var d=function(e,t,r){var n=new i({objectMode:e.objectMode});return n._write=t,n._flush=r,n}(u,p,(function(e){l.close(),e()}));u.objectMode||(d._writev=E);var y=u.browserBufferSize||524288,m=u.browserBufferTimeout||1e3;"object"==typeof e?l=e:(l=h&&f?new s(e,r):new s(e,r,u)).binaryType="arraybuffer";var v=void 0===l.addEventListener;l.readyState===l.OPEN?c=d:(c=c=o(void 0,void 0,u),u.objectMode||(c._writev=E),v?l.addEventListener("open",b):l.onopen=b);c.socket=l,v?(l.addEventListener("close",_),l.addEventListener("error",w),l.addEventListener("message",S)):(l.onclose=_,l.onerror=w,l.onmessage=S);d.on("close",(function(){l.close()}));var g=!u.objectMode;function b(){c.setReadable(d),c.setWritable(d),c.emit("connect")}function _(){c.end(),c.destroy()}function w(e){c.destroy(e)}function S(e){var t=e.data;t=t instanceof ArrayBuffer?a.from(t):a.from(t,"utf8"),d.push(t)}function E(e,t){for(var r=new Array(e.length),n=0;n>>31}var f=(n<<5|n>>>27)+a+u[c];f+=c<20?1518500249+(i&o|~i&s):c<40?1859775393+(i^o^s):c<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,a=s,s=o,o=i<<30|i>>>2,i=n,n=f}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=s._createHelper(c),n.HmacSHA1=s._createHmacHelper(c),l.SHA1)},function(e,t,r){var n,i,o,s;e.exports=(n=r(4),o=(i=n).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,u=o.words,c=0;c0)try{var i=JSON.parse(r.body.toString());(i.__type||i.code)&&(t.code=(i.__type||i.code).split("#").pop()),"RequestEntityTooLarge"===t.code?t.message="Request body must be less than 1 MB":t.message=i.message||i.Message||null}catch(i){t.statusCode=r.statusCode,t.message=r.statusMessage}else t.statusCode=r.statusCode,t.message=r.statusCode.toString();e.error=n.error(new Error,t)},extractData:function(e){var t=e.httpResponse.body.toString()||"{}";if(!1===e.request.service.config.convertResponseTypes)e.data=JSON.parse(t);else{var r=e.request.service.api.operations[e.request.operation].output||{},n=new o;e.data=n.parse(t,r)}}}},function(e,t,r){var n=r(7);function i(){}function o(e,t){if(t&&null!=e)switch(t.type){case"structure":return function(e,t){var r={};return n.each(e,(function(e,n){var i=t.members[e];if(i){if("body"!==i.location)return;var s=i.isLocationName?i.name:e,a=o(n,i);void 0!==a&&(r[s]=a)}})),r}(e,t);case"map":return function(e,t){var r={};return n.each(e,(function(e,n){var i=o(n,t.value);void 0!==i&&(r[e]=i)})),r}(e,t);case"list":return function(e,t){var r=[];return n.arrayEach(e,(function(e){var n=o(e,t.member);void 0!==n&&r.push(n)})),r}(e,t);default:return function(e,t){return t.toWireFormat(e)}(e,t)}}i.prototype.build=function(e,t){return JSON.stringify(o(e,t))},e.exports=i},function(e,t,r){var n=r(7);function i(){}function o(e,t){if(t&&void 0!==e)switch(t.type){case"structure":return function(e,t){if(null==e)return;var r={},i=t.members;return n.each(i,(function(t,n){var i=n.isLocationName?n.name:t;if(Object.prototype.hasOwnProperty.call(e,i)){var s=o(e[i],n);void 0!==s&&(r[t]=s)}})),r}(e,t);case"map":return function(e,t){if(null==e)return;var r={};return n.each(e,(function(e,n){var i=o(n,t.value);r[e]=void 0===i?null:i})),r}(e,t);case"list":return function(e,t){if(null==e)return;var r=[];return n.arrayEach(e,(function(e){var n=o(e,t.member);void 0===n?r.push(null):r.push(n)})),r}(e,t);default:return function(e,t){return t.toType(e)}(e,t)}}i.prototype.parse=function(e,t){return o(JSON.parse(e),t)},e.exports=i},function(e,t,r){var n=r(7),i=r(3);e.exports={populateHostPrefix:function(e){if(!e.service.config.hostPrefixEnabled)return e;var t,r,o,s=e.service.api.operations[e.operation];if(function(e){var t=e.service.api,r=t.operations[e.operation],i=t.endpointOperation&&t.endpointOperation===n.string.lowerFirst(r.name);return"NULL"!==r.endpointDiscoveryRequired||!0===i}(e))return e;if(s.endpoint&&s.endpoint.hostPrefix){var a=function(e,t,r){return n.each(r.members,(function(r,i){if(!0===i.hostLabel){if("string"!=typeof t[r]||""===t[r])throw n.error(new Error,{message:"Parameter "+r+" should be a non-empty string.",code:"InvalidParameter"});var o=new RegExp("\\{"+r+"\\}","g");e=e.replace(o,t[r])}})),e}(s.endpoint.hostPrefix,e.params,s.input);!function(e,t){e.host&&(e.host=t+e.host);e.hostname&&(e.hostname=t+e.hostname)}(e.httpRequest.endpoint,a),t=e.httpRequest.endpoint.hostname,r=t.split("."),o=/^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/,n.arrayEach(r,(function(e){if(!e.length||e.length<1||e.length>63)throw n.error(new Error,{code:"ValidationError",message:"Hostname label length should be between 1 to 63 characters, inclusive."});if(!o.test(e))throw i.util.error(new Error,{code:"ValidationError",message:e+" is not hostname compatible."})}))}return e}}},function(e,t,r){!function(e){"use strict";function t(e){return null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function n(e,i){if(e===i)return!0;if(Object.prototype.toString.call(e)!==Object.prototype.toString.call(i))return!1;if(!0===t(e)){if(e.length!==i.length)return!1;for(var o=0;o":!0,"=":!0,"!":!0},l={" ":!0,"\t":!0,"\n":!0};function f(e){return e>="0"&&e<="9"||"-"===e}function h(){}h.prototype={tokenize:function(e){var t,r,n,i,o=[];for(this._current=0;this._current="a"&&i<="z"||i>="A"&&i<="Z"||"_"===i)t=this._current,r=this._consumeUnquotedIdentifier(e),o.push({type:"UnquotedIdentifier",value:r,start:t});else if(void 0!==u[e[this._current]])o.push({type:u[e[this._current]],value:e[this._current],start:this._current}),this._current++;else if(f(e[this._current]))n=this._consumeNumber(e),o.push(n);else if("["===e[this._current])n=this._consumeLBracket(e),o.push(n);else if('"'===e[this._current])t=this._current,r=this._consumeQuotedIdentifier(e),o.push({type:"QuotedIdentifier",value:r,start:t});else if("'"===e[this._current])t=this._current,r=this._consumeRawStringLiteral(e),o.push({type:"Literal",value:r,start:t});else if("`"===e[this._current]){t=this._current;var s=this._consumeLiteral(e);o.push({type:"Literal",value:s,start:t})}else if(void 0!==c[e[this._current]])o.push(this._consumeOperator(e));else if(void 0!==l[e[this._current]])this._current++;else if("&"===e[this._current])t=this._current,this._current++,"&"===e[this._current]?(this._current++,o.push({type:"And",value:"&&",start:t})):o.push({type:"Expref",value:"&",start:t});else{if("|"!==e[this._current]){var a=new Error("Unknown character:"+e[this._current]);throw a.name="LexerError",a}t=this._current,this._current++,"|"===e[this._current]?(this._current++,o.push({type:"Or",value:"||",start:t})):o.push({type:"Pipe",value:"|",start:t})}return o},_consumeUnquotedIdentifier:function(e){var t,r=this._current;for(this._current++;this._current="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t);)this._current++;return e.slice(r,this._current)},_consumeQuotedIdentifier:function(e){var t=this._current;this._current++;for(var r=e.length;'"'!==e[this._current]&&this._current"===r?"="===e[this._current]?(this._current++,{type:"GTE",value:">=",start:t}):{type:"GT",value:">",start:t}:"="===r&&"="===e[this._current]?(this._current++,{type:"EQ",value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t,r=this._current,n=e.length;"`"!==e[this._current]&&this._current=0)return!0;if(["true","false","null"].indexOf(e)>=0)return!0;if(!("-0123456789".indexOf(e[0])>=0))return!1;try{return JSON.parse(e),!0}catch(e){return!1}}};var p={};function d(){}function y(e){this.runtime=e}function m(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[s]}]},avg:{_func:this._functionAvg,_signature:[{types:[8]}]},ceil:{_func:this._functionCeil,_signature:[{types:[s]}]},contains:{_func:this._functionContains,_signature:[{types:[a,3]},{types:[1]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[a]},{types:[a]}]},floor:{_func:this._functionFloor,_signature:[{types:[s]}]},length:{_func:this._functionLength,_signature:[{types:[a,3,4]}]},map:{_func:this._functionMap,_signature:[{types:[6]},{types:[3]}]},max:{_func:this._functionMax,_signature:[{types:[8,9]}]},merge:{_func:this._functionMerge,_signature:[{types:[4],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[3]},{types:[6]}]},sum:{_func:this._functionSum,_signature:[{types:[8]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[a]},{types:[a]}]},min:{_func:this._functionMin,_signature:[{types:[8,9]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[3]},{types:[6]}]},type:{_func:this._functionType,_signature:[{types:[1]}]},keys:{_func:this._functionKeys,_signature:[{types:[4]}]},values:{_func:this._functionValues,_signature:[{types:[4]}]},sort:{_func:this._functionSort,_signature:[{types:[9,8]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[3]},{types:[6]}]},join:{_func:this._functionJoin,_signature:[{types:[a]},{types:[9]}]},reverse:{_func:this._functionReverse,_signature:[{types:[a,3]}]},to_array:{_func:this._functionToArray,_signature:[{types:[1]}]},to_string:{_func:this._functionToString,_signature:[{types:[1]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[1]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[1],variadic:!0}]}}}p.EOF=0,p.UnquotedIdentifier=0,p.QuotedIdentifier=0,p.Rbracket=0,p.Rparen=0,p.Comma=0,p.Rbrace=0,p.Number=0,p.Current=0,p.Expref=0,p.Pipe=1,p.Or=2,p.And=3,p.EQ=5,p.GT=5,p.LT=5,p.GTE=5,p.LTE=5,p.NE=5,p.Flatten=9,p.Star=20,p.Filter=21,p.Dot=40,p.Not=45,p.Lbrace=50,p.Lbracket=55,p.Lparen=60,d.prototype={parse:function(e){this._loadTokens(e),this.index=0;var t=this.expression(0);if("EOF"!==this._lookahead(0)){var r=this._lookaheadToken(0),n=new Error("Unexpected token type: "+r.type+", value: "+r.value);throw n.name="ParserError",n}return t},_loadTokens:function(e){var t=(new h).tokenize(e);t.push({type:"EOF",value:"",start:e.length}),this.tokens=t},expression:function(e){var t=this._lookaheadToken(0);this._advance();for(var r=this.nud(t),n=this._lookahead(0);e=0?this.expression(e):"Lbracket"===t?(this._match("Lbracket"),this._parseMultiselectList()):"Lbrace"===t?(this._match("Lbrace"),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(p[this._lookahead(0)]<10)t={type:"Identity"};else if("Lbracket"===this._lookahead(0))t=this.expression(e);else if("Filter"===this._lookahead(0))t=this.expression(e);else{if("Dot"!==this._lookahead(0)){var r=this._lookaheadToken(0),n=new Error("Sytanx error, unexpected token: "+r.value+"("+r.type+")");throw n.name="ParserError",n}this._match("Dot"),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){for(var e=[];"Rbracket"!==this._lookahead(0);){var t=this.expression(0);if(e.push(t),"Comma"===this._lookahead(0)&&(this._match("Comma"),"Rbracket"===this._lookahead(0)))throw new Error("Unexpected token Rbracket")}return this._match("Rbracket"),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t,r,n=[],i=["UnquotedIdentifier","QuotedIdentifier"];;){if(e=this._lookaheadToken(0),i.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(t=e.value,this._advance(),this._match("Colon"),r={type:"KeyValuePair",name:t,value:this.expression(0)},n.push(r),"Comma"===this._lookahead(0))this._match("Comma");else if("Rbrace"===this._lookahead(0)){this._match("Rbrace");break}}return{type:"MultiSelectHash",children:n}}},y.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,o){var s,a,u,c,l,f,h,p,d;switch(e.type){case"Field":return null===o?null:r(o)?void 0===(f=o[e.name])?null:f:null;case"Subexpression":for(u=this.visit(e.children[0],o),d=1;d0)for(d=g;db;d+=_)u.push(o[d]);return u;case"Projection":var w=this.visit(e.children[0],o);if(!t(w))return null;for(p=[],d=0;dl;break;case"GTE":u=c>=l;break;case"LT":u=c=e&&(t=r<0?e-1:e),t}},m.prototype={callFunction:function(e,t){var r=this.functionTable[e];if(void 0===r)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,r._signature),r._func.call(this,t)},_validateArgs:function(e,t,r){var n,i,o,s;if(r[r.length-1].variadic){if(t.length=0;n--)r+=t[n];return r}var i=e[0].slice(0);return i.reverse(),i},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,r=e[0],n=0;n=0},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return r(e[0])?Object.keys(e[0]).length:e[0].length},_functionMap:function(e){for(var t=[],r=this._interpreter,n=e[0],i=e[1],o=0;o0){if(this._getTypeName(e[0][0])===s)return Math.max.apply(Math,e[0]);for(var t=e[0],r=t[0],n=1;n0){if(this._getTypeName(e[0][0])===s)return Math.min.apply(Math,e[0]);for(var t=e[0],r=t[0],n=1;na?1:su&&(u=r,t=i[c]);return t},_functionMinBy:function(e){for(var t,r,n=e[1],i=e[0],o=this.createKeyFunction(n,[s,a]),u=1/0,c=0;c>>((3&t)<<3)&255;return i}}},function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,i=r;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}},function(e,t,r){"use strict";(function(t){var n=r(59),i=r(41).Readable,o={objectMode:!0},s={clean:!0},a=r(162);function u(e){if(!(this instanceof u))return new u(e);this.options=e||{},this.options=n(s,e),this._inflights=new a}u.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},u.prototype.createStream=function(){var e=new i(o),r=!1,n=[],s=0;return this._inflights.forEach((function(e,t){n.push(e)})),e._read=function(){!r&&s0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?w(e,s,t,!1):A(e,s)):w(e,s,t,!1))):n||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function E(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(I,e):I(e))}function I(e){p("emit readable"),e.emit("readable"),T(e)}function A(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(k,e,t))}function k(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0===(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function O(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function N(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):E(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&O(this),null;var n,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?R(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&O(this)),null!==n&&this.emit("data",n),n},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?l:b;function c(t,n){p("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),e.removeListener("close",v),e.removeListener("finish",g),e.removeListener("drain",f),e.removeListener("error",m),e.removeListener("unpipe",c),r.removeListener("end",l),r.removeListener("end",b),r.removeListener("data",y),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){p("onend"),e.end()}o.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",c);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,T(e))}}(r);e.on("drain",f);var h=!1;var d=!1;function y(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==N(o.pipes,e))&&!h&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function m(t){p("onerror",t),b(),e.removeListener("error",m),0===a(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",g),b()}function g(){p("onfinish"),e.removeListener("close",v),b()}function b(){p("unpipe"),r.unpipe(e)}return r.on("data",y),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",m),e.once("close",v),e.once("finish",g),e.emit("pipe",r),o.flowing||(p("pipe resume"),r.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?n:o.nextTick;g.WritableState=v;var c=Object.create(r(38));c.inherits=r(20);var l={deprecate:r(160)},f=r(87),h=r(14).Buffer,p=i.Uint8Array||function(){};var d,y=r(88);function m(){}function v(e,t){a=a||r(24),e=e||{};var n=t instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,c=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(o.nextTick(i,n),o.nextTick(I,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),I(e,t))}(e,r,n,t,i);else{var s=S(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),n?u(_,e,r,s,i):_(e,r,s,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function g(e){if(a=a||r(24),!(d.call(g,this)||this instanceof a))return new g(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function b(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function _(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),I(e,t)}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,b(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback;if(b(e,t,!1,t.objectMode?1:c.length,c,l,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function E(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),I(e,t)}))}function I(e,t){var r=S(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(E,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}c.inherits(g,f),v.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(v.prototype,"buffer",{get:l.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===g&&(e&&e._writableState instanceof v)}})):d=function(e){return e instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(e,t,r){var n,i=this._writableState,s=!1,a=!i.objectMode&&(n=e,h.isBuffer(n)||n instanceof p);return a&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=m),i.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),o.nextTick(t,r)}(this,r):(a||function(e,t,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),o.nextTick(n,s),i=!1),i}(this,i,e,r))&&(i.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,I(e,t),r&&(t.finished?o.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),g.prototype.destroy=y.destroy,g.prototype._undestroy=y.undestroy,g.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(6),r(90).setImmediate,r(13))},function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(159),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(13))},function(e,t,r){"use strict";var n=r(14).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(e.lastNeed=i-1),i;if(--n=0)return i>0&&(e.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";e.exports=s;var n=r(24),i=Object.create(r(38));function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length65535||c%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;d+=2;if(d+=1,a){if("object"!=typeof a)return t.emit("error",new Error("Invalid will")),!1;if(!a.topic||"string"!=typeof a.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(d+=i.byteLength(a.topic)+2,a.payload&&a.payload){if(!(a.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof a.payload?d+=i.byteLength(a.payload)+2:d+=a.payload.length+2}else d+=2}var y=!1;if(null!=f){if(!E(f))return t.emit("error",new Error("Invalid username")),!1;y=!0,d+=i.byteLength(f)+2}if(null!=p){if(!y)return t.emit("error",new Error("Username is required to use password")),!1;if(!E(p))return t.emit("error",new Error("Invalid password")),!1;d+=S(p)+2}t.write(n.CONNECT_HEADER),v(t,d),w(t,o),t.write(4===s?n.VERSION4:n.VERSION3);var m=0;m|=null!=f?n.USERNAME_MASK:0,m|=null!=p?n.PASSWORD_MASK:0,m|=a&&a.retain?n.WILL_RETAIN_MASK:0,m|=a&&a.qos?a.qos<0&&h(t,l);return t.write(c)}(e,t);case"puback":case"pubrec":case"pubrel":case"pubcomp":case"unsuback":return function(e,t){var r=e||{},i=r.cmd||"puback",o=r.messageId,s=r.dup&&"pubrel"===i?n.DUP_MASK:0,a=0;"pubrel"===i&&(a=1);if("number"!=typeof o)return t.emit("error",new Error("Invalid messageId")),!1;return t.write(n.ACKS[i][a][s][0]),v(t,2),h(t,o)}(e,t);case"subscribe":return function(e,t){var r=e||{},o=r.dup?n.DUP_MASK:0,s=r.messageId,a=r.subscriptions,u=0;if("number"!=typeof s)return t.emit("error",new Error("Invalid messageId")),!1;u+=2;if("object"!=typeof a||!a.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(var c=0;c=0&&e<128?1:e>=128&&e<16384?2:e>=16384&&e<2097152?3:e>=2097152&&e<268435456?4:0}(e));do{t=e%128|0,(e=e/128|0)>0&&(t|=128),n.writeUInt8(t,r++)}while(e>0);return n}(t),t<16384&&(m[t]=r)),e.write(r)}function g(e,t){var r=i.byteLength(t);h(e,r),e.write(t,"utf8")}function b(e,t){return e.write(c[t])}function _(e,t){return e.write(l(t))}function w(e,t){"string"==typeof t?g(e,t):t?(h(e,t.length),e.write(t)):h(e,0)}function S(e){return e?e instanceof i?e.length:i.byteLength(e):0}function E(e){return"string"==typeof e||e instanceof i}e.exports=d},function(e,t,r){"use strict";t.decode=t.parse=r(231),t.encode=t.stringify=r(232)},function(e,t,r){"use strict";var n=r(233);e.exports=function(e,t){var r,i;return t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost",r=t.port,i=t.hostname,n.createConnection(r,i)}},function(e,t,r){"use strict";var n=!1,i=[];function o(e){n?wx.sendSocketMessage({data:e.buffer||e}):i.push(e)}var s=r(65);function a(e,t){var r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);var a=function(e,t){var r="wxs"===e.protocol?"wss":"ws",n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return s(function(e,t){var r={OPEN:1,CLOSING:2,CLOSED:3,readyState:n?1:0,send:o,close:wx.closeSocket,onopen:null,onmessage:null,onclose:null,onerror:null};return wx.connectSocket({url:e,protocols:t}),wx.onSocketOpen((function(e){r.readyState=r.OPEN,n=!0;for(var t=0;t>>7)^(d<<14|d>>>18)^d>>>3,m=c[p-2],v=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;c[p]=y+c[p-7]+v+c[p-16]}var g=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),_=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[p]+c[p];h=f,f=l,l=a,a=s+_|0,s=o,o=i,i=n,n=_+(b+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)},function(e,t,r){var n;e.exports=(n=r(4),r(46),function(){var e=n,t=e.lib.Hasher,r=e.x64,i=r.Word,o=r.WordArray,s=e.algo;function a(){return i.create.apply(i,arguments)}var u=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=a()}();var l=s.SHA512=t.extend({_doReset:function(){this._hash=new o.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 r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],f=r[6],h=r[7],p=n.high,d=n.low,y=i.high,m=i.low,v=o.high,g=o.low,b=s.high,_=s.low,w=a.high,S=a.low,E=l.high,I=l.low,A=f.high,k=f.low,C=h.high,x=h.low,T=p,R=d,O=y,P=m,N=v,L=g,D=b,j=_,M=w,q=S,U=E,B=I,F=A,H=k,V=C,z=x,K=0;K<80;K++){var W=c[K];if(K<16)var G=W.high=0|e[t+2*K],X=W.low=0|e[t+2*K+1];else{var Y=c[K-15],Q=Y.high,J=Y.low,$=(Q>>>1|J<<31)^(Q>>>8|J<<24)^Q>>>7,Z=(J>>>1|Q<<31)^(J>>>8|Q<<24)^(J>>>7|Q<<25),ee=c[K-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=c[K-7],se=oe.high,ae=oe.low,ue=c[K-16],ce=ue.high,le=ue.low;G=(G=(G=$+se+((X=Z+ae)>>>0>>0?1:0))+ne+((X+=ie)>>>0>>0?1:0))+ce+((X+=le)>>>0>>0?1:0),W.high=G,W.low=X}var fe,he=M&U^~M&F,pe=q&B^~q&H,de=T&O^T&N^O&N,ye=R&P^R&L^P&L,me=(T>>>28|R<<4)^(T<<30|R>>>2)^(T<<25|R>>>7),ve=(R>>>28|T<<4)^(R<<30|T>>>2)^(R<<25|T>>>7),ge=(M>>>14|q<<18)^(M>>>18|q<<14)^(M<<23|q>>>9),be=(q>>>14|M<<18)^(q>>>18|M<<14)^(q<<23|M>>>9),_e=u[K],we=_e.high,Se=_e.low,Ee=V+ge+((fe=z+be)>>>0>>0?1:0),Ie=ve+ye;V=F,z=H,F=U,H=B,U=M,B=q,M=D+(Ee=(Ee=(Ee=Ee+he+((fe+=pe)>>>0>>0?1:0))+we+((fe+=Se)>>>0>>0?1:0))+G+((fe+=X)>>>0>>0?1:0))+((q=j+fe|0)>>>0>>0?1:0)|0,D=N,j=L,N=O,L=P,O=T,P=R,T=Ee+(me+de+(Ie>>>0>>0?1:0))+((R=fe+Ie|0)>>>0>>0?1:0)|0}d=n.low=d+R,n.high=p+T+(d>>>0>>0?1:0),m=i.low=m+P,i.high=y+O+(m>>>0

>>0?1:0),g=o.low=g+L,o.high=v+N+(g>>>0>>0?1:0),_=s.low=_+j,s.high=b+D+(_>>>0>>0?1:0),S=a.low=S+q,a.high=w+M+(S>>>0>>0?1:0),I=l.low=I+B,l.high=E+U+(I>>>0>>0?1:0),k=f.low=k+H,f.high=A+F+(k>>>0>>0?1:0),x=h.low=x+z,h.high=C+V+(x>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),n.SHA512)},function(e,t,r){var n=r(3),i=r(7),o=r(271),s=r(39),a=r(73).populateHostPrefix;e.exports={buildRequest:function(e){var t=e.service.api.operations[e.operation],r=e.httpRequest;r.headers["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8",r.params={Version:e.service.api.apiVersion,Action:t.name},(new o).serialize(e.params,t.input,(function(e,t){r.params[e]=t})),r.body=i.queryParamsToString(r.params),a(e)},extractError:function(e){var t,r=e.httpResponse.body.toString();if(r.match("0){var f=(t=new n.XML.Parser).parse(s.toString(),u);i.update(e.data,f)}}}},function(e,t,r){var n=r(113),i=r(117),o=r(39),s=r(118),a=r(119),u=r(120),c=r(7),l=c.property,f=c.memoizedProperty;e.exports=function(e,t){var r=this;e=e||{},(t=t||{}).api=this,e.metadata=e.metadata||{};var h=t.serviceIdentifier;delete t.serviceIdentifier,l(this,"isApi",!0,!1),l(this,"apiVersion",e.metadata.apiVersion),l(this,"endpointPrefix",e.metadata.endpointPrefix),l(this,"signingName",e.metadata.signingName),l(this,"globalEndpoint",e.metadata.globalEndpoint),l(this,"signatureVersion",e.metadata.signatureVersion),l(this,"jsonVersion",e.metadata.jsonVersion),l(this,"targetPrefix",e.metadata.targetPrefix),l(this,"protocol",e.metadata.protocol),l(this,"timestampFormat",e.metadata.timestampFormat),l(this,"xmlNamespaceUri",e.metadata.xmlNamespace),l(this,"abbreviation",e.metadata.serviceAbbreviation),l(this,"fullName",e.metadata.serviceFullName),l(this,"serviceId",e.metadata.serviceId),h&&u[h]&&l(this,"xmlNoDefaultLists",u[h].xmlNoDefaultLists,!1),f(this,"className",(function(){var t=e.metadata.serviceAbbreviation||e.metadata.serviceFullName;return t?("ElasticLoadBalancing"===(t=t.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g,""))&&(t="ELB"),t):null})),l(this,"operations",new n(e.operations,t,(function(e,r){return new i(e,r,t)}),c.string.lowerFirst,(function(e,t){!0===t.endpointoperation&&l(r,"endpointOperation",c.string.lowerFirst(e))}))),l(this,"shapes",new n(e.shapes,t,(function(e,r){return o.create(r,t)}))),l(this,"paginators",new n(e.paginators,t,(function(e,r){return new s(e,r,t)}))),l(this,"waiters",new n(e.waiters,t,(function(e,r){return new a(e,r,t)}),c.string.lowerFirst)),t.documentation&&(l(this,"documentation",e.documentation),l(this,"documentationUrl",e.documentationUrl))}},function(e,t,r){var n=r(39),i=r(7),o=i.property,s=i.memoizedProperty;e.exports=function(e,t,r){var i=this;r=r||{},o(this,"name",t.name||e),o(this,"api",r.api,!1),t.http=t.http||{},o(this,"endpoint",t.endpoint),o(this,"httpMethod",t.http.method||"POST"),o(this,"httpPath",t.http.requestUri||"/"),o(this,"authtype",t.authtype||""),o(this,"endpointDiscoveryRequired",t.endpointdiscovery?t.endpointdiscovery.required?"REQUIRED":"OPTIONAL":"NULL"),s(this,"input",(function(){return t.input?n.create(t.input,r):new n.create({type:"structure"},r)})),s(this,"output",(function(){return t.output?n.create(t.output,r):new n.create({type:"structure"},r)})),s(this,"errors",(function(){var e=[];if(!t.errors)return null;for(var i=0;i-1&&r.splice(i,1)}return this},removeAllListeners:function(e){return e?delete this._events[e]:this._events={},this},emit:function(e,t,r){r||(r=function(){});var n=this.listeners(e),i=n.length;return this.callListeners(n,t,r),i>0},callListeners:function(e,t,r,i){var o=this,s=i||null;function a(i){if(i&&(s=n.util.error(s||new Error,i),o._haltHandlersOnError))return r.call(o,s);o.callListeners(e,t,r,s)}for(;e.length>0;){var u=e.shift();if(u._isAsync)return void u.apply(o,t.concat([a]));try{u.apply(o,t)}catch(e){s=n.util.error(s||new Error,e)}if(s&&o._haltHandlersOnError)return void r.call(o,s)}r.call(o,s)},addListeners:function(e){var t=this;return e._events&&(e=e._events),n.util.each(e,(function(e,r){"function"==typeof r&&(r=[r]),n.util.arrayEach(r,(function(r){t.on(e,r)}))})),t},addNamedListener:function(e,t,r,n){return this[e]=r,this.addListener(t,r,n),this},addNamedAsyncListener:function(e,t,r,n){return r._isAsync=!0,this.addNamedListener(e,t,r,n)},addNamedListeners:function(e){var t=this;return e((function(){t.addNamedListener.apply(t,arguments)}),(function(){t.addNamedAsyncListener.apply(t,arguments)})),this}}),n.SequentialExecutor.prototype.addListener=n.SequentialExecutor.prototype.on,e.exports=n.SequentialExecutor},function(e,t,r){var n=r(3);n.Credentials=n.util.inherit({constructor:function(){if(n.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof arguments[0]){var e=arguments[0].credentials||arguments[0];this.accessKeyId=e.accessKeyId,this.secretAccessKey=e.secretAccessKey,this.sessionToken=e.sessionToken}else this.accessKeyId=arguments[0],this.secretAccessKey=arguments[1],this.sessionToken=arguments[2]},expiryWindow:15,needsRefresh:function(){var e=n.util.date.getDate().getTime(),t=new Date(e+1e3*this.expiryWindow);return!!(this.expireTime&&t>this.expireTime)||(this.expired||!this.accessKeyId||!this.secretAccessKey)},get:function(e){var t=this;this.needsRefresh()?this.refresh((function(r){r||(t.expired=!1),e&&e(r)})):e&&e()},refresh:function(e){this.expired=!1,e()},coalesceRefresh:function(e,t){var r=this;1===r.refreshCallbacks.push(e)&&r.load((function(e){n.util.arrayEach(r.refreshCallbacks,(function(r){t?r(e):n.util.defer((function(){r(e)}))})),r.refreshCallbacks.length=0}))},load:function(e){e()}}),n.Credentials.addPromisesToClass=function(e){this.prototype.getPromise=n.util.promisifyMethod("get",e),this.prototype.refreshPromise=n.util.promisifyMethod("refresh",e)},n.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise},n.util.addPromises(n.Credentials)},function(e,t,r){var n=r(3);n.CredentialProviderChain=n.util.inherit(n.Credentials,{constructor:function(e){this.providers=e||n.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(e){var t=this;if(0===t.providers.length)return e(new Error("No providers")),t;if(1===t.resolveCallbacks.push(e)){var r=0,i=t.providers.slice(0);!function e(o,s){if(!o&&s||r===i.length)return n.util.arrayEach(t.resolveCallbacks,(function(e){e(o,s)})),void(t.resolveCallbacks.length=0);var a=i[r++];(s="function"==typeof a?a.call():a).get?s.get((function(t){e(t,t?null:s)})):e(null,s)}()}return t}}),n.CredentialProviderChain.defaultProviders=[],n.CredentialProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=n.util.promisifyMethod("resolve",e)},n.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise},n.util.addPromises(n.CredentialProviderChain)},function(e,t,r){var n=r(3),i=n.util.inherit;n.Endpoint=i({constructor:function(e,t){if(n.util.hideProperties(this,["slashes","auth","hash","search","query"]),null==e)throw new Error("Invalid endpoint: "+e);if("string"!=typeof e)return n.util.copy(e);e.match(/^http/)||(e=((t&&void 0!==t.sslEnabled?t.sslEnabled:n.config.sslEnabled)?"https":"http")+"://"+e);n.util.update(this,n.util.urlParse(e)),this.port?this.port=parseInt(this.port,10):this.port="https:"===this.protocol?443:80}}),n.HttpRequest=i({constructor:function(e,t){e=new n.Endpoint(e),this.method="POST",this.path=e.path||"/",this.headers={},this.body="",this.endpoint=e,this.region=t,this._userAgent="",this.setUserAgent()},setUserAgent:function(){this._userAgent=this.headers[this.getUserAgentHeaderName()]=n.util.userAgent()},getUserAgentHeaderName:function(){return(n.util.isBrowser()?"X-Amz-":"")+"User-Agent"},appendToUserAgent:function(e){"string"==typeof e&&e&&(this._userAgent+=" "+e),this.headers[this.getUserAgentHeaderName()]=this._userAgent},getUserAgent:function(){return this._userAgent},pathname:function(){return this.path.split("?",1)[0]},search:function(){var e=this.path.split("?",2)[1];return e?(e=n.util.queryStringParse(e),n.util.queryParamsToString(e)):""},updateEndpoint:function(e){var t=new n.Endpoint(e);this.endpoint=t,this.path=t.path||"/",this.headers.Host&&(this.headers.Host=t.host)}}),n.HttpResponse=i({constructor:function(){this.statusCode=void 0,this.headers={},this.body=void 0,this.streaming=!1,this.stream=null},createUnbufferedStream:function(){return this.streaming=!0,this.stream}}),n.HttpClient=i({}),n.HttpClient.getInstance=function(){return void 0===this.singleton&&(this.singleton=new this),this.singleton}},function(e,t,r){var n=r(3),i=n.util.inherit;n.Signers.V3=i(n.Signers.RequestSigner,{addAuthorization:function(e,t){var r=n.util.date.rfc822(t);this.request.headers["X-Amz-Date"]=r,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken),this.request.headers["X-Amzn-Authorization"]=this.authorization(e,r)},authorization:function(e){return"AWS3 AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,SignedHeaders="+this.signedHeaders()+",Signature="+this.signature(e)},signedHeaders:function(){var e=[];return n.util.arrayEach(this.headersToSign(),(function(t){e.push(t.toLowerCase())})),e.sort().join(";")},canonicalHeaders:function(){var e=this.request.headers,t=[];return n.util.arrayEach(this.headersToSign(),(function(r){t.push(r.toLowerCase().trim()+":"+String(e[r]).trim())})),t.sort().join("\n")+"\n"},headersToSign:function(){var e=[];return n.util.each(this.request.headers,(function(t){("Host"===t||"Content-Encoding"===t||t.match(/^X-Amz/i))&&e.push(t)})),e},signature:function(e){return n.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push("/"),e.push(""),e.push(this.canonicalHeaders()),e.push(this.request.body),n.util.crypto.sha256(e.join("\n"))}}),e.exports=n.Signers.V3},function(e,t,r){e.exports=r(130)},function(e,t,r){"use strict";r.d(t,"a",(function(){return y}));var n=r(10),i=r(50),o=r(52),s=r(35),a=r(55),u=r(8),c=r(22),l=r(18),f=r(51),h=r(54),p=r(53),d=r(56),y={User:{Service:i.a,Model:u.a,ListQuery:f.a},Conversation:{Service:o.a,Model:c.a,ListQuery:h.a},Message:{Service:s.a,Model:l.a,ListQuery:p.a},File:{Service:d.a},PushNotification:{Service:a.a},Client:n.a}},function(e,t,r){"use strict";r.d(t,"a",(function(){return g}));var n=r(26),i=r(2),o=r(27);function s(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};y(this,e),v(this,"__socketClass",u),v(this,"__socket",void 0),v(this,"__events",{connected:{topic:"connected"},disconnected:{topic:"disconnected"},reconnected:{topic:"reconnected"},"conversation.updated":{topic:"users/[login_user]/conversation/updated"},"conversation.members_added":{topic:"users/[login_user]/conversation/members_added"},"conversation.members_removed":{topic:"users/[login_user]/conversation/members_removed"},"conversation.admin_added":{topic:"users/[login_user]/conversation/admin_added"},"conversation.typing":{topic:"users/[login_user]/conversation_typing"},"conversation.mark_as_read":{topic:"users/[login_user]/conversation/mark_as_read"},"message.deleted_for_everyone":{topic:"users/[login_user]/messages/deleted_for_everyone"},"user.friends_added":{topic:"users/[login_user]/friends_added"},"user.friends_removed":{topic:"users/[login_user]/friends_removed"},"user.blocked":{topic:"users/[login_user]/blocked"},"user.unblocked":{topic:"users/[login_user]/unblocked"},"user.conversation_deleted":{topic:"users/[login_user]/conversation_deleted"},"user.conversation_cleared":{topic:"users/[login_user]/conversation_cleared"},"user.mute_updated":{topic:"users/[login_user]/mute_updated"},"user.joined":{topic:"users/[login_user]/joined"},"user.removed":{topic:"users/[login_user]/removed"},"user.message_created":{topic:"users/[login_user]/message_created"},"user.message_deleted":{topic:"users/[login_user]/message_deleted"},"user.total_unread_message_count_updated":{topic:"users/[login_user]/total_unread_message_count_updated"},"user.status_updated":{topic:"users/status_updated"},"user.updated":{topic:"users/updated"}}),v(this,"allowForceResubscribe",!1),v(this,"__baseEvents",["connected","disconnected","reconnected"]),v(this,"__subscribedTopics",{}),v(this,"__preConnectEvents",[]),this.__socket=new this.__socketClass(this),this.__connected=!1,this.__autoSubscribed=!1,this.__publicKey=t.publicKey}var t,r,n;return t=e,(r=[{key:"connect",value:function(e,t,r){var n=this;return Object(i.a)(r,(function(r){n.__userId=e,n.__socket.connect(e,t,r)}))}},{key:"__onConnected",value:function(e){this.__connected=!0,e?this.__trigger("reconnected",null):this.__trigger("connected",null),this.allowForceResubscribe&&e&&this.__autoSubscribed?this.__resubscribe():this.__autoSubscribed||this.__subscribeAll(),this.__preConnectSubscribe(),this.__setUserOnline()}},{key:"__onConnectionLost",value:function(e){this.__connected=!1,this.__trigger("disconnected",e)}},{key:"__disconnect",value:function(){this.__socket.__disconnect()}},{key:"__validate",value:function(e,t,r){if(!this.__isSupported(e))return function(e){throw e}(new Error(l.a.sprintf(c.a.INVALID_EVENT,e)));if(!this.__hasDependencyVars(e))return!0;this.__events[e].vars.forEach((function(r){if(!t[r])return function(e){throw e}(new Error(l.a.sprintf(c.a.REQUIRED_SOCKET_EVENT_PARAM,r,e)))}));var n="__validate"+this.__capitalize(e);if("function"==typeof this[n]){var i=this[n](e,t);if(i.error)return function(e){throw e}(new Error(i.message))}}},{key:"on",value:function(){var e=Array.prototype.slice.call(arguments,0,arguments.length),t=e.shift(),r=e.pop(),n={};e.length&&this.__hasDependencyVars(t)&&this.__events[t].vars.forEach((function(t){n[t]=e.shift()})),this.__validate(t,n,r),this.__isConnected()||this.__isBaseEvent(t)?this.__subscribe(t,n,r):this.__preConnectAdd(t,n,r)}},{key:"__preConnectAdd",value:function(e,t,r){this.__preConnectEvents.push({event:e,params:t,cb:r})}},{key:"__isBaseEvent",value:function(e){return this.__baseEvents.includes(e)}},{key:"__isConnected",value:function(){return this.__connected}},{key:"__preConnectSubscribe",value:function(){for(var e;e=this.__preConnectEvents.shift();)this.__subscribe(e.event,e.params,e.cb)}},{key:"__getEventTopic",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.__events[e].topic,i=this.__events[e].vars;return Array.isArray(n)?n.map((function(e){return t.__replaceTopicVar(e,i,r)})):this.__replaceTopicVar(n,i,r)}},{key:"__isSubscribed",value:function(e){return this.__subscribedTopics.hasOwnProperty(e)}},{key:"__isSupported",value:function(e){return this.__events.hasOwnProperty(e)}},{key:"__hasDependencyVars",value:function(e){return this.__events[e]&&this.__events[e].hasOwnProperty("vars")&&this.__events[e].vars.length}},{key:"__subscribe",value:function(e,t,r){var n=this,i=this.__getEventTopic(e,t);(Array.isArray(i)?i:[i]).forEach((function(t){n.__isSubscribed(t)||(n.__isBaseEvent(e)||n.__subscribeSocket(t),n.__subscribedTopics[t]={event:e,cb:[]}),r&&"function"==typeof r&&n.__subscribedTopics[t].cb.push(r)}))}},{key:"__subscribeSocket",value:function(e){this.__socket.__subscribe(this.__publicKey+"/"+e)}},{key:"__publishSocket",value:function(e,t){t=this.__addDefaultProperties(t),e=e.replace("[login_user]",this.__userId),this.__socket.__publish(this.__publicKey+"/"+e,JSON.stringify(t))}},{key:"__addDefaultProperties",value:function(e){return Object.assign(e,{version:"v2"})}},{key:"__subscribeAll",value:function(){var e=this;Object.keys(this.__events).forEach((function(t){e.__hasDependencyVars(t)||e.__subscribe(t,null)})),this.__autoSubscribed=!0}},{key:"__resubscribe",value:function(){var e=this;Object.keys(this.__subscribedTopics).forEach((function(t){var r=e.__subscribedTopics[t].event;e.__isBaseEvent(r)||e.__subscribeSocket(t)}))}},{key:"__trigger",value:function(e,t){e=e.replace(this.__publicKey+"/",""),this.__isSubscribed(e)&&this.__subscribedTopics[e].cb.forEach((function(e){e(t)}))}},{key:"__processPayload",value:function(e,t){var r=this.__subscribedTopics[e].event;return"function"==typeof d[r]?d[r](e,t):[t]}},{key:"__replaceTopicVar",value:function(e,t,r){return e=e.replace("[login_user]",this.__userId),t&&t.length?(t.forEach((function(t){e=e.replace("["+t+"]",r[t])})),e):e}},{key:"__capitalize",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}},{key:"__validateUserUpdated",value:function(e,t){return{error:"string"!=typeof t.user_id,message:"User Id should be string"}}},{key:"__setUserOnline",value:function(){this.__publishSocket("users/server/online",{userId:this.__userId})}}])&&m(t.prototype,r),n&&m(t,n),e}()},function(e,t,r){"use strict";r.r(t),function(e){r.d(t,"Channelize",(function(){return o})),r.d(t,"core",(function(){return a})),r.d(t,"client",(function(){return u}));var n=r(10),i=r(127);e.Channelize?console.error("ERROR: It appears that you have multiple copies of the Channelize WebSDK in your build!"):e.Channelize={core:i.a,client:n.a};var o=e.Channelize,s=e.Channelize,a=s.core,u=s.client}.call(this,r(13))},function(e,t,r){"use strict";var n=r(11),i=r(76),o=r(132),s=r(57);function a(e){var t=new o(e),r=i(o.prototype.request,t);return n.extend(r,o.prototype,t),n.extend(r,t),r}var u=a(s);u.Axios=o,u.create=function(e){return a(n.merge(s,e))},u.Cancel=r(80),u.CancelToken=r(145),u.isCancel=r(79),u.all=function(e){return Promise.all(e)},u.spread=r(146),e.exports=u,e.exports.default=u},function(e,t){ +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ +e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";var n=r(57),i=r(11),o=r(140),s=r(141);function a(e){this.defaults=e,this.interceptors={request:new o,response:new o}}a.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),(e=i.merge(n,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[s,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},i.forEach(["delete","get","head","options"],(function(e){a.prototype[e]=function(t,r){return this.request(i.merge(r||{},{method:e,url:t}))}})),i.forEach(["post","put","patch"],(function(e){a.prototype[e]=function(t,r,n){return this.request(i.merge(n||{},{method:e,url:t,data:r}))}})),e.exports=a},function(e,t,r){"use strict";var n=r(11);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},function(e,t,r){"use strict";var n=r(78);e.exports=function(e,t,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e}},function(e,t,r){"use strict";var n=r(11);function i(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var s=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),s.push(i(t)+"="+i(e))})))})),o=s.join("&")}return o&&(e+=(-1===e.indexOf("?")?"?":"&")+o),e}},function(e,t,r){"use strict";var n=r(11),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,s={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(s[t]&&i.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([r]):s[t]?s[t]+", "+r:r}})),s):s}},function(e,t,r){"use strict";var n=r(11);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(11);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,i,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(i)&&a.push("path="+i),n.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";var n=r(11);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},function(e,t,r){"use strict";var n=r(11),i=r(142),o=r(79),s=r(57),a=r(143),u=r(144);function c(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return c(e),e.baseURL&&!a(e.url)&&(e.url=u(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return c(e),t.data=i(t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(c(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var n=r(11);e.exports=function(e,t,r){return n.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var n=r(80);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){var n,i,o=r(82),s=r(83),a=0,u=0;e.exports=function(e,t,r){var c=t&&r||0,l=t||[],f=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==h){var p=o();null==f&&(f=n=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==h&&(h=i=16383&(p[6]<<8|p[7]))}var d=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:u+1,m=d-a+(y-u)/1e4;if(m<0&&void 0===e.clockseq&&(h=h+1&16383),(m<0||d>a)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=d,u=y,i=h;var v=(1e4*(268435455&(d+=122192928e5))+y)%4294967296;l[c++]=v>>>24&255,l[c++]=v>>>16&255,l[c++]=v>>>8&255,l[c++]=255&v;var g=d/4294967296*1e4&268435455;l[c++]=g>>>8&255,l[c++]=255&g,l[c++]=g>>>24&15|16,l[c++]=g>>>16&255,l[c++]=h>>>8|128,l[c++]=255&h;for(var b=0;b<6;++b)l[c+b]=f[b];return t||s(l)}},function(e,t,r){var n=r(82),i=r(83);e.exports=function(e,t,r){var o=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||n)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[o+a]=s[a];return t||i(s)}},function(e,t,r){e.exports.device=r(58),e.exports.thingShadow=r(269),e.exports.jobs=r(270)},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){"use strict";(function(t){var n=r(153),i=r(84),o=r(63),s=r(59),a={};function u(e,t){if("object"!=typeof e||t||(t=e,e=null),t=t||{},e){var r=o.parse(e,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(t=s(r,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(function(e){var t;e.auth&&((t=e.auth.match(/^(.+):(.+)$/))?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!a[t.protocol]){var i=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs"].filter((function(e,t){return(!i||t%2!=0)&&"function"==typeof a[e]}))[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");return t.protocol&&(t.defaultProtocol=t.protocol),new n((function(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),a[t.protocol](e,t)}),t)}"browser"!==t.title?(a.mqtt=r(107),a.tcp=r(107),a.ssl=r(64),a.tls=r(64),a.mqtts=r(64)):(a.wx=r(108),a.wxs=r(108)),a.ws=r(109),a.wss=r(109),e.exports=u,e.exports.connect=u,e.exports.MqttClient=n,e.exports.Store=i}).call(this,r(6))},function(e,t,r){"use strict";(function(t,n){var i=r(19),o=r(84),s=r(103),a=r(219),u=r(41).Writable,c=r(20),l=r(226),f=r(227),h=r(59),p=t.setImmediate||function(e){n.nextTick(e)},d={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0};function y(e,t,r){e.emit("packetsend",t),!a.writeToStream(t,e.stream)&&r?e.stream.once("drain",r):r&&r()}function m(e,t,r){e.outgoingStore.put(t,(function(n){if(n)return r&&r(n);y(e,t,r)}))}function v(){}function g(e,t){var r,n=this;if(!(this instanceof g))return new g(e,t);for(r in this.options=t||{},d)void 0===this.options[r]?this.options[r]=d[r]:this.options[r]=t[r];this.options.clientId="string"==typeof this.options.clientId?this.options.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),this.streamBuilder=e,this.outgoingStore=this.options.outgoingStore||new o,this.incomingStore=this.options.incomingStore||new o,this.queueQoSZero=void 0===this.options.queueQoSZero||this.options.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this.nextId=Math.max(1,Math.floor(65535*Math.random())),this.outgoing={},this.on("connect",(function(){if(!this.disconnected){this.connected=!0;var e=this.outgoingStore.createStream();this.once("close",t),e.on("end",(function(){n.removeListener("close",t)})),e.on("error",(function(e){n.removeListener("close",t),n.emit("error",e)})),function t(){if(e){var r,i=e.read(1);i?n.disconnecting||n.reconnectTimer?e.destroy&&e.destroy():(r=n.outgoing[i.messageId],n.outgoing[i.messageId]=function(e,n){r&&r(e,n),t()},n._sendPacket(i)):e.once("readable",t)}}()}function t(){e.destroy(),e=null}})),this.on("close",(function(){this.connected=!1,clearTimeout(this.connackTimer)})),this.on("connect",this._setupPingTimer),this.on("connect",(function(){var e=this.queue;!function t(){var r,i=e.shift();i&&(r=i.packet,n._sendPacket(r,(function(e){i.cb&&i.cb(e),t()})))}()}));var s=!0;this.on("connect",(function(){!s&&this.options.clean&&Object.keys(this._resubscribeTopics).length>0&&(this.options.resubscribe?(this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics)):this._resubscribeTopics={}),s=!1})),this.on("close",(function(){null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null)})),this.on("close",this._setupReconnect),i.EventEmitter.call(this),this._setupStream()}c(g,i.EventEmitter),g.prototype._setupStream=function(){var e,t=this,r=new u,i=a.parser(this.options),o=null,c=[];function l(){n.nextTick(f)}function f(){var e=c.shift(),r=o;e?t._handlePacket(e,l):(o=null,r())}this._clearReconnect(),this.stream=this.streamBuilder(this),i.on("packet",(function(e){c.push(e)})),r._write=function(e,t,r){o=r,i.parse(e),f()},this.stream.pipe(r),this.stream.on("error",v),s(this.stream,this.emit.bind(this,"close")),(e=Object.create(this.options)).cmd="connect",y(this,e),i.on("error",this.emit.bind(this,"error")),this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){t._cleanUp(!0)}),this.options.connectTimeout)},g.prototype._handlePacket=function(e,t){switch(this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"pingresp":this._handlePingresp(e),t()}},g.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},g.prototype.publish=function(e,t,r,n){var i;"function"==typeof r&&(n=r,r=null);if(r=h({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;switch(i={cmd:"publish",topic:e,payload:t,qos:r.qos,retain:r.retain,messageId:this._nextId(),dup:r.dup},r.qos){case 1:case 2:this.outgoing[i.messageId]=n||v,this._sendPacket(i);break;default:this._sendPacket(i,n)}return this},g.prototype.subscribe=function(){var e,t,r=Array.prototype.slice.call(arguments),n=[],i=r.shift(),o=i.resubscribe,s=r.pop()||v,a=r.pop(),u=this;if(delete i.resubscribe,"string"==typeof i&&(i=[i]),"function"!=typeof s&&(a=s,s=v),null!==(t=f.validateTopics(i)))return p(s,new Error("Invalid topic "+t)),this;if(this._checkDisconnecting(s))return this;var c={qos:0};if(a=h(c,a),Array.isArray(i)?i.forEach((function(e){(u._resubscribeTopics[e]0&&(u._resubscribeTopics[e.topic]=e.qos,l.push(e.topic))})),u.messageIdToTopic[e.messageId]=l}return this.outgoing[e.messageId]=function(e,t){if(!e)for(var r=t.granted,i=0;i0?this.once("outgoingEmpty",setTimeout.bind(null,i,10)):i()),this},g.prototype.removeOutgoingMessage=function(e){var t=this.outgoing[e];return delete this.outgoing[e],this.outgoingStore.del({messageId:e},(function(){t(new Error("Message removed"))})),this},g.prototype.reconnect=function(e){var t=this,r=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new o,t.outgoingStore=t.options.outgoingStore||new o,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},g.prototype._reconnect=function(){this.emit("reconnect"),this._setupStream()},g.prototype._setupReconnect=function(){var e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0&&(this.reconnecting||(this.emit("offline"),this.reconnecting=!0),e.reconnectTimer=setInterval((function(){e._reconnect()}),e.options.reconnectPeriod))},g.prototype._clearReconnect=function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},g.prototype._cleanUp=function(e,t){var r;t&&this.stream.on("close",t),e?(0===this.options.reconnectPeriod&&this.options.clean&&(r=this.outgoing)&&Object.keys(r).forEach((function(e){"function"==typeof r[e]&&(r[e](new Error("Connection closed")),delete r[e])})),this.stream.destroy()):this._sendPacket({cmd:"disconnect"},p.bind(null,this.stream.end.bind(this.stream))),this.disconnecting||(this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(this.stream.removeListener("close",t),t())},g.prototype._sendPacket=function(e,t){if(this.connected){switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void m(this,e,t);default:return void y(this,e,t)}switch(e.qos){case 2:case 1:m(this,e,t);break;case 0:default:y(this,e,t)}}else 0===(e.qos||0)&&this.queueQoSZero||"publish"!==e.cmd?this.queue.push({packet:e,cb:t}):e.qos>0?(t=this.outgoing[e.messageId],this.outgoingStore.put(e,(function(e){if(e)return t&&t(e)}))):t&&t(new Error("No connection to broker"))},g.prototype._setupPingTimer=function(){var e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=l((function(){e._checkPing()}),1e3*this.options.keepalive))},g.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},g.prototype._checkPing=function(){this.pingResp?(this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):this._cleanUp(!0)},g.prototype._handlePingresp=function(){this.pingResp=!0},g.prototype._handleConnack=function(e){var t=e.returnCode;if(clearTimeout(this.connackTimer),0===t)this.reconnecting=!1,this.emit("connect",e);else if(t>0){var r=new Error("Connection refused: "+["","Unacceptable protocol version","Identifier rejected","Server unavailable","Bad username or password","Not authorized"][t]);r.code=t,this.emit("error",r)}},g.prototype._handlePublish=function(e,t){t=void 0!==t?t:v;var r=e.topic.toString(),n=e.payload,i=e.qos,o=e.messageId,s=this;switch(i){case 2:this.incomingStore.put(e,(function(e){if(e)return t(e);s._sendPacket({cmd:"pubrec",messageId:o},t)}));break;case 1:this.emit("message",r,n,e),this.handleMessage(e,(function(e){if(e)return t(e);s._sendPacket({cmd:"puback",messageId:o},t)}));break;case 0:this.emit("message",r,n,e),this.handleMessage(e,t)}},g.prototype.handleMessage=function(e,t){t()},g.prototype._handleAck=function(e){var t=e.messageId,r=e.cmd,n=null,i=this.outgoing[t],o=this;if(i){switch(r){case"pubcomp":case"puback":delete this.outgoing[t],this.outgoingStore.del(e,i);break;case"pubrec":n={cmd:"pubrel",qos:2,messageId:t},this._sendPacket(n);break;case"suback":if(delete this.outgoing[t],1===e.granted.length&&0!=(128&e.granted[0])){var s=this.messageIdToTopic[t];s&&s.forEach((function(e){delete o._resubscribeTopics[e]}))}i(null,e);break;case"unsuback":delete this.outgoing[t],i(null);break;default:o.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}},g.prototype._handlePubrel=function(e,t){t=void 0!==t?t:v;var r=e.messageId,n=this,i={cmd:"pubcomp",messageId:r};n.incomingStore.get(e,(function(r,o){r||"pubrel"===o.cmd?n._sendPacket(i,t):(n.emit("message",o.topic,o.payload,o),n.incomingStore.put(e,(function(e){if(e)return t(e);n.handleMessage(o,(function(e){if(e)return t(e);n._sendPacket(i,t)}))})))}))},g.prototype._nextId=function(){var e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},g.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},e.exports=g}).call(this,r(13),r(6))},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),s=n[0],a=n[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),l=0,f=a>0?s-4:s;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;sa?a:s+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,o,s=[],a=t;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,l=-7,f=r?i-1:0,h=r?-1:1,p=e[t+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;e[r+p]=255&s,p+=d,s/=256,c-=8);e[r+p-d]|=128*y}},function(e,t){},function(e,t,r){"use strict";var n=r(14).Buffer,i=r(158);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t,r,i,o=n.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=o,i=a,t.copy(r,i),a+=s.data.length,s=s.next;return o},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i,o,s,a,u=1,c={},l=!1,f=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){d(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){d(e.data)},n=function(e){o.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,n=function(e){var t=f.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):n=function(e){setTimeout(d,0,e)}:(s="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&d(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),n=function(t){e.postMessage(s+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r=0?c(l):i(this.length)-c(u(l));t0?1:-1}},function(e,t,r){"use strict";var n=r(28),i={function:!0,object:!0};e.exports=function(e){return n(e)&&i[typeof e]||!1}},function(e,t,r){"use strict";var n,i,o,s,a=Object.create;r(95)()||(n=r(96)),e.exports=n?1!==n.level?a:(i={},o={},s={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach((function(e){o[e]="__proto__"!==e?s:{configurable:!0,enumerable:!1,writable:!0,value:void 0}})),Object.defineProperties(i,o),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:i}),function(e,t){return a(null===e?i:e,t)}):a},function(e,t,r){"use strict";var n=r(177);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!n(e)}},function(e,t,r){"use strict";var n=r(60);e.exports=function(e){if(!n(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},function(e,t,r){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,r){"use strict";var n=r(180),i=r(21),o=Math.max;e.exports=function(e,t){var r,s,a,u=o(arguments.length,2);for(e=Object(i(e)),a=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},s=1;s-1}},function(e,t,r){"use strict";var n,i,o,s,a,u,c,l=r(16),f=r(25),h=Function.prototype.apply,p=Function.prototype.call,d=Object.create,y=Object.defineProperty,m=Object.defineProperties,v=Object.prototype.hasOwnProperty,g={configurable:!0,enumerable:!1,writable:!0};i=function(e,t){var r,i;return f(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),h.call(t,this,arguments)}),r.__eeOnceListener__=t,this},a={on:n=function(e,t){var r;return f(t),v.call(this,"__ee__")?r=this.__ee__:(r=g.value=d(null),y(this,"__ee__",g),g.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},once:i,off:o=function(e,t){var r,n,i,o;if(f(t),!v.call(this,"__ee__"))return this;if(!(r=this.__ee__)[e])return this;if("object"==typeof(n=r[e]))for(o=0;i=n[o];++o)i!==t&&i.__eeOnceListener__!==t||(2===n.length?r[e]=n[o?0:1]:n.splice(o,1));else n!==t&&n.__eeOnceListener__!==t||delete r[e];return this},emit:s=function(e){var t,r,n,i,o;if(v.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"==typeof i){for(r=arguments.length,o=new Array(r-1),t=1;t=55296&&m<=56319&&(y+=e[++p]),u.call(t,v,y,f),!h);++p);else c.call(e,(function(e){return u.call(t,v,e,f),h}))}},function(e,t,r){"use strict";var n=r(44),i=r(45),o=r(197),s=r(212),a=r(101),u=r(23).iterator;e.exports=function(e){return"function"==typeof a(e)[u]?e[u]():n(e)?new o(e):i(e)?new s(e):new o(e)}},function(e,t,r){"use strict";var n,i=r(42),o=r(99),s=r(16),a=r(23),u=r(62),c=Object.defineProperty;n=e.exports=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,e),t=t?o.call(t,"key+value")?"key+value":o.call(t,"key")?"key":"value":"value",c(this,"__kind__",s("",t))},i&&i(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:s((function(e){return"value"===this.__kind__?this.__list__[e]:"key+value"===this.__kind__?[e,this.__list__[e]]:e}))}),c(n.prototype,a.toStringTag,s("c","Array Iterator"))},function(e,t,r){"use strict";var n,i=r(29),o=r(199),s=r(203),a=r(204),u=r(98),c=r(209),l=Function.prototype.bind,f=Object.defineProperty,h=Object.prototype.hasOwnProperty;n=function(e,t,r){var n,i=o(t)&&s(t.value);return delete(n=a(t)).writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&h.call(this,e)?i:(t.value=l.call(i,r.resolveContext?r.resolveContext(this):this),f(this,e,t),this[e])},n},e.exports=function(e){var t=u(arguments[1]);return i(t.resolveContext)&&s(t.resolveContext),c(e,(function(e,r){return n(r,e,t)}))}},function(e,t,r){"use strict";var n=r(102),i=r(29);e.exports=function(e){return i(e)?e:n(e,"Cannot use %v",arguments[1])}},function(e,t,r){"use strict";var n=r(29),i=r(60),o=Object.prototype.toString;e.exports=function(e){if(!n(e))return null;if(i(e)){var t=e.toString;if("function"!=typeof t)return null;if(t===o)return null}try{return""+e}catch(e){return null}}},function(e,t,r){"use strict";var n=r(202),i=/[\n\r\u2028\u2029]/g;e.exports=function(e){var t=n(e);return null===t?"":(t.length>100&&(t=t.slice(0,99)+"…"),t=t.replace(i,(function(e){switch(e){case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}})))}},function(e,t,r){"use strict";e.exports=function(e){try{return e.toString()}catch(t){try{return String(e)}catch(e){return null}}}},function(e,t,r){"use strict";var n=r(102),i=r(97);e.exports=function(e){return i(e)?e:n(e,"%v is not a plain function",arguments[1])}},function(e,t,r){"use strict";var n=r(205),i=r(61),o=r(21);e.exports=function(e){var t=Object(o(e)),r=arguments[1],s=Object(arguments[2]);if(t!==e&&!r)return t;var a={};return r?n(r,(function(t){(s.ensure||t in e)&&(a[t]=e[t])})):i(a,e),a}},function(e,t,r){"use strict";e.exports=r(206)()?Array.from:r(207)},function(e,t,r){"use strict";e.exports=function(){var e,t,r=Array.from;return"function"==typeof r&&(t=r(e=["raz","dwa"]),Boolean(t&&t!==e&&"dwa"===t[1]))}},function(e,t,r){"use strict";var n=r(23).iterator,i=r(44),o=r(208),s=r(94),a=r(25),u=r(21),c=r(28),l=r(45),f=Array.isArray,h=Function.prototype.call,p={configurable:!0,enumerable:!0,writable:!0,value:null},d=Object.defineProperty;e.exports=function(e){var t,r,y,m,v,g,b,_,w,S,E=arguments[1],I=arguments[2];if(e=Object(u(e)),c(E)&&a(E),this&&this!==Array&&o(this))t=this;else{if(!E){if(i(e))return 1!==(v=e.length)?Array.apply(null,e):((m=new Array(1))[0]=e[0],m);if(f(e)){for(m=new Array(v=e.length),r=0;r=55296&&g<=56319&&(S+=e[++r]),S=E?h.call(E,I,S,y):S,t?(p.value=S,d(m,y,p)):m[y]=S,++y;v=y}if(void 0===v)for(v=s(e.length),t&&(m=new t(v)),r=0;r=55296&&t<=56319?r+this.__list__[this.__nextIndex__++]:r}))}),u(n.prototype,s.toStringTag,o("c","String Iterator"))},function(e,t,r){"use strict";var n,i=r(42),o=r(16),s=r(62),a=r(23).toStringTag,u=r(214),c=Object.defineProperties,l=s.prototype._unBind;n=e.exports=function(e,t){if(!(this instanceof n))return new n(e,t);s.call(this,e.__mapKeysData__,e),t&&u[t]||(t="key+value"),c(this,{__kind__:o("",t),__values__:o("w",e.__mapValuesData__)})},i&&i(n,s),n.prototype=Object.create(s.prototype,{constructor:o(n),_resolve:o((function(e){return"value"===this.__kind__?this.__values__[e]:"key"===this.__kind__?this.__list__[e]:[this.__list__[e],this.__values__[e]]})),_unBind:o((function(){this.__values__=null,l.call(this)})),toString:o((function(){return"[object Map Iterator]"}))}),Object.defineProperty(n.prototype,a,o("c","Map Iterator"))},function(e,t,r){"use strict";e.exports=r(215)("key","value","key+value")},function(e,t,r){"use strict";var n=Array.prototype.forEach,i=Object.create;e.exports=function(e){var t=i(null);return n.call(arguments,(function(e){t[e]=!0})),t}},function(e,t,r){"use strict";e.exports="undefined"!=typeof Map&&"[object Map]"===Object.prototype.toString.call(new Map)},function(e,t,r){var n=r(218);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}e.exports=n(i),e.exports.strict=n(o),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},function(e,t){e.exports=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){n[e]=t[e]})),n;function n(){for(var e=new Array(arguments.length),r=0;r0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,this._stateCounter>=this._states.length&&(this._stateCounter=0);return this._list.length},u.prototype._parseHeader=function(){var e=this._list.readUInt8(0);return this.packet.cmd=a.types[e>>a.CMD_SHIFT],this.packet.retain=0!=(e&a.RETAIN_MASK),this.packet.qos=e>>a.QOS_SHIFT&a.QOS_MASK,this.packet.dup=0!=(e&a.DUP_MASK),this._list.consume(1),!0},u.prototype._parseLength=function(){for(var e,t=0,r=1,n=0,i=!0;t<5&&(n+=r*((e=this._list.readUInt8(t++))&a.LENGTH_MASK),r*=128,0!=(e&a.LENGTH_FIN_MASK));)if(this._list.length<=t){i=!1;break}return i&&(this.packet.length=n,this._list.consume(t)),i},u.prototype._parsePayload=function(){var e=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseMessageId();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":case"disconnect":break;default:this._emitError(new Error("Not supported"))}e=!0}return e},u.prototype._parseConnect=function(){var e,t,r,n,i,o,s={},u=this.packet;if(null===(e=this._parseString()))return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==e&&"MQIsdp"!==e)return this._emitError(new Error("Invalid protocolId"));if(u.protocolId=e,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(u.protocolVersion=this._list.readUInt8(this._pos),3!==u.protocolVersion&&4!==u.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.username=this._list.readUInt8(this._pos)&a.USERNAME_MASK,s.password=this._list.readUInt8(this._pos)&a.PASSWORD_MASK,s.will=this._list.readUInt8(this._pos)&a.WILL_FLAG_MASK,s.will&&(u.will={},u.will.retain=0!=(this._list.readUInt8(this._pos)&a.WILL_RETAIN_MASK),u.will.qos=(this._list.readUInt8(this._pos)&a.WILL_QOS_MASK)>>a.WILL_QOS_SHIFT),u.clean=0!=(this._list.readUInt8(this._pos)&a.CLEAN_SESSION_MASK),this._pos++,u.keepalive=this._parseNum(),-1===u.keepalive)return this._emitError(new Error("Packet too short"));if(null===(t=this._parseString()))return this._emitError(new Error("Packet too short"));if(u.clientId=t,s.will){if(null===(r=this._parseString()))return this._emitError(new Error("Cannot parse will topic"));if(u.will.topic=r,null===(n=this._parseBuffer()))return this._emitError(new Error("Cannot parse will payload"));u.will.payload=n}if(s.username){if(null===(o=this._parseString()))return this._emitError(new Error("Cannot parse username"));u.username=o}if(s.password){if(null===(i=this._parseBuffer()))return this._emitError(new Error("Cannot parse password"));u.password=i}return u},u.prototype._parseConnack=function(){var e=this.packet;return this._list.length<2?null:(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&a.SESSIONPRESENT_MASK),e.returnCode=this._list.readUInt8(this._pos),-1===e.returnCode?this._emitError(new Error("Cannot parse return code")):void 0)},u.prototype._parsePublish=function(){var e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));e.qos>0&&!this._parseMessageId()||(e.payload=this._list.slice(this._pos,e.length))},u.prototype._parseSubscribe=function(){var e,t,r=this.packet;if(1!==r.qos)return this._emitError(new Error("Wrong subscribe header"));if(r.subscriptions=[],this._parseMessageId())for(;this._pos=r.length)return this._emitError(new Error("Malformed Subscribe Payload"));t=this._list.readUInt8(this._pos++),r.subscriptions.push({topic:e,qos:t})}},u.prototype._parseSuback=function(){if(this.packet.granted=[],this._parseMessageId())for(;this._posthis._list.length||n>this.packet.length?null:(t=this._list.toString("utf8",this._pos,n),this._pos+=r,t)},u.prototype._parseBuffer=function(){var e,t=this._parseNum(),r=t+this._pos;return-1===t||r>this._list.length||r>this.packet.length?null:(e=this._list.slice(this._pos,r),this._pos+=t,e)},u.prototype._parseNum=function(){if(this._list.length-this._pos<2)return-1;var e=this._list.readUInt16BE(this._pos);return this._pos+=2,e},u.prototype._newPacket=function(){return this.packet&&(this._list.consume(this.packet.length),this.emit("packet",this.packet)),this.packet=new s,!0},u.prototype._emitError=function(e){this.error=e,this.emit("error",e)},e.exports=u},function(e,t,r){var n=r(222),i=r(36),o=r(14).Buffer;function s(e){if(!(this instanceof s))return new s(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)}))}else this.append(e);n.call(this)}i.inherits(s,n),s.prototype._offset=function(e){var t,r=0,n=0;if(0===e)return[0,0];for(;nthis.length)&&(n=this.length),r>=this.length)return e||o.alloc(0);if(n<=0)return e||o.alloc(0);var i,s,a=!!e,u=this._offset(r),c=n-r,l=c,f=a&&t||0,h=u[1];if(0===r&&n==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:o.concat(this._bufs,this.length);for(s=0;s(i=this._bufs[s].length-h))){this._bufs[s].copy(e,f,h,h+l);break}this._bufs[s].copy(e,f,h),f+=i,l-=i,h&&(h=0)}return e},s.prototype.shallowSlice=function(e,t){e=e||0,t=t||this.length,e<0&&(e+=this.length),t<0&&(t+=this.length);var r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0==n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!=r[1]&&(i[0]=i[0].slice(r[1])),new s(i)},s.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},s.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){for(var e=0,t=new s;e>8,0),t.writeUInt8(255&e,1),t}e.exports={cache:i,generateCache:function(){for(var e=0;e<65536;e++)i[e]=o(e)},generateNumber:o}},function(e,t,r){"use strict";function n(e,t,r){var n=this;this._callback=e,this._args=r,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=n._interval),n._interval&&clearInterval(n._interval),n._interval=setInterval(n._callback,e,n._args)},this.clear=function(){n._interval&&(clearInterval(n._interval),n._interval=void 0)},this.destroy=function(){n._interval&&clearInterval(n._interval),n._callback=void 0,n._interval=void 0,n._args=void 0}}e.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,d=String.fromCharCode;function y(e){throw RangeError(h[e])}function m(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function v(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+m((e=e.replace(f,".")).split("."),t).join(".")}function g(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=d((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=d(e)})).join("")}function _(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,r){var n=0;for(e=r?p(e/700):e>>1,e+=p(e/t);e>455;n+=36)e=p(e/35);return p(n+36*e/(e+38))}function S(e){var t,r,n,i,o,s,a,c,l,f,h,d=[],m=e.length,v=0,g=128,_=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&y("not-basic"),d.push(e.charCodeAt(n));for(i=r>0?r+1:0;i=m&&y("invalid-input"),((c=(h=e.charCodeAt(i++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||c>p((u-v)/s))&&y("overflow"),v+=c*s,!(c<(l=a<=_?1:a>=_+26?26:a-_));a+=36)s>p(u/(f=36-l))&&y("overflow"),s*=f;_=w(v-o,t=d.length+1,0==o),p(v/t)>u-g&&y("overflow"),g+=p(v/t),v%=t,d.splice(v++,0,g)}return b(d)}function E(e){var t,r,n,i,o,s,a,c,l,f,h,m,v,b,S,E=[];for(m=(e=g(e)).length,t=128,r=0,o=72,s=0;s=t&&hp((u-r)/(v=n+1))&&y("overflow"),r+=(a-t)*v,t=a,s=0;su&&y("overflow"),h==t){for(c=r,l=36;!(c<(f=l<=o?1:l>=o+26?26:l-o));l+=36)S=c-f,b=36-f,E.push(d(_(f+S%b,0))),c=p(S/b);E.push(d(_(c,0))),o=w(r,v,n==i),r=0,++n}++r,++t}return E.join("")}a={version:"1.3.2",ucs2:{decode:g,encode:b},decode:S,encode:E,toASCII:function(e){return v(e,(function(e){return l.test(e)?"xn--"+E(e):e}))},toUnicode:function(e){return v(e,(function(e){return c.test(e)?S(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,r,t,e))||(e.exports=i)}()}).call(this,r(229)(e),r(13))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,o){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l=0?(f=y.substr(0,m),h=y.substr(m+1)):(f=y,h=""),p=decodeURIComponent(f),d=decodeURIComponent(h),n(s,p)?i(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(n(s))+r;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(n(e))})).join(t):a+encodeURIComponent(n(e[s]))})).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)}).prototype=e}}(),n.lib.WordArray)},function(e,t,r){var n;e.exports=(n=r(4),function(){var e=n,t=e.lib.WordArray,r=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var r=e.length,n=[],i=0;i>>1]|=e.charCodeAt(i)<<16-i%2*16;return t.create(n,2*r)}},r.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return t.create(n,2*r)}}}(),n.enc.Utf16)},function(e,t,r){var n,i,o,s,a,u;e.exports=(u=r(4),r(110),i=(n=u).lib.WordArray,o=n.algo,s=o.SHA256,a=o.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),n.SHA224=s._createHelper(a),n.HmacSHA224=s._createHmacHelper(a),u.SHA224)},function(e,t,r){var n,i,o,s,a,u,c,l;e.exports=(l=r(4),r(46),r(111),i=(n=l).x64,o=i.Word,s=i.WordArray,a=n.algo,u=a.SHA512,c=a.SHA384=u.extend({_doReset:function(){this._hash=new s.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=u._doFinalize.call(this);return e.sigBytes-=16,e}}),n.SHA384=u._createHelper(c),n.HmacSHA384=u._createHmacHelper(c),l.SHA384)},function(e,t,r){var n;e.exports=(n=r(4),r(46),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.x64.Word,a=t.algo,u=[],c=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){u[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var a=0,f=0,h=0;h<7;h++){if(1&i){var p=(1<>>24)|4278255360&(o<<24|o>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(x=r[i]).high^=s,x.low^=o}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var p=0,d=0,y=0;y<5;y++)p^=(x=r[h+5*y]).high,d^=x.low;var m=f[h];m.high=p,m.low=d}for(h=0;h<5;h++){var v=f[(h+4)%5],g=f[(h+1)%5],b=g.high,_=g.low;for(p=v.high^(b<<1|_>>>31),d=v.low^(_<<1|b>>>31),y=0;y<5;y++)(x=r[h+5*y]).high^=p,x.low^=d}for(var w=1;w<25;w++){var S=(x=r[w]).high,E=x.low,I=u[w];I<32?(p=S<>>32-I,d=E<>>32-I):(p=E<>>64-I,d=S<>>64-I);var A=f[c[w]];A.high=p,A.low=d}var k=f[0],C=r[0];for(k.high=C.high,k.low=C.low,h=0;h<5;h++)for(y=0;y<5;y++){var x=r[w=h+5*y],T=f[w],R=f[(h+1)%5+5*y],O=f[(h+2)%5+5*y];x.high=T.high^~R.high&O.high,x.low=T.low^~R.low&O.low}x=r[0];var P=l[a];x.high^=P.high,x.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,u=a/8,c=[],l=0;l>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),c.push(p),c.push(h)}return new i.init(c,a)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=o._createHelper(h),t.HmacSHA3=o._createHmacHelper(h)}(Math),n.SHA3)},function(e,t,r){var n;e.exports=(n=r(4), +/** @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. + */ +function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=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]),u=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]),c=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]),h=i.create([1352829926,1548603684,1836072691,2053994217,0]),p=s.RIPEMD160=o.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,s,p,_,w,S,E,I,A,k,C,x=this._hash.words,T=f.words,R=h.words,O=a.words,P=u.words,N=c.words,L=l.words;for(S=o=x[0],E=s=x[1],I=p=x[2],A=_=x[3],k=w=x[4],r=0;r<80;r+=1)C=o+e[t+O[r]]|0,C+=r<16?d(s,p,_)+T[0]:r<32?y(s,p,_)+T[1]:r<48?m(s,p,_)+T[2]:r<64?v(s,p,_)+T[3]:g(s,p,_)+T[4],C=(C=b(C|=0,N[r]))+w|0,o=w,w=_,_=b(p,10),p=s,s=C,C=S+e[t+P[r]]|0,C+=r<16?g(E,I,A)+R[0]:r<32?v(E,I,A)+R[1]:r<48?m(E,I,A)+R[2]:r<64?y(E,I,A)+R[3]:d(E,I,A)+R[4],C=(C=b(C|=0,L[r]))+k|0,S=k,k=A,A=b(I,10),I=E,E=C;C=x[1]+p+A|0,x[1]=x[2]+_+k|0,x[2]=x[3]+w+S|0,x[3]=x[4]+o+E|0,x[4]=x[0]+s+I|0,x[0]=C},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,s=0;s<5;s++){var a=o[s];o[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,r){return e^t^r}function y(e,t,r){return e&t|~e&r}function m(e,t,r){return(e|~t)^r}function v(e,t,r){return e&r|t&~r}function g(e,t,r){return e^(t|~r)}function b(e,t){return e<>>32-t}t.RIPEMD160=o._createHelper(p),t.HmacRIPEMD160=o._createHmacHelper(p)}(Math),n.RIPEMD160)},function(e,t,r){var n,i,o,s,a,u,c,l,f;e.exports=(f=r(4),r(66),r(67),i=(n=f).lib,o=i.Base,s=i.WordArray,a=n.algo,u=a.SHA1,c=a.HMAC,l=a.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:u,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=c.create(r.hasher,e),i=s.create(),o=s.create([1]),a=i.words,u=o.words,l=r.keySize,f=r.iterations;a.length>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}var r=e.Encryptor=e.extend({processBlock:function(e,r){var n=this._cipher,i=n.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),function(e){0===(e[0]=t(e[0]))&&(e[1]=t(e[1]))}(s);var a=s.slice(0);n.encryptBlock(a,0);for(var u=0;u>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n.pad.Ansix923)},function(e,t,r){var n;e.exports=(n=r(4),r(9),n.pad.Iso10126={pad:function(e,t){var r=4*t,i=r-e.sigBytes%r;e.concat(n.lib.WordArray.random(i-1)).concat(n.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},n.pad.Iso10126)},function(e,t,r){var n;e.exports=(n=r(4),r(9),n.pad.Iso97971={pad:function(e,t){e.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(e,t)},unpad:function(e){n.pad.ZeroPadding.unpad(e),e.sigBytes--}},n.pad.Iso97971)},function(e,t,r){var n;e.exports=(n=r(4),r(9),n.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){for(var t=e.words,r=e.sigBytes-1;!(t[r>>>2]>>>24-r%4*8&255);)r--;e.sigBytes=r+1}},n.pad.ZeroPadding)},function(e,t,r){var n;e.exports=(n=r(4),r(9),n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding)},function(e,t,r){var n,i,o,s;e.exports=(s=r(4),r(9),i=(n=s).lib.CipherParams,o=n.enc.Hex,n.format.Hex={stringify:function(e){return e.ciphertext.toString(o)},parse:function(e){var t=o.parse(e);return i.create({ciphertext:t})}},s.format.Hex)},function(e,t,r){var n;e.exports=(n=r(4),r(30),r(31),r(32),r(9),function(){var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],o=[],s=[],a=[],u=[],c=[],l=[],f=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var d=n^n<<1^n<<2^n<<3^n<<4;d=d>>>8^255&d^99,i[r]=d,o[d]=r;var y=e[r],m=e[y],v=e[m],g=257*e[d]^16843008*d;s[r]=g<<24|g>>>8,a[r]=g<<16|g>>>16,u[r]=g<<8|g>>>24,c[r]=g,g=16843009*v^65537*m^257*y^16843008*r,l[d]=g<<24|g>>>8,f[d]=g<<16|g>>>16,h[d]=g<<8|g>>>24,p[d]=g,r?(r=y^e[e[e[v^y]]],n^=e[e[n]]):r=n=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],y=r.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],s=0;s6&&s%r==4&&(a=i[a>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a]):(a=i[(a=a<<8|a>>>24)>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a],a^=d[s/r|0]<<24),o[s]=o[s-r]^a}for(var u=this._invKeySchedule=[],c=0;c>>24]]^f[i[a>>>16&255]]^h[i[a>>>8&255]]^p[i[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,u,c,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,f,h,p,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,s,a){for(var u=this._nRounds,c=e[t]^r[0],l=e[t+1]^r[1],f=e[t+2]^r[2],h=e[t+3]^r[3],p=4,d=1;d>>24]^i[l>>>16&255]^o[f>>>8&255]^s[255&h]^r[p++],m=n[l>>>24]^i[f>>>16&255]^o[h>>>8&255]^s[255&c]^r[p++],v=n[f>>>24]^i[h>>>16&255]^o[c>>>8&255]^s[255&l]^r[p++],g=n[h>>>24]^i[c>>>16&255]^o[l>>>8&255]^s[255&f]^r[p++];c=y,l=m,f=v,h=g}y=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&h])^r[p++],m=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^r[p++],v=(a[f>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^r[p++],g=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^r[p++],e[t]=y,e[t+1]=m,e[t+2]=v,e[t+3]=g},keySize:8});e.AES=t._createHelper(y)}(),n.AES)},function(e,t,r){var n;e.exports=(n=r(4),r(30),r(31),r(32),r(9),function(){var e=n,t=e.lib,r=t.WordArray,i=t.BlockCipher,o=e.algo,s=[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],a=[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],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{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=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=s[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var c=i[o]=[],l=u[o];for(r=0;r<24;r++)c[r/6|0]|=t[(a[r]-1+l)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(a[r+24]-1+l)%28]<<31-r%6;for(c[0]=c[0]<<1|c[0]>>>31,r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}var f=this._invSubKeys=[];for(r=0;r<16;r++)f[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,s=this._rBlock,a=0,u=0;u<8;u++)a|=c[u][((s^i[u])&l[u])>>>0];this._lBlock=s,this._rBlock=o^a}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<>>2]>>>24-s%4*8&255;o=(o+n[i]+a)%256;var u=n[i];n[i]=n[o],n[o]=u}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}e.RC4=t._createHelper(i);var s=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--)o.call(this)}});e.RC4Drop=t._createHelper(s)}(),n.RC4)},function(e,t,r){var n;e.exports=(n=r(4),r(30),r(31),r(32),r(9),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=[],o=[],s=[],a=r.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var 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],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,r=0;r<4;r++)u.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,s=o[0],a=o[1],c=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=c>>>16|4294901760&l,h=l<<16|65535&c;for(i[0]^=c,i[1]^=f,i[2]^=l,i[3]^=h,i[4]^=c,i[5]^=f,i[6]^=l,i[7]^=h,r=0;r<4;r++)u.call(this)}},_doProcessBlock:function(e,t){var r=this._X;u.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function u(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];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,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,a=n>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=u^c}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=t._createHelper(a)}(),n.Rabbit)},function(e,t,r){var n;e.exports=(n=r(4),r(30),r(31),r(32),r(9),function(){var e=n,t=e.lib.StreamCipher,r=e.algo,i=[],o=[],s=[],a=r.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,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],n=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++)u.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var o=t.words,s=o[0],a=o[1],c=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),f=c>>>16|4294901760&l,h=l<<16|65535&c;for(n[0]^=c,n[1]^=f,n[2]^=l,n[3]^=h,n[4]^=c,n[5]^=f,n[6]^=l,n[7]^=h,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(e,t){var r=this._X;u.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function u(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];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,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,a=n>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=u^c}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=t._createHelper(a)}(),n.RabbitLegacy)},function(e,t){e.exports={INVALID_CONNECT_OPTIONS:"Invalid connect options supplied.",INVALID_CLIENT_ID_OPTION:'Invalid "clientId" (mqtt client id) option supplied.',INVALID_RECONNECT_TIMING:"Invalid reconnect timing options supplied.",INVALID_OFFLINE_QUEUEING_PARAMETERS:"Invalid offline queueing options supplied."}},function(e,t,r){(function(t){var n=r(68),i=r(47),o=r(264);e.exports=function(e){if(i(e.keyPath)&&i(e.privateKey))throw new Error(o.NO_KEY_OPTION);if(i(e.certPath)&&i(e.clientCert))throw new Error(o.NO_CERT_OPTION);if(i(e.caPath)&&i(e.caCert))throw new Error(o.NO_CA_OPTION);if(!i(e.caCert))if(t.isBuffer(e.caCert))e.ca=e.caCert;else{if(!n.existsSync(e.caCert))throw new Error(o.INVALID_CA_CERT_OPTION);e.ca=n.readFileSync(e.caCert)}if(!i(e.privateKey))if(t.isBuffer(e.privateKey))e.key=e.privateKey;else{if(!n.existsSync(e.privateKey))throw new Error(o.INVALID_PRIVATE_KEY_OPTION);e.key=n.readFileSync(e.privateKey)}if(!i(e.clientCert))if(t.isBuffer(e.clientCert))e.cert=e.clientCert;else{if(!n.existsSync(e.clientCert))throw new Error(o.INVALID_CLIENT_CERT_OPTION);e.cert=n.readFileSync(e.clientCert)}if(n.existsSync(e.keyPath))e.key=n.readFileSync(e.keyPath);else if(!i(e.keyPath))throw new Error(o.INVALID_KEY_PATH_OPTION);if(n.existsSync(e.certPath))e.cert=n.readFileSync(e.certPath);else if(!i(e.certPath))throw new Error(o.INVALID_CERT_PATH_OPTION);if(n.existsSync(e.caPath))e.ca=n.readFileSync(e.caPath);else if(!i(e.caPath))throw new Error(o.INVALID_CA_PATH_OPTION);e.requestCert=!0,e.rejectUnauthorized=!0}}).call(this,r(15).Buffer)},function(e,t){e.exports={NO_KEY_OPTION:'No "keyPath" or "privateKey" option supplied.',NO_CERT_OPTION:'No "certPath" or "clientCert" option supplied.',NO_CA_OPTION:'No "caPath" or "caCert" option supplied.',INVALID_KEY_PATH_OPTION:'Invalid "keyPath" option supplied.',INVALID_CERT_PATH_OPTION:'Invalid "certPath" option supplied.',INVALID_CA_PATH_OPTION:'Invalid "caPath" option supplied.',INVALID_CLIENT_CERT_OPTION:'Invalid "clientCert" option supplied.',INVALID_PRIVATE_KEY_OPTION:'Invalid "privateKey" option supplied.',INVALID_CA_CERT_OPTION:'Invalid "caCert" option supplied.'}},function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,i="/"===s.charAt(0))}return(i?"/":"")+(t=r(n(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var o=t.isAbsolute(e),s="/"===i(e,-1);return(e=r(n(e.split("/"),(function(e){return!!e})),!o).join("/"))||o||(e="."),e&&s&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u=1;--o)if(47===(t=e.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":e.slice(0,n)},t.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,n=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){r=t+1;break}}else-1===n&&(i=!1,n=t+1);return-1===n?"":e.slice(r,n)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,n=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===n&&(i=!1,n=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){r=s+1;break}}return-1===t||-1===n||0===o||1===o&&t===n-1&&t===r+1?"":e.slice(t,n)};var i="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,r(6))},function(e){e.exports=JSON.parse('{"_from":"aws-iot-device-sdk@^2.2.1","_id":"aws-iot-device-sdk@2.2.4","_inBundle":false,"_integrity":"sha512-DgNVTPQMVHxC1o6SENWDjio2Ku8gz70XPi5CoS31Q4ndWpx3zwq3QKBvGdRm02SF4Xb4ft5cd9tXQCeIjgkqlQ==","_location":"/aws-iot-device-sdk","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"aws-iot-device-sdk@^2.2.1","name":"aws-iot-device-sdk","escapedName":"aws-iot-device-sdk","rawSpec":"^2.2.1","saveSpec":null,"fetchSpec":"^2.2.1"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/aws-iot-device-sdk/-/aws-iot-device-sdk-2.2.4.tgz","_shasum":"ce21632833e72ee1d6051c425ce8b4822069bf05","_spec":"aws-iot-device-sdk@^2.2.1","_where":"/opt/lampp/htdocs/channelize-js-sdk/channelize-websdk","author":{"name":"Amazon Web Services","url":"http://aws.amazon.com"},"bugs":{"url":"http://github.com/aws/aws-iot-device-sdk-js/issues"},"bundleDependencies":false,"dependencies":{"crypto-js":"3.1.6","minimist":"1.2.5","mqtt":"2.18.8","websocket-stream":"^5.0.1"},"deprecated":false,"description":"AWS IoT Node.js SDK for Embedded Devices","devDependencies":{"gulp":"^3.9.0","gulp-beautify":"^2.0.0","gulp-concat":"^2.6.0","gulp-coverage":"^0.3.38","gulp-jscs":"^4.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^3.0.1","jshint":"^2.9.1","jshint-stylish":"^2.2.1","rewire":"^2.5.1","sinon":"^1.17.3"},"engines":{"node":">=4.0.0"},"homepage":"https://github.com/aws/aws-iot-device-sdk-js","keywords":["api","amazon","aws","iot","mqtt"],"license":"Apache-2.0","main":"index.js","name":"aws-iot-device-sdk","repository":{"type":"git","url":"git://github.com/aws/aws-iot-device-sdk-js.git"},"scripts":{"beautify":"node ./node_modules/gulp/bin/gulp.js beautify","browserize":"./scripts/browserize.sh","test":"node ./node_modules/gulp/bin/gulp.js test --verbose"},"version":"2.2.4"}')},function(e,t,r){var n=r(68);e.exports=function(e,t){var r;function i(t){e.emit("error",t),r.end()}return(r=n.connect(t)).on("secureConnect",(function(){r.authorized?r.removeListener("error",i):r.emit("error",new Error("TLS not authorized"))})),r.on("error",i),r}},function(e,t,r){const n=r(65);e.exports=function(e,t){return n(t.url,["mqttv3.1"],t.websocketOptions)}},function(e,t,r){var n=r(19),i=r(36).inherits,o=r(58),s=r(47);function a(e,t,r){return s(r)?"$aws/things/"+e+"/shadow/"+t:"$aws/things/"+e+"/shadow/"+t+"/"+r}function u(e){return"$aws/things/"===e.substring(0,12)}function c(e,t){if(!(this instanceof c))return new c(e,t);var r=this,i=[{}],l=0,f=1e4,h=!0,p=o.DeviceClient(e);s(t)||s(t.operationTimeout)||(f=t.operationTimeout),this._handleSubscriptions=function(e,t,r,n){for(var o=[],u=0,c=t.length;u0)return void n("Not all subscriptions were granted",r);n()}}))):s(n)||y.push(n),p[r].apply(p,y)},this._handleMessages=function(t,r,n,o){var a={};try{a=JSON.parse(o.toString())}catch(t){return void(!0===e.debug&&console.error("failed parsing JSON '"+o.toString()+"', "+t))}var u=a.clientToken,c=a.version;if(delete a.clientToken,!s(c)&&"rejected"!==n)if(s(i[t].version)||c>=i[t].version)i[t].version=c;else if("delete"!==r&&!0===i[t].discardStale)return void(!0===e.debug&&console.warn("out-of-date version '"+c+"' on '"+t+"' (local version '"+i[t].version+"')"));"delta"!==n?s(i[t].clientToken)||i[t].clientToken!==u?"accepted"===n&&"get"!==r&&this.emit("foreignStateChange",t,r,a):(clearTimeout(i[t].timeout),delete i[t].timeout,delete i[t].clientToken,i[t].pending=!1,!1===i[t].persistentSubscribe&&this._handleSubscriptions(t,[{operations:[r],statii:["accepted","rejected"]}],"unsubscribe"),this.emit("status",t,n,u,a)):this.emit("delta",t,a)},p.on("connect",(function(){r.emit("connect")})),p.on("close",(function(){r.emit("close")})),p.on("reconnect",(function(){r.emit("reconnect")})),p.on("offline",(function(){r.emit("offline")})),p.on("error",(function(e){r.emit("error",e)})),p.on("packetsend",(function(e){r.emit("packetsend",e)})),p.on("packetreceive",(function(e){r.emit("packetreceive",e)})),p.on("message",(function(e,t){if(!0===h){var n=e.split("/");!function(e,t){var r=!1;return"$aws"===e[0]&&("things"!==e[1]||"shadow"!==e[3]||"update"!==e[4]&&"get"!==e[4]&&"delete"!==e[4]||("subscribe"===t?"accepted"!==e[5]&&"rejected"!==e[5]&&"delta"!==e[5]||6!==e.length||(r=!0):5===e.length&&(r=!0))),r}(n,"subscribe")?r.emit("message",e,t):i.hasOwnProperty(n[2])&&r._handleMessages(n[2],n[4],n[5],t)}})),this._thingOperation=function(t,n,o){var u=null;if(i.hasOwnProperty(t))if(!1===i[t].pending){var c;if(i[t].pending=!0,s(o.clientToken)){var h=e.clientId.length;c=h>48?e.clientId.substr(h-48)+"-"+l++:e.clientId+"-"+l++}else c=o.clientToken;i[t].clientToken=c;var d=a(t,n);i[t].timeout=setTimeout((function(e,t){!1===i[e].persistentSubscribe&&r._handleSubscriptions(e,[{operations:[n],statii:["accepted","rejected"]}],"unsubscribe"),i[e].pending=!1,delete i[e].timeout,delete i[e].clientToken,r.emit("timeout",e,t)}),f,t,c),!1===i[t].persistentSubscribe?this._handleSubscriptions(t,[{operations:[n],statii:["accepted","rejected"]}],"subscribe",(function(e,r){s(e)&&s(r)?s(o)||(!s(i[t].version)&&i[t].enableVersioning&&(o.version=i[t].version),o.clientToken=c,p.publish(d,JSON.stringify(o),{qos:i[t].qos}),s(i[t])||!0!==i[t].debug||console.log("publishing '"+JSON.stringify(o)+" on '"+d+"'")):console.warn("failed subscription to accepted/rejected topics")})):(!s(i[t].version)&&i[t].enableVersioning&&(o.version=i[t].version),o.clientToken=c,p.publish(d,JSON.stringify(o),{qos:i[t].qos}),!0===i[t].debug&&console.log("publishing '"+JSON.stringify(o)+" on '"+d+"'")),u=c}else!0===e.debug&&console.error(n+" still in progress on thing: ",t);else!0===e.debug&&console.error("attempting to "+n+" unknown thing: ",t);return u},this.register=function(t,r,n){if(i.hasOwnProperty(t))!0===e.debug&&console.error("thing already registered: ",t);else{var o=!1,a=[];i[t]={persistentSubscribe:!0,debug:!1,discardStale:!0,enableVersioning:!0,qos:0,pending:!0},"function"==typeof r&&(n=r,r=null),s(r)||(s(r.ignoreDeltas)||(o=r.ignoreDeltas),s(r.persistentSubscribe)||(i[t].persistentSubscribe=r.persistentSubscribe),s(r.debug)||(i[t].debug=r.debug),s(r.discardStale)||(i[t].discardStale=r.discardStale),s(r.enableVersioning)||(i[t].enableVersioning=r.enableVersioning),s(r.qos)||(i[t].qos=r.qos)),!1===o&&a.push({operations:["update"],statii:["delta"]}),!0===i[t].persistentSubscribe&&a.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),a.length>0?this._handleSubscriptions(t,a,"subscribe",(function(e,r){s(e)&&s(r)&&(i[t].pending=!1),s(n)||n(e,r)})):(i[t].pending=!1,s(n)||n())}},this.unregister=function(t){if(i.hasOwnProperty(t)){var r=[];r.push({operations:["update"],statii:["delta"]}),!0===i[t].persistentSubscribe&&r.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),this._handleSubscriptions(t,r,"unsubscribe"),s(i[t].timeout)||clearTimeout(i[t].timeout),delete i[t]}else!0===e.debug&&console.error("attempting to unregister unknown thing: ",t)},this.update=function(e,t){var n=null;return s(t.version)?n=r._thingOperation(e,"update",t):console.error("message can't contain 'version' property"),n},this.get=function(e,t){var n={};return s(t)||(n.clientToken=t),r._thingOperation(e,"get",n)},this.delete=function(e,t){var n={};return s(t)||(n.clientToken=t),r._thingOperation(e,"delete",n)},this.publish=function(e,t,r,n){if(u(e))throw"cannot publish to reserved topic '"+e+"'";p.publish(e,t,r,n)},this.subscribe=function(e,t,r){var n=[];"string"==typeof e?n.push(e):"object"==typeof e&&e.length&&(n=e);for(var i=0;i0||n?o.toString():""},e.exports=s},function(e,t,r){var n=r(274).escapeAttribute;function i(e,t){void 0===t&&(t=[]),this.name=e,this.children=t,this.attributes={}}i.prototype.addAttribute=function(e,t){return this.attributes[e]=t,this},i.prototype.addChildNode=function(e){return this.children.push(e),this},i.prototype.removeAttribute=function(e){return delete this.attributes[e],this},i.prototype.toString=function(){for(var e=Boolean(this.children.length),t="<"+this.name,r=this.attributes,i=0,o=Object.keys(r);i"+this.children.map((function(e){return e.toString()})).join("")+"":"/>")},e.exports={XmlNode:i}},function(e,t){e.exports={escapeAttribute:function(e){return e.replace(/&/g,"&").replace(/'/g,"'").replace(//g,">").replace(/"/g,""")}}},function(e,t,r){var n=r(276).escapeElement;function i(e){this.value=e}i.prototype.toString=function(){return n(""+this.value)},e.exports={XmlText:i}},function(e,t){e.exports={escapeElement:function(e){return e.replace(/&/g,"&").replace(//g,">")}}},function(e,t){function r(e,t){if(!r.services.hasOwnProperty(e))throw new Error("InvalidService: Failed to load api for "+e);return r.services[e][t]}r.services={},e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(279),i=function(){function e(e){void 0===e&&(e=1e3),this.maxSize=e,this.cache=new n.LRUCache(e)}return Object.defineProperty(e.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),e.prototype.put=function(t,r){var n="string"!=typeof t?e.getKeyString(t):t,i=this.populateValue(r);this.cache.put(n,i)},e.prototype.get=function(t){var r="string"!=typeof t?e.getKeyString(t):t,n=Date.now(),i=this.cache.get(r);if(i)for(var o=0;o=0;i--)if("*"!==t[i][t[i].length-1]&&(r=t[i]),t[i].substr(0,10)<=e)return r;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+e+"'")},api:{},defaultRetryCount:3,customizeRequests:function(e){if(e){if("function"!=typeof e)throw new Error("Invalid callback type '"+typeof e+"' provided in customizeRequests");this.customRequestHandler=e}else this.customRequestHandler=null},makeRequest:function(e,t,r){if("function"==typeof t&&(r=t,t=null),t=t||{},this.config.params){var i=this.api.operations[e];i&&(t=n.util.copy(t),n.util.each(this.config.params,(function(e,r){i.input.members[e]&&(void 0!==t[e]&&null!==t[e]||(t[e]=r))})))}var o=new n.Request(this,e,t);return this.addAllRequestListeners(o),this.attachMonitoringEmitter(o),r&&o.send(r),o},makeUnauthenticatedRequest:function(e,t,r){"function"==typeof t&&(r=t,t={});var n=this.makeRequest(e,t).toUnauthenticated();return r?n.send(r):n},waitFor:function(e,t,r){return new n.ResourceWaiter(this,e).wait(t,r)},addAllRequestListeners:function(e){for(var t=[n.events,n.EventListeners.Core,this.serviceInterface(),n.EventListeners.CorePost],r=0;r299?(i.code&&(r.FinalAwsException=i.code),i.message&&(r.FinalAwsExceptionMessage=i.message)):((i.code||i.name)&&(r.FinalSdkException=i.code||i.name),i.message&&(r.FinalSdkExceptionMessage=i.message))}return r},apiAttemptEvent:function(e){var t=e.service.api.operations[e.operation],r={Type:"ApiCallAttempt",Api:t?t.name:e.operation,Version:1,Service:e.service.api.serviceId||e.service.api.endpointPrefix,Fqdn:e.httpRequest.endpoint.hostname,UserAgent:e.httpRequest.getUserAgent()},n=e.response;return n.httpResponse.statusCode&&(r.HttpStatusCode=n.httpResponse.statusCode),!e._unAuthenticated&&e.service.config.credentials&&e.service.config.credentials.accessKeyId&&(r.AccessKey=e.service.config.credentials.accessKeyId),n.httpResponse.headers?(e.httpRequest.headers["x-amz-security-token"]&&(r.SessionToken=e.httpRequest.headers["x-amz-security-token"]),n.httpResponse.headers["x-amzn-requestid"]&&(r.XAmznRequestId=n.httpResponse.headers["x-amzn-requestid"]),n.httpResponse.headers["x-amz-request-id"]&&(r.XAmzRequestId=n.httpResponse.headers["x-amz-request-id"]),n.httpResponse.headers["x-amz-id-2"]&&(r.XAmzId2=n.httpResponse.headers["x-amz-id-2"]),r):r},attemptFailEvent:function(e){var t=this.apiAttemptEvent(e),r=e.response,n=r.error;return r.httpResponse.statusCode>299?(n.code&&(t.AwsException=n.code),n.message&&(t.AwsExceptionMessage=n.message)):((n.code||n.name)&&(t.SdkException=n.code||n.name),n.message&&(t.SdkExceptionMessage=n.message)),t},attachMonitoringEmitter:function(e){var t,r,i,o,s,a,u=0,c=this;e.on("validate",(function(){o=n.util.realClock.now(),a=Date.now()}),!0),e.on("sign",(function(){r=n.util.realClock.now(),t=Date.now(),s=e.httpRequest.region,u++}),!0),e.on("validateResponse",(function(){i=Math.round(n.util.realClock.now()-r)})),e.addNamedListener("API_CALL_ATTEMPT","success",(function(){var r=c.apiAttemptEvent(e);r.Timestamp=t,r.AttemptLatency=i>=0?i:0,r.Region=s,c.emit("apiCallAttempt",[r])})),e.addNamedListener("API_CALL_ATTEMPT_RETRY","retry",(function(){var o=c.attemptFailEvent(e);o.Timestamp=t,i=i||Math.round(n.util.realClock.now()-r),o.AttemptLatency=i>=0?i:0,o.Region=s,c.emit("apiCallAttempt",[o])})),e.addNamedListener("API_CALL","complete",(function(){var t=c.apiCallEvent(e);if(t.AttemptCount=u,!(t.AttemptCount<=0)){t.Timestamp=a;var r=Math.round(n.util.realClock.now()-o);t.Latency=r>=0?r:0;var i=e.response;i.error&&i.error.retryable&&"number"==typeof i.retryCount&&"number"==typeof i.maxRetries&&i.retryCount>=i.maxRetries&&(t.MaxRetriesExceeded=1),c.emit("apiCall",[t])}}))},setupRequestListeners:function(e){},getSignerClass:function(e){var t,r=null,i="";e&&(i=(r=(e.service.api.operations||{})[e.operation]||null)?r.authtype:"");return t=this.config.signatureVersion?this.config.signatureVersion:"v4"===i||"v4-unsigned-body"===i?"v4":this.api.signatureVersion,n.Signers.RequestSigner.getVersion(t)},serviceInterface:function(){switch(this.api.protocol){case"ec2":case"query":return n.EventListeners.Query;case"json":return n.EventListeners.Json;case"rest-json":return n.EventListeners.RestJson;case"rest-xml":return n.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(e){return e.httpResponse.statusCode<300},numRetries:function(){return void 0!==this.config.maxRetries?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(e,t){return n.util.calculateRetryDelay(e,this.config.retryDelayOptions,t)},retryableError:function(e){return!!this.timeoutError(e)||(!!this.networkingError(e)||(!!this.expiredCredentialsError(e)||(!!this.throttledError(e)||e.statusCode>=500)))},networkingError:function(e){return"NetworkingError"===e.code},timeoutError:function(e){return"TimeoutError"===e.code},expiredCredentialsError:function(e){return"ExpiredTokenException"===e.code},clockSkewError:function(e){switch(e.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},getSkewCorrectedDate:function(){return new Date(Date.now()+this.config.systemClockOffset)},applyClockOffset:function(e){e&&(this.config.systemClockOffset=e-Date.now())},isClockSkewed:function(e){if(e)return Math.abs(this.getSkewCorrectedDate().getTime()-e)>=3e5},throttledError:function(e){if(429===e.statusCode)return!0;switch(e.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":case"RequestThrottledException":case"TooManyRequestsException":case"TransactionInProgressException":case"EC2ThrottledException":return!0;default:return!1}},endpointFromTemplate:function(e){if("string"!=typeof e)return e;var t=e;return t=(t=(t=t.replace(/\{service\}/g,this.api.endpointPrefix)).replace(/\{region\}/g,this.config.region)).replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(e){this.endpoint=new n.Endpoint(e,this.config)},paginationConfig:function(e,t){var r=this.api.operations[e].paginator;if(!r){if(t){var i=new Error;throw n.util.error(i,"No pagination configuration for "+e)}return null}return r}}),n.util.update(n.Service,{defineMethods:function(e){n.util.each(e.prototype.api.operations,(function(t){e.prototype[t]||("none"===e.prototype.api.operations[t].authtype?e.prototype[t]=function(e,r){return this.makeUnauthenticatedRequest(t,e,r)}:e.prototype[t]=function(e,r){return this.makeRequest(t,e,r)})}))},defineService:function(e,t,r){n.Service._serviceMap[e]=!0,Array.isArray(t)||(r=t,t=[]);var i=s(n.Service,r||{});if("string"==typeof e){n.Service.addVersions(i,t);var o=i.serviceIdentifier||e;i.serviceIdentifier=o}else i.prototype.api=e,n.Service.defineMethods(i);if(n.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&n.util.clientSideMonitoring){var a=n.util.clientSideMonitoring.Publisher,u=(0,n.util.clientSideMonitoring.configProvider)();this.prototype.publisher=new a(u),u.enabled&&(n.Service._clientSideMonitoring=!0)}return n.SequentialExecutor.call(i.prototype),n.Service.addDefaultMonitoringListeners(i.prototype),i},addVersions:function(e,t){Array.isArray(t)||(t=[t]),e.services=e.services||{};for(var r=0;r=0)return e.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",t();n.util.computeSha256(o,(function(r,n){r?t(r):(e.httpRequest.headers["X-Amz-Content-Sha256"]=n,t())}))}else t()}})),e("SET_CONTENT_LENGTH","afterBuild",(function(e){var t=function(e){if(!e.service.api.operations)return"";var t=e.service.api.operations[e.operation];return t?t.authtype:""}(e),r=n.util.getRequestPayloadShape(e);if(void 0===e.httpRequest.headers["Content-Length"])try{var i=n.util.string.byteLength(e.httpRequest.body);e.httpRequest.headers["Content-Length"]=i}catch(n){if(r&&r.isStreaming){if(r.requiresLength)throw n;if(t.indexOf("unsigned-body")>=0)return void(e.httpRequest.headers["Transfer-Encoding"]="chunked");throw n}throw n}})),e("SET_HTTP_HOST","afterBuild",(function(e){e.httpRequest.headers.Host=e.httpRequest.endpoint.host})),e("RESTART","restart",(function(){var e=this.response.error;e&&e.retryable&&(this.httpRequest=new n.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount=600?this.emit("sign",[this],(function(e){e?t(e):o()})):o()})),e("HTTP_HEADERS","httpHeaders",(function(e,t,r,i){r.httpResponse.statusCode=e,r.httpResponse.statusMessage=i,r.httpResponse.headers=t,r.httpResponse.body=n.util.buffer.toBuffer(""),r.httpResponse.buffers=[],r.httpResponse.numBytes=0;var o=t.date||t.Date,s=r.request.service;if(o){var a=Date.parse(o);s.config.correctClockSkew&&s.isClockSkewed(a)&&s.applyClockOffset(a)}})),e("HTTP_DATA","httpData",(function(e,t){if(e){if(n.util.isNode()){t.httpResponse.numBytes+=e.length;var r=t.httpResponse.headers["content-length"],i={loaded:t.httpResponse.numBytes,total:r};t.request.emit("httpDownloadProgress",[i,t])}t.httpResponse.buffers.push(n.util.buffer.toBuffer(e))}})),e("HTTP_DONE","httpDone",(function(e){if(e.httpResponse.buffers&&e.httpResponse.buffers.length>0){var t=n.util.buffer.concat(e.httpResponse.buffers);e.httpResponse.body=t}delete e.httpResponse.numBytes,delete e.httpResponse.buffers})),e("FINALIZE_ERROR","retry",(function(e){e.httpResponse.statusCode&&(e.error.statusCode=e.httpResponse.statusCode,void 0===e.error.retryable&&(e.error.retryable=this.service.retryableError(e.error,this)))})),e("INVALIDATE_CREDENTIALS","retry",(function(e){if(e.error)switch(e.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":e.error.retryable=!0,e.request.service.config.credentials.expired=!0}})),e("EXPIRED_SIGNATURE","retry",(function(e){var t=e.error;t&&"string"==typeof t.code&&"string"==typeof t.message&&t.code.match(/Signature/)&&t.message.match(/expired/)&&(e.error.retryable=!0)})),e("CLOCK_SKEWED","retry",(function(e){e.error&&this.service.clockSkewError(e.error)&&this.service.config.correctClockSkew&&(e.error.retryable=!0)})),e("REDIRECT","retry",(function(e){e.error&&e.error.statusCode>=300&&e.error.statusCode<400&&e.httpResponse.headers.location&&(this.httpRequest.endpoint=new n.Endpoint(e.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,e.error.redirect=!0,e.error.retryable=!0)})),e("RETRY_CHECK","retry",(function(e){e.error&&(e.error.redirect&&e.redirectCount=0?(e.error=null,setTimeout(t,r)):t()}))})),CorePost:(new i).addNamedListeners((function(e){e("EXTRACT_REQUEST_ID","extractData",n.util.extractRequestId),e("EXTRACT_REQUEST_ID","extractError",n.util.extractRequestId),e("ENOTFOUND_ERROR","httpError",(function(e){if("NetworkingError"===e.code&&"ENOTFOUND"===e.errno){var t="Inaccessible host: `"+e.hostname+"'. This service may not be available in the `"+e.region+"' region.";this.response.error=n.util.error(new Error(t),{code:"UnknownEndpoint",region:e.region,hostname:e.hostname,retryable:!0,originalError:e})}}))})),Logger:(new i).addNamedListeners((function(e){e("LOG_REQUEST","complete",(function(e){var t=e.request,i=t.service.config.logger;if(i){var o=function(){var o=(e.request.service.getSkewCorrectedDate().getTime()-t.startTime.getTime())/1e3,s=!!i.isTTY,a=e.httpResponse.statusCode,u=t.params;t.service.api.operations&&t.service.api.operations[t.operation]&&t.service.api.operations[t.operation].input&&(u=function e(t,r){if(!r)return r;switch(t.type){case"structure":var i={};return n.util.each(r,(function(r,n){Object.prototype.hasOwnProperty.call(t.members,r)?i[r]=e(t.members[r],n):i[r]=n})),i;case"list":var o=[];return n.util.arrayEach(r,(function(r,n){o.push(e(t.member,r))})),o;case"map":var s={};return n.util.each(r,(function(r,n){s[r]=e(t.value,n)})),s;default:return t.isSensitive?"***SensitiveInformation***":r}}(t.service.api.operations[t.operation].input,t.params));var c=r(36).inspect(u,!0,null),l="";return s&&(l+=""),l+="[AWS "+t.service.serviceIdentifier+" "+a,l+=" "+o.toString()+"s "+e.retryCount+" retries]",s&&(l+=""),l+=" "+n.util.string.lowerFirst(t.operation),l+="("+c+")",s&&(l+=""),l}();"function"==typeof i.log?i.log(o):"function"==typeof i.write&&i.write(o+"\n")}}))})),Json:(new i).addNamedListeners((function(e){var t=r(70);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})),Rest:(new i).addNamedListeners((function(e){var t=r(48);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})),RestJson:(new i).addNamedListeners((function(e){var t=r(114);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})),RestXml:(new i).addNamedListeners((function(e){var t=r(115);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})),Query:(new i).addNamedListeners((function(e){var t=r(112);e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}))}},function(e,t,r){(function(t){var n=r(3),i=r(7),o=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function s(e){var t=e.service,r=t.api||{},n=(r.operations,{});return t.config.region&&(n.region=t.config.region),r.serviceId&&(n.serviceId=r.serviceId),t.config.credentials.accessKeyId&&(n.accessKeyId=t.config.credentials.accessKeyId),n}function a(e,t){var r={};return function e(t,r,n){n&&null!=r&&"structure"===n.type&&n.required&&n.required.length>0&&i.arrayEach(n.required,(function(i){var o=n.members[i];if(!0===o.endpointDiscoveryId){var s=o.isLocationName?o.name:i;t[s]=String(r[i])}else e(t,r[i],o)}))}(r,e.params,t),r}function u(e){var t=e.service,r=t.api,o=r.operations?r.operations[e.operation]:void 0,u=a(e,o?o.input:void 0),c=s(e);Object.keys(u).length>0&&(c=i.update(c,u),o&&(c.operation=o.name));var l=n.endpointCache.get(c);if(!l||1!==l.length||""!==l[0].Address)if(l&&l.length>0)e.httpRequest.updateEndpoint(l[0].Address);else{var h=t.makeRequest(r.endpointOperation,{Operation:o.name,Identifiers:u});f(h),h.removeListener("validate",n.EventListeners.Core.VALIDATE_PARAMETERS),h.removeListener("retry",n.EventListeners.Core.RETRY_CHECK),n.endpointCache.put(c,[{Address:"",CachePeriodInMinutes:1}]),h.send((function(e,t){t&&t.Endpoints?n.endpointCache.put(c,t.Endpoints):e&&n.endpointCache.put(c,[{Address:"",CachePeriodInMinutes:1}])}))}}var c={};function l(e,t){var r=e.service,o=r.api,u=o.operations?o.operations[e.operation]:void 0,l=u?u.input:void 0,h=a(e,l),p=s(e);Object.keys(h).length>0&&(p=i.update(p,h),u&&(p.operation=u.name));var d=n.EndpointCache.getKeyString(p),y=n.endpointCache.get(d);if(y&&1===y.length&&""===y[0].Address)return c[d]||(c[d]=[]),void c[d].push({request:e,callback:t});if(y&&y.length>0)e.httpRequest.updateEndpoint(y[0].Address),t();else{var m=r.makeRequest(o.endpointOperation,{Operation:u.name,Identifiers:h});m.removeListener("validate",n.EventListeners.Core.VALIDATE_PARAMETERS),f(m),n.endpointCache.put(d,[{Address:"",CachePeriodInMinutes:60}]),m.send((function(r,o){if(r){var s={code:"EndpointDiscoveryException",message:"Request cannot be fulfilled without specifying an endpoint",retryable:!1};if(e.response.error=i.error(r,s),n.endpointCache.remove(p),c[d]){var a=c[d];i.arrayEach(a,(function(e){e.request.response.error=i.error(r,s),e.callback()})),delete c[d]}}else if(o&&(n.endpointCache.put(d,o.Endpoints),e.httpRequest.updateEndpoint(o.Endpoints[0].Address),c[d])){a=c[d];i.arrayEach(a,(function(e){e.request.httpRequest.updateEndpoint(o.Endpoints[0].Address),e.callback()})),delete c[d]}t()}))}}function f(e){var t=e.service.api.apiVersion;t&&!e.httpRequest.headers["x-amz-api-version"]&&(e.httpRequest.headers["x-amz-api-version"]=t)}function h(e){var t=e.error,r=e.httpResponse;if(t&&("InvalidEndpointException"===t.code||421===r.statusCode)){var o=e.request,u=o.service.api.operations||{},c=a(o,u[o.operation]?u[o.operation].input:void 0),l=s(o);Object.keys(c).length>0&&(l=i.update(l,c),u[o.operation]&&(l.operation=u[o.operation].name)),n.endpointCache.remove(l)}}function p(e){return["false","0"].indexOf(e)>=0}e.exports={discoverEndpoint:function(e,r){var s=e.service||{};if(function(e){if(e._originalConfig&&e._originalConfig.endpoint&&!0===e._originalConfig.endpointDiscoveryEnabled)throw i.error(new Error,{code:"ConfigurationException",message:"Custom endpoint is supplied; endpointDiscoveryEnabled must not be true."});var t=n.config[e.serviceIdentifier]||{};return Boolean(n.config.endpoint||t.endpoint||e._originalConfig&&e._originalConfig.endpoint)}(s)||e.isPresigned())return r();var a=(s.api.operations||{})[e.operation],c=a?a.endpointDiscoveryRequired:"NULL";if(!function(e){if(!0===(e.service||{}).config.endpointDiscoveryEnabled)return!0;if(i.isBrowser())return!1;for(var r=0;r=0){u=!0;var c=0}var l=function(){u&&c!==a?i.emit("error",t.util.error(new Error("Stream content length mismatch. Received "+c+" of "+a+" bytes."),{code:"StreamContentLengthMismatch"})):2===t.HttpClient.streamsApiVersion?i.end():i.emit("end")},f=s.httpResponse.createUnbufferedStream();if(2===t.HttpClient.streamsApiVersion)if(u){var h=new r.PassThrough;h._write=function(e){return e&&e.length&&(c+=e.length),r.PassThrough.prototype._write.apply(this,arguments)},h.on("end",l),i.on("error",(function(e){u=!1,f.unpipe(h),h.emit("end"),h.end()})),f.pipe(h).pipe(i,{end:!1})}else f.pipe(i);else u&&f.on("data",(function(e){e&&e.length&&(c+=e.length)})),f.on("data",(function(e){i.emit("data",e)})),f.on("end",l);f.on("error",(function(e){u=!1,i.emit("error",e)}))}})),i},emitEvent:function(e,r,n){"function"==typeof r&&(n=r,r=null),n||(n=function(){}),r||(r=this.eventParameters(e,this.response)),t.SequentialExecutor.prototype.emit.call(this,e,r,(function(e){e&&(this.response.error=e),n.call(this,e)}))},eventParameters:function(e){switch(e){case"restart":case"validate":case"sign":case"build":case"afterValidate":case"afterBuild":return[this];case"error":return[this.response.error,this.response];default:return[this.response]}},presign:function(e,r){return r||"function"!=typeof e||(r=e,e=null),(new t.Signers.Presign).sign(this.toGet(),e,r)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this._unAuthenticated=!0,this.removeListener("validate",t.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",t.EventListeners.Core.SIGN),this},toGet:function(){return"query"!==this.service.api.protocol&&"ec2"!==this.service.api.protocol||(this.removeListener("build",this.buildAsGet),this.addListener("build",this.buildAsGet)),this},buildAsGet:function(e){e.httpRequest.method="GET",e.httpRequest.path=e.service.endpoint.path+"?"+e.httpRequest.body,e.httpRequest.body="",delete e.httpRequest.headers["Content-Length"],delete e.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}}),t.Request.addPromisesToClass=function(e){this.prototype.promise=function(){var t=this;return this.httpRequest.appendToUserAgent("promise"),new e((function(e,r){t.on("complete",(function(t){t.error?r(t.error):e(Object.defineProperty(t.data||{},"$response",{value:t}))})),t.runTo()}))}},t.Request.deletePromisesFromClass=function(){delete this.prototype.promise},t.util.addPromises(t.Request),t.util.mixin(t.Request,t.SequentialExecutor)}).call(this,r(6))},function(e,t){function r(e,t){this.currentState=t||null,this.states=e||{}}r.prototype.runTo=function(e,t,r,n){"function"==typeof e&&(n=r,r=t,t=e,e=null);var i=this,o=i.states[i.currentState];o.fn.call(r||i,n,(function(n){if(n){if(!o.fail)return t?t.call(r,n):null;i.currentState=o.fail}else{if(!o.accept)return t?t.call(r):null;i.currentState=o.accept}if(i.currentState===e)return t?t.call(r,n):null;i.runTo(e,t,r,n)}))},r.prototype.addState=function(e,t,r,n){return"function"==typeof t?(n=t,t=null,r=null):"function"==typeof r&&(n=r,r=null),this.currentState||(this.currentState=e),this.states[e]={accept:t,fail:r,fn:n},this},e.exports=r},function(e,t,r){var n=r(3),i=n.util.inherit,o=r(74);n.Response=i({constructor:function(e){this.request=e,this.data=null,this.error=null,this.retryCount=0,this.redirectCount=0,this.httpResponse=new n.HttpResponse,e&&(this.maxRetries=e.service.numRetries(),this.maxRedirects=e.service.config.maxRedirects)},nextPage:function(e){var t,r=this.request.service,i=this.request.operation;try{t=r.paginationConfig(i,!0)}catch(e){this.error=e}if(!this.hasNextPage()){if(e)e(this.error,null);else if(this.error)throw this.error;return null}var o=n.util.copy(this.request.params);if(this.nextPageTokens){var s=t.inputToken;"string"==typeof s&&(s=[s]);for(var a=0;a=0?"&":"?";this.request.path+=o+n.util.queryParamsToString(i)},authorization:function(e,t){var r=[],n=this.credentialString(t);return r.push(this.algorithm+" Credential="+e.accessKeyId+"/"+n),r.push("SignedHeaders="+this.signedHeaders()),r.push("Signature="+this.signature(e,t)),r.join(", ")},signature:function(e,t){var r=i.getSigningKey(e,t.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return n.util.crypto.hmac(r,this.stringToSign(t),"hex")},stringToSign:function(e){var t=[];return t.push("AWS4-HMAC-SHA256"),t.push(e),t.push(this.credentialString(e)),t.push(this.hexEncodedHash(this.canonicalString())),t.join("\n")},canonicalString:function(){var e=[],t=this.request.pathname();return"s3"!==this.serviceName&&"s3v4"!==this.signatureVersion&&(t=n.util.uriEscapePath(t)),e.push(this.request.method),e.push(t),e.push(this.request.search()),e.push(this.canonicalHeaders()+"\n"),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join("\n")},canonicalHeaders:function(){var e=[];n.util.each.call(this,this.request.headers,(function(t,r){e.push([t,r])})),e.sort((function(e,t){return e[0].toLowerCase()50&&delete i[o.shift()]),p},emptyCache:function(){i={},o=[]}}},function(e,t,r){var n=r(3),i=n.util.inherit;n.Signers.S3=i(n.Signers.RequestSigner,{subResources:{acl:1,accelerate:1,analytics:1,cors:1,lifecycle:1,delete:1,inventory:1,location:1,logging:1,metrics:1,notification:1,partNumber:1,policy:1,requestPayment:1,replication:1,restore:1,tagging:1,torrent:1,uploadId:1,uploads:1,versionId:1,versioning:1,versions:1,website:1},responseHeaders:{"response-content-type":1,"response-content-language":1,"response-expires":1,"response-cache-control":1,"response-content-disposition":1,"response-content-encoding":1},addAuthorization:function(e,t){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=n.util.date.rfc822(t)),e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken);var r=this.sign(e.secretAccessKey,this.stringToSign()),i="AWS "+e.accessKeyId+":"+r;this.request.headers.Authorization=i},stringToSign:function(){var e=this.request,t=[];t.push(e.method),t.push(e.headers["Content-MD5"]||""),t.push(e.headers["Content-Type"]||""),t.push(e.headers["presigned-expires"]||"");var r=this.canonicalizedAmzHeaders();return r&&t.push(r),t.push(this.canonicalizedResource()),t.join("\n")},canonicalizedAmzHeaders:function(){var e=[];n.util.each(this.request.headers,(function(t){t.match(/^x-amz-/i)&&e.push(t)})),e.sort((function(e,t){return e.toLowerCase()604800){throw n.util.error(new Error,{code:"InvalidExpiryTime",message:"Presigning does not support expiry time greater than a week with SigV4 signing.",retryable:!1})}e.httpRequest.headers[o]=t}else{if(r!==n.Signers.S3)throw n.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1});var i=e.service?e.service.getSkewCorrectedDate():n.util.date.getDate();e.httpRequest.headers[o]=parseInt(n.util.date.unixTimestamp(i)+t,10).toString()}}function a(e){var t=e.httpRequest.endpoint,r=n.util.urlParse(e.httpRequest.path),i={};r.search&&(i=n.util.queryStringParse(r.search.substr(1)));var s=e.httpRequest.headers.Authorization.split(" ");if("AWS"===s[0])s=s[1].split(":"),i.AWSAccessKeyId=s[0],i.Signature=s[1],n.util.each(e.httpRequest.headers,(function(e,t){e===o&&(e="Expires"),0===e.indexOf("x-amz-meta-")&&(delete i[e],e=e.toLowerCase()),i[e]=t})),delete e.httpRequest.headers[o],delete i.Authorization,delete i.Host;else if("AWS4-HMAC-SHA256"===s[0]){s.shift();var a=s.join(" ").match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];i["X-Amz-Signature"]=a,delete i.Expires}t.pathname=r.pathname,t.search=n.util.queryParamsToString(i)}n.Signers.Presign=i({sign:function(e,t,r){if(e.httpRequest.headers[o]=t||3600,e.on("build",s),e.on("sign",a),e.removeListener("afterBuild",n.EventListeners.Core.SET_CONTENT_LENGTH),e.removeListener("afterBuild",n.EventListeners.Core.COMPUTE_SHA256),e.emit("beforePresign",[e]),!r){if(e.build(),e.response.error)throw e.response.error;return n.util.urlFormat(e.httpRequest.endpoint)}e.build((function(){this.response.error?r(this.response.error):r(null,n.util.urlFormat(e.httpRequest.endpoint))}))}}),e.exports=n.Signers.Presign},function(e,t,r){var n=r(3);n.ParamValidator=n.util.inherit({constructor:function(e){!0!==e&&void 0!==e||(e={min:!0}),this.validation=e},validate:function(e,t,r){if(this.errors=[],this.validateMember(e,t||{},r||"params"),this.errors.length>1){var i=this.errors.join("\n* ");throw i="There were "+this.errors.length+" validation errors:\n* "+i,n.util.error(new Error(i),{code:"MultipleValidationErrors",errors:this.errors})}if(1===this.errors.length)throw this.errors[0];return!0},fail:function(e,t){this.errors.push(n.util.error(new Error(t),{code:e}))},validateStructure:function(e,t,r){var n;this.validateType(t,r,["object"],"structure");for(var i=0;e.required&&i= 1, but found "'+t+'" for '+r)},validatePattern:function(e,t,r){this.validation.pattern&&void 0!==e.pattern&&(new RegExp(e.pattern).test(t)||this.fail("PatternMatchError",'Provided value "'+t+'" does not match regex pattern /'+e.pattern+"/ for "+r))},validateRange:function(e,t,r,n){this.validation.min&&void 0!==e.min&&t= "+e.min+", but found "+t+" for "+r),this.validation.max&&void 0!==e.max&&t>e.max&&this.fail("MaxRangeError","Expected "+n+" <= "+e.max+", but found "+t+" for "+r)},validateEnum:function(e,t,r){this.validation.enum&&void 0!==e.enum&&-1===e.enum.indexOf(t)&&this.fail("EnumError","Found string value of "+t+", but expected "+e.enum.join("|")+" for "+r)},validateType:function(e,t,r,i){if(null==e)return!1;for(var o=!1,s=0;se.BLOCK_SIZE){var i=new e;i.update(r),r=i.digest()}var o=new Uint8Array(e.BLOCK_SIZE);return o.set(r),o}(e,t),i=new Uint8Array(e.BLOCK_SIZE);i.set(r);for(var o=0;o>>32-i)+r&4294967295}function a(e,t,r,n,i,o,a){return s(t&r|~t&n,e,t,i,o,a)}function u(e,t,r,n,i,o,a){return s(t&n|r&~n,e,t,i,o,a)}function c(e,t,r,n,i,o,a){return s(t^r^n,e,t,i,o,a)}function l(e,t,r,n,i,o,a){return s(r^(t|~n),e,t,i,o,a)}e.exports=o,o.BLOCK_SIZE=64,o.prototype.update=function(e){if(n.isEmptyData(e))return this;if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=n.convertToBuffer(e),r=0,i=t.byteLength;for(this.bytesHashed+=i;i>0;)this.buffer.setUint8(this.bufferLength++,t[r++]),i--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},o.prototype.digest=function(e){if(!this.finished){var t=this.buffer,r=this.bufferLength,n=8*this.bytesHashed;if(t.setUint8(this.bufferLength++,128),r%64>=56){for(var o=this.bufferLength;o<64;o++)t.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(o=this.bufferLength;o<56;o++)t.setUint8(o,0);t.setUint32(56,n>>>0,!0),t.setUint32(60,Math.floor(n/4294967296),!0),this.hashBuffer(),this.finished=!0}var s=new DataView(new ArrayBuffer(16));for(o=0;o<4;o++)s.setUint32(4*o,this.state[o],!0);var a=new i(s.buffer,s.byteOffset,s.byteLength);return e?a.toString(e):a},o.prototype.hashBuffer=function(){var e=this.buffer,t=this.state,r=t[0],n=t[1],i=t[2],o=t[3];r=a(r,n,i,o,e.getUint32(0,!0),7,3614090360),o=a(o,r,n,i,e.getUint32(4,!0),12,3905402710),i=a(i,o,r,n,e.getUint32(8,!0),17,606105819),n=a(n,i,o,r,e.getUint32(12,!0),22,3250441966),r=a(r,n,i,o,e.getUint32(16,!0),7,4118548399),o=a(o,r,n,i,e.getUint32(20,!0),12,1200080426),i=a(i,o,r,n,e.getUint32(24,!0),17,2821735955),n=a(n,i,o,r,e.getUint32(28,!0),22,4249261313),r=a(r,n,i,o,e.getUint32(32,!0),7,1770035416),o=a(o,r,n,i,e.getUint32(36,!0),12,2336552879),i=a(i,o,r,n,e.getUint32(40,!0),17,4294925233),n=a(n,i,o,r,e.getUint32(44,!0),22,2304563134),r=a(r,n,i,o,e.getUint32(48,!0),7,1804603682),o=a(o,r,n,i,e.getUint32(52,!0),12,4254626195),i=a(i,o,r,n,e.getUint32(56,!0),17,2792965006),r=u(r,n=a(n,i,o,r,e.getUint32(60,!0),22,1236535329),i,o,e.getUint32(4,!0),5,4129170786),o=u(o,r,n,i,e.getUint32(24,!0),9,3225465664),i=u(i,o,r,n,e.getUint32(44,!0),14,643717713),n=u(n,i,o,r,e.getUint32(0,!0),20,3921069994),r=u(r,n,i,o,e.getUint32(20,!0),5,3593408605),o=u(o,r,n,i,e.getUint32(40,!0),9,38016083),i=u(i,o,r,n,e.getUint32(60,!0),14,3634488961),n=u(n,i,o,r,e.getUint32(16,!0),20,3889429448),r=u(r,n,i,o,e.getUint32(36,!0),5,568446438),o=u(o,r,n,i,e.getUint32(56,!0),9,3275163606),i=u(i,o,r,n,e.getUint32(12,!0),14,4107603335),n=u(n,i,o,r,e.getUint32(32,!0),20,1163531501),r=u(r,n,i,o,e.getUint32(52,!0),5,2850285829),o=u(o,r,n,i,e.getUint32(8,!0),9,4243563512),i=u(i,o,r,n,e.getUint32(28,!0),14,1735328473),r=c(r,n=u(n,i,o,r,e.getUint32(48,!0),20,2368359562),i,o,e.getUint32(20,!0),4,4294588738),o=c(o,r,n,i,e.getUint32(32,!0),11,2272392833),i=c(i,o,r,n,e.getUint32(44,!0),16,1839030562),n=c(n,i,o,r,e.getUint32(56,!0),23,4259657740),r=c(r,n,i,o,e.getUint32(4,!0),4,2763975236),o=c(o,r,n,i,e.getUint32(16,!0),11,1272893353),i=c(i,o,r,n,e.getUint32(28,!0),16,4139469664),n=c(n,i,o,r,e.getUint32(40,!0),23,3200236656),r=c(r,n,i,o,e.getUint32(52,!0),4,681279174),o=c(o,r,n,i,e.getUint32(0,!0),11,3936430074),i=c(i,o,r,n,e.getUint32(12,!0),16,3572445317),n=c(n,i,o,r,e.getUint32(24,!0),23,76029189),r=c(r,n,i,o,e.getUint32(36,!0),4,3654602809),o=c(o,r,n,i,e.getUint32(48,!0),11,3873151461),i=c(i,o,r,n,e.getUint32(60,!0),16,530742520),r=l(r,n=c(n,i,o,r,e.getUint32(8,!0),23,3299628645),i,o,e.getUint32(0,!0),6,4096336452),o=l(o,r,n,i,e.getUint32(28,!0),10,1126891415),i=l(i,o,r,n,e.getUint32(56,!0),15,2878612391),n=l(n,i,o,r,e.getUint32(20,!0),21,4237533241),r=l(r,n,i,o,e.getUint32(48,!0),6,1700485571),o=l(o,r,n,i,e.getUint32(12,!0),10,2399980690),i=l(i,o,r,n,e.getUint32(40,!0),15,4293915773),n=l(n,i,o,r,e.getUint32(4,!0),21,2240044497),r=l(r,n,i,o,e.getUint32(32,!0),6,1873313359),o=l(o,r,n,i,e.getUint32(60,!0),10,4264355552),i=l(i,o,r,n,e.getUint32(24,!0),15,2734768916),n=l(n,i,o,r,e.getUint32(52,!0),21,1309151649),r=l(r,n,i,o,e.getUint32(16,!0),6,4149444226),o=l(o,r,n,i,e.getUint32(44,!0),10,3174756917),i=l(i,o,r,n,e.getUint32(8,!0),15,718787259),n=l(n,i,o,r,e.getUint32(36,!0),21,3951481745),t[0]=r+t[0]&4294967295,t[1]=n+t[1]&4294967295,t[2]=i+t[2]&4294967295,t[3]=o+t[3]&4294967295}},function(e,t,r){var n=r(15).Buffer,i=r(49);new Uint32Array([1518500249,1859775393,-1894007588,-899497514]),Math.pow(2,53);function o(){this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=new Uint32Array(80),this.offset=0,this.shift=24,this.totalLength=0}e.exports=o,o.BLOCK_SIZE=64,o.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(i.isEmptyData(e))return this;var t=(e=i.convertToBuffer(e)).length;this.totalLength+=8*t;for(var r=0;r14||14===this.offset&&this.shift<24)&&this.processBlock(),this.offset=14,this.shift=24,this.write(0),this.write(0),this.write(this.totalLength>0xffffffffff?this.totalLength/1099511627776:0),this.write(this.totalLength>4294967295?this.totalLength/4294967296:0);for(var t=24;t>=0;t-=8)this.write(this.totalLength>>t);var r=new n(20),i=new DataView(r.buffer);return i.setUint32(0,this.h0,!1),i.setUint32(4,this.h1,!1),i.setUint32(8,this.h2,!1),i.setUint32(12,this.h3,!1),i.setUint32(16,this.h4,!1),e?r.toString(e):r},o.prototype.processBlock=function(){for(var e=16;e<80;e++){var t=this.block[e-3]^this.block[e-8]^this.block[e-14]^this.block[e-16];this.block[e]=t<<1|t>>>31}var r,n,i=this.h0,o=this.h1,s=this.h2,a=this.h3,u=this.h4;for(e=0;e<80;e++){e<20?(r=a^o&(s^a),n=1518500249):e<40?(r=o^s^a,n=1859775393):e<60?(r=o&s|a&(o|s),n=2400959708):(r=o^s^a,n=3395469782);var c=(i<<5|i>>>27)+r+u+n+(0|this.block[e]);u=a,a=s,s=o<<30|o>>>2,o=i,i=c}for(this.h0=this.h0+i|0,this.h1=this.h1+o|0,this.h2=this.h2+s|0,this.h3=this.h3+a|0,this.h4=this.h4+u|0,this.offset=0,e=0;e<16;e++)this.block[e]=0}},function(e,t,r){var n=r(15).Buffer,i=r(49),o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=Math.pow(2,53)-1;function a(){this.state=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}e.exports=a,a.BLOCK_SIZE=64,a.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(i.isEmptyData(e))return this;var t=0,r=(e=i.convertToBuffer(e)).byteLength;if(this.bytesHashed+=r,8*this.bytesHashed>s)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},a.prototype.digest=function(e){if(!this.finished){var t=8*this.bytesHashed,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),i=this.bufferLength;if(r.setUint8(this.bufferLength++,128),i%64>=56){for(var o=this.bufferLength;o<64;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(o=this.bufferLength;o<56;o++)r.setUint8(o,0);r.setUint32(56,Math.floor(t/4294967296),!0),r.setUint32(60,t),this.hashBuffer(),this.finished=!0}var s=new n(32);for(o=0;o<8;o++)s[4*o]=this.state[o]>>>24&255,s[4*o+1]=this.state[o]>>>16&255,s[4*o+2]=this.state[o]>>>8&255,s[4*o+3]=this.state[o]>>>0&255;return e?s.toString(e):s},a.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],n=t[1],i=t[2],s=t[3],a=t[4],u=t[5],c=t[6],l=t[7],f=0;f<64;f++){if(f<16)this.temp[f]=(255&e[4*f])<<24|(255&e[4*f+1])<<16|(255&e[4*f+2])<<8|255&e[4*f+3];else{var h=this.temp[f-2],p=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,d=((h=this.temp[f-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[f]=(p+this.temp[f-7]|0)+(d+this.temp[f-16]|0)}var y=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&u^~a&c)|0)+(l+(o[f]+this.temp[f]|0)|0)|0,m=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&n^r&i^n&i)|0;l=c,c=u,u=a,a=s+y|0,s=i,i=n,n=r,r=y+m|0}t[0]+=r,t[1]+=n,t[2]+=i,t[3]+=s,t[4]+=a,t[5]+=u,t[6]+=c,t[7]+=l}},function(e,t){e.exports={now:function(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}}},function(e,t,r){var n=r(305).eventMessageChunker,i=r(306).parseEvent;e.exports={createEventStream:function(e,t,r){for(var o=n(e),s=[],a=0;a-1&&(e[t]++,0===e[t]);t--);}o.fromNumber=function(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(e+" is too large (or, if negative, too small) to represent as an Int64");for(var t=new Uint8Array(8),r=7,n=Math.abs(Math.round(e));r>-1&&n>0;r--,n/=256)t[r]=n;return e<0&&s(t),new o(t)},o.prototype.valueOf=function(){var e=this.bytes.slice(0),t=128&e[0];return t&&s(e),parseInt(e.toString("hex"),16)*(t?-1:1)},o.prototype.toString=function(){return String(this.valueOf())},e.exports={Int64:o}},function(e,t,r){var n=r(3).util,i=n.buffer.toBuffer;e.exports={splitMessage:function(e){if(n.Buffer.isBuffer(e)||(e=i(e)),e.length<16)throw new Error("Provided message too short to accommodate event stream message overhead");if(e.length!==e.readUInt32BE(0))throw new Error("Reported message length does not match received message length");var t=e.readUInt32BE(8);if(t!==n.crypto.crc32(e.slice(0,8)))throw new Error("The prelude checksum specified in the message ("+t+") does not match the calculated CRC32 checksum.");var r=e.readUInt32BE(e.length-4);if(r!==n.crypto.crc32(e.slice(0,e.length-4)))throw new Error("The message checksum did not match the expected value of "+r);var o=12+e.readUInt32BE(4);return{headers:e.slice(12,o),body:e.slice(o,e.length-4)}}}},function(e,t,r){var n=r(3),i=r(40);n.TemporaryCredentials=n.util.inherit(n.Credentials,{constructor:function(e,t){n.Credentials.call(this),this.loadMasterCredentials(t),this.expired=!0,this.params=e||{},this.params.RoleArn&&(this.params.RoleSessionName=this.params.RoleSessionName||"temporary-credentials")},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.masterCredentials.get((function(){t.service.config.credentials=t.masterCredentials,(t.params.RoleArn?t.service.assumeRole:t.service.getSessionToken).call(t.service,(function(r,n){r||t.service.credentialsFrom(n,t),e(r)}))}))},loadMasterCredentials:function(e){for(this.masterCredentials=e||n.config.credentials;this.masterCredentials.masterCredentials;)this.masterCredentials=this.masterCredentials.masterCredentials;"function"!=typeof this.masterCredentials.get&&(this.masterCredentials=new n.Credentials(this.masterCredentials))},createClients:function(){this.service=this.service||new i({params:this.params})}})},function(e,t,r){var n=r(3),i=r(312);n.util.update(n.STS.prototype,{credentialsFrom:function(e,t){return e?(t||(t=new n.TemporaryCredentials),t.expired=!1,t.accessKeyId=e.Credentials.AccessKeyId,t.secretAccessKey=e.Credentials.SecretAccessKey,t.sessionToken=e.Credentials.SessionToken,t.expireTime=e.Credentials.Expiration,t):null},assumeRoleWithWebIdentity:function(e,t){return this.makeUnauthenticatedRequest("assumeRoleWithWebIdentity",e,t)},assumeRoleWithSAML:function(e,t){return this.makeUnauthenticatedRequest("assumeRoleWithSAML",e,t)},setupRequestListeners:function(e){e.addListener("validate",this.optInRegionalEndpoint,!0)},optInRegionalEndpoint:function(e){var t=e.service,r=t.config;if(r.stsRegionalEndpoints=i(t._originalConfig,{env:"AWS_STS_REGIONAL_ENDPOINTS",sharedConfig:"sts_regional_endpoints",clientConfig:"stsRegionalEndpoints"}),"regional"===r.stsRegionalEndpoints&&t.isGlobalEndpoint){if(!r.region)throw n.util.error(new Error,{code:"ConfigError",message:"Missing region in config"});var o=r.endpoint.indexOf(".amazonaws.com"),s=r.endpoint.substring(0,o)+"."+r.region+r.endpoint.substring(o);e.httpRequest.updateEndpoint(s),e.httpRequest.region=r.region}}})},function(e,t,r){(function(t){var n=r(3);function i(e,t){if("string"==typeof e){if(["legacy","regional"].indexOf(e.toLowerCase())>=0)return e.toLowerCase();throw n.util.error(new Error,t)}}e.exports=function(e,r){var o;if((e=e||{})[r.clientConfig]&&(o=i(e[r.clientConfig],{code:"InvalidConfiguration",message:'invalid "'+r.clientConfig+'" configuration. Expect "legacy" or "regional". Got "'+e[r.clientConfig]+'".'})))return o;if(!n.util.isNode())return o;if(Object.prototype.hasOwnProperty.call(t.env,r.env)&&(o=i(t.env[r.env],{code:"InvalidEnvironmentalVariable",message:"invalid "+r.env+' environmental variable. Expect "legacy" or "regional". Got "'+t.env[r.env]+'".'})))return o;var s={};try{s=n.util.getProfilesFromSharedConfig(n.util.iniLoader)[t.env.AWS_PROFILE||n.util.defaultProfile]}catch(e){}return s&&Object.prototype.hasOwnProperty.call(s,r.sharedConfig)&&(o=i(s[r.sharedConfig],{code:"InvalidConfiguration",message:"invalid "+r.sharedConfig+' profile config. Expect "legacy" or "regional". Got "'+s[r.sharedConfig]+'".'})),o}}).call(this,r(6))},function(e){e.exports=JSON.parse('{"version":"2.0","metadata":{"apiVersion":"2011-06-15","endpointPrefix":"sts","globalEndpoint":"sts.amazonaws.com","protocol":"query","serviceAbbreviation":"AWS STS","serviceFullName":"AWS Security Token Service","serviceId":"STS","signatureVersion":"v4","uid":"sts-2011-06-15","xmlNamespace":"https://sts.amazonaws.com/doc/2011-06-15/"},"operations":{"AssumeRole":{"input":{"type":"structure","required":["RoleArn","RoleSessionName"],"members":{"RoleArn":{},"RoleSessionName":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"},"Tags":{"shape":"S8"},"TransitiveTagKeys":{"type":"list","member":{}},"ExternalId":{},"SerialNumber":{},"TokenCode":{}}},"output":{"resultWrapper":"AssumeRoleResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"}}}},"AssumeRoleWithSAML":{"input":{"type":"structure","required":["RoleArn","PrincipalArn","SAMLAssertion"],"members":{"RoleArn":{},"PrincipalArn":{},"SAMLAssertion":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"}}},"output":{"resultWrapper":"AssumeRoleWithSAMLResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"},"Subject":{},"SubjectType":{},"Issuer":{},"Audience":{},"NameQualifier":{}}}},"AssumeRoleWithWebIdentity":{"input":{"type":"structure","required":["RoleArn","RoleSessionName","WebIdentityToken"],"members":{"RoleArn":{},"RoleSessionName":{},"WebIdentityToken":{},"ProviderId":{},"PolicyArns":{"shape":"S4"},"Policy":{},"DurationSeconds":{"type":"integer"}}},"output":{"resultWrapper":"AssumeRoleWithWebIdentityResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"SubjectFromWebIdentityToken":{},"AssumedRoleUser":{"shape":"Sm"},"PackedPolicySize":{"type":"integer"},"Provider":{},"Audience":{}}}},"DecodeAuthorizationMessage":{"input":{"type":"structure","required":["EncodedMessage"],"members":{"EncodedMessage":{}}},"output":{"resultWrapper":"DecodeAuthorizationMessageResult","type":"structure","members":{"DecodedMessage":{}}}},"GetAccessKeyInfo":{"input":{"type":"structure","required":["AccessKeyId"],"members":{"AccessKeyId":{}}},"output":{"resultWrapper":"GetAccessKeyInfoResult","type":"structure","members":{"Account":{}}}},"GetCallerIdentity":{"input":{"type":"structure","members":{}},"output":{"resultWrapper":"GetCallerIdentityResult","type":"structure","members":{"UserId":{},"Account":{},"Arn":{}}}},"GetFederationToken":{"input":{"type":"structure","required":["Name"],"members":{"Name":{},"Policy":{},"PolicyArns":{"shape":"S4"},"DurationSeconds":{"type":"integer"},"Tags":{"shape":"S8"}}},"output":{"resultWrapper":"GetFederationTokenResult","type":"structure","members":{"Credentials":{"shape":"Sh"},"FederatedUser":{"type":"structure","required":["FederatedUserId","Arn"],"members":{"FederatedUserId":{},"Arn":{}}},"PackedPolicySize":{"type":"integer"}}}},"GetSessionToken":{"input":{"type":"structure","members":{"DurationSeconds":{"type":"integer"},"SerialNumber":{},"TokenCode":{}}},"output":{"resultWrapper":"GetSessionTokenResult","type":"structure","members":{"Credentials":{"shape":"Sh"}}}}},"shapes":{"S4":{"type":"list","member":{"type":"structure","members":{"arn":{}}}},"S8":{"type":"list","member":{"type":"structure","required":["Key","Value"],"members":{"Key":{},"Value":{}}}},"Sh":{"type":"structure","required":["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],"members":{"AccessKeyId":{},"SecretAccessKey":{},"SessionToken":{},"Expiration":{"type":"timestamp"}}},"Sm":{"type":"structure","required":["AssumedRoleId","Arn"],"members":{"AssumedRoleId":{},"Arn":{}}}}}')},function(e){e.exports=JSON.parse('{"pagination":{}}')},function(e,t,r){var n=r(3),i=r(40);n.ChainableTemporaryCredentials=n.util.inherit(n.Credentials,{constructor:function(e){n.Credentials.call(this),e=e||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var t=n.util.copy(e.params)||{};if(t.RoleArn&&(t.RoleSessionName=t.RoleSessionName||"temporary-credentials"),t.SerialNumber){if(!e.tokenCodeFn||"function"!=typeof e.tokenCodeFn)throw new n.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=e.tokenCodeFn}var r=n.util.merge({params:t,credentials:e.masterCredentials||n.config.credentials},e.stsConfig||{});this.service=new i(r)},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this,r=t.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode((function(n,i){var o={};n?e(n):(i&&(o.TokenCode=i),t.service[r](o,(function(r,n){r||t.service.credentialsFrom(n,t),e(r)})))}))},getTokenCode:function(e){var t=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,(function(r,i){if(r){var o=r;return r instanceof Error&&(o=r.message),void e(n.util.error(new Error("Error fetching MFA token: "+o),{code:t.errorCode}))}e(null,i)})):e(null)}})},function(e,t,r){var n=r(3),i=r(40);n.WebIdentityCredentials=n.util.inherit(n.Credentials,{constructor:function(e,t){n.Credentials.call(this),this.expired=!0,this.params=e,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=n.util.copy(t||{})},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.service.assumeRoleWithWebIdentity((function(r,n){t.data=null,r||(t.data=n,t.service.credentialsFrom(n,t)),e(r)}))},createClients:function(){if(!this.service){var e=n.util.merge({},this._clientConfig);e.params=this.params,this.service=new i(e)}}})},function(e,t,r){var n=r(3),i=r(318),o=r(40);n.CognitoIdentityCredentials=n.util.inherit(n.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(e,t){n.Credentials.call(this),this.expired=!0,this.params=e,this.data=null,this._identityId=null,this._clientConfig=n.util.copy(t||{}),this.loadCachedId();var r=this;Object.defineProperty(this,"identityId",{get:function(){return r.loadCachedId(),r._identityId||r.params.IdentityId},set:function(e){r._identityId=e}})},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.data=null,t._identityId=null,t.getId((function(r){r?(t.clearIdOnNotAuthorized(r),e(r)):t.params.RoleArn?t.getCredentialsFromSTS(e):t.getCredentialsForIdentity(e)}))},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var e=this.params.IdentityPoolId,t=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+e+t],delete this.storage[this.localStorageKey.providers+e+t]},clearIdOnNotAuthorized:function(e){"NotAuthorizedException"==e.code&&this.clearCachedId()},getId:function(e){var t=this;if("string"==typeof t.params.IdentityId)return e(null,t.params.IdentityId);t.cognito.getId((function(r,n){!r&&n.IdentityId?(t.params.IdentityId=n.IdentityId,e(null,n.IdentityId)):e(r)}))},loadCredentials:function(e,t){e&&t&&(t.expired=!1,t.accessKeyId=e.Credentials.AccessKeyId,t.secretAccessKey=e.Credentials.SecretKey,t.sessionToken=e.Credentials.SessionToken,t.expireTime=e.Credentials.Expiration)},getCredentialsForIdentity:function(e){var t=this;t.cognito.getCredentialsForIdentity((function(r,n){r?t.clearIdOnNotAuthorized(r):(t.cacheId(n),t.data=n,t.loadCredentials(t.data,t)),e(r)}))},getCredentialsFromSTS:function(e){var t=this;t.cognito.getOpenIdToken((function(r,n){r?(t.clearIdOnNotAuthorized(r),e(r)):(t.cacheId(n),t.params.WebIdentityToken=n.Token,t.webIdentityCredentials.refresh((function(r){r||(t.data=t.webIdentityCredentials.data,t.sts.credentialsFrom(t.data,t)),e(r)})))}))},loadCachedId:function(){if(n.util.isBrowser()&&!this.params.IdentityId){var e=this.getStorage("id");if(e&&this.params.Logins){var t=Object.keys(this.params.Logins);0!==(this.getStorage("providers")||"").split(",").filter((function(e){return-1!==t.indexOf(e)})).length&&(this.params.IdentityId=e)}else e&&(this.params.IdentityId=e)}},createClients:function(){var e=this._clientConfig;if(this.webIdentityCredentials=this.webIdentityCredentials||new n.WebIdentityCredentials(this.params,e),!this.cognito){var t=n.util.merge({},e);t.params=this.params,this.cognito=new i(t)}this.sts=this.sts||new o(e)},cacheId:function(e){this._identityId=e.IdentityId,this.params.IdentityId=this._identityId,n.util.isBrowser()&&(this.setStorage("id",e.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(e){return this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(e,t){try{this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]=t}catch(e){}},storage:function(){try{var e=n.util.isBrowser()&&null!==window.localStorage&&"object"==typeof window.localStorage?window.localStorage:{};return e["aws.test-storage"]="foobar",delete e["aws.test-storage"],e}catch(e){return{}}}()})},function(e,t,r){r(69);var n=r(3),i=n.Service,o=n.apiLoader;o.services.cognitoidentity={},n.CognitoIdentity=i.defineService("cognitoidentity",["2014-06-30"]),r(319),Object.defineProperty(o.services.cognitoidentity,"2014-06-30",{get:function(){var e=r(320);return e.paginators=r(321).pagination,e},enumerable:!0,configurable:!0}),e.exports=n.CognitoIdentity},function(e,t,r){var n=r(3);n.util.update(n.CognitoIdentity.prototype,{getOpenIdToken:function(e,t){return this.makeUnauthenticatedRequest("getOpenIdToken",e,t)},getId:function(e,t){return this.makeUnauthenticatedRequest("getId",e,t)},getCredentialsForIdentity:function(e,t){return this.makeUnauthenticatedRequest("getCredentialsForIdentity",e,t)}})},function(e){e.exports=JSON.parse('{"version":"2.0","metadata":{"apiVersion":"2014-06-30","endpointPrefix":"cognito-identity","jsonVersion":"1.1","protocol":"json","serviceFullName":"Amazon Cognito Identity","serviceId":"Cognito Identity","signatureVersion":"v4","targetPrefix":"AWSCognitoIdentityService","uid":"cognito-identity-2014-06-30"},"operations":{"CreateIdentityPool":{"input":{"type":"structure","required":["IdentityPoolName","AllowUnauthenticatedIdentities"],"members":{"IdentityPoolName":{},"AllowUnauthenticatedIdentities":{"type":"boolean"},"AllowClassicFlow":{"type":"boolean"},"SupportedLoginProviders":{"shape":"S5"},"DeveloperProviderName":{},"OpenIdConnectProviderARNs":{"shape":"S9"},"CognitoIdentityProviders":{"shape":"Sb"},"SamlProviderARNs":{"shape":"Sg"},"IdentityPoolTags":{"shape":"Sh"}}},"output":{"shape":"Sk"}},"DeleteIdentities":{"input":{"type":"structure","required":["IdentityIdsToDelete"],"members":{"IdentityIdsToDelete":{"type":"list","member":{}}}},"output":{"type":"structure","members":{"UnprocessedIdentityIds":{"type":"list","member":{"type":"structure","members":{"IdentityId":{},"ErrorCode":{}}}}}}},"DeleteIdentityPool":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}}},"DescribeIdentity":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{}}},"output":{"shape":"Sv"}},"DescribeIdentityPool":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}},"output":{"shape":"Sk"}},"GetCredentialsForIdentity":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{},"Logins":{"shape":"S10"},"CustomRoleArn":{}}},"output":{"type":"structure","members":{"IdentityId":{},"Credentials":{"type":"structure","members":{"AccessKeyId":{},"SecretKey":{},"SessionToken":{},"Expiration":{"type":"timestamp"}}}}}},"GetId":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"AccountId":{},"IdentityPoolId":{},"Logins":{"shape":"S10"}}},"output":{"type":"structure","members":{"IdentityId":{}}}},"GetIdentityPoolRoles":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{}}},"output":{"type":"structure","members":{"IdentityPoolId":{},"Roles":{"shape":"S1c"},"RoleMappings":{"shape":"S1e"}}}},"GetOpenIdToken":{"input":{"type":"structure","required":["IdentityId"],"members":{"IdentityId":{},"Logins":{"shape":"S10"}}},"output":{"type":"structure","members":{"IdentityId":{},"Token":{}}}},"GetOpenIdTokenForDeveloperIdentity":{"input":{"type":"structure","required":["IdentityPoolId","Logins"],"members":{"IdentityPoolId":{},"IdentityId":{},"Logins":{"shape":"S10"},"TokenDuration":{"type":"long"}}},"output":{"type":"structure","members":{"IdentityId":{},"Token":{}}}},"ListIdentities":{"input":{"type":"structure","required":["IdentityPoolId","MaxResults"],"members":{"IdentityPoolId":{},"MaxResults":{"type":"integer"},"NextToken":{},"HideDisabled":{"type":"boolean"}}},"output":{"type":"structure","members":{"IdentityPoolId":{},"Identities":{"type":"list","member":{"shape":"Sv"}},"NextToken":{}}}},"ListIdentityPools":{"input":{"type":"structure","required":["MaxResults"],"members":{"MaxResults":{"type":"integer"},"NextToken":{}}},"output":{"type":"structure","members":{"IdentityPools":{"type":"list","member":{"type":"structure","members":{"IdentityPoolId":{},"IdentityPoolName":{}}}},"NextToken":{}}}},"ListTagsForResource":{"input":{"type":"structure","required":["ResourceArn"],"members":{"ResourceArn":{}}},"output":{"type":"structure","members":{"Tags":{"shape":"Sh"}}}},"LookupDeveloperIdentity":{"input":{"type":"structure","required":["IdentityPoolId"],"members":{"IdentityPoolId":{},"IdentityId":{},"DeveloperUserIdentifier":{},"MaxResults":{"type":"integer"},"NextToken":{}}},"output":{"type":"structure","members":{"IdentityId":{},"DeveloperUserIdentifierList":{"type":"list","member":{}},"NextToken":{}}}},"MergeDeveloperIdentities":{"input":{"type":"structure","required":["SourceUserIdentifier","DestinationUserIdentifier","DeveloperProviderName","IdentityPoolId"],"members":{"SourceUserIdentifier":{},"DestinationUserIdentifier":{},"DeveloperProviderName":{},"IdentityPoolId":{}}},"output":{"type":"structure","members":{"IdentityId":{}}}},"SetIdentityPoolRoles":{"input":{"type":"structure","required":["IdentityPoolId","Roles"],"members":{"IdentityPoolId":{},"Roles":{"shape":"S1c"},"RoleMappings":{"shape":"S1e"}}}},"TagResource":{"input":{"type":"structure","required":["ResourceArn","Tags"],"members":{"ResourceArn":{},"Tags":{"shape":"Sh"}}},"output":{"type":"structure","members":{}}},"UnlinkDeveloperIdentity":{"input":{"type":"structure","required":["IdentityId","IdentityPoolId","DeveloperProviderName","DeveloperUserIdentifier"],"members":{"IdentityId":{},"IdentityPoolId":{},"DeveloperProviderName":{},"DeveloperUserIdentifier":{}}}},"UnlinkIdentity":{"input":{"type":"structure","required":["IdentityId","Logins","LoginsToRemove"],"members":{"IdentityId":{},"Logins":{"shape":"S10"},"LoginsToRemove":{"shape":"Sw"}}}},"UntagResource":{"input":{"type":"structure","required":["ResourceArn","TagKeys"],"members":{"ResourceArn":{},"TagKeys":{"type":"list","member":{}}}},"output":{"type":"structure","members":{}}},"UpdateIdentityPool":{"input":{"shape":"Sk"},"output":{"shape":"Sk"}}},"shapes":{"S5":{"type":"map","key":{},"value":{}},"S9":{"type":"list","member":{}},"Sb":{"type":"list","member":{"type":"structure","members":{"ProviderName":{},"ClientId":{},"ServerSideTokenCheck":{"type":"boolean"}}}},"Sg":{"type":"list","member":{}},"Sh":{"type":"map","key":{},"value":{}},"Sk":{"type":"structure","required":["IdentityPoolId","IdentityPoolName","AllowUnauthenticatedIdentities"],"members":{"IdentityPoolId":{},"IdentityPoolName":{},"AllowUnauthenticatedIdentities":{"type":"boolean"},"AllowClassicFlow":{"type":"boolean"},"SupportedLoginProviders":{"shape":"S5"},"DeveloperProviderName":{},"OpenIdConnectProviderARNs":{"shape":"S9"},"CognitoIdentityProviders":{"shape":"Sb"},"SamlProviderARNs":{"shape":"Sg"},"IdentityPoolTags":{"shape":"Sh"}}},"Sv":{"type":"structure","members":{"IdentityId":{},"Logins":{"shape":"Sw"},"CreationDate":{"type":"timestamp"},"LastModifiedDate":{"type":"timestamp"}}},"Sw":{"type":"list","member":{}},"S10":{"type":"map","key":{},"value":{}},"S1c":{"type":"map","key":{},"value":{}},"S1e":{"type":"map","key":{},"value":{"type":"structure","required":["Type"],"members":{"Type":{},"AmbiguousRoleResolution":{},"RulesConfiguration":{"type":"structure","required":["Rules"],"members":{"Rules":{"type":"list","member":{"type":"structure","required":["Claim","MatchType","Value","RoleARN"],"members":{"Claim":{},"MatchType":{},"Value":{},"RoleARN":{}}}}}}}}}}}')},function(e){e.exports=JSON.parse('{"pagination":{}}')},function(e,t,r){var n=r(3),i=r(40);n.SAMLCredentials=n.util.inherit(n.Credentials,{constructor:function(e){n.Credentials.call(this),this.expired=!0,this.params=e},refresh:function(e){this.coalesceRefresh(e||n.util.fn.callback)},load:function(e){var t=this;t.createClients(),t.service.assumeRoleWithSAML((function(r,n){r||t.service.credentialsFrom(n,t),e(r)}))},createClients:function(){this.service=this.service||new i({params:this.params})}})},function(e,t,r){var n=r(7),i=r(39);function o(){}function s(e,t){for(var r=e.getElementsByTagName(t),n=0,i=r.length;n=this.HEADERS_RECEIVED&&!f&&(u.statusCode=l.status,u.headers=s.parseHeaders(l.getAllResponseHeaders()),u.emit("headers",u.statusCode,u.headers,l.statusText),f=!0),this.readyState===this.DONE&&s.finishRequest(l,u)}),!1),l.upload.addEventListener("progress",(function(e){u.emit("sendProgress",e)})),l.addEventListener("progress",(function(e){u.emit("receiveProgress",e)}),!1),l.addEventListener("timeout",(function(){o(n.util.error(new Error("Timeout"),{code:"TimeoutError"}))}),!1),l.addEventListener("error",(function(){o(n.util.error(new Error("Network Failure"),{code:"NetworkingError"}))}),!1),l.addEventListener("abort",(function(){o(n.util.error(new Error("Request aborted"),{code:"RequestAbortedError"}))}),!1),r(u),l.open(e.method,c,!1!==t.xhrAsync),n.util.each(e.headers,(function(e,t){"Content-Length"!==e&&"User-Agent"!==e&&"Host"!==e&&l.setRequestHeader(e,t)})),t.timeout&&!1!==t.xhrAsync&&(l.timeout=t.timeout),t.xhrWithCredentials&&(l.withCredentials=!0);try{l.responseType="arraybuffer"}catch(e){}try{e.body?l.send(e.body):l.send()}catch(t){if(!e.body||"object"!=typeof e.body.buffer)throw t;l.send(e.body.buffer)}return u},parseHeaders:function(e){var t={};return n.util.arrayEach(e.split(/\r?\n/),(function(e){var r=e.split(":",1)[0],n=e.substring(r.length+2);r.length>0&&(t[r.toLowerCase()]=n)})),t},finishRequest:function(e,t){var r;if("arraybuffer"===e.responseType&&e.response){var i=e.response;r=new n.util.Buffer(i.byteLength);for(var o=new Uint8Array(i),s=0;s App); diff --git a/react-native-redux/ios/AwesomeProject-tvOS/Info.plist b/react-native-redux/ios/AwesomeProject-tvOS/Info.plist new file mode 100644 index 0000000..ecbd496 --- /dev/null +++ b/react-native-redux/ios/AwesomeProject-tvOS/Info.plist @@ -0,0 +1,53 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + NSAppTransportSecurity + + NSExceptionDomains + + localhost + + NSExceptionAllowsInsecureHTTPLoads + + + + + NSLocationWhenInUseUsageDescription + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/react-native-redux/ios/AwesomeProject-tvOSTests/Info.plist b/react-native-redux/ios/AwesomeProject-tvOSTests/Info.plist new file mode 100644 index 0000000..886825c --- /dev/null +++ b/react-native-redux/ios/AwesomeProject-tvOSTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/react-native-redux/ios/AwesomeProject.xcodeproj/project.pbxproj b/react-native-redux/ios/AwesomeProject.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c1eab2d --- /dev/null +++ b/react-native-redux/ios/AwesomeProject.xcodeproj/project.pbxproj @@ -0,0 +1,880 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 00E356F31AD99517003FC87E /* AwesomeProjectTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* AwesomeProjectTests.m */; }; + 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; + 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; + 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; + 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; + 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; + 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; + 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; + 2DCD954D1E0B4F2C00145EB5 /* AwesomeProjectTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* AwesomeProjectTests.m */; }; + 61ACEE6256B4485DAE9B6493 /* AntDesign.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 4826D8B37F1E478A93DE12C1 /* AntDesign.ttf */; }; + E6298E81B41346BFB147CD80 /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1A8222CBCA1D4250A0F71B30 /* Entypo.ttf */; }; + 800C8C37BBF949A88E844820 /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B4CF6DB571F64B6F89EB017A /* EvilIcons.ttf */; }; + 98B5E5A955E347DE8C1F0E01 /* Feather.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 68C217A3CBB14B008DDA89FD /* Feather.ttf */; }; + BEE612F4B19C4D5E9DB66B04 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 663221E6A83645C38592EB9C /* FontAwesome.ttf */; }; + 3C83E6A2F6EC40B4A0599941 /* FontAwesome5_Brands.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 40F65C61813640E5A75FE4EC /* FontAwesome5_Brands.ttf */; }; + B69EDE2E73E94C009E13764E /* FontAwesome5_Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7DCD060701284501884E2F26 /* FontAwesome5_Regular.ttf */; }; + 154107F2342A49EE96D97040 /* FontAwesome5_Solid.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 5A284F88CC674CC3AC36A051 /* FontAwesome5_Solid.ttf */; }; + 0F375BC7BD904D8FBC6CC871 /* Fontisto.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8408EF6A98F746629A2A6A59 /* Fontisto.ttf */; }; + FC6EEC622D1F401FBC5AFBFA /* Foundation.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A75C56DA1B1540D788815AB9 /* Foundation.ttf */; }; + F5EC1F245FFE48188155BCFB /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B47D680A0D7D4E278CAA46C5 /* Ionicons.ttf */; }; + 1856DA8856744CDEA124F981 /* MaterialCommunityIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 5046157983FB47A587E1BD73 /* MaterialCommunityIcons.ttf */; }; + BE78DEB0F87F41C2BA0A7A28 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F2E9DCC4461E4EDBB999E22A /* MaterialIcons.ttf */; }; + 0CFFEE9C505F4D1382F72685 /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6755EA5775A343CE8A86E597 /* Octicons.ttf */; }; + 0E3FBDAF2BFE4CB7986CC2DD /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 119675C8C1AF483F8CDEC911 /* SimpleLineIcons.ttf */; }; + 496FBB744DC7422887C2E6B0 /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1A194CF16D044E3F959B05A5 /* Zocial.ttf */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 13B07F861A680F5B00A75B9A; + remoteInfo = AwesomeProject; + }; + 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7; + remoteInfo = "AwesomeProject-tvOS"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; + 00E356EE1AD99517003FC87E /* AwesomeProjectTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AwesomeProjectTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 00E356F21AD99517003FC87E /* AwesomeProjectTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AwesomeProjectTests.m; sourceTree = ""; }; + 13B07F961A680F5B00A75B9A /* AwesomeProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AwesomeProject.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = AwesomeProject/AppDelegate.h; sourceTree = ""; }; + 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = AwesomeProject/AppDelegate.m; sourceTree = ""; }; + 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = AwesomeProject/Images.xcassets; sourceTree = ""; }; + 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = AwesomeProject/Info.plist; sourceTree = ""; }; + 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = AwesomeProject/main.m; sourceTree = ""; }; + 2D02E47B1E0B4A5D006451C7 /* AwesomeProject-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "AwesomeProject-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2D02E4901E0B4A5D006451C7 /* AwesomeProject-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AwesomeProject-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; + ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; + 4826D8B37F1E478A93DE12C1 /* AntDesign.ttf */ = {isa = PBXFileReference; name = "AntDesign.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 1A8222CBCA1D4250A0F71B30 /* Entypo.ttf */ = {isa = PBXFileReference; name = "Entypo.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Entypo.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + B4CF6DB571F64B6F89EB017A /* EvilIcons.ttf */ = {isa = PBXFileReference; name = "EvilIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 68C217A3CBB14B008DDA89FD /* Feather.ttf */ = {isa = PBXFileReference; name = "Feather.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Feather.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 663221E6A83645C38592EB9C /* FontAwesome.ttf */ = {isa = PBXFileReference; name = "FontAwesome.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 40F65C61813640E5A75FE4EC /* FontAwesome5_Brands.ttf */ = {isa = PBXFileReference; name = "FontAwesome5_Brands.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 7DCD060701284501884E2F26 /* FontAwesome5_Regular.ttf */ = {isa = PBXFileReference; name = "FontAwesome5_Regular.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 5A284F88CC674CC3AC36A051 /* FontAwesome5_Solid.ttf */ = {isa = PBXFileReference; name = "FontAwesome5_Solid.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 8408EF6A98F746629A2A6A59 /* Fontisto.ttf */ = {isa = PBXFileReference; name = "Fontisto.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Fontisto.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + A75C56DA1B1540D788815AB9 /* Foundation.ttf */ = {isa = PBXFileReference; name = "Foundation.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Foundation.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + B47D680A0D7D4E278CAA46C5 /* Ionicons.ttf */ = {isa = PBXFileReference; name = "Ionicons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 5046157983FB47A587E1BD73 /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; name = "MaterialCommunityIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + F2E9DCC4461E4EDBB999E22A /* MaterialIcons.ttf */ = {isa = PBXFileReference; name = "MaterialIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 6755EA5775A343CE8A86E597 /* Octicons.ttf */ = {isa = PBXFileReference; name = "Octicons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 119675C8C1AF483F8CDEC911 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; name = "SimpleLineIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; + 1A194CF16D044E3F959B05A5 /* Zocial.ttf */ = {isa = PBXFileReference; name = "Zocial.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 00E356EB1AD99517003FC87E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2D02E4781E0B4A5D006451C7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 00E356EF1AD99517003FC87E /* AwesomeProjectTests */ = { + isa = PBXGroup; + children = ( + 00E356F21AD99517003FC87E /* AwesomeProjectTests.m */, + 00E356F01AD99517003FC87E /* Supporting Files */, + ); + path = AwesomeProjectTests; + sourceTree = ""; + }; + 00E356F01AD99517003FC87E /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 00E356F11AD99517003FC87E /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 13B07FAE1A68108700A75B9A /* AwesomeProject */ = { + isa = PBXGroup; + children = ( + 008F07F21AC5B25A0029DE68 /* main.jsbundle */, + 13B07FAF1A68108700A75B9A /* AppDelegate.h */, + 13B07FB01A68108700A75B9A /* AppDelegate.m */, + 13B07FB51A68108700A75B9A /* Images.xcassets */, + 13B07FB61A68108700A75B9A /* Info.plist */, + 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, + 13B07FB71A68108700A75B9A /* main.m */, + ); + name = AwesomeProject; + sourceTree = ""; + }; + 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { + isa = PBXGroup; + children = ( + ED297162215061F000B7C4FE /* JavaScriptCore.framework */, + ED2971642150620600B7C4FE /* JavaScriptCore.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 832341AE1AAA6A7D00B99B32 /* Libraries */ = { + isa = PBXGroup; + children = ( + ); + name = Libraries; + sourceTree = ""; + }; + 83CBB9F61A601CBA00E9B192 = { + isa = PBXGroup; + children = ( + 13B07FAE1A68108700A75B9A /* AwesomeProject */, + 832341AE1AAA6A7D00B99B32 /* Libraries */, + 00E356EF1AD99517003FC87E /* AwesomeProjectTests */, + 83CBBA001A601CBA00E9B192 /* Products */, + 2D16E6871FA4F8E400B85C8A /* Frameworks */, + F0E53DCEB82A442BA7B6000F /* Resources */, + ); + indentWidth = 2; + sourceTree = ""; + tabWidth = 2; + usesTabs = 0; + }; + 83CBBA001A601CBA00E9B192 /* Products */ = { + isa = PBXGroup; + children = ( + 13B07F961A680F5B00A75B9A /* AwesomeProject.app */, + 00E356EE1AD99517003FC87E /* AwesomeProjectTests.xctest */, + 2D02E47B1E0B4A5D006451C7 /* AwesomeProject-tvOS.app */, + 2D02E4901E0B4A5D006451C7 /* AwesomeProject-tvOSTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + F0E53DCEB82A442BA7B6000F /* Resources */ = { + isa = "PBXGroup"; + children = ( + 4826D8B37F1E478A93DE12C1 /* AntDesign.ttf */, + 1A8222CBCA1D4250A0F71B30 /* Entypo.ttf */, + B4CF6DB571F64B6F89EB017A /* EvilIcons.ttf */, + 68C217A3CBB14B008DDA89FD /* Feather.ttf */, + 663221E6A83645C38592EB9C /* FontAwesome.ttf */, + 40F65C61813640E5A75FE4EC /* FontAwesome5_Brands.ttf */, + 7DCD060701284501884E2F26 /* FontAwesome5_Regular.ttf */, + 5A284F88CC674CC3AC36A051 /* FontAwesome5_Solid.ttf */, + 8408EF6A98F746629A2A6A59 /* Fontisto.ttf */, + A75C56DA1B1540D788815AB9 /* Foundation.ttf */, + B47D680A0D7D4E278CAA46C5 /* Ionicons.ttf */, + 5046157983FB47A587E1BD73 /* MaterialCommunityIcons.ttf */, + F2E9DCC4461E4EDBB999E22A /* MaterialIcons.ttf */, + 6755EA5775A343CE8A86E597 /* Octicons.ttf */, + 119675C8C1AF483F8CDEC911 /* SimpleLineIcons.ttf */, + 1A194CF16D044E3F959B05A5 /* Zocial.ttf */, + ); + name = Resources; + sourceTree = ""; + path = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 00E356ED1AD99517003FC87E /* AwesomeProjectTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "AwesomeProjectTests" */; + buildPhases = ( + 00E356EA1AD99517003FC87E /* Sources */, + 00E356EB1AD99517003FC87E /* Frameworks */, + 00E356EC1AD99517003FC87E /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 00E356F51AD99517003FC87E /* PBXTargetDependency */, + ); + name = AwesomeProjectTests; + productName = AwesomeProjectTests; + productReference = 00E356EE1AD99517003FC87E /* AwesomeProjectTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 13B07F861A680F5B00A75B9A /* AwesomeProject */ = { + isa = PBXNativeTarget; + buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AwesomeProject" */; + buildPhases = ( + FD10A7F022414F080027D42C /* Start Packager */, + 13B07F871A680F5B00A75B9A /* Sources */, + 13B07F8C1A680F5B00A75B9A /* Frameworks */, + 13B07F8E1A680F5B00A75B9A /* Resources */, + 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AwesomeProject; + productName = AwesomeProject; + productReference = 13B07F961A680F5B00A75B9A /* AwesomeProject.app */; + productType = "com.apple.product-type.application"; + }; + 2D02E47A1E0B4A5D006451C7 /* AwesomeProject-tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "AwesomeProject-tvOS" */; + buildPhases = ( + FD10A7F122414F3F0027D42C /* Start Packager */, + 2D02E4771E0B4A5D006451C7 /* Sources */, + 2D02E4781E0B4A5D006451C7 /* Frameworks */, + 2D02E4791E0B4A5D006451C7 /* Resources */, + 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "AwesomeProject-tvOS"; + productName = "AwesomeProject-tvOS"; + productReference = 2D02E47B1E0B4A5D006451C7 /* AwesomeProject-tvOS.app */; + productType = "com.apple.product-type.application"; + }; + 2D02E48F1E0B4A5D006451C7 /* AwesomeProject-tvOSTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "AwesomeProject-tvOSTests" */; + buildPhases = ( + 2D02E48C1E0B4A5D006451C7 /* Sources */, + 2D02E48D1E0B4A5D006451C7 /* Frameworks */, + 2D02E48E1E0B4A5D006451C7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */, + ); + name = "AwesomeProject-tvOSTests"; + productName = "AwesomeProject-tvOSTests"; + productReference = 2D02E4901E0B4A5D006451C7 /* AwesomeProject-tvOSTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 83CBB9F71A601CBA00E9B192 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1130; + TargetAttributes = { + 00E356ED1AD99517003FC87E = { + CreatedOnToolsVersion = 6.2; + TestTargetID = 13B07F861A680F5B00A75B9A; + }; + 13B07F861A680F5B00A75B9A = { + LastSwiftMigration = 1120; + }; + 2D02E47A1E0B4A5D006451C7 = { + CreatedOnToolsVersion = 8.2.1; + ProvisioningStyle = Automatic; + }; + 2D02E48F1E0B4A5D006451C7 = { + CreatedOnToolsVersion = 8.2.1; + ProvisioningStyle = Automatic; + TestTargetID = 2D02E47A1E0B4A5D006451C7; + }; + }; + }; + buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AwesomeProject" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 83CBB9F61A601CBA00E9B192; + productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 13B07F861A680F5B00A75B9A /* AwesomeProject */, + 00E356ED1AD99517003FC87E /* AwesomeProjectTests */, + 2D02E47A1E0B4A5D006451C7 /* AwesomeProject-tvOS */, + 2D02E48F1E0B4A5D006451C7 /* AwesomeProject-tvOSTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 00E356EC1AD99517003FC87E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 13B07F8E1A680F5B00A75B9A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, + 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, + 61ACEE6256B4485DAE9B6493 /* AntDesign.ttf in Resources */, + E6298E81B41346BFB147CD80 /* Entypo.ttf in Resources */, + 800C8C37BBF949A88E844820 /* EvilIcons.ttf in Resources */, + 98B5E5A955E347DE8C1F0E01 /* Feather.ttf in Resources */, + BEE612F4B19C4D5E9DB66B04 /* FontAwesome.ttf in Resources */, + 3C83E6A2F6EC40B4A0599941 /* FontAwesome5_Brands.ttf in Resources */, + B69EDE2E73E94C009E13764E /* FontAwesome5_Regular.ttf in Resources */, + 154107F2342A49EE96D97040 /* FontAwesome5_Solid.ttf in Resources */, + 0F375BC7BD904D8FBC6CC871 /* Fontisto.ttf in Resources */, + FC6EEC622D1F401FBC5AFBFA /* Foundation.ttf in Resources */, + F5EC1F245FFE48188155BCFB /* Ionicons.ttf in Resources */, + 1856DA8856744CDEA124F981 /* MaterialCommunityIcons.ttf in Resources */, + BE78DEB0F87F41C2BA0A7A28 /* MaterialIcons.ttf in Resources */, + 0CFFEE9C505F4D1382F72685 /* Octicons.ttf in Resources */, + 0E3FBDAF2BFE4CB7986CC2DD /* SimpleLineIcons.ttf in Resources */, + 496FBB744DC7422887C2E6B0 /* Zocial.ttf in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2D02E4791E0B4A5D006451C7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2D02E48E1E0B4A5D006451C7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Bundle React Native code and images"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; + }; + 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Bundle React Native Code And Images"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; + }; + FD10A7F022414F080027D42C /* Start Packager */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Start Packager"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; + showEnvVarsInLog = 0; + }; + FD10A7F122414F3F0027D42C /* Start Packager */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Start Packager"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 00E356EA1AD99517003FC87E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 00E356F31AD99517003FC87E /* AwesomeProjectTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 13B07F871A680F5B00A75B9A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, + 13B07FC11A68108700A75B9A /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2D02E4771E0B4A5D006451C7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, + 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2D02E48C1E0B4A5D006451C7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2DCD954D1E0B4F2C00145EB5 /* AwesomeProjectTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 13B07F861A680F5B00A75B9A /* AwesomeProject */; + targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; + }; + 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2D02E47A1E0B4A5D006451C7 /* AwesomeProject-tvOS */; + targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + 13B07FB21A68108700A75B9A /* Base */, + ); + name = LaunchScreen.xib; + path = AwesomeProject; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 00E356F61AD99517003FC87E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = AwesomeProjectTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + "$(inherited)", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AwesomeProject.app/AwesomeProject"; + }; + name = Debug; + }; + 00E356F71AD99517003FC87E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + COPY_PHASE_STRIP = NO; + INFOPLIST_FILE = AwesomeProjectTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + "$(inherited)", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AwesomeProject.app/AwesomeProject"; + }; + name = Release; + }; + 13B07F941A680F5B00A75B9A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = 1; + ENABLE_BITCODE = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "FB_SONARKIT_ENABLED=1", + ); + INFOPLIST_FILE = AwesomeProject/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = AwesomeProject; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 13B07F951A680F5B00A75B9A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_FILE = AwesomeProject/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = AwesomeProject; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; + 2D02E4971E0B4A5E006451C7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "AwesomeProject-tvOS/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.AwesomeProject-tvOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.2; + }; + name = Debug; + }; + 2D02E4981E0B4A5E006451C7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "AwesomeProject-tvOS/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.AwesomeProject-tvOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.2; + }; + name = Release; + }; + 2D02E4991E0B4A5E006451C7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "AwesomeProject-tvOSTests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.AwesomeProject-tvOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AwesomeProject-tvOS.app/AwesomeProject-tvOS"; + TVOS_DEPLOYMENT_TARGET = 10.1; + }; + name = Debug; + }; + 2D02E49A1E0B4A5E006451C7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "AwesomeProject-tvOSTests/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-lc++", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.AwesomeProject-tvOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AwesomeProject-tvOS.app/AwesomeProject-tvOS"; + TVOS_DEPLOYMENT_TARGET = 10.1; + }; + name = Release; + }; + 83CBBA201A601CBA00E9B192 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; + LIBRARY_SEARCH_PATHS = ( + "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", + "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", + "\"$(inherited)\"", + ); + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 83CBBA211A601CBA00E9B192 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; + LIBRARY_SEARCH_PATHS = ( + "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", + "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", + "\"$(inherited)\"", + ); + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "AwesomeProjectTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 00E356F61AD99517003FC87E /* Debug */, + 00E356F71AD99517003FC87E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AwesomeProject" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 13B07F941A680F5B00A75B9A /* Debug */, + 13B07F951A680F5B00A75B9A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "AwesomeProject-tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D02E4971E0B4A5E006451C7 /* Debug */, + 2D02E4981E0B4A5E006451C7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "AwesomeProject-tvOSTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2D02E4991E0B4A5E006451C7 /* Debug */, + 2D02E49A1E0B4A5E006451C7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AwesomeProject" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 83CBBA201A601CBA00E9B192 /* Debug */, + 83CBBA211A601CBA00E9B192 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; +} diff --git a/react-native-redux/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject-tvOS.xcscheme b/react-native-redux/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject-tvOS.xcscheme new file mode 100644 index 0000000..361ca1e --- /dev/null +++ b/react-native-redux/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject-tvOS.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/react-native-redux/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject.xcscheme b/react-native-redux/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject.xcscheme new file mode 100644 index 0000000..5a3289a --- /dev/null +++ b/react-native-redux/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/react-native-redux/ios/AwesomeProject/AppDelegate.h b/react-native-redux/ios/AwesomeProject/AppDelegate.h new file mode 100644 index 0000000..ef1de86 --- /dev/null +++ b/react-native-redux/ios/AwesomeProject/AppDelegate.h @@ -0,0 +1,8 @@ +#import +#import + +@interface AppDelegate : UIResponder + +@property (nonatomic, strong) UIWindow *window; + +@end diff --git a/react-native-redux/ios/AwesomeProject/AppDelegate.m b/react-native-redux/ios/AwesomeProject/AppDelegate.m new file mode 100644 index 0000000..17d791c --- /dev/null +++ b/react-native-redux/ios/AwesomeProject/AppDelegate.m @@ -0,0 +1,58 @@ +#import "AppDelegate.h" + +#import +#import +#import + +#if DEBUG +#import +#import +#import +#import +#import +#import + +static void InitializeFlipper(UIApplication *application) { + FlipperClient *client = [FlipperClient sharedClient]; + SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; + [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; + [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; + [client addPlugin:[FlipperKitReactPlugin new]]; + [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; + [client start]; +} +#endif + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ +#if DEBUG + InitializeFlipper(application); +#endif + + RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; + RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge + moduleName:@"AwesomeProject" + initialProperties:nil]; + + rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; + + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; + UIViewController *rootViewController = [UIViewController new]; + rootViewController.view = rootView; + self.window.rootViewController = rootViewController; + [self.window makeKeyAndVisible]; + return YES; +} + +- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge +{ +#if DEBUG + return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; +#else + return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; +#endif +} + +@end diff --git a/react-native-redux/ios/AwesomeProject/Base.lproj/LaunchScreen.xib b/react-native-redux/ios/AwesomeProject/Base.lproj/LaunchScreen.xib new file mode 100644 index 0000000..44ef61b --- /dev/null +++ b/react-native-redux/ios/AwesomeProject/Base.lproj/LaunchScreen.xib @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/react-native-redux/ios/AwesomeProject/Images.xcassets/AppIcon.appiconset/Contents.json b/react-native-redux/ios/AwesomeProject/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..118c98f --- /dev/null +++ b/react-native-redux/ios/AwesomeProject/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/react-native-redux/ios/AwesomeProject/Images.xcassets/Contents.json b/react-native-redux/ios/AwesomeProject/Images.xcassets/Contents.json new file mode 100644 index 0000000..2d92bd5 --- /dev/null +++ b/react-native-redux/ios/AwesomeProject/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/react-native-redux/ios/AwesomeProject/Info.plist b/react-native-redux/ios/AwesomeProject/Info.plist new file mode 100644 index 0000000..885d9fc --- /dev/null +++ b/react-native-redux/ios/AwesomeProject/Info.plist @@ -0,0 +1,76 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + AwesomeProject + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSExceptionDomains + + localhost + + NSExceptionAllowsInsecureHTTPLoads + + + + + NSLocationWhenInUseUsageDescription + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + UIAppFonts + + AntDesign.ttf + Entypo.ttf + EvilIcons.ttf + Feather.ttf + FontAwesome.ttf + FontAwesome5_Brands.ttf + FontAwesome5_Regular.ttf + FontAwesome5_Solid.ttf + Fontisto.ttf + Foundation.ttf + Ionicons.ttf + MaterialCommunityIcons.ttf + MaterialIcons.ttf + Octicons.ttf + SimpleLineIcons.ttf + Zocial.ttf + + + diff --git a/react-native-redux/ios/AwesomeProject/main.m b/react-native-redux/ios/AwesomeProject/main.m new file mode 100644 index 0000000..b1df44b --- /dev/null +++ b/react-native-redux/ios/AwesomeProject/main.m @@ -0,0 +1,9 @@ +#import + +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/react-native-redux/ios/AwesomeProjectTests/AwesomeProjectTests.m b/react-native-redux/ios/AwesomeProjectTests/AwesomeProjectTests.m new file mode 100644 index 0000000..5e677a8 --- /dev/null +++ b/react-native-redux/ios/AwesomeProjectTests/AwesomeProjectTests.m @@ -0,0 +1,65 @@ +#import +#import + +#import +#import + +#define TIMEOUT_SECONDS 600 +#define TEXT_TO_LOOK_FOR @"Welcome to React" + +@interface AwesomeProjectTests : XCTestCase + +@end + +@implementation AwesomeProjectTests + +- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test +{ + if (test(view)) { + return YES; + } + for (UIView *subview in [view subviews]) { + if ([self findSubviewInView:subview matching:test]) { + return YES; + } + } + return NO; +} + +- (void)testRendersWelcomeScreen +{ + UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; + NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; + BOOL foundElement = NO; + + __block NSString *redboxError = nil; +#ifdef DEBUG + RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { + if (level >= RCTLogLevelError) { + redboxError = message; + } + }); +#endif + + while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { + [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; + [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; + + foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { + if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { + return YES; + } + return NO; + }]; + } + +#ifdef DEBUG + RCTSetLogFunction(RCTDefaultLogFunction); +#endif + + XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); + XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); +} + + +@end diff --git a/react-native-redux/ios/AwesomeProjectTests/Info.plist b/react-native-redux/ios/AwesomeProjectTests/Info.plist new file mode 100644 index 0000000..ba72822 --- /dev/null +++ b/react-native-redux/ios/AwesomeProjectTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/react-native-redux/ios/Podfile b/react-native-redux/ios/Podfile new file mode 100644 index 0000000..0c91946 --- /dev/null +++ b/react-native-redux/ios/Podfile @@ -0,0 +1,83 @@ +platform :ios, '9.0' +require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' + +def add_flipper_pods! + version = '~> 0.33.1' + pod 'FlipperKit', version, :configuration => 'Debug' + pod 'FlipperKit/FlipperKitLayoutPlugin', version, :configuration => 'Debug' + pod 'FlipperKit/SKIOSNetworkPlugin', version, :configuration => 'Debug' + pod 'FlipperKit/FlipperKitUserDefaultsPlugin', version, :configuration => 'Debug' + pod 'FlipperKit/FlipperKitReactPlugin', version, :configuration => 'Debug' +end + +# Post Install processing for Flipper +def flipper_post_install(installer) + installer.pods_project.targets.each do |target| + if target.name == 'YogaKit' + target.build_configurations.each do |config| + config.build_settings['SWIFT_VERSION'] = '4.1' + end + end + end +end + +target 'AwesomeProject' do + # Pods for AwesomeProject + pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" + pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" + pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" + pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" + pod 'React', :path => '../node_modules/react-native/' + pod 'React-Core', :path => '../node_modules/react-native/' + pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' + pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' + pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' + pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' + pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' + pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' + pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' + pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' + pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' + pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' + pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' + pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' + + pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' + pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' + pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' + pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' + pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon" + pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" + pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true + + pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' + pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' + pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' + + pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' + + target 'AwesomeProjectTests' do + inherit! :complete + # Pods for testing + end + + use_native_modules! + + # Enables Flipper. + # + # Note that if you have use_frameworks! enabled, Flipper will not work and + # you should disable these next few lines. + add_flipper_pods! + post_install do |installer| + flipper_post_install(installer) + end +end + +target 'AwesomeProject-tvOS' do + # Pods for AwesomeProject-tvOS + + target 'AwesomeProject-tvOSTests' do + inherit! :search_paths + # Pods for testing + end +end diff --git a/react-native-redux/metro.config.js b/react-native-redux/metro.config.js new file mode 100644 index 0000000..13a9642 --- /dev/null +++ b/react-native-redux/metro.config.js @@ -0,0 +1,17 @@ +/** + * Metro configuration for React Native + * https://github.com/facebook/react-native + * + * @format + */ + +module.exports = { + transformer: { + getTransformOptions: async () => ({ + transform: { + experimentalImportSupport: false, + inlineRequires: false, + }, + }), + }, +}; diff --git a/react-native-redux/package.json b/react-native-redux/package.json new file mode 100644 index 0000000..7fe5dd3 --- /dev/null +++ b/react-native-redux/package.json @@ -0,0 +1,37 @@ +{ + "name": "ChannelizeReactNative", + "version": "0.0.1", + "private": true, + "scripts": { + "android": "react-native run-android", + "ios": "react-native run-ios", + "start": "react-native start", + "test": "jest", + "lint": "eslint ." + }, + "dependencies": { + "immer": "^6.0.3", + "react": "16.11.0", + "react-native": "0.62.0", + "react-native-vector-icons": "^6.6.0", + "react-redux": "^7.2.0", + "redux": "^4.0.5", + "redux-thunk": "^2.3.0", + "uuidv4": "^6.0.7" + }, + "devDependencies": { + "@babel/core": "^7.6.2", + "@babel/runtime": "^7.6.2", + "@react-native-community/eslint-config": "^0.0.5", + "babel-jest": "^24.9.0", + "eslint": "^6.5.1", + "jest": "^24.9.0", + "metro-react-native-babel-preset": "^0.58.0", + "react-test-renderer": "16.11.0", + "redux-logger": "^3.0.6", + "remote-redux-devtools": "^0.5.16" + }, + "jest": { + "preset": "react-native" + } +} diff --git a/react-native-redux/src/actions/clientActions.js b/react-native-redux/src/actions/clientActions.js new file mode 100644 index 0000000..af85499 --- /dev/null +++ b/react-native-redux/src/actions/clientActions.js @@ -0,0 +1,107 @@ +import { + CONNECT_SUCCESS, + CONNECT_FAIL, + DISCONNECT_SUCCESS, + DISCONNECT_FAIL, + NEW_MESSAGE_RECEIVED, + USER_STATUS_UPDATED +} from '../constants'; + +const _connect = (client, userId, accessToken) => { + return new Promise((resolve, reject) => { + if (!userId) { + reject('UserID is required.'); + return; + } + if (!accessToken) { + reject('accessToken is required.'); + return; + } + + if (!client) { + reject('Channelize.io client was not created.'); + } + + client.connect(userId, accessToken, (error, res) => { + if (error) { + reject('Channelize.io connection Failed.'); + } else { + resolve(res); + } + }); + }); +}; + +export const chConnect = (client, userId, accessToken) => { + return dispatch => { + return _connect(client, userId, accessToken) + .then(response => connectSuccess(dispatch, response)) + .catch(error => connectFail(dispatch, error)); + }; +}; + +const connectSuccess = (dispatch, response) => { + dispatch({ + type: CONNECT_SUCCESS, + payload: response + }); +}; + +const connectFail = (dispatch, error) => { + dispatch({ + type: CONNECT_FAIL, + payload: error + }); +}; + +const _disconnect = (client) => { + return new Promise((resolve, reject) => { + if (client) { + client.disconnect(() => { + resolve(null); + }); + } else { + resolve(null); + } + }); +}; + +export const chDisconnect = (client) => { + return dispatch => { + return _disconnect(client) + .then(response => disconnectSuccess(dispatch, response)) + .catch(error => disconnectFail(dispatch, error)); + }; +}; + +const disconnectSuccess = (dispatch, response) => { + dispatch({ + type: DISCONNECT_SUCCESS, + payload: response + }); +}; + +const disconnectFail = (dispatch, error) => { + dispatch({ + type: DISCONNECT_FAIL, + payload: error + }); +}; + +export const registerEventHandlers = (client) => { + return dispatch => { + client.chsocket.on('user.status_updated', function (payload) { + dispatch({ + type: USER_STATUS_UPDATED, + payload: payload + }); + }); + + client.chsocket.on('user.message_created', function (response) { + dispatch({ + type: NEW_MESSAGE_RECEIVED, + payload: response + }); + }); + }; +}; \ No newline at end of file diff --git a/react-native-redux/src/actions/conversationActions.js b/react-native-redux/src/actions/conversationActions.js new file mode 100644 index 0000000..d102be9 --- /dev/null +++ b/react-native-redux/src/actions/conversationActions.js @@ -0,0 +1,70 @@ +import { + LOADING_CONVERSATION_LIST, + CONVERSATION_LIST_FAIL, + CONVERSATION_LIST_SUCCESS, + LOADING_ACTIVE_CONVERSATION, + ACTIVE_CONVERSATION_FAIL, + ACTIVE_CONVERSATION_SUCCESS +} from '../constants'; + +export const getConversationList = (conversationListQuery) => { + return dispatch => { + dispatch({ + type: LOADING_CONVERSATION_LIST, + payload: {} + }); + return conversationListQuery.list((err, response) => { + if (err) { + dispatch({ + type: CONVERSATION_LIST_FAIL, + payload: error + }); + } + dispatch({ + type: CONVERSATION_LIST_SUCCESS, + payload: response + }); + }) + }; +}; + +export const getActiveConversation = (client, {userId, conversationId}) => { + let conversationListQuery = client.Conversation.createConversationListQuery(); + if (userId) { + conversationListQuery.membersExactly = userId; + conversationListQuery.isGroup = false; + } + + if (conversationId) { + conversationListQuery.ids = conversationId; + } + + return dispatch => { + dispatch({ + type: LOADING_ACTIVE_CONVERSATION, + payload: {} + }); + return conversationListQuery.list((err, conversations) => { + if (err) { + return dispatch({ + type: ACTIVE_CONVERSATION_FAIL, + payload: error + }); + } + + if (conversations.length) { + return dispatch({ + type: ACTIVE_CONVERSATION_SUCCESS, + payload: conversations[0] + }); + } + + client.User.get(userId, (err, user) => { + return dispatch({ + type: ACTIVE_CONVERSATION_SUCCESS, + payload: {isGroup: false, user} + }); + }) + }) + }; +}; diff --git a/react-native-redux/src/actions/index.js b/react-native-redux/src/actions/index.js new file mode 100644 index 0000000..e832f7e --- /dev/null +++ b/react-native-redux/src/actions/index.js @@ -0,0 +1,3 @@ +export * from './clientActions'; +export * from './conversationActions'; +export * from './messageActions'; diff --git a/react-native-redux/src/actions/messageActions.js b/react-native-redux/src/actions/messageActions.js new file mode 100644 index 0000000..b7d9594 --- /dev/null +++ b/react-native-redux/src/actions/messageActions.js @@ -0,0 +1,96 @@ +import { + LOADING_MESSAGE_LIST, + MESSAGE_LIST_FAIL, + MESSAGE_LIST_SUCCESS, + SENDING_MESSAGE, + SEND_MESSAGE_FAIL, + SEND_MESSAGE_SUCCESS, + LOADING_LOAD_MORE_MESSAGES, + LOAD_MORE_MESSAGES_SUCCESS, + LOAD_MORE_MESSAGES_FAIL +} from '../constants'; + +export const sendMessageToConversation = (conversation, body) => { + return dispatch => { + // dispatch({ + // type: SENDING_MESSAGE, + // payload: body + // }); + return conversation.sendMessage(body, (err, response) => { + if (err) { + body.error = err; + dispatch({ + type: SEND_MESSAGE_FAIL, + payload: body + }); + } + dispatch({ + type: SEND_MESSAGE_SUCCESS, + payload: response + }); + }) + }; +}; + +export const sendMessageToUserId = (client, userId, body) => { + return dispatch => { + // dispatch({ + // type: SENDING_MESSAGE, + // payload: body + // }); + return client.Message.sendMessage(body, (err, response) => { + if (err) { + dispatch({ + type: SEND_MESSAGE_FAIL, + payload: error + }); + } + dispatch({ + type: SEND_MESSAGE_SUCCESS, + payload: response + }); + }) + }; +}; + +export const getMessageList = (messageListQuery) => { + return dispatch => { + dispatch({ + type: LOADING_MESSAGE_LIST, + payload: {} + }); + return messageListQuery.list((err, response) => { + if (err) { + dispatch({ + type: MESSAGE_LIST_FAIL, + payload: error + }); + } + dispatch({ + type: MESSAGE_LIST_SUCCESS, + payload: response + }); + }) + }; +}; + +export const loadMoreMessages = (messageListQuery) => { + return dispatch => { + dispatch({ + type: LOADING_LOAD_MORE_MESSAGES, + payload: {} + }); + return messageListQuery.list((err, response) => { + if (err) { + dispatch({ + type: LOAD_MORE_MESSAGES_FAIL, + payload: error + }); + } + dispatch({ + type: LOAD_MORE_MESSAGES_SUCCESS, + payload: response + }); + }) + }; +}; diff --git a/react-native-redux/src/components/Connect.js b/react-native-redux/src/components/Connect.js new file mode 100644 index 0000000..742747d --- /dev/null +++ b/react-native-redux/src/components/Connect.js @@ -0,0 +1,58 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { ConnectContext } from '../context'; +import { chConnect, registerEventHandlers } from '../actions'; +import { connect } from 'react-redux'; + +class Connect extends Component { + static propTypes = { + /** The Channelize.io client object */ + client: PropTypes.object.isRequired, + } + + constructor(props) { + super(props); + this.state = { + connected: false + }; + } + + componentDidMount() { + const { client, userId, accessToken } = this.props; + this.props.chConnect(client, userId, accessToken); + } + + componentDidUpdate(prevProps) { + if (!this.props.connected) { + return; + } + + // Register real time events after successful connection + if (!prevProps.connected && this.props.connected) { + this.props.registerEventHandlers(this.props.client) + } + } + + getContext = () => ({ + client: this.props.client + }) + + render() { + const { connected } = this.props; + return ( + + { connected && this.props.children } + + ); + } +}; + +function mapStateToProps({ client }) { + const { connected, error } = client; + return { error, connected }; +} + +export default connect( + mapStateToProps, + { chConnect, registerEventHandlers } +)(Connect); diff --git a/react-native-redux/src/components/ConversationWindow.js b/react-native-redux/src/components/ConversationWindow.js new file mode 100644 index 0000000..6adff56 --- /dev/null +++ b/react-native-redux/src/components/ConversationWindow.js @@ -0,0 +1,335 @@ +import React, { PureComponent } from 'react'; +import { View, Image, TextInput, TouchableOpacity, FlatList, Text, Dimensions, Platform } from 'react-native'; +import Icon from 'react-native-vector-icons/FontAwesome'; +import uuidv4 from 'uuid/v4'; +import { + getActiveConversation, + getMessageList, + sendMessageToConversation, + sendMessageToUserId, + loadMoreMessages as loadMoreMessagesAction +} from '../actions'; +import { withConnectContext } from '../context'; +import { connect } from 'react-redux'; +import { modifyMessageList, updateTimeFormat } from '../utils'; + +class ConversationWindow extends PureComponent { + constructor(props) { + super(props); + + this.state = { + text: '', + needActiveConversation: false + } + + this.limit = 30; + this.skip = 0; + this.sendMessage = this.sendMessage.bind(this); + this.loadMoreMessage = this.loadMoreMessage.bind(this); + } + + componentDidMount() { + const { client, userId, conversationId } = this.props; + this.props.getActiveConversation(client, {userId, conversationId}) + } + + componentDidUpdate(prevProps) { + const { needActiveConversation } = this.state; + if (!this.props.activeConversation) { + return; + } + + if (!needActiveConversation && !this.props.activeConversation.id) { + this.setState({needActiveConversation: true}); + } + + if (needActiveConversation && this.props.list.length && !this.props.activeConversation.id && !this.props.conversationLoading) { + const message = this.props.list[0]; + this.props.getActiveConversation(this.props.client, {conversationId: message.conversationId}) + } + + if (needActiveConversation && this.props.activeConversation.id) { + this.setState({needActiveConversation: false}); + } + + if (needActiveConversation || this.props.list.length) { + return + } + + // Load messages after loading active conversation + if ((!prevProps.activeConversation && this.props.activeConversation.id) || (prevProps.activeConversation && this.props.activeConversation.id !== prevProps.activeConversation.id)) { + let messageListQuery = this.props.activeConversation.createMessageListQuery(); + messageListQuery.limit = this.limit; + messageListQuery.skip = this.skip; + this.props.getMessageList(messageListQuery) + } + } + + _renderMessage(message) { + const { client } = this.props; + return ( + + { message.owner.isShow && !message.isUser && + + + {message.owner.displayName} + + + } + + {message.body} + + + + {message.createdAt} + + + + ) + } + + sendMessage() { + const { activeConversation, client } = this.props; + const { text } = this.state; + let body = { + id: uuidv4(), + body: text + } + this.setState({text: ''}) + + if (activeConversation.id) { + this.props.sendMessageToConversation(activeConversation, body) + } else { + const userId = activeConversation.user.id; + body.userId = userId; + this.props.sendMessageToUserId(client, userId, body) + } + } + + loadMoreMessage() { + const { activeConversation, list, loadingMoreMessage, allMessageLoaded } = this.props; + if (loadingMoreMessage || allMessageLoaded || list.length < this.limit) { + return + } + + // Set skip + this.skip = list.length; + + let messageListQuery = activeConversation.createMessageListQuery(); + messageListQuery.limit = this.limit; + messageListQuery.skip = this.skip; + this.props.loadMoreMessagesAction(messageListQuery) + } + + render() { + let { activeConversation, list, conversationLoading, messageLoading, error, client } = this.props; + const { text } = this.state; + + if ((!activeConversation || conversationLoading) && !list.length) { + return ( + + Loading... + + ) + } + + if (error) { + return ( + + Something Went Wrong + + ) + } + + let headerImage; + let headetTitle; + let headerSubtitle; + if (!activeConversation.isGroup) { + headerImage = activeConversation.user.profileImageUrl; + headetTitle = activeConversation.user.displayName; + headerSubtitle = activeConversation.user.isOnline ? 'Online' : 'Last seen ' + updateTimeFormat(activeConversation.user.lastSeen); + } else { + headerImage = activeConversation.profileImageUrl; + headetTitle = activeConversation.title; + headerSubtitle = activeConversation.memberCount + ' Members'; + } + + list = modifyMessageList(client, list); + return ( + + + + + + + {headetTitle} + {headerSubtitle} + + + + { messageLoading && + + Loading... + + } + { !messageLoading && + console.log('Scrolling')} + extraData={true} + onEndReached={this.loadMoreMessage} + ListEmptyComponent={No Messsage Found} + inverted + renderItem={({item: message}) => this._renderMessage(message)} + keyboardShouldPersistTaps="always" + keyExtractor={(item) => + item.id || + item.created_at || + (item.date ? item.date.toISOString() : false) || + uuidv4() + } + /> + } + + + this.setState({text})} + /> + + + + + + ) + } +}; + +const styles = { + container: { + position: 'absolute', + top: 0, + height: '100%', + width: '100%', + backgroundColor: '#FFFFFF', + flex:1, + flexDirection: 'column' + }, + header: { + padding: 10, + flexDirection: 'row', + backgroundColor: '#1A6DF5', + }, + headerImage: { + justifyContent: 'center', + width: '10%', + marginRight: 10 + }, + headerTitle: { + width: '40%', + overflow: 'hidden', + flexDirection: 'column', + }, + headerTitleText: { + color: "#FFFFFF", + textTransform: 'capitalize' + }, + headerSubtitleText: { + color: "#FFFFFF", + textTransform: 'capitalize' + }, + messageListContainer: { + paddingLeft: 10, + paddingRight: 10, + flexDirection: 'column', + flex: 10 + }, + flatList: { + }, + messageLeft: { + alignSelf: 'flex-start', + marginBottom: 20, + }, + messageLeftBubble: { + padding: 20, + backgroundColor: '#F5F5F5' + }, + messageLeftText: { + color: "#544867" + }, + messageCreatedText: { + color: "#878d99" + }, + messageOwnerName: { + color: "#878d99", + textTransform: 'capitalize' + }, + messageRight: { + alignSelf: 'flex-end', + marginBottom: 20 + }, + messageRightBubble: { + padding: 20, + backgroundColor: "#1A6DF5" + }, + messageRightText: { + color: "#FFFFFF" + }, + messageComposer: { + backgroundColor: '#F5F5F5', + padding: 10, + flexDirection: 'row' + }, + messageComposerInput: { + width: "90%", + }, + messageComposerSendButton: { + justifyContent: 'center' + } +}; + +function mapStateToProps({ conversation, message }) { + const { activeConversation } = conversation; + const { list, loadingMoreMessage, allMessageLoaded } = message; + + const conversationLoading = conversation.loading; + const messageLoading = message.loading; + + let error = conversation.error || message.error; + return { + activeConversation, + list, + conversationLoading, + messageLoading, + error, + loadingMoreMessage, + allMessageLoaded + }; +} + +ConversationWindow = withConnectContext(ConversationWindow); + +export default connect( + mapStateToProps, + { + getActiveConversation, + getMessageList, + sendMessageToConversation, + sendMessageToUserId, + loadMoreMessagesAction } +)(ConversationWindow); \ No newline at end of file diff --git a/react-native-redux/src/constants/index.js b/react-native-redux/src/constants/index.js new file mode 100644 index 0000000..6173efb --- /dev/null +++ b/react-native-redux/src/constants/index.js @@ -0,0 +1,21 @@ +export const CONNECT_SUCCESS = 'CONNECT_SUCCESS' +export const CONNECT_FAIL = 'CONNECT_FAIL' +export const DISCONNECT_SUCCESS = 'DISCONNECT_SUCCESS' +export const DISCONNECT_FAIL = 'DISCONNECT_FAIL' +export const LOADING_MESSAGE_LIST = 'LOADING_MESSAGE_LIST' +export const MESSAGE_LIST_FAIL = 'MESSAGE_LIST_FAIL' +export const MESSAGE_LIST_SUCCESS = 'MESSAGE_LIST_SUCCESS' +export const LOADING_ACTIVE_CONVERSATION = 'LOADING_ACTIVE_CONVERSATION' +export const ACTIVE_CONVERSATION_FAIL = 'ACTIVE_CONVERSATION_FAIL' +export const ACTIVE_CONVERSATION_SUCCESS = 'ACTIVE_CONVERSATION_SUCCESS' +export const SENDING_MESSAGE = 'SENDING_MESSAGE' +export const SEND_MESSAGE_FAIL = 'SEND_MESSAGE_FAIL' +export const SEND_MESSAGE_SUCCESS = 'SEND_MESSAGE_SUCCESS' +export const LOADING_LOAD_MORE_MESSAGES = 'LOADING_LOAD_MORE_MESSAGES' +export const LOAD_MORE_MESSAGES_SUCCESS = 'LOAD_MORE_MESSAGES_SUCCESS' +export const LOAD_MORE_MESSAGES_FAIL = 'LOAD_MORE_MESSAGES_FAIL' +export const NEW_MESSAGE_RECEIVED = 'NEW_MESSAGE_RECEIVED' +export const USER_STATUS_UPDATED = 'USER_STATUS_UPDATED' +export const LOADING_USER = 'LOADING_USER' +export const LOAD_USER_FAIL = 'LOAD_USER_FAIL' +export const LOAD_USER_SUCCESS = 'LOAD_USER_SUCCESS' \ No newline at end of file diff --git a/react-native-redux/src/context.js b/react-native-redux/src/context.js new file mode 100644 index 0000000..32f6cd5 --- /dev/null +++ b/react-native-redux/src/context.js @@ -0,0 +1,34 @@ +import React from 'react'; + +export const ConnectContext = React.createContext({ client: null }); + +export function withConnectContext(OriginalComponent) { + const ContextAwareComponent = getContextAwareComponent( + ConnectContext, + OriginalComponent, + ); + return ContextAwareComponent; +} + +const getContextAwareComponent = function(context, originalComponent) { + const Context = context; + const OriginalComponent = originalComponent; + const ContextAwareComponent = function(props) { + return ( + + {(c) => } + + ); + }; + + ContextAwareComponent.themePath = OriginalComponent.themePath; + ContextAwareComponent.extraThemePaths = OriginalComponent.extraThemePaths; + ContextAwareComponent.displayName = + OriginalComponent.displayName || OriginalComponent.name || 'Component'; + ContextAwareComponent.displayName = ContextAwareComponent.displayName.replace( + 'Base', + '', + ); + + return ContextAwareComponent; +}; \ No newline at end of file diff --git a/react-native-redux/src/reducers/clientReducer.js b/react-native-redux/src/reducers/clientReducer.js new file mode 100644 index 0000000..0286467 --- /dev/null +++ b/react-native-redux/src/reducers/clientReducer.js @@ -0,0 +1,26 @@ +import { + CONNECT_SUCCESS, + CONNECT_FAIL, + DISCONNECT_SUCCESS, + DISCONNECT_FAIL +} from '../constants'; + +const INITIAL_STATE = { + connected: false, + error: null +}; + +export default (state = INITIAL_STATE, action) => { + switch (action.type) { + case CONNECT_SUCCESS: + return { ...state, connected: true }; + case CONNECT_FAIL: + return { ...state, connected: false, error: action.payload }; + case DISCONNECT_SUCCESS: + return { ...state, connected: false }; + case DISCONNECT_FAIL: + return { ...state, connected: true, error: action.payload }; + default: + return state; + } +}; diff --git a/react-native-redux/src/reducers/conversationReducer.js b/react-native-redux/src/reducers/conversationReducer.js new file mode 100644 index 0000000..c19f6d4 --- /dev/null +++ b/react-native-redux/src/reducers/conversationReducer.js @@ -0,0 +1,45 @@ +import { + LOADING_ACTIVE_CONVERSATION, + ACTIVE_CONVERSATION_FAIL, + ACTIVE_CONVERSATION_SUCCESS, + USER_STATUS_UPDATED +} from '../constants'; +import { createReducer } from '../utils'; + +const INITIAL_STATE = { + list: [], + activeConversation: null, + loading: false, + error: null +}; + +export const loadingActiveConversation = (state, action) => { + state.loading = true; +}; + +export const activeConversationSuccess = (state, action) => { + state.loading = false; + state.activeConversation = action.payload; +}; + +export const activeConversationFail = (state, action) => { + state.loading = false; + state.error = action.payload; +}; + +export const userStatusUpdated = (state, action) => { + // const user = action.payload.user; + // if (user.id == state.activeConversation.user.id) { + // state.activeConversation.user = user; + // // state.activeConversation = {...state.activeConversation}; + // } +}; + +export const handlers = { + [LOADING_ACTIVE_CONVERSATION]: loadingActiveConversation, + [ACTIVE_CONVERSATION_FAIL]: activeConversationFail, + [ACTIVE_CONVERSATION_SUCCESS]: activeConversationSuccess, + [USER_STATUS_UPDATED]: userStatusUpdated +}; + +export default createReducer(INITIAL_STATE, handlers); \ No newline at end of file diff --git a/react-native-redux/src/reducers/index.js b/react-native-redux/src/reducers/index.js new file mode 100644 index 0000000..df7292e --- /dev/null +++ b/react-native-redux/src/reducers/index.js @@ -0,0 +1,10 @@ +import { combineReducers } from 'redux'; +import messageReducer from './messageReducer'; +import clientReducer from './clientReducer'; +import conversationReducer from './conversationReducer'; + +export default combineReducers({ + message: messageReducer, + conversation: conversationReducer, + client: clientReducer +}); diff --git a/react-native-redux/src/reducers/messageReducer.js b/react-native-redux/src/reducers/messageReducer.js new file mode 100644 index 0000000..f432cab --- /dev/null +++ b/react-native-redux/src/reducers/messageReducer.js @@ -0,0 +1,101 @@ +import { + LOADING_MESSAGE_LIST, + MESSAGE_LIST_FAIL, + MESSAGE_LIST_SUCCESS, + SENDING_MESSAGE, + SEND_MESSAGE_FAIL, + SEND_MESSAGE_SUCCESS, + LOADING_LOAD_MORE_MESSAGES, + LOAD_MORE_MESSAGES_SUCCESS, + LOAD_MORE_MESSAGES_FAIL, + ACTIVE_CONVERSATION_SUCCESS, + NEW_MESSAGE_RECEIVED +} from '../constants'; +import { createReducer, uniqueList } from '../utils'; + +const INITIAL_STATE = { + list: [], + loading: false, + error: null, + loadingMoreMessage: false, + allMessageLoaded: false, + activeConversation: null +}; + +export const loadingMessageList = (state, action) => { + state.loading = true; +}; + +export const messageListSuccess = (state, action) => { + state.loading = false; + state.list = action.payload; +}; + +export const messageListFail = (state, action) => { + state.loading = false; + state.error = action.payload; +}; + +export const loadingLoadMoreMessages = (state, action) => { + state.loadingMoreMessage = true; +}; + +export const loadMoreMessagesFail = (state, action) => { + state.loadingMoreMessage = false; + state.error = action.payload; +}; + +export const loadMoreMessagesSuccess = (state, action) => { + state.loadingMoreMessage = false; + if (!action.payload.length) { + state.allMessageLoaded = true; + } else { + state.list = [...state.list, ...action.payload]; + state.list = uniqueList(state.list); + } +}; + +export const sendingMessage = (state, action) => { + action.payload.status = "pending"; + state.list = [...[action.payload], ...state.list]; + state.list = uniqueList(state.list); +}; + +export const sendMessageSuccess = (state, action) => { + state.list = [...[action.payload], ...state.list]; + state.list = uniqueList(state.list); +}; + +export const sendMessageFail = (state, action) => { + action.payload.status = "failed"; + state.list = [...[action.payload], ...state.list]; + state.list = uniqueList(state.list); +}; + +export const activeConversationSuccess = (state, action) => { + state.activeConversation = action.payload; +}; + +export const newMessageReceived = (state, action) => { + let message = action.payload.message; + if (state.activeConversation.id == message.conversationId) { + state.list = [...[message], ...state.list]; + state.list = uniqueList(state.list); + } +}; + +export const handlers = { + [LOADING_MESSAGE_LIST]: loadingMessageList, + [MESSAGE_LIST_SUCCESS]: messageListSuccess, + [MESSAGE_LIST_FAIL]: messageListFail, + [SENDING_MESSAGE]: sendingMessage, + [SEND_MESSAGE_SUCCESS]: sendMessageSuccess, + [SEND_MESSAGE_FAIL]: sendMessageFail, + [LOADING_LOAD_MORE_MESSAGES]: loadingLoadMoreMessages, + [LOAD_MORE_MESSAGES_SUCCESS]: loadMoreMessagesSuccess, + [LOAD_MORE_MESSAGES_FAIL]: loadMoreMessagesFail, + [ACTIVE_CONVERSATION_SUCCESS]: activeConversationSuccess, + [NEW_MESSAGE_RECEIVED]: newMessageReceived +}; + +export default createReducer(INITIAL_STATE, handlers); \ No newline at end of file diff --git a/react-native-redux/src/store/index.js b/react-native-redux/src/store/index.js new file mode 100644 index 0000000..02308cc --- /dev/null +++ b/react-native-redux/src/store/index.js @@ -0,0 +1,31 @@ +import { createStore, applyMiddleware, compose } from 'redux'; + +import thunk from 'redux-thunk'; +import { logger } from 'redux-logger'; +import { composeWithDevTools } from 'remote-redux-devtools'; + +import rootReducer from '../reducers'; + +const initialState = {}; +const enhancers = []; +const middleware = [ + thunk, +]; + +let composeFunction = compose; + +if (process.env.NODE_ENV === 'development') { + composeFunction = composeWithDevTools; + middleware.push(logger); +} + +const composedEnhancers = composeFunction( + applyMiddleware(...middleware), + ...enhancers, +); + +export const store = createStore( + rootReducer, + initialState, + composedEnhancers +); diff --git a/react-native-redux/src/utils/index.js b/react-native-redux/src/utils/index.js new file mode 100644 index 0000000..6047e62 --- /dev/null +++ b/react-native-redux/src/utils/index.js @@ -0,0 +1,89 @@ +import {produce, setAutoFreeze} from "immer" +setAutoFreeze(false); + +export function createReducer(initialState, actionsMap) { + return (state = initialState, action) => { + return produce(state, draft => { + const caseReducer = actionsMap[action.type]; + return caseReducer ? caseReducer(draft, action) : undefined; + }); + }; +} + +export function uniqueList(list) { + return list.reduce((uniqList, currentValue) => { + let ids = uniqList.map(item => { + return item.id; + }); + if (ids.indexOf(currentValue.id) < 0) { + uniqList.push(currentValue); + } + return uniqList; + }, []); +}; + +export const modifyMessageList = (client, list) => { + const user = client.getLoginUser(); + return list.map((message, i) => { + if (!message.hasOwnProperty('isUser')) { + message['createdAt'] = updateTimeFormat(message.createdAt); + } + + // Determine if message owner is self or other? + message['isUser'] = false; + if (user.id == message.ownerId) { + message.isUser = true + } + + // Determine if message owner should be displayed or not? + message.owner.isShow = true; + if (i < list.length - 1) { + let prevMessage = list[i + 1]; + if (prevMessage.owner.id === message.owner.id) { + message.owner.isShow = false; + } + } + return message; + }); +}; + +export function updateTimeFormat(time) { + const months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; + + var _getDay = val => { + let day = parseInt(val); + if (day == 1) { + return day + "st"; + } else if (day == 2) { + return day + "nd"; + } else if (day == 3) { + return day + "rd"; + } else { + return day + "th"; + } + }; + + var _checkTime = val => { + return +val < 10 ? "0" + val : val; + }; + + if (time) { + const LAST_MESSAGE_YESTERDAY = "Yesterday"; + var _nowDate = new Date(); + var _date = new Date(time); + if (_nowDate.getDate() - _date.getDate() == 1) { + return LAST_MESSAGE_YESTERDAY; + } else if ( + _nowDate.getFullYear() == _date.getFullYear() && + _nowDate.getMonth() == _date.getMonth() && + _nowDate.getDate() == _date.getDate() + ) { + return ( + _checkTime(_date.getHours()) + ":" + _checkTime(_date.getMinutes()) + ); + } else { + return months[_date.getMonth()] + " " + _getDay(_date.getDate()); + } + } + return ""; +} \ No newline at end of file diff --git a/web-widget/README.md b/web-widget/README.md old mode 100755 new mode 100644 index 31e01eb..66163ea --- a/web-widget/README.md +++ b/web-widget/README.md @@ -1,18 +1,13 @@ # Channelize JavaScript Widget UI kit -This contains the customization capabilities you can achieve by using our JavaScript Sample App created using our [JavaScript SDK](https://docs.channelize.io/javascript-sdk-introduction-overview). This Sample App allows you to add a customized chat widget / docked layout on your website. +This JavaScript Sample app is built using our [JavaScript SDK](https://docs.channelize.io/javascript-sdk-introduction-overview), this will help you add a chat widget / docked layout to your website which can be customized to build chat exactly how you want, and unbelievably quickly. It enables achieving a beautiful chat app interface for all use-cases like live chat, online consultation & tutoring, team collaboration, messaging, customer support and gaming chat. -### Features : ### -- Highly customization -- Easy to implement -- Ready to use -- Multiple use cases -#### You can also check out our demo [here](https://demo.channelize.io). +#### See in Action [here](https://demo.channelize.io). ## Getting Started -Follow the below steps to add Channelize widget / docked layout on your website. +Follow the below steps to add the Channelize chat widget / docked layout to your website. ##### Step 1: Add widget ##### @@ -20,7 +15,7 @@ Add the Channelize widget div in the body tag of your website. ```html -

+
``` @@ -29,7 +24,7 @@ Add the Channelize widget div in the body tag of your website. Import the `widget.Channelize.js` file after body tag in your website. ```javascript - + ``` ##### Step 3: Import Channelize JS-SDK ##### @@ -37,17 +32,17 @@ Import the `widget.Channelize.js` file after body tag in your website. Import the [`Channelize JS-SDK`](https://docs.channelize.io/javascript-sdk-introduction-overview) after body tag in your website. ```javascript - + ``` ##### Step 4: Create widget object ##### -Create widget object and call the load function which will require your public key as an argument. +Create Channelize.io object and call the load function which will require your public key as an argument. ```javascript ``` @@ -62,12 +57,12 @@ Create widget object and call the load function which will require your public k 2. Install required npm packages. ```bash -npm install +sudo npm install ``` 3. Build your changes. ```bash -npm run build +sudo npm run build ``` 4. Start sample app. @@ -77,69 +72,57 @@ npm start ###### For UI Customizations : ###### -- Customize the UI of widget / docked layout as per your choice by changing the values of predefined variables in `./web-widget/src/scss/variables.scss file` or by making changes in the code of the elements/content. +- Customize the UI of chat widget / docked layout as per your choice by changing the values of predefined variables in `./web-widget/src/scss/variables.scss file` or by making changes in the code of the elements/content. ###### For Function Customizations : ###### -- Add your functions or make code-level changes. +- Add your own functions or make code-level changes. ## Advanced -### Change the application : -If you want to change your current application, you just need to change the `PUBLIC_KEY` in `index.html` file. +### Load for logged-in user +Load the Channelize for an already logged-in user, you can use `loadWithUserId()` method instead of load() method. loadWithUserId() method takes two arguments user-id and access token. you can get access token in the response of login api call. ```html ... - + ``` -### Load with already connected user : -If you want to load the Channelize for already connected user, you can use loadWithConnect() method instead of load() method. loadWithConnect() method takes two arguments user-id and access token. you can get access token in the response of login api call. +### Load Recent Conversations Screen +Load the recent conversations screen using `loadRecentConversation()` method. It takes two arguments user-id and access token. ```html ... - + ``` -### Load Recent Conversation Screen : -If you want to open only recent conversation, you can use `loadRecentConversation()` method. It takes two arguments user-id and access token. - -```html -... +### Load Conversation Window +Load conversation window using `loadConversationWindow()` method. It requires conversation-id as argument. - - +```js + loadConversationWindow(conversationId) ``` -### Load Conversation Window : -If you want to load conversation window, then you can use `loadConversationWindow()` method. It takes two arguments otherMemberId and conversationId. - -```html -... +### Load Conversation Window By User-Id +Load conversation window using `loadConversationWindowByUserId(userId)` method. It requires user-id as argument. - - +```js + loadConversationWindowByUserId(userId) ``` -## File Structure of Channelize Sample App : +## File Structure of Channelize Sample App ``` |-- dist |-- widget.Channelize.js - Channelize Widget Bundle file @@ -150,8 +133,10 @@ If you want to load conversation window, then you can use `loadConversationWindo |-- components |-- conversation-window.js - conversation screen class |-- login.js - login class + |-- members.js - members class |-- recent-conversation.js - recent conversation class |-- search.js - search class + |-- thread.js - thread screen class |-- adapter.js - Channelize JS SDK functions |-- constants.js - const variables |-- utility.js - utility functions @@ -164,4 +149,4 @@ If you want to load conversation window, then you can use `loadConversationWindo |-- README.md - description file |-- server.js - server file |-- webpack.config.js - webpack setting -``` +``` \ No newline at end of file diff --git a/web-widget/index.html b/web-widget/index.html index ffd1181..16cf922 100755 --- a/web-widget/index.html +++ b/web-widget/index.html @@ -8,11 +8,11 @@
- - + + diff --git a/web-widget/package.json b/web-widget/package.json old mode 100755 new mode 100644 index 38e141d..51b8472 --- a/web-widget/package.json +++ b/web-widget/package.json @@ -13,12 +13,13 @@ "@babel/core": "^7.7.4", "@babel/preset-env": "^7.7.4", "babel-loader": "^8.0.6", - "webpack": "^4.41.2", - "webpack-cli": "^3.3.10", "css-loader": "^3.4.0", "express": "^4.17.1", "node-sass": "^4.13.0", "sass-loader": "^8.0.0", - "style-loader": "^1.1.2" + "style-loader": "^1.1.2", + "uuid": "^7.0.3", + "webpack": "^4.41.2", + "webpack-cli": "^3.3.10" } } diff --git a/web-widget/server.js b/web-widget/server.js old mode 100755 new mode 100644 index 7c05a87..dfc77a8 --- a/web-widget/server.js +++ b/web-widget/server.js @@ -7,7 +7,7 @@ app.use(express.static('dist')); app.use(express.static('./')); app.get('/', function(req, res) { - res.sendfile('index.html'); + res.sendfile('index.html'); }); app.listen(PORT); diff --git a/web-widget/src/js/adapter.js b/web-widget/src/js/adapter.js old mode 100755 new mode 100644 index 4cd02a8..be53e24 --- a/web-widget/src/js/adapter.js +++ b/web-widget/src/js/adapter.js @@ -20,8 +20,8 @@ class ChannelizeAdapter { }); } - getCurrentUser(cb) { - return cb(null, this.channelize.getCurrentUser()); + getLoginUser() { + return this.channelize.getCurrentUser(); } connect(userId, accessToken, cb) { @@ -40,8 +40,13 @@ class ChannelizeAdapter { }); } - createUser(displayName, email, password, cb) { - this.channelize.User.createUser(displayName, email, password, function (err, user) { + createUser(name, email, password, cb) { + let data = { + displayName : name, + email : email, + password : password + } + this.channelize.User.createUser(data, function (err, user) { if(err) return cb(err); return cb(null, user); @@ -56,12 +61,19 @@ class ChannelizeAdapter { }); } - getConversationsList(limit, skip, memberId = null, cb) { + getConversationsList(limit, skip, memberIds, include, convIds, convType, search, isGroup, customTypes, cb) { let conversationListQuery = this.channelize.Conversation.createConversationListQuery(); conversationListQuery.limit = limit; conversationListQuery.skip = skip; - if(memberId) - conversationListQuery.memberId = memberId; + conversationListQuery.include = include; + conversationListQuery.ids = convIds; + conversationListQuery.type = convType; + conversationListQuery.search = search; + conversationListQuery.isGroup = isGroup; + conversationListQuery.customTypes = customTypes; + + if(memberIds) + conversationListQuery.membersExactly = memberIds; conversationListQuery.list(function (err, conversations) { if(err) return cb(err); @@ -71,7 +83,7 @@ class ChannelizeAdapter { } getConversation(conversationId, cb) { - this.channelize.Conversation.getConversation(conversationId, "messages", function (err, conversation) { + this.channelize.Conversation.getConversation(conversationId, "members", function (err, conversation) { if(err) return cb(err); return cb(null, conversation); @@ -86,108 +98,150 @@ class ChannelizeAdapter { }); } - addMember(conversation, memberIds, cb) { - conversation.addMembers(memberIds, function (err, res) { - if (err) return cb(err); + addMembers(conversation, memberIds, cb) { + conversation.addMembers(memberIds, function (err, res) { + if (err) return cb(err); - return cb(null, res); - }); + return cb(null, res); + }); } - removeMember(conversation, memberIds, cb) { - conversation.removeMembers(memberIds, function (err, res) { - if (err) return cb(err); + removeMembers(conversation, memberIds, cb) { + conversation.removeMembers(memberIds, function (err, res) { + if (err) return cb(err); - return cb(null, res); - }); + return cb(null, res); + }); } - blockMember(userId, cb) { + blockUser(userId, cb) { this.channelize.User.block(userId, function (err, res) { - if (err) return cb(err); + if (err) return cb(err); - return cb(null, res); - }); + return cb(null, res); + }); } - unblockMember(userId, cb) { + unblockUser(userId, cb) { this.channelize.User.unblock(userId, function (err, res) { - if (err) return cb(err); + if (err) return cb(err); - return cb(null, res); - }); + return cb(null, res); + }); } clearConversation(conversation, cb) { - conversation.clear(function (err, res) { - if (err) return cb(err); + conversation.clear(function (err, res) { + if (err) return cb(err); - return cb(null, res); - }); + return cb(null, res); + }); } leaveConversation(conversation, cb) { - conversation.leave(function (err, res) { - if (err) return cb(err); + conversation.leave(function (err, res) { + if (err) return cb(err); - return cb(null, res); - }); + return cb(null, res); + }); + } + + joinConversation(conversation, cb) { + conversation.join(function (err, res) { + if (err) return cb(err); + + return cb(null, res); + }); } muteConversation(conversation, cb) { - conversation.mute(function (err, res) { + conversation.muteConversation(function (err, res) { if (err) return cb(err); return cb(null, res); }); } - deleteConversation(conversation, cb) { - conversation.delete(function (err, res) { - if (err) return cb(err); + unmuteConversation(conversation, cb) { + conversation.unmuteConversation(function (err, res) { + if (err) return cb(err); return cb(null, res); - }); + }); } - markAsReadConversation(conversation, cb) { - conversation.markAllMessageRead(function (err, res) { - if (err) return cb(err); + deleteConversation(conversation, cb) { + conversation.delete(function (err, res) { + if (err) return cb(err); - return cb(null, res); - }); + return cb(null, res); + }); } - async sendTextMessage(conversation, body, tags = [], cb) { - conversation.sendTextMessage(body, tags, function (err, res) { - if (err) return cb(err); + markAsReadConversation(conversation, timestamp, cb) { + conversation.markAsRead(timestamp, function (err, res) { + if (err) return cb(err); - return cb(null, res); - }); + return cb(null, res); + }); + } + + sendMessage(conversation, data, cb) { + conversation.sendMessage(data, function (err, res) { + if (err) return cb(err); + + return cb(null, res); + }); + } + + sendMessageToUser(data, cb) { + this.channelize.Message.sendMessage(data, function (err, message) { + if (err) return cb(err); + + return cb(null, message); + }); } - async sendTextMessageToUser(userId, body, cb) { - this.channelize.Message.sendTextMessage(userId, body, function (err, message) { - if (err) return cb(err); + uploadFile(file, type, createThumbnail, cb) { + this.channelize.File.upload(file, type, createThumbnail, function(err, message) { + if (err) return cb(err); - return cb(null, message); - }); + return cb(null, message); + }); } - async sendFileMessage(conversation, file, createThumbnail, cb) { - conversation.sendFileMessage(file, createThumbnail, function(err, message) { - if (err) return cb(err); + getConversationMembers(conversation, cb) { + conversation.getMembers(function(err, members) { + if (err) return cb(err); - return cb(null, message); - }); + return cb(null, message); + }); } - getMessages(conversation, limit = 50, skip = 0, cb) { + getMessageReadMembers(conversation, message) { + return conversation.getReadMembers(message); + } + + readByAllMembers(conversation, message) { + return conversation.readByAllMembers(message); + } + + getConversationConfig(conversation, key) { + return conversation.getConfig(key); + } + + getMessages(conversation, limit, skip, ids, types, attachmentTypes, ownerIds, parentId, showInConversation, cb) { let messageListQuery = conversation.createMessageListQuery(); messageListQuery.sort = 'createdAt DESC'; - messageListQuery.limit = limit; + messageListQuery.limit = limit ? limit : 50; messageListQuery.skip = skip; - + messageListQuery.ids = ids; + messageListQuery.types = types; + messageListQuery.attachmentTypes = attachmentTypes; + messageListQuery.ownerIds = ownerIds; + messageListQuery.parentId = parentId; + messageListQuery.showInConversation = showInConversation; + messageListQuery.list(function (err, messages) { if (err) return cb(err); @@ -195,10 +249,6 @@ class ChannelizeAdapter { }); } - getLastMessage(conversation, cb) { - return cb(null, conversation.getLastMessage()); - } - deleteMessagesForMe(messageIds, cb) { this.channelize.Message.deleteMessagesForMe(messageIds, function (err, res) { if(err) return cb(err); @@ -223,8 +273,15 @@ class ChannelizeAdapter { }); } - getFriends(cb) { + getFriends(searchTerm, limit, skip, isOnline, includeBlocked, cb) { let userListQuery = this.channelize.User.createUserListQuery(); + userListQuery.search = searchTerm; + userListQuery.limit = limit; + userListQuery.skip = skip; + userListQuery.sort = "displayName ASC"; + userListQuery.isOnline = isOnline; + userListQuery.includeBlocked = includeBlocked; + userListQuery.friendsList(function (err, users) { if(err) return cb(err); @@ -240,13 +297,28 @@ class ChannelizeAdapter { userListQuery.role = role; userListQuery.includeDeleted = includeDeleted; - userListQuery.allUsersList(function (err, users) { + userListQuery.usersList(function (err, users) { if(err) return cb(err); return cb(null, users); }); } + addReaction(message, data, cb) { + message.addReaction(data, function (err, res) { + if(err) return cb(err); + + return cb(null, res); + }); + } + + removeReaction(message, data, cb) { + message.removeReaction(data, function (err, res) { + if(err) return cb(err); + + return cb(null, res); + }); + } } export { ChannelizeAdapter as default }; \ No newline at end of file diff --git a/web-widget/src/js/components/conversation-window.js b/web-widget/src/js/components/conversation-window.js old mode 100755 new mode 100644 index 3a3a905..e2ea114 --- a/web-widget/src/js/components/conversation-window.js +++ b/web-widget/src/js/components/conversation-window.js @@ -1,6 +1,6 @@ import Utility from "../utility.js"; -import RecentConversations from "./recent-conversations.js"; -import { LANGUAGE_PHRASES, IMAGES, SETTINGS } from "../constants.js"; +import { v4 as uuid } from 'uuid'; +import { LANGUAGE_PHRASES, IMAGES, SETTINGS, ICONS } from "../constants.js"; class ConversationWindow { @@ -13,19 +13,46 @@ class ConversationWindow { this.loadCount = 0; this.limit = 25; this.skip = 0; + this.allowThreadMessage = SETTINGS.ALLOW_MESSAGE_THREADING; + this.messages = []; + this.replyMessage = {}; + + // Message reactions config + this.reactionsSetting= SETTINGS.REACTION_SETTINGS; + this.reactionsTypes = []; + this.enableScrolling = false; + this.scrollMenuWidth = 0; } init(conversation = null, data = null) { - if(!conversation && data) { + if (!conversation && data) { this._createDummyConversation(data); return; } this.conversation = this.modifyConversation(conversation); - this._openConversationWindow(this.conversation, true); this._registerClickEventHandlers(); this._markAsRead(this.conversation); + this.widget.handleConversationEvents(this.conversation); + this._createReactionScrollMenuData(); + } + + _createReactionScrollMenuData() { + // Get Reaction types + let reactionsTypes = []; + for(var type of Object.keys(this.reactionsSetting.types)) { + reactionsTypes.push({name: type, icon: this.reactionsSetting.types[type]}) + } + this.reactionsTypes = reactionsTypes; + + // Get reaction menu width + let scrollMenuWidth = this.reactionsTypes.length * 50; + if(scrollMenuWidth > 200) { + this.enableScrolling = true; + scrollMenuWidth = 200; + } + this.scrollMenuWidth = scrollMenuWidth + "px"; } _createDummyConversation(member) { @@ -37,9 +64,9 @@ class ConversationWindow { isDummyObject: true } - if(member.isOnline) + if (member.isOnline) dummyObject.status = "online"; - else if(!member.isOnline && member.lastSeen) + else if (!member.isOnline && member.lastSeen) dummyObject.status = LANGUAGE_PHRASES.LAST_SEEN + this.utility.updateTimeFormat(member.lastSeen); this.conversation = dummyObject; @@ -68,7 +95,13 @@ class ConversationWindow { // Create conversation header title let titleAttributes = [{"class":"ch-conv-title"}]; - this.utility.createElement("div", titleAttributes, conversation.title, detailsWrapper); + let headerTitle = this.utility.createElement("div", titleAttributes, conversation.title, detailsWrapper); + + if (this.conversation.isGroup) { + headerTitle.addEventListener("click", (data) => { + this.widget.loadConversationMembers(this.conversation.id); + }); + } // Create option button let optionAttributes = [{"id":"ch_conv_options"}]; @@ -83,28 +116,38 @@ class ConversationWindow { let dropDownAttributes = [{"id":"ch_conv_drop_down"},{"class":"ch-conv-drop-down"}]; let dropDown = this.utility.createElement("div", dropDownAttributes, null, header); - // Create mute option - let muteOptionAttributes = [{"id":"ch_conv_mute"},{"class":"ch-conv-mute"}]; - this.utility.createElement("div", muteOptionAttributes, LANGUAGE_PHRASES.MUTE_CONV, dropDown); - // Create clear option let clearOptionAttributes = [{"id":"ch_conv_clear"},{"class":"ch-conv-clear"}]; - this.utility.createElement("div", clearOptionAttributes, LANGUAGE_PHRASES.CLEAR_CONV, dropDown); + let clearOption = this.utility.createElement("div", clearOptionAttributes, LANGUAGE_PHRASES.CLEAR_CONV, dropDown); + clearOption.style.display = 'block'; + if(conversation.type != 'private') { + clearOption.style.display = 'none'; + } // Create delete option let deleteOptionAttributes = [{"id":"ch_conv_delete"},{"class":"ch-conv-delete"}]; this.utility.createElement("div", deleteOptionAttributes, LANGUAGE_PHRASES.DELETE_CONV, dropDown); + // Create leave conversation option + let leaveOptionAttributes = [{"id":"ch_conv_leave"},{"class":"ch-conv-leave"}]; + let leaveOption = this.utility.createElement("div", leaveOptionAttributes, LANGUAGE_PHRASES.LEAVE_CONV, dropDown); + leaveOption.style.display = "none"; + if(conversation.isGroup && conversation.isActive) { + leaveOption.style.display = "block"; + } + // Create block user option - let blockOptionAttributes = [{"id":"ch_conv_block"},{"class":"ch-conv-block"}]; + let blockOptionAttributes = [{"id":"ch_conv_block"}]; let blockOption = this.utility.createElement("div", blockOptionAttributes, LANGUAGE_PHRASES.BLOCK_USER, dropDown); + blockOption.style.display = "none"; // Create unblock user option - let unblockOptionAttributes = [{"id":"ch_conv_unblock"},{"class":"ch-conv-unblock"}]; + let unblockOptionAttributes = [{"id":"ch_conv_unblock"}]; let unblockOption = this.utility.createElement("div", unblockOptionAttributes, LANGUAGE_PHRASES.UNBLOCK_USER, dropDown); + unblockOption.style.display = "none"; - if(!conversation.isGroup) { - if(conversation.blockedByUser) + if (!conversation.isGroup) { + if (conversation.blockedByUser) unblockOption.style.display = "block"; else blockOption.style.display = "block"; @@ -119,11 +162,7 @@ class ConversationWindow { let msgsBoxAttributes = [{"id":"ch_messages_box"},{"class":"ch-messages-box"}]; let messagesBox = this.utility.createElement("div", msgsBoxAttributes, null, windowDiv); - // Create snackbar for warnings - let snackbarAttributes = [{"id":"ch_snackbar"}]; - this.utility.createElement("div", snackbarAttributes, null, windowDiv); - - if(loadMessages) { + if (loadMessages) { // Create loader container let loaderContainerAttributes = [{"id":"ch_conv_loader_container"},{"class":"ch-loader-bg"}]; let loaderContainer = this.utility.createElement("div", loaderContainerAttributes, null, messagesBox); @@ -147,6 +186,48 @@ class ConversationWindow { let inputBoxAttributes = [{"id":"ch_input_box"},{"class":"ch-input-box"}, {"type":"text"}, {"placeholder":LANGUAGE_PHRASES.SEND_MESSAGE}]; this.utility.createElement("textarea", inputBoxAttributes, null, sendBox); + // Create reply container view + let replyContainerAttributes = [{"id":"ch_reply_container"},{"class":"ch-reply-container"}]; + let replyContainer = this.utility.createElement("div", replyContainerAttributes, null, sendBox); + + // Create reply comppser view + let replyComposerAttributes = [{"id":"ch_reply_composer"},{"class":"ch-reply-composer"}]; + let replyComposer = this.utility.createElement("div", replyComposerAttributes, null, replyContainer); + + // Create reply composer left view + let replyComposerLeftAttributes = [{"id":"ch_reply_composer_left"},{"class":"ch-reply-composer-left"}]; + let replyComposerLeft = this.utility.createElement("div", replyComposerLeftAttributes, null, replyComposer); + + // Create reply composer thumbnail view + let replyMessageThumbnailAttributes = [{"id":"ch_reply_message_thumbnail"},{"class":"ch-reply-message-thumbnail"}]; + this.utility.createElement("img", replyMessageThumbnailAttributes, null, replyComposerLeft); + + // Create reply composer right view + let replyComposerRightAttributes = [{"id":"ch_reply_composer_right"},{"class":"ch-reply-composer-right"}]; + let replyComposerRight = this.utility.createElement("div", replyComposerRightAttributes, null, replyComposer); + + // Create reply composer parent message owner name view + let replyTitleAttributes = [{"id":"ch_reply_msg_owner_name"},{"class":"ch-reply-msg-owner-name"}]; + this.utility.createElement("p", replyTitleAttributes, null, replyComposerRight); + + // Create reply composer parent message attachment icon view + let replyMessageIconAttributes = [{"id":"ch_reply_msg_icon"}]; + let replyMessageIcon = this.utility.createElement("i", replyMessageIconAttributes, null, replyComposerRight); + replyMessageIcon.classList.add("material-icons", "ch-reply-msg-icon"); + + // Create reply composer parent message attachment message duration view + let replyMessageDurationAttributes = [{"id":"ch_reply_msg_duration"},{"class":"ch-reply-msg-duration"}]; + this.utility.createElement("span", replyMessageDurationAttributes, null, replyComposerRight); + + // Create reply composer parent message body view + let replyMessageAttributes = [{"id":"ch_reply_msg_body"},{"class":"ch-reply-msg-body"}]; + this.utility.createElement("p", replyMessageAttributes, null, replyComposerRight); + + // Create reply composer close icon + let replyComposerCloseBtnAttributes = [{"id":"ch_reply_composer_close_btn"},{"title":LANGUAGE_PHRASES.CLOSE}]; + let replyComposerCloseBtn = this.utility.createElement("i", replyComposerCloseBtnAttributes, "close", replyComposer); + replyComposerCloseBtn.classList.add("material-icons", "ch-reply-composer-close-btn"); + // Create media messages docker let mediaDockerAttributes = [{"id":"ch_media_docker"},{"class":"ch-media-docker"}]; let mediaDocker = this.utility.createElement("div", mediaDockerAttributes, null, sendBox); @@ -226,27 +307,38 @@ class ConversationWindow { sendIcon.classList.add("material-icons"); // Hide send message box and status is blocked user - if(conversation.blockedByUser || conversation.blockedByMember) { + if(conversation.blockedByUser || conversation.blockedByMember || !conversation.isActive) { status.style.visibility = "hidden"; - sendBox.style.visibility = "hidden"; + sendBox.style.visibility = "hidden"; + } + + // Create join conversation button + let footerAttributes = [{"id":"ch_footer"},{"class":"ch-footer"}]; + let footer = this.utility.createElement("div", footerAttributes, null, windowDiv); + + let joinButtonAttributes = [{"id":"ch_conv_join"},{"class":"ch-conv-join"}]; + let joinButton = this.utility.createElement("button", joinButtonAttributes, LANGUAGE_PHRASES.JOIN_CONV, footer); + joinButton.style.visibility = "hidden"; + if(conversation.isGroup && conversation.type === 'public' && !conversation.isActive) { + joinButton.style.visibility = "visible"; } - if(loadMessages) + if (loadMessages) this._createMessagesListing(conversation); } _createMessagesListing(conversation) { // Get conversation messages this._getMessages(conversation, this.limit, this.skip, (err, messages) => { - if(err) return console.error(err); + if (err) return console.error(err); this.messages = messages; // Hide loader - if(document.getElementById("ch_conv_loader_container")) + if (document.getElementById("ch_conv_loader_container")) document.getElementById("ch_conv_loader_container").remove(); let messagesBox = document.getElementById("ch_messages_box"); - if(!messages.length) { + if (!messages.length) { // Create no message div let noMessageDivAttributes = [{"id":"ch_no_msg"},{"class":"ch-no-msg"}]; this.utility.createElement("div", noMessageDivAttributes, LANGUAGE_PHRASES.NO_MESSAGES_FOUND, messagesBox); @@ -256,79 +348,49 @@ class ConversationWindow { this.messages.forEach(message => { // Update message object message = this._modifyMessage(message); - this.previousUserId = message.ownerId; - - // Handle meta message - if(message.contentType == 1) { - // let metaMessageAttributes = [{"class":"ch-meta-msg"}]; - // this.utility.createElement("div", metaMessageAttributes, "Meta Message", messagesBox); - return; - } - - // Create message list - let msgListAttributes = [{"id":message.id},{"class":"ch-msg-list"}]; - let msgList = this.utility.createElement("div", msgListAttributes, null, messagesBox); - - // Create sender name div - if(conversation.isGroup && message.ownerId != window.userId) { - let senderAttributes = [{"class":"ch-sender-name"}]; - this.utility.createElement("div", senderAttributes, message.owner.displayName, msgList); - } - // Create message container - let msgContainerAttributes = [{"class":"ch-msg-container"}]; - let msgContainer = this.utility.createElement("div", msgContainerAttributes, null, msgList); - - // Create message more options - let moreOptionAttributes = [{"class":"ch-msg-more-option"}]; - let moreOption = this.utility.createElement("i", moreOptionAttributes, "more_vert", msgList); - moreOption.classList.add("material-icons"); - this._addListenerOnMoreOption(message, moreOption, msgList); - - // Create message div - let msgDivAttributes = [{"id":"ch_message_"+message.id},{"class":"ch-message"}]; - let msgDiv = this.utility.createElement("div", msgDivAttributes, message.body, msgContainer); - - // Create media message frame - this._createMediaMessageFrame(message); - - // Create message time span - let msgTimeAttributes = [{"id":"ch_msg_time"},{"class":"ch-msg-time"}]; - let msgTime = this.utility.createElement("span", msgTimeAttributes, message.createdAt, msgContainer); - - if(message.ownerId == window.userId) { - msgContainer.classList.add("right"); - moreOption.classList.add("left"); - // Create message read status - let statusAttributes = [{"id":"ch_msg_status"}]; - let readIcon = message.readStatus == 3 ? "done_all" : "check"; - let msgStatus = this.utility.createElement("i", statusAttributes, readIcon, msgContainer); - msgStatus.classList.add("material-icons", "ch-msg-status"); - } - else{ - msgContainer.classList.add("left"); - moreOption.classList.add("right"); - } + // Create message frame + this._createMessageFrame(message, messagesBox, false); }); - messagesBox.scrollTop = messagesBox.scrollHeight; + if (messagesBox) { + messagesBox.scrollTop = messagesBox.scrollHeight; + } }); } modifyConversation(conversation) { - if(!conversation.isGroup) { - // Set conversation title and image - let member = conversation.membersList.find(member => member.userId != window.userId); - conversation.title = member.user.displayName; - conversation.profileImageUrl = member.user.profileImageUrl ? member.user.profileImageUrl : IMAGES.AVTAR; - - if(member.user.isOnline) - conversation.status = LANGUAGE_PHRASES.ONLINE; - else if(!member.user.isOnline && member.user.lastSeen) - conversation.status = LANGUAGE_PHRASES.LAST_SEEN + this.utility.updateTimeFormat(member.user.lastSeen); + if (!conversation || conversation.isModified) + return conversation; + + if (!conversation.isGroup && conversation.user && Object.entries(conversation.user).length === 0) { + conversation.title = LANGUAGE_PHRASES.DELETED_MEMBER; + conversation.profileImageUrl = IMAGES.AVTAR; + return conversation; + } + + // Set profile Image, title and status of conversation + if (conversation.isGroup) { + conversation.profileImageUrl = conversation.profileImageUrl ? conversation.profileImageUrl : IMAGES.GROUP; + conversation.status = conversation.memberCount + " " + LANGUAGE_PHRASES.MEMBERS; } else { - conversation.status = conversation.memberCount + " " + LANGUAGE_PHRASES.MEMBERS; + conversation.profileImageUrl = conversation.user.profileImageUrl ? conversation.user.profileImageUrl : IMAGES.AVTAR; + conversation.title = conversation.user.displayName; + + // Set block user status + let member = conversation.members.find(member => member.userId == conversation.user.id); + conversation.blockedByMember = member ? false : true; + + if (!conversation.isActive) { + conversation.blockedByUser = true; + } + if (conversation.user.isOnline) { + conversation.status = LANGUAGE_PHRASES.ONLINE; + } + else { + conversation.status = LANGUAGE_PHRASES.LAST_SEEN + this.utility.updateTimeFormat(member.user.lastSeen); + } } return conversation; } @@ -337,12 +399,12 @@ class ConversationWindow { ++this.loadCount; this.skip = this.loadCount * this.limit; this._getMessages(this.conversation, this.limit, this.skip, (err, messages) => { - if(err) return console.error(err); + if (err) return console.error(err); - if(!messages && messages[0].chatId != this.conversation.id) + if (!messages.length) { return; + } - messages.reverse(); this.messages = this.messages.concat(messages); // Save first message to scroll @@ -350,60 +412,19 @@ class ConversationWindow { let firstMessage = messagesBox.childNodes[0]; messages.forEach(message => { - - // Remove meta message - if(message.contentType == 1) - return; - // Update message object message = this._modifyMessage(message); - // Create message list - let msgListAttributes = [{"id":message.id},{"class":"ch-msg-list"}]; - let msgList = this.utility.createElement("div", msgListAttributes, null, null); - - // Create message container - let msgContainerAttributes = [{"class":"ch-msg-container"}]; - let msgContainer = this.utility.createElement("div", msgContainerAttributes, null, msgList); - - // Create message more options - let moreOptionAttributes = [{"class":"ch-msg-more-option"}]; - let moreOption = this.utility.createElement("i", moreOptionAttributes, "more_vert", msgList); - moreOption.classList.add("material-icons"); - this._addListenerOnMoreOption(message, moreOption, msgList); - - // Create message div - let msgDivAttributes = [{"id":"ch_message_"+message.id},{"class":"ch-message"}]; - let msgDiv = this.utility.createElement("div", msgDivAttributes, message.body, msgContainer); - - // Create media message frame - this._createMediaMessageFrame(message); - - // Create message time span - let msgTimeAttributes = [{"id":"ch_msg_time"},{"class":"ch-msg-time"}]; - let msgTime = this.utility.createElement("span", msgTimeAttributes, message.createdAt, msgContainer); - - if(message.ownerId == window.userId) { - msgContainer.classList.add("right"); - moreOption.classList.add("left"); - // Create message read status - let statusAttributes = [{"id":"ch_msg_status"}]; - let readIcon = message.readStatus == 3 ? "done_all" : "check"; - let msgStatus = this.utility.createElement("i", statusAttributes, readIcon, msgContainer); - msgStatus.classList.add("material-icons", "ch-msg-status"); - } - else { - msgContainer.classList.add("left"); - moreOption.classList.add("right"); - } + // Create message frame + this._createMessageFrame(message, messagesBox, false); + let msgList = document.getElementById(message.id); messagesBox.insertBefore(msgList, messagesBox.childNodes[0]); }); - if(firstMessage) { + if (firstMessage) { firstMessage.scrollIntoView(); } }); - } _registerClickEventHandlers() { @@ -414,51 +435,61 @@ class ConversationWindow { this.widget.convWindows.pop(); }); - // Conversation option listener + // Conversation option button listener let optionBtn = document.getElementById("ch_conv_options"); optionBtn.addEventListener("click", (data) => { document.getElementById("ch_conv_drop_down").classList.toggle("ch-show-element"); }); - // Conversation mute listener - let muteBtn = document.getElementById("ch_conv_mute"); - muteBtn.addEventListener("click", (data) => { - document.getElementById("ch_conv_drop_down").classList.toggle("ch-show-element"); - this.muteConversation(); - }); - - // Conversation clear listener + // Conversation clear button listener let clearBtn = document.getElementById("ch_conv_clear"); clearBtn.addEventListener("click", (data) => { document.getElementById("ch_conv_drop_down").classList.toggle("ch-show-element"); this.clearConversation(); }); - // Conversation delete listener + // Conversation delete button listener let deleteBtn = document.getElementById("ch_conv_delete"); deleteBtn.addEventListener("click", (data) => { document.getElementById("ch_conv_drop_down").classList.toggle("ch-show-element"); this.deleteConversation(); }); - // Member block listener + // Conversation leave button listener + let leaveBtn = document.getElementById("ch_conv_leave"); + if(leaveBtn) { + leaveBtn.addEventListener("click", (data) => { + document.getElementById("ch_conv_drop_down").classList.toggle("ch-show-element"); + this.leaveConversation(); + }); + } + + // Conversation leave button listener + let joinBtn = document.getElementById("ch_conv_join"); + if(joinBtn) { + joinBtn.addEventListener("click", (data) => { + this.joinConversation(); + }); + } + + // Member block button listener let blockBtn = document.getElementById("ch_conv_block"); - if(blockBtn) { + if (blockBtn) { blockBtn.addEventListener("click", (data) => { document.getElementById("ch_conv_drop_down").classList.toggle("ch-show-element"); - this.chAdapter.blockMember(this.conversation.member.userId, (err, res) => { - if(err) return console.error(err); + this.chAdapter.blockUser(this.conversation.user.id, (err, res) => { + if (err) return console.error(err); }); }); } - // Member unblock listener + // Member unblock button listener let unblockBtn = document.getElementById("ch_conv_unblock"); - if(unblockBtn) { + if (unblockBtn) { unblockBtn.addEventListener("click", (data) => { document.getElementById("ch_conv_drop_down").classList.toggle("ch-show-element"); - this.chAdapter.unblockMember(this.conversation.member.userId, (err, res) => { - if(err) return console.error(err); + this.chAdapter.unblockUser(this.conversation.user.id, (err, res) => { + if (err) return console.error(err); }); }); } @@ -466,7 +497,7 @@ class ConversationWindow { // Send message on Enter press let input = document.getElementById("ch_input_box"); input.addEventListener("keydown", (data) => { - if(data.keyCode === 13) { + if (data.keyCode === 13) { data.preventDefault(); this.sendMessage("text"); } @@ -481,21 +512,26 @@ class ConversationWindow { // Scroll message box listener let msgBox = document.getElementById("ch_messages_box"); msgBox.addEventListener("scroll", (data) => { - if(msgBox.scrollTop == 0) + if (msgBox.scrollTop == 0) this._loadMoreMessages(); }); // Attachment button listener let attachmentBtn = document.getElementById("ch_attachment_btn"); attachmentBtn.addEventListener("click", (data) => { + // Hide reply container + this.showReplyContainer(false); + // Toggle media message docker document.getElementById("ch_media_docker").classList.toggle("ch-show-docker"); }); // Send message on image choose let imageInput = document.getElementById("ch_image_input"); imageInput.addEventListener("change", (data) => { - if(data.target.files[0].size > 25000000) - this._showSnackbar(LANGUAGE_PHRASES.FILE_SIZE_WARNING); + if (data.target.files[0].size > 25000000) { + this.utility.showWarningMsg(LANGUAGE_PHRASES.FILE_SIZE_WARNING); + this.showMediaDocker(false); + } else this.sendMessage("image"); }); @@ -503,8 +539,10 @@ class ConversationWindow { // Send message on audio choose let audioInput = document.getElementById("ch_audio_input"); audioInput.addEventListener("change", (data) => { - if(data.target.files[0].size > 25000000) - this._showSnackbar(LANGUAGE_PHRASES.FILE_SIZE_WARNING); + if (data.target.files[0].size > 25000000) { + this.utility.showWarningMsg(LANGUAGE_PHRASES.FILE_SIZE_WARNING); + this.showMediaDocker(false); + } else this.sendMessage("audio"); }); @@ -512,280 +550,776 @@ class ConversationWindow { // Send message on video choose let videoInput = document.getElementById("ch_video_input"); videoInput.addEventListener("change", (data) => { - if(data.target.files[0].size > 25000000) - this._showSnackbar(LANGUAGE_PHRASES.FILE_SIZE_WARNING); + if (data.target.files[0].size > 25000000) { + this.utility.showWarningMsg(LANGUAGE_PHRASES.FILE_SIZE_WARNING); + this.showMediaDocker(false); + } else this.sendMessage("video"); }); - } - _showSnackbar(text) { - // Show size limit exceed message - let snackbar = document.getElementById("ch_snackbar"); - snackbar.innerText = text; - snackbar.className = "show"; - setTimeout(function() { - snackbar.className = snackbar.className.replace("show", ""); - }, 3000); + // Reply container close button listener + let closeReplyComposer = document.getElementById("ch_reply_composer_close_btn"); + closeReplyComposer.addEventListener("click", (data) => { + this.showReplyContainer(false); + }); + } sendMessage(msgType) { - // Hide file picker - document.getElementById("ch_media_docker").classList.remove("ch-show-docker"); + // Hide media docker + this.showMediaDocker(false); - if(msgType == "text") { - let inputValue = document.getElementById("ch_input_box").value; - document.getElementById("ch_input_box").value = ""; + let messagesBox = document.getElementById("ch_messages_box"); - if(!inputValue.trim()) - return; + // Show loader image if media message + if (msgType != "text") { + if (document.getElementById("ch_no_msg")) + document.getElementById("ch_no_msg").remove(); + + let msgLoaderAttributes = [{"id":"ch_msg_loader"},{"class":"ch-msg-loader"}]; + let imageMsg = this.utility.createElement("div", msgLoaderAttributes, null, messagesBox); + imageMsg.style.backgroundImage = "url(" + IMAGES.MESSAGE_LOADER + ")"; + imageMsg.scrollIntoView(); + } + + switch(msgType) { + case "text": + let inputValue = document.getElementById("ch_input_box").value; + document.getElementById("ch_input_box").value = ""; + + if (!inputValue.trim()) + return; + + let data = { + id : uuid(), + type : "normal", + body : inputValue + }; + // Add reply message data + if (document.getElementsByClassName("ch-reply-container ch-show-reply-container").length) { + data['parentId'] = this.replyMessage['id']; + data['type'] = 'reply'; + data['parentMessage'] = this.replyMessage; + + // Hide reply container + this.showReplyContainer(false); + } + + // Add pending message into list + this.addPendingMessage(data); + + if (this.conversation.isDummyObject) { + data['userId'] = this.conversation.userId; + + this.chAdapter.sendMessageToUser(data, (err, res) => { + if (err) return console.error(err); + }); + } + else { + this.chAdapter.sendMessage(this.conversation, data, (err, res) => { + if (err) return console.error(err); + }); + } + break; + + case "image": + let imageFile = document.getElementById("ch_image_input").files[0]; - if(this.conversation.isDummyObject) { - this.chAdapter.sendTextMessageToUser(this.conversation.userId, inputValue, (err, res) => { - if(err) return console.error(err); + // Upload file on channelize server + this.chAdapter.uploadFile(imageFile, "image", true, (err, fileData) => { + if (err) return console.error(err); + + this._sendFileMessage(fileData); }); - } - else { - this.chAdapter.sendTextMessage(this.conversation, inputValue, [], (err, res) => { - if(err) return console.error(err); + break; + + case "audio": + let audioFile = document.getElementById("ch_audio_input").files[0]; + + // Upload file on channelize server + this.chAdapter.uploadFile(audioFile, "audio", true, (err, fileData) => { + if (err) return console.error(err); + + this._sendFileMessage(fileData); }); - } + break; + + case "video": + let videoFile = document.getElementById("ch_video_input").files[0]; + // Upload file on channelize server + this.chAdapter.uploadFile(videoFile, "video", true, (err, fileData) => { + if (err) return console.error(err); + + this._sendFileMessage(fileData); + }); + break; } - else if(msgType == "image") { - let file = document.getElementById("ch_image_input").files[0]; + } - this.chAdapter.sendFileMessage(this.conversation, file, true, (err, message) => { - if(err) return console.error(err); - }); + _sendFileMessage(fileData) { + fileData.type = fileData.attachmentType; + + let data = { + id : uuid(), + type : "normal", + attachments : [fileData] } - else if(msgType == "audio") { - let file = document.getElementById("ch_audio_input").files[0]; - this.chAdapter.sendFileMessage(this.conversation, file, true, (err, message) => { - if(err) return console.error(err); + // Send file message as attachment + if (this.conversation.isDummyObject) { + data['userId'] = this.conversation.userId; + this.chAdapter.sendMessageToUser(data, (err, message) => { + if (err) return console.error(err); }); } - else if(msgType == "video") { - let file = document.getElementById("ch_video_input").files[0]; - - this.chAdapter.sendFileMessage(this.conversation, file, true, (err, message) => { - if(err) return console.error(err); + else { + this.chAdapter.sendMessage(this.conversation, data, (err, message) => { + if (err) return console.error(err); }); } } - muteConversation() { - this.chAdapter.muteConversation(this.conversation, (err, res) => { - if(err) return console.error(err); - }); + addPendingMessage(msgData) { + msgData["ownerId"] = this.widget.userId; + let messagesBox = document.getElementById("ch_messages_box"); + + // Remove no message tag + if (messagesBox.firstChild && messagesBox.firstChild.id == "ch_no_msg") { + messagesBox.firstChild.remove(); + } + + // Create message frame + this._createMessageFrame(msgData, messagesBox, true); + + // Scroll to newly added dummy message + messagesBox.scrollTop = messagesBox.scrollHeight; } clearConversation() { this.chAdapter.clearConversation(this.conversation, (err, res) => { - if(err) return console.error(err); + if (err) return console.error(err); }); } deleteConversation() { this.chAdapter.deleteConversation(this.conversation, (err, res) => { + if (err) return console.error(err); + }); + } + + leaveConversation() { + this.chAdapter.leaveConversation(this.conversation, (err, res) => { + if(err) return console.error(err); + }); + } + + joinConversation() { + this.chAdapter.joinConversation(this.conversation, (err, res) => { if(err) return console.error(err); }); } _getMessages(conversation, limit, skip, cb) { - this.chAdapter.getMessages(conversation, limit, skip, (err, messages) => { - if(err) return cb(err); + let showInConversation = null; + // If thread messing enable then only show message whose 'showInConversation' value is true. + if (this.allowThreadMessage) { + showInConversation = true; + } + + this.chAdapter.getMessages(conversation, limit, skip, null, null, null, null, null, showInConversation, (err, messages) => { + if (err) return cb(err); + messages.reverse(); return cb(null, messages); }); } _modifyMessage(message) { - if(!message) + if (!message) + return message; + + // Handle meta message + if (message.type == "admin") { + + // adminMessageType + switch(message.body) { + case "admin_group_create" : + message.body = LANGUAGE_PHRASES.GROUP_CREATED; + break; + + case "admin_group_change_photo" : + message.body = LANGUAGE_PHRASES.GROUP_PHOTO_CHANGED; + break; + + case "admin_group_change_title" : + message.body = LANGUAGE_PHRASES.GROUP_TITLE_CHANGED; + break; + + case "admin_group_add_members" : + message.body = LANGUAGE_PHRASES.GROUP_MEMBER_ADDED; + break; + + case "admin_group_remove_members" : + message.body = LANGUAGE_PHRASES.GROUP_MEMBER_REMOVED; + break; + + case "admin_group_make_admin" : + message.body = LANGUAGE_PHRASES.GROUP_ADMIN_UPDATED; + break; + } + return message; + } + + // Set read status of message + if(!this.conversation.isDummyObject && this.chAdapter.getConversationConfig(this.conversation, 'read_events')) { + message.readByAll = this.chAdapter.readByAllMembers(this.conversation, message); + } + + message.createdAt = this.utility.updateTimeFormat(message.createdAt); + + if (message.isDeleted) { + message.body = "" + LANGUAGE_PHRASES.MESSAGE_DELETED; + } + + return message; + } + + _markAsRead(conversation) { + if(!this.chAdapter.getConversationConfig(conversation, 'read_events')) return; + let currentDate = new Date(); + let timestamp = currentDate.toISOString(); + this.chAdapter.markAsReadConversation(conversation, timestamp, (err, res) => { + if (err) return console.error(err); + }); + } + + addNewMessage(message, newConversation) { + // Convert message object to message model + message = new Channelize.core.Message.Model(message); + + // Update reply count + if (this.allowThreadMessage && message.type == "reply") { + let parentMessage = message.parentMessage; + let parentMessageId = parentMessage.id; + let messageIndex = this.messages.findIndex(message => message.id == parentMessageId); + if (messageIndex != -1) { + // Update parent message reply count + this.messages[messageIndex]['replyCount'] = parentMessage.replyCount; + document.getElementById("ch_reply_count_" + parentMessageId).innerHTML = parentMessage.replyCount + " " + LANGUAGE_PHRASES.REPLIES; + + // Show the reply container + document.getElementById("ch_reply_count_container_" + parentMessageId).classList.add("show"); + } + } + + /* Only add a new message on the conversation window if thread messaging is disabled and + new message showInConversation is true. */ + if (this.allowThreadMessage && !message.showInConversation) { return; + } - let member = message.recipients.find(member => member.recipientId == window.userId); - message.createdAt = this.utility.updateTimeFormat(member.createdAt); - message.readStatus = member.status; + // Set new conversation to replace dummy conversation + if (newConversation) { + this.conversation = newConversation; + } + + message = this._modifyMessage(message); + this.messages.push(message); - if(message.isDeleted) - message.body = "" + LANGUAGE_PHRASES.MESSAGE_DELETED; + // Remove pending dummy message + let dummyMessage = document.getElementById(message.id); + if (dummyMessage) { + dummyMessage.remove(); + } - return message; - } + let messagesBox = document.getElementById("ch_messages_box"); + if (message.type == "admin") { + let metaMessageAttributes = [{"class":"ch-admin-msg"}]; + this.utility.createElement("div", metaMessageAttributes, message.body, messagesBox); + return; + } - _markAsRead(conversation) { - this.chAdapter.markAsReadConversation(conversation, (err, res) => { - if(err) return console.error(err); - }); - } + // Hide message loader + if (document.getElementById("ch_msg_loader") && message.ownerId == this.widget.userId) { + document.getElementById("ch_msg_loader").remove(); + } - addNewMessage(message) { - let messagesBox = document.getElementById("ch_messages_box"); - if(message.chatId != this.conversation.id || !messagesBox) + if (message.conversationId != this.conversation.id || !messagesBox) return; message.createdAt = this.utility.updateTimeFormat(Date()); // Remove no message tag - if(messagesBox.firstChild && messagesBox.firstChild.id == "ch_no_msg") + if (messagesBox.firstChild && messagesBox.firstChild.id == "ch_no_msg") { messagesBox.firstChild.remove(); + } - // Create message list - let msgListAttributes = [{"id":message.id},{"class":"ch-msg-list"}]; - let msgList = this.utility.createElement("div", msgListAttributes, null, messagesBox); + // Create message frame + this._createMessageFrame(message, messagesBox, false); - // Create message container - let msgContainerAttributes = [{"class":"ch-msg-container"}]; - let msgContainer = this.utility.createElement("div", msgContainerAttributes, null, msgList); - - // Create message more options - let moreOptionAttributes = [{"class":"ch-msg-more-option"}]; - let moreOption = this.utility.createElement("i", moreOptionAttributes, "more_vert", msgList); - moreOption.classList.add("material-icons"); - this._addListenerOnMoreOption(message, moreOption, msgList); + if (message.ownerId != this.widget.userId) { + // Message mark a read + this._markAsRead(this.conversation); + } - // Create message div - let msgDivAttributes = [{"id":"ch_message_"+message.id},{"class":"ch-message"}]; - let msgDiv = this.utility.createElement("div", msgDivAttributes, message.body, msgContainer); + // Scroll to new message + if (messagesBox) + messagesBox.scrollTop = messagesBox.scrollHeight; + } - // Create media message frame - this._createMediaMessageFrame(message); + updateMsgStatus(data) { + if (data.conversation.id != this.conversation.id || this.conversation.isGroup) { + return; + } - // Create message time span - let msgTimeAttributes = [{"id":"ch_msg_time"},{"class":"ch-msg-time"}]; - let msgTime = this.utility.createElement("span", msgTimeAttributes, message.createdAt, msgContainer); + // Check read status of second last message + if (this.messages.slice(-2, -1) && this.messages.slice(-2, -1).readByAll) { + let lastMessage = this.messages[this.messages.length-1]; + lastMessage.readByAll = true; + // Update read tag icon + let msgDiv = document.getElementById(lastMessage.id); + if (msgDiv) { + let statusDiv = msgDiv.querySelector("#ch_msg_status"); - if(message.ownerId == window.userId) { - msgContainer.classList.add("right"); - moreOption.classList.add("left"); - // Create message read status - let statusAttributes = [{"id":"ch_msg_status"}]; - let readIcon = message.readStatus == 3 ? "done_all" : "check"; - let msgStatus = this.utility.createElement("i", statusAttributes, readIcon, msgContainer); - msgStatus.classList.add("material-icons", "ch-msg-status"); + if (statusDiv) { + statusDiv.innerHTML = "done_all"; + } + } } else { - msgContainer.classList.add("left"); - moreOption.classList.add("right"); + this.messages.forEach(msg => { + msg.readByAll = true; - // Message mark a read - this._markAsRead(this.conversation); + // Update read tag icon + let msgDiv = document.getElementById(msg.id); + if (msgDiv) { + let statusDiv = msgDiv.querySelector("#ch_msg_status"); + + if (statusDiv) { + statusDiv.innerHTML = "done_all"; + } + } + }); } + } - // Scroll to new message - if(messagesBox) - messagesBox.scrollTop = messagesBox.scrollHeight; - } + updateUserStatus(user) { + if (this.conversation.isGroup || !this.conversation.user || (this.conversation.user.id != user.id)) + return; - updateStatus(user) { - if(this.conversation.isGroup || (this.conversation.member && this.conversation.member.userId != user.id)) - return; + if (user.isOnline) { + this.conversation.status = LANGUAGE_PHRASES.ONLINE; + } + else if (!user.isOnline && user.lastSeen) { + this.conversation.status = LANGUAGE_PHRASES.LAST_SEEN + this.utility.updateTimeFormat(user.lastSeen); + } + document.getElementById("ch_conv_status").innerText = this.conversation.status; + } - if(user.isOnline) { - this.conversation.status = LANGUAGE_PHRASES.ONLINE; - } - else if(!user.isOnline && user.lastSeen) { - this.conversation.status = LANGUAGE_PHRASES.LAST_SEEN + this.utility.updateTimeFormat(user.lastSeen); - } - document.getElementById("ch_conv_status").innerText = this.conversation.status; - } + _createMessageReactionFrame(message, parentDiv) { + if (!message.reactions) { + return; + } - _createMediaMessageFrame(message) { - let messageBox = document.getElementById("ch_message_"+message.id); + if (document.getElementById("ch_reaction_" + message.id)) { + document.getElementById("ch_reaction_" + message.id).remove(); + } - // Create message div - if(!message.contentType && message.attachmentType != "text") { - let attachmentData = Object.keys(message.attachment).length != 0 ? message.attachment : message.fileData; + let messageDiv = document.getElementById("ch_message_" + message.id); + if (messageDiv) { + messageDiv.classList.remove("reaction-space"); + } + + // Get total reaction counts + let totalReactionCounts = 0 + if (message.reactionsCount) { + Object.keys(message.reactionsCount).forEach((type) => { + totalReactionCounts += message.reactionsCount[type]; + }); + } + + // If no reaction on message then return + if (totalReactionCounts == 0) { + return; + } + + // Add class reaction-space + messageDiv.classList.add("reaction-space"); + + // Create reaction container + let msgReactionContainerAttributes = [{"id":"ch_reaction_" + message.id},{"class":"ch-msg-reaction-container"}]; + let msgReactionContainer = this.utility.createElement("div", msgReactionContainerAttributes, null, parentDiv); + + let msgReactionAttributes = [{"class":"ch-msg-reaction"}]; + let msgReaction = this.utility.createElement("div", msgReactionAttributes, null, msgReactionContainer); + + // Create message reaction listing + let msgReactionListAttributes = [{"class":"ch-msg-reaction-list"}]; + let msgReactionList = this.utility.createElement("ul", msgReactionListAttributes, null, msgReaction); + + Object.keys(message.reactions).forEach((type) => { + + if (this.reactionsSetting.types && this.reactionsSetting.types[type] && message.reactionsCount[type]) { + + let msgReactionItemAttributes = [{"class":"ch-msg-reaction-item"}]; + let msgReactionItem = this.utility.createElement("li", msgReactionItemAttributes, null, msgReactionList); + + // Set the border radius + msgReactionItem.style['border-radius'] = (message.reactionsCount[type] > 1) ? '15px' : '50%'; + + // Create reaction icons span like 👍, 👎. + let msgReactionNameAttributes = [{"class":"ch-msg-reaction-name"}]; + let msgReactionName = this.utility.createElement("span", msgReactionNameAttributes, this.reactionsSetting.types[type], msgReactionItem); + + // Create reaction count span + if (message.reactionsCount[type] > 1) { + let msgReactionCountAttributes = [{"class":"ch-msg-reaction-count"}]; + let msgReactionCount = this.utility.createElement("span", msgReactionCountAttributes, message.reactionsCount[type], msgReactionItem); + } + } + }) + + } - if(message.attachmentType == "audio") { - let audioMsgAttributes = [{"id":"ch_audio_message"},{"class":"ch-audio-message"},{"src":attachmentData.fileUrl}]; - let audioTag = this.utility.createElement("audio", audioMsgAttributes, null, messageBox); - audioTag.setAttribute("controls",true); - } - else if(message.attachmentType == "video") { - let videoMsgAttributes = [{"id":"ch_video_message"},{"class":"ch-video-message"}]; - let videoMessage = this.utility.createElement("div", videoMsgAttributes, null, messageBox); - videoMessage.style.backgroundImage = "url(" + attachmentData.thumbnailUrl + ")"; - - // Create play icon - let playIconAttributes = [{"id":"ch_play_icon"}]; - let playIcon = this.utility.createElement("i", playIconAttributes, "play_circle_outline", videoMessage); - playIcon.classList.add("material-icons", "ch-play-icon"); - - // Set video message listener - videoMessage.addEventListener("click", data => { - window.open(attachmentData.fileUrl, "_blank"); + _createTextMessageFrame(message, parentDiv) { + // Create reply message view container + if (message.type == 'reply' && !message.isDeleted && !this.allowThreadMessage) { + + let parentMessage = message.parentMessage; + let attachment = parentMessage.attachments && parentMessage.attachments[0]; + let attachmentType = attachment ? attachment.type : ''; + + let formatedMessageImg = ''; + switch(attachmentType) { + case "image": + formatedMessageImg = attachment.thumbnailUrl ? attachment.thumbnailUrl : attachment.fileUrl; + break; + + case "video": + formatedMessageImg = attachment.thumbnailUrl ? attachment.thumbnailUrl : ''; + break; + + case "sticker": case "gif": + formatedMessageImg = attachment.stillUrl; + break; + + case "location": + formatedMessageImg = SETTINGS.LOCATION_IMG_URL + "?center=" + + attachment.latitude + "," + attachment.longitude + "&zoom=15&size=208x100&maptype=roadmap&markers=color:red%7C" + + attachment.latitude + "," + attachment.longitude + "&key=" + SETTINGS.LOCATION_API_KEY; + break; + } + + // Create reply conatiner view + let replyMsgContainerAttributes = [{"id":"ch_reply_msg_container_" + message.id},{"class": attachmentType ? "ch-reply-msg-container-attachment" : "ch-reply-msg-container"}]; + let replyContainer = this.utility.createElement("div", replyMsgContainerAttributes, null, parentDiv); + + // Create parent message owner name in reply message view + let replyTitle = (parentMessage.ownerId == this.widget.userId) ? LANGUAGE_PHRASES.YOU : parentMessage.owner.displayName; + let parentMsgOwnerNameAttributes = [{"class":"ch-parent-msg-owner-name"}]; + this.utility.createElement("p", parentMsgOwnerNameAttributes, replyTitle, replyContainer); + + // Create parent message icon in reply message view + if (attachmentType) { + let parentMsgIconAttributes = [{"class":"ch-parent-msg-icon"}]; + let parentMsgIcon = this.utility.createElement("i", parentMsgIconAttributes, ICONS[attachmentType], replyContainer); + parentMsgIcon.classList.add("material-icons"); + } + + // Create parent message duration in reply message view + if (attachmentType && ['audio','video'].includes(attachmentType)) { + let parentMsgDurationAttributes = [{"class":"ch-parent-msg-duration"}]; + this.utility.createElement("span", parentMsgDurationAttributes, this.utility.formatDuration(attachment.duration), replyContainer); + } + + // Create parent message body in reply message view + let parentMessageBody = parentMessage.body ? parentMessage.body : LANGUAGE_PHRASES[attachmentType.toLocaleUpperCase()]; + let parentMsgBodyAttributes = [{"class":"ch-parent-msg-body"}]; + this.utility.createElement("p", parentMsgBodyAttributes, parentMessageBody, replyContainer); + + // Create container right view + if (formatedMessageImg) { + let replyMsgContainerRightAttributes = [{"class":"ch-reply-msg-container-right"}]; + let replyMsgContainerRight = this.utility.createElement("div", replyMsgContainerRightAttributes, null, replyContainer); + + // Create parent message thumbnail in reply message view + let parentMsgBodyThumbnailAttributes = [{"class":"ch-parent-msg-thumbnail"},{"src":formatedMessageImg}]; + this.utility.createElement("img", parentMsgBodyThumbnailAttributes, null, replyMsgContainerRight); + } + + // Add an event listener to the reply container. Go to parent message on click replied message.. + replyContainer.addEventListener("click", (data) => { + let parentMessageElement = document.getElementById(parentMessage.id); + if (parentMessageElement) { + parentMessageElement.scrollIntoView(true); + return; + } + }); + } + + // Show 'Reply of thread' if thread messagin is enabled and message showInConversation value is true + if (this.allowThreadMessage && message.type == "reply" && message.showInConversation) { + let parentMessage = message.parentMessage; + // Update message object + parentMessage = this._modifyMessage(parentMessage); + + let attachment = parentMessage.attachments && parentMessage.attachments[0]; + let attachmentType = attachment ? attachment.type : ''; + let parentMessageBody = parentMessage.body ? parentMessage.body : LANGUAGE_PHRASES[attachmentType.toLocaleUpperCase()]; + + let msgSendConversationAttributes = [{"class": attachment ? + "ch-attachments-message-reply-thread" : "ch-text-message-reply-thread"}]; + let msgSendConversation = this.utility.createElement("p", msgSendConversationAttributes, + LANGUAGE_PHRASES.REPLY_OF_THREAD + ": " + parentMessageBody, parentDiv); + + msgSendConversation.addEventListener("click", (data) => { + this.widget.loadThread(parentMessage, this.conversation); + }); + } + + // Create message body view + if (message.type == "reply" && !message.body) { + let msgBodyAttributes = [{"id":"ch_message_body_" + message.id}]; + this.utility.createElement("p", msgBodyAttributes, null, parentDiv); + } else { + let msgBodyAttributes = [{"id":"ch_message_body_" + message.id},{"class":"ch-message-body"}]; + this.utility.createElement("p", msgBodyAttributes, message.body, parentDiv); + } + + } + + _createMediaMessageFrame(message, parentDiv) { + + // Create message div + if (!message.body && Object.keys(message.attachments).length != 0) { + message.attachments.forEach(attachment => { + + switch(attachment.type) { + case "audio": + let audioMsgAttributes = [{"id":"ch_audio_message"},{"class":"ch-audio-message"},{"src":attachment.fileUrl}]; + let audioTag = this.utility.createElement("audio", audioMsgAttributes, null, parentDiv); + audioTag.setAttribute("controls",true); + break; + + case "video": + let videoMsgAttributes = [{"id":"ch_video_message"},{"class":"ch-video-message"}]; + let videoMessage = this.utility.createElement("div", videoMsgAttributes, null, parentDiv); + videoMessage.style.backgroundImage = "url(" + attachment.thumbnailUrl + ")"; + + // Create play icon + let playIconAttributes = [{"id":"ch_play_icon"}]; + let playIcon = this.utility.createElement("i", playIconAttributes, "play_circle_outline", videoMessage); + playIcon.classList.add("material-icons", "ch-play-icon"); + + // Set video message listener + videoMessage.addEventListener("click", data => { + window.open(attachment.fileUrl, "_blank"); + }); + break; + + case "sticker": + let stickerMsgAttributes = [{"id":"ch_sticker_message"},{"class":"ch-sticker-message"}]; + let stickerMsg = this.utility.createElement("div", stickerMsgAttributes, null, parentDiv); + stickerMsg.style.backgroundImage = "url(" + attachment.originalUrl + ")"; + break; + + case "gif": + let gifMsgAttributes = [{"id":"ch_gif_message"},{"class":"ch-sticker-message"}]; + let gifMsg = this.utility.createElement("div", gifMsgAttributes, null, parentDiv); + gifMsg.style.backgroundImage = "url(" + attachment.originalUrl + ")"; + break; + + case "location": + let locationSrc = SETTINGS.LOCATION_IMG_URL + "?center=" + + attachment.latitude + "," + attachment.longitude + "&zoom=15&size=208x100&maptype=roadmap&markers=color:red%7C" + + attachment.latitude + "," + attachment.longitude + "&key=" + SETTINGS.LOCATION_API_KEY; + + let locationMsgAttributes = [{"id":"ch_location_message"},{"class":"ch-location-message"}]; + let locationMsg = this.utility.createElement("div", locationMsgAttributes, null, parentDiv); + locationMsg.style.backgroundImage = "url(" + locationSrc + ")"; + + // Set location message listener + locationMsg.addEventListener("click", data => { + let mapUrl = "https://www.google.com/maps?z=15&t=m&q=loc:" + attachment.latitude + "," + attachment.longitude; + window.open(mapUrl, "_blank"); + }); + break; + + default: + let imageMsgAttributes = [{"id":"ch_image_message"},{"class":"ch-image-message"}]; + let imageMsg = this.utility.createElement("div", imageMsgAttributes, null, parentDiv); + imageMsg.style.backgroundImage = "url(" + attachment.thumbnailUrl + ")"; + + // Set image message listener + imageMsg.addEventListener("click", data => { + window.open(attachment.fileUrl, "_blank"); + }); + } + }); + } + } + + _addListenerOnAddReactionOption(message, addReaction, msgList) { + addReaction.addEventListener("click", (data) => { + if (document.getElementById("ch_scroll_menu_container")) { + document.getElementById("ch_scroll_menu_container").remove(); + return; + } + + // Hide the more option container + if (document.getElementById("ch_msg_option_container")) { + document.getElementById("ch_msg_option_container").remove(); + } + + // Create message reaction container + let scrollMenuContainerAttributes = [{"id":"ch_scroll_menu_container"},{"class":"ch-scroll-menu-container"}]; + let scrollMenuContainer = this.utility.createElement("div", scrollMenuContainerAttributes, null, msgList); + + // Create message reaction listing + let scrollMenuAttributes = [{"class":"ch-scroll-menu"}]; + let scrollMenu = this.utility.createElement("div", scrollMenuAttributes, null, scrollMenuContainer); + scrollMenu.style.width = this.scrollMenuWidth; + + // Create scroll left arrow + if (this.enableScrolling) { + let scrollMenuLeftAttributes = [{"class":"ch-scroll-menu-arrow ch-scroll-menu-arrow-left"}]; + let scrollMenuLeft = this.utility.createElement("i", scrollMenuLeftAttributes, "keyboard_arrow_left", scrollMenuContainer); + scrollMenuLeft.classList.add("material-icons"); + + // Add event listiner + scrollMenuLeft.addEventListener("click", (data) => { + scrollMenu.scrollLeft -= 200; }); - } - else { - let imageMsgAttributes = [{"id":"ch_image_message"},{"class":"ch-image-message"}]; - let imageMsg = this.utility.createElement("div", imageMsgAttributes, null, messageBox); - imageMsg.style.backgroundImage = "url(" + attachmentData.thumbnailUrl + ")"; - - // Set image message listener - imageMsg.addEventListener("click", data => { - window.open(attachmentData.fileUrl, "_blank"); + } + + // Create message reaction listing + let reactionListingAttributes = [{"class":"ch-reaction-listing"}]; + let reactionListing = this.utility.createElement("ul", reactionListingAttributes, null, scrollMenu); + + // Create message reaction menu listing + this.reactionsTypes.forEach((type) => { + let reactionTypeObj = message.reactions[type.name]; + var reactionMenuListAttributes = [{"class":"ch-reaction-menu-list"}]; + if (reactionTypeObj && reactionTypeObj.indexOf(this.widget.userId) != -1) { + reactionMenuListAttributes = [{"class":"ch-reaction-menu-list reaction-selected"},{"title":type.name},{"name":type.name}]; + } + let reactionMenuList = this.utility.createElement("li", reactionMenuListAttributes, null, reactionListing); + + let reactionMenuListItemAttributes = [{"class":"ch-reaction-menu-list-item"},{"title":type.name},{"name":type.name}]; + let reactionMenuListItem = this.utility.createElement("span", reactionMenuListItemAttributes, type.icon, reactionMenuList); + + // Add event listiner on reaction menu item + this._updateReaction(message.id, reactionMenuListItem); + }); + + // Create scroll right arrow + if (this.enableScrolling) { + let scrollMenuRightAttributes = [{"class":"ch-scroll-menu-arrow ch-scroll-menu-arrow-right"}]; + let scrollMenuRight = this.utility.createElement("i", scrollMenuRightAttributes, "keyboard_arrow_right", scrollMenuContainer); + scrollMenuRight.classList.add("material-icons"); + + // Add event listiner + scrollMenuRight.addEventListener("click", (data) => { + scrollMenu.scrollLeft += 200; }); - } - } - else if(message.contentType == 2) { - let stickerMsgAttributes = [{"id":"ch_sticker_message"},{"class":"ch-sticker-message"}]; - let stickerMsg = this.utility.createElement("div", stickerMsgAttributes, null, messageBox); - stickerMsg.style.backgroundImage = "url(" + message.originalUrl + ")"; - - } - else if(message.contentType == 3) { - let locationSrc = SETTINGS.LOCATION_IMG_URL + "?center=" + - message.data.latitude + "," + message.data.longitude + "&zoom=15&size=208x100&maptype=roadmap&markers=color:red%7C" + - message.data.latitude + "," + message.data.longitude + "&key=" + SETTINGS.LOCATION_API_KEY; - - let locationMsgAttributes = [{"id":"ch_location_message"},{"class":"ch-location-message"}]; - let locationMsg = this.utility.createElement("div", locationMsgAttributes, null, messageBox); - locationMsg.style.backgroundImage = "url(" + locationSrc + ")"; - - // Set location message listener - locationMsg.addEventListener("click", data => { - let mapUrl = "https://www.google.com/maps?z=15&t=m&q=loc:"+message.data.latitude+","+message.data.longitude; - window.open(mapUrl, "_blank"); + } + }); - } - } + } - _addListenerOnMoreOption(message, moreOption, msgList) { + _updateReaction(messageId, reactionMenuListItem) { + reactionMenuListItem.addEventListener("click", (data) => { + // Close the reaction container + if (document.getElementById("ch_scroll_menu_container")) { + document.getElementById("ch_scroll_menu_container").remove(); + } + const messageIndex = this.messages.findIndex(message => message.id == messageId); + if (messageIndex == -1) { + return; + } + + const message = this.messages[messageIndex]; + const reactionType = reactionMenuListItem.title; + + const reactionTypeObj = message.reactions[reactionType]; + if (reactionTypeObj && reactionTypeObj.indexOf(this.widget.userId) != -1) { + // Update message reactions + var memberIndex = this.messages[messageIndex]["reactions"][reactionType].indexOf(this.widget.userId); + if (memberIndex != -1) { + this.messages[messageIndex]["reactions"][reactionType].splice(memberIndex, 1); + this.messages[messageIndex]["reactionsCount"][reactionType] --; + } + + this.chAdapter.removeReaction(message, { type: reactionType }, (err, res) => { + }); + } else { + // Update message reactions + if(this.messages[messageIndex]["reactions"][reactionType]) { + var memberIndex = this.messages[messageIndex]["reactions"][reactionType].indexOf(this.widget.userId); + if (memberIndex == -1) { + this.messages[messageIndex]["reactions"][reactionType].push(this.widget.userId); + this.messages[messageIndex]["reactionsCount"][reactionType] ++; + } + } else { + const reactionData = this.messages[messageIndex]["reactions"]; + reactionData[reactionType] = [this.widget.userId]; + this.messages[messageIndex]["reactions"] = reactionData; + + const reactionCountData = this.messages[messageIndex]["reactionsCount"]; + reactionCountData[reactionType] = 1; + this.messages[messageIndex]["reactionsCount"] = reactionCountData; + } + + this.chAdapter.addReaction(message, { type: reactionType }, (err, res) => { + }); + } + + }); + } + + _addListenerOnMoreOption(message, moreOption, msgList) { moreOption.addEventListener("click", (data) => { - if(document.getElementById("ch_msg_option_container")) { + if (document.getElementById("ch_msg_option_container")) { document.getElementById("ch_msg_option_container").remove(); return; } + // Hide the add reaction container + if (document.getElementById("ch_scroll_menu_container")) { + document.getElementById("ch_scroll_menu_container").remove(); + } + // Create message options container let msgOptionsContainerAttributes = [{"id":"ch_msg_option_container"},{"class":"ch-msg-option-container"}]; let msgOptionsContainer = this.utility.createElement("div", msgOptionsContainerAttributes, null, msgList); - if(message.ownerId == window.userId) + if (message.ownerId == this.widget.userId) { msgOptionsContainer.style.left = "15px"; - else + } else { msgOptionsContainer.style.right = "15px"; + } // Create delete message for me option - let deleteMsgAttributes = [{"class":"ch-msg-delete-for-me"}]; - let deleteMsgOption = this.utility.createElement("div", deleteMsgAttributes, LANGUAGE_PHRASES.DELETE_FOR_ME, msgOptionsContainer); + if(this.conversation.type === 'private') { + let deleteMsgAttributes = [{"class":"ch-msg-delete-for-me"}]; + let deleteMsgOption = this.utility.createElement("div", deleteMsgAttributes, LANGUAGE_PHRASES.DELETE_FOR_ME, msgOptionsContainer); - // Add listener on delete message for me - deleteMsgOption.addEventListener("click", (data) => { - msgOptionsContainer.remove(); - - // Delete message for me - this.chAdapter.deleteMessagesForMe([message.id], (err, res) => { - if(err) console.error(err); - }) - }); + // Add listener on delete message for me + deleteMsgOption.addEventListener("click", (data) => { + msgOptionsContainer.remove(); + + // Delete message for me + this.chAdapter.deleteMessagesForMe([message.id], (err, res) => { + if(err) console.error(err); + }) + }); + } - if(!message.isDeleted && message.ownerId == window.userId) { + if (!message.isDeleted && message.ownerId == this.widget.userId) { // Create delete message for everyone option let deleteMsgEveryoneAttributes = [{"id":"ch_msg_delete_for_everyone"},{"class":"ch-msg-delete-for-everyone"}]; let deleteMsgEveryoneOption = this.utility.createElement("div", deleteMsgEveryoneAttributes, LANGUAGE_PHRASES.DELETE_FOR_EVERYONE, msgOptionsContainer); @@ -796,44 +1330,388 @@ class ConversationWindow { // Delete message for me this.chAdapter.deleteMessagesForEveryone([message.id], (err, res) => { - if(err) console.error(err); + if (err) console.error(err); }) }); } - }); - } + + if (!message.isDeleted && !this.allowThreadMessage) { + // Create reply message option + let replyMsgAttributes = [{"class":"ch-msg-reply"}]; + let replyMsgOption = this.utility.createElement("div", replyMsgAttributes, LANGUAGE_PHRASES.REPLIES, msgOptionsContainer); + + // Add listener on reply + replyMsgOption.addEventListener("click", (data) => { + msgOptionsContainer.remove(); + this.replyMessage = message; + this.openReplyMessageComposerBox(message); + }); + } + + if (!message.isDeleted && this.allowThreadMessage && message.replyCount == 0) { + // Create Reply in Thread option + let startThreadAttributes = [{"id":"ch_msg_start_thread"},{"class":"ch-msg-start-thread"}]; + let startThreadOption = this.utility.createElement("div", startThreadAttributes, LANGUAGE_PHRASES.REPLY_IN_THREAD, msgOptionsContainer); + + // Add listener on Reply in Thread + startThreadOption.addEventListener("click", (data) => { + msgOptionsContainer.remove(); + this.widget.loadThread(message, this.conversation); + }); + } - updateDeleteForEveryoneMsg(msgData) { - // Update text of deleted message - let convTargetMsg = document.getElementById("ch_message_" + msgData.deletedIds[0]); - if(convTargetMsg) { - convTargetMsg.innerHTML = "" + LANGUAGE_PHRASES.MESSAGE_DELETED; + if (this.allowThreadMessage && message.replyCount) { + // Create view thread option + let viewThreadAttributes = [{"id":"ch_msg_view_thread"},{"class":"ch-msg-view-thread"}]; + let viewThreadOption = this.utility.createElement("div", viewThreadAttributes, LANGUAGE_PHRASES.VIEW_THREAD, msgOptionsContainer); + + // Add listener on view thread + viewThreadOption.addEventListener("click", (data) => { + msgOptionsContainer.remove(); + this.widget.loadThread(message, this.conversation); + }); } + }); + } + + openReplyMessageComposerBox(message) { + // Hide media docker + this.showMediaDocker(false); + // Show reply container + this.showReplyContainer(true); + + /* Set reply composer params */ + let attachment = message.attachments && message.attachments[0]; + let attachmentType = attachment ? attachment.type : ''; + + let formatedMessageImg = ''; + switch(attachmentType) { + case "image": + formatedMessageImg = attachment.thumbnailUrl ? attachment.thumbnailUrl : attachment.fileUrl; + break; + + case "video": + formatedMessageImg = attachment.thumbnailUrl ? attachment.thumbnailUrl : ''; + break; + + case "sticker": case "gif": + formatedMessageImg = attachment.stillUrl; + break; + + case "location": + formatedMessageImg = SETTINGS.LOCATION_IMG_URL + "?center=" + + attachment.latitude + "," + attachment.longitude + "&zoom=15&size=208x100&maptype=roadmap&markers=color:red%7C" + + attachment.latitude + "," + attachment.longitude + "&key=" + SETTINGS.LOCATION_API_KEY; + break; + } + + // Set parent message owner name in reply composer + let replyTitle = (message.ownerId == this.widget.userId) ? LANGUAGE_PHRASES.YOU : message.owner.displayName; + document.getElementById('ch_reply_msg_owner_name').innerHTML = replyTitle; + + // Set parent message icon in reply composer + if (attachmentType) { + document.getElementById('ch_reply_msg_icon').innerHTML = ICONS[attachmentType]; + document.getElementById('ch_reply_msg_icon').style.display = 'block'; + } else { + document.getElementById('ch_reply_msg_icon').innerHTML = ''; + document.getElementById('ch_reply_msg_icon').style.display = 'none'; + } + + // Set parent message duration in reply composer + if (attachmentType && ['audio','video'].includes(attachmentType)) { + document.getElementById('ch_reply_msg_duration').innerHTML = this.utility.formatDuration(attachment.duration); + document.getElementById('ch_reply_msg_duration').style.display = 'block'; + } else { + document.getElementById('ch_reply_msg_duration').innerHTML = ''; + document.getElementById('ch_reply_msg_duration').style.display = 'none'; + } + + // Set parent message body in reply composer + let replyMessage = message.body ? message.body : LANGUAGE_PHRASES[attachmentType.toLocaleUpperCase()]; + document.getElementById('ch_reply_msg_body').innerHTML = replyMessage; + + // Set parent message thumbnail in reply composer + if (formatedMessageImg) { + document.getElementById('ch_reply_message_thumbnail').src = formatedMessageImg; + document.getElementById('ch_reply_message_thumbnail').style.display = 'block'; + } else { + document.getElementById('ch_reply_message_thumbnail').src = ''; + document.getElementById('ch_reply_message_thumbnail').style.display = 'none'; + } + } + + _createMessageFrame(message, messagesBox, isPendingMessage) { + + // Create admin message view + if (message.type == "admin") { + let metaMessageAttributes = [{"class":"ch-admin-msg"}]; + this.utility.createElement("div", metaMessageAttributes, message.body, messagesBox); + return; + } + + // Create message list + let msgListAttributes = [{"id":message.id},{"class":"ch-msg-list"}]; + let msgList = this.utility.createElement("div", msgListAttributes, null, messagesBox); + + // Create sender name div + if (this.conversation.isGroup && message.ownerId != this.widget.userId) { + let senderAttributes = [{"class":"ch-sender-name"}]; + this.utility.createElement("div", senderAttributes, message.owner.displayName, msgList); + } + + // Create message container + let msgContainerAttributes = [{"class":"ch-msg-container"}]; + let msgContainer = this.utility.createElement("div", msgContainerAttributes, null, msgList); + + // Create message more options + let moreOptionAttributes = [{"class":"ch-msg-more-option"}]; + let moreOption = this.utility.createElement("i", moreOptionAttributes, "more_vert", msgList); + moreOption.classList.add("material-icons"); + + // Add event listiner on more option + this._addListenerOnMoreOption(message, moreOption, msgList); + + // Create message div + let msgDivAttributes = [{"id":"ch_message_" + message.id},{"class":"ch-message"}]; + let msgDiv = this.utility.createElement("div", msgDivAttributes, null, msgContainer); + + // Create add reaction div. + if (this.reactionsSetting.enable && message.ownerId != this.widget.userId && !message.isDeleted) { + let addReactionAttributes = [{"class":"ch-add-reaction-option"}]; + let addReaction = this.utility.createElement("i", addReactionAttributes, "insert_emoticon", msgList); + addReaction.classList.add("material-icons"); + + // Add event listiner on add reaction option + this._addListenerOnAddReactionOption(message, addReaction, msgList); + } + + // Create message and reply message frame + this._createTextMessageFrame(message, msgDiv); + + // Create media message frame + this._createMediaMessageFrame(message, msgDiv); + + // Create added message reaction view + if (this.reactionsSetting.enable && !message.isDeleted) { + this._createMessageReactionFrame(message, msgDiv); + } + + // Create message reply count container + let msgReplyCountContainerAttributes = [{"id":"ch_reply_count_container_" + message.id},{"class":"ch-msg-reply-count-container"}]; + let msgReplyCountContainer = this.utility.createElement("div", msgReplyCountContainerAttributes, null, msgContainer); + + // Create message reply count icon view + let arrowIcon = (message.ownerId == this.widget.userId) ? "subdirectory_arrow_left" : "subdirectory_arrow_right"; + let msgReplyIconAttributes = [{"class":"ch-msg-reply-count-icon"}]; + let msgReplyIcon = this.utility.createElement("i", msgReplyIconAttributes, arrowIcon, msgReplyCountContainer); + msgReplyIcon.classList.add("material-icons"); + + // Create message reply count span + let msgReplyCountAttributes = [{"id":"ch_reply_count_" + message.id},{"class":"ch-msg-reply-count"}]; + let msgReplyCount = this.utility.createElement("span", msgReplyCountAttributes, null, msgReplyCountContainer); + + msgReplyCount.addEventListener("click", (data) => { + this.widget.loadThread(message, this.conversation); + }); + + // Set reply icon and count + if (this.allowThreadMessage && message.replyCount) { + msgReplyCountContainer.classList.add("show"); + msgReplyCount.innerHTML = message.replyCount + " " + LANGUAGE_PHRASES.REPLIES; + } + + // Create message time span + let createdAt = message.createdAt; + if (!createdAt) { + let date = new Date(); + date = date.toISOString(); + createdAt = this.utility.updateTimeFormat(date); + } + let msgTimeAttributes = [{"class":"ch-msg-time"}]; + let msgTime = this.utility.createElement("span", msgTimeAttributes, createdAt, msgContainer); + + if (message.ownerId == this.widget.userId) { + msgContainer.classList.add("right"); + moreOption.classList.add("left"); + // Create message read status + let statusAttributes = [{"id":"ch_msg_status"}]; + let readIcon = message.readByAll ? "done_all" : "check"; + let msgStatus = this.utility.createElement("i", statusAttributes, isPendingMessage ? "schedule" : readIcon, msgContainer); + msgStatus.classList.add("material-icons", "ch-msg-status"); + } + else{ + msgContainer.classList.add("left"); + moreOption.classList.add("right"); + } + } + + updateDeleteForEveryoneMsg(data) { + if (this.conversation.id != data.conversation.id) + return; + + // Update text of deleted message + let convTargetMsg = document.getElementById("ch_message_" + data.messages[0].id); + if (convTargetMsg) { + convTargetMsg.innerHTML = "" + LANGUAGE_PHRASES.MESSAGE_DELETED; + } // Update listener of deleted message - let deletedMsgOptionBtn = document.getElementById(msgData.deletedIds[0]).lastChild; - deletedMsgOptionBtn.addEventListener("click", data => { - // Remove delete for everyone option - let deleteForEveryoneBtn = document.getElementById("ch_msg_delete_for_everyone"); - if(deleteForEveryoneBtn) { - deleteForEveryoneBtn.remove(); - } - }); - } + let targetMessage = document.getElementById(data.messages[0].id) + if (targetMessage) { + let deletedMsgOptionBtn = targetMessage.lastChild; + deletedMsgOptionBtn.addEventListener("click", data => { + // Remove delete for everyone option + let deleteForEveryoneBtn = document.getElementById("ch_msg_delete_for_everyone"); + if (deleteForEveryoneBtn) { + deleteForEveryoneBtn.remove(); + } + + // Remove Reply in Thread option + let deleteStartThread = document.getElementById("ch_msg_start_thread"); + if (deleteStartThread) { + deleteStartThread.remove(); + } + }); + } + } + + handleBlock(data) { + if (this.conversation.isGroup) + return; - handleBlock(self, userId) { - document.getElementById("ch_conv_block").style.display = "none";; - document.getElementById("ch_conv_unblock").style.display = "block"; - document.getElementById("ch_conv_status").style.visibility = "hidden"; + if (this.conversation.user.id == data.blockee.id) { + document.getElementById("ch_conv_block").style.display = "none";; + document.getElementById("ch_conv_unblock").style.display = "block"; + } + + // Hide status and input field + document.getElementById("ch_conv_status").style.visibility = "hidden"; document.getElementById("ch_send_box").style.visibility = "hidden"; - } + } - handleUnblock(self, userId) { - document.getElementById("ch_conv_unblock").style.display = "none"; - document.getElementById("ch_conv_block").style.display = "block"; - document.getElementById("ch_conv_status").style.visibility = "visible"; + handleUnblock(data) { + if (this.conversation.isGroup) + return; + + if (this.conversation.user.id == data.unblockee.id) { + document.getElementById("ch_conv_unblock").style.display = "none"; + document.getElementById("ch_conv_block").style.display = "block"; + } + + // Show status and input field + document.getElementById("ch_conv_status").style.visibility = "visible"; document.getElementById("ch_send_box").style.visibility = "visible"; - } + } + + handleClearConversation(conversation) { + if (conversation.id != this.conversation.id) { + return; + } + let messagesBox = document.getElementById("ch_messages_box"); + if (messagesBox) { + messagesBox.innerHTML = ""; + } + } + + handleDeleteConversation(conversation) { + if (conversation.id != this.conversation.id) { + return; + } + + let conversationWindow = document.getElementById("ch_conv_window"); + if (conversationWindow) { + conversationWindow.remove(); + } + } + + handleUserJoined(data) { + if(data.conversation.id != this.conversation.id) return; + this.conversation.isActive = true; + document.getElementById("ch_send_box").style.visibility = "visible"; + document.getElementById("ch_conv_leave").style.display = "block"; + if(this.conversation.type === 'public') { + document.getElementById("ch_conv_join").style.visibility = "hidden"; + } + } + + handleUserRemoved(data) { + if(data.conversation.id != this.conversation.id) return; + this.conversation.isActive = false; + document.getElementById("ch_send_box").style.visibility = "hidden"; + document.getElementById("ch_conv_leave").style.display = "none"; + if(this.conversation.type === 'public') { + document.getElementById("ch_conv_join").style.visibility = "visible"; + } + } + + handleAddReaction(data) { + if (data.message.conversationId != this.conversation.id) { + return; + } + + const messageId = data.message.id; + const messageIndex = this.messages.findIndex(message => message.id == messageId); + if (messageIndex != -1) { + const reactionType = data.reaction.type; + const userId = data.user.id; + const reactionsCount = data.message.reactionsCount; + + if(this.messages[messageIndex]["reactions"][reactionType]) { + var memberIndex = this.messages[messageIndex]["reactions"][reactionType].indexOf(userId); + if (memberIndex == -1) { + this.messages[messageIndex]["reactions"][reactionType].push(userId); + } + this.messages[messageIndex]["reactionsCount"] = reactionsCount; + } else { + const reactionData = this.messages[messageIndex]["reactions"]; + reactionData[reactionType] = [userId]; + this.messages[messageIndex]["reactions"] = reactionData; + this.messages[messageIndex]["reactionsCount"] = reactionsCount; + } + + let msgDiv = document.getElementById("ch_message_" + messageId); + this._createMessageReactionFrame(this.messages[messageIndex], msgDiv); + } + } + + handleRemoveReaction(data) { + if (data.message.conversationId != this.conversation.id) { + return; + } + + const messageId = data.message.id; + const reactionType = data.reaction.type; + const messageIndex = this.messages.findIndex(message => message.id == messageId); + if (messageIndex != -1 && this.messages[messageIndex]["reactions"][reactionType]) { + const userId = data.user.id; + const reactionsCount = data.message.reactionsCount; + var memberIndex = this.messages[messageIndex]["reactions"][reactionType].indexOf(userId); + if (memberIndex != -1) { + this.messages[messageIndex]["reactions"][reactionType].splice(memberIndex, 1); + } + this.messages[messageIndex]["reactionsCount"] = reactionsCount; + + let msgDiv = document.getElementById("ch_message_" + messageId); + this._createMessageReactionFrame(this.messages[messageIndex], msgDiv); + } + } + + showMediaDocker(value) { + if (value) { + document.getElementById("ch_media_docker").classList.add("ch-show-docker"); + } else { + document.getElementById("ch_media_docker").classList.remove("ch-show-docker"); + } + } + + showReplyContainer(value) { + if (value) { + document.getElementById("ch_reply_container").classList.add('ch-show-reply-container'); + } else { + document.getElementById("ch_reply_container").classList.remove('ch-show-reply-container'); + } + } } export { ConversationWindow as default }; \ No newline at end of file diff --git a/web-widget/src/js/components/login.js b/web-widget/src/js/components/login.js old mode 100755 new mode 100644 index 4a2c0bc..e1c51c1 --- a/web-widget/src/js/components/login.js +++ b/web-widget/src/js/components/login.js @@ -45,7 +45,7 @@ class Login { this.utility.createElement("div", loginNameAttributes, LANGUAGE_PHRASES.NAME, loginNameContainer); // Create input div - let loginNameInputAttributes = [{"id":"ch_login_name_input"},{"class":"ch-login-name-input"},{"type":"text"}]; + let loginNameInputAttributes = [{"id":"ch_login_name_input"},{"class":"ch-login-name-input"},{"type":"text"},{"placeholder":"Enter a name"}]; this.utility.createElement("input", loginNameInputAttributes, null, loginNameContainer); // Create error div @@ -58,7 +58,6 @@ class Login { // Create Login button let loginBtnAttributes = [{"id":"ch_login_btn"},{"class":"ch-login-btn"}]; this.utility.createElement("button", loginBtnAttributes, LANGUAGE_PHRASES.START, loginWindow); - } _createDummyUsersContainer(parent) { @@ -75,7 +74,7 @@ class Login { let user1 = this.utility.createElement("img", dummyUser1Attributes, null, dummyContainer); user1.addEventListener("click", (data) => { - const email = "test1@channelize.io"; + const email = "test1@seaddons.com"; const password = "123456"; this._loginUser(email, password, true); }); @@ -85,7 +84,7 @@ class Login { let user2 = this.utility.createElement("img", dummyUser2Attributes, null, dummyContainer); user2.addEventListener("click", (data) => { - const email = "test2@channelize.io"; + const email = "test2@seaddons.com"; const password = "123456"; this._loginUser(email, password, true); }); @@ -95,8 +94,8 @@ class Login { let user3 = this.utility.createElement("img", dummyUser3Attributes, null, dummyContainer); user3.addEventListener("click", (data) => { - const email = "test3@channelize.io"; - const password = "123456"; + const email = "test@channelize.io"; + const password = "Test@123456"; this._loginUser(email, password, true); }); @@ -105,8 +104,8 @@ class Login { let user4 = this.utility.createElement("img", dummyUser4Attributes, null, dummyContainer); user4.addEventListener("click", (data) => { - const email = "test4@channelize.io"; - const password = "123456"; + const email = "heyley@channelize.io"; + const password = "Test@123456"; this._loginUser(email, password, true); }); } @@ -124,8 +123,8 @@ class Login { document.getElementById("ch_login_loader_container").style.display = "block"; - var email = name.replace(/\s/g, '').toLowerCase() + '@gmail.com'; - const password = "12345"; + var email = name.replace(/\s/g, '').toLowerCase() + "@channelize.io"; + const password = "123456"; // Create a new user this.chAdapter.createUser(name, email, password, (err, user) => { @@ -147,14 +146,14 @@ class Login { this.chAdapter.loginWithEmail(email, password, (err, res) => { if(err) console.error(err); - const userId = window.userId = res.user.id; + const userId = this.widget.userId = res.user.id; const accessToken = res.id; // Connect to Channelize Server this.widget.connect(userId, accessToken, (err,res) => { if(err) console.error(err); // Set cookies - this.widget.setCookie(userId, accessToken, 1); + this.widget.setCookie(userId, accessToken, 30); if(isDummyUser) { // Open recent conversation window @@ -164,17 +163,10 @@ class Login { document.getElementById("ch_login_window").remove(); } else { - // Add channelize.io team as a friend - const channelizeTeamId = "16d31770-8843-11e9-88fd-33cb21cf39cd"; // Channelize.io account ID - - this.chAdapter.addFriend(channelizeTeamId, 2, (err, res) => { - if(err) return console.error(err); + new RecentConversations(this.widget); - // Open recent conversation window - new RecentConversations(this.widget); - // Close login window - document.getElementById("ch_login_window").remove(); - }); + // Close login window + document.getElementById("ch_login_window").remove(); } }); }); @@ -184,7 +176,6 @@ class Login { // Login button listener let loginBtn = document.getElementById("ch_login_btn"); loginBtn.addEventListener("click", data => { - this._createUser(); }); diff --git a/web-widget/src/js/components/members.js b/web-widget/src/js/components/members.js new file mode 100644 index 0000000..c8a3ab1 --- /dev/null +++ b/web-widget/src/js/components/members.js @@ -0,0 +1,126 @@ +import Utility from "../utility.js"; +import ConversationWindow from "./conversation-window.js"; +import { LANGUAGE_PHRASES, IMAGES } from "../constants.js"; + +class Members { + constructor(widget, conversationId) { + this.widget = widget; + this.chAdapter = widget.chAdapter; + this.conversationId = conversationId; + this.utility = new Utility(); + this.createMembersList(); + } + + createMembersList() { + // Remove previous members window if exist + let olderMembersWindow = document.getElementById("ch_members_window"); + if(olderMembersWindow) { + olderMembersWindow.remove(); + } + + // Create members box components + let widget = document.getElementById("ch_frame"); + let membersWindowAttributes = [{"id": "ch_members_window"},{"class":"ch-members-window"}]; + let membersWindow = this.utility.createElement("div", membersWindowAttributes, null, widget); + + // Create members header + let membersHeaderAttributes = [{"id":"ch_members_header"},{"class":"ch-header"}]; + let membersHeader = this.utility.createElement("div", membersHeaderAttributes, LANGUAGE_PHRASES.MEMBERS, membersWindow); + + // Create members Close button + let closeBtnAttributes = [{"id":"ch_members_close_btn"}]; + let closeBtn = this.utility.createElement("i", closeBtnAttributes, "arrow_back", membersHeader); + closeBtn.classList.add("material-icons", "ch-close-btn"); + + // Create members listing box + let membersBoxAttributes = [{"id":"ch_members_box"},{"class":"ch-members-box"}]; + this.utility.createElement("div", membersBoxAttributes, null, membersWindow); + + // get conversation Members + this.chAdapter.getConversation(this.conversationId, (err, conversation) => { + if (err) return console.error(err); + + if(conversation.members) { + conversation.members.forEach(member => { + this._loadMembers(member); + }); + } + }); + + this._registerClickEventHandlers(); + } + + _loadMembers(member) { + let membersBox = document.getElementById("ch_members_box"); + let membersListAttributes = [{"id":member.userId},{"class":"ch-members-list"}]; + let membersList = this.utility.createElement("li", membersListAttributes, null, membersBox); + + if(member.userId !== this.widget.userId) { + // Add click listener on members list + membersList.addEventListener("click", (data) => { + // Remove conversation window + if(document.getElementById("ch_conv_window")) { + document.getElementById("ch_conv_window").remove(); + this.widget.convWindows.pop(); + } + + // Remove members window + document.getElementById("ch_members_window").remove(); + + // Check for exist conversation + this.chAdapter.getConversationsList(1, 0 , member.userId, "members", null, null, null, null, null, (err, conversation) => { + if(err) return console.error(err); + + conversation = conversation[0]; + + if(conversation) { + const conversationWindow = new ConversationWindow(this.widget); + conversationWindow.init(conversation); + this.widget.convWindows.push(conversationWindow); + } + else { + // Open new conversation window + const conversationWindow = new ConversationWindow(this.widget); + conversationWindow.init(null, member.user); + this.widget.convWindows.push(conversationWindow); + } + }); + }); + } + else { + membersList.style.cursor = "text"; + } + + // Create image tag + member.profileImageUrl = member.user.profileImageUrl ? member.user.profileImageUrl : IMAGES.AVTAR; + let imageAttributes = [{"id":"ch_member_img"},{"class":"ch-member-img"}]; + let memberImg = this.utility.createElement("div", imageAttributes, null, membersList); + memberImg.style.backgroundImage = "url(" + member.profileImageUrl + ")"; + + // Create name div + const memberName = member.userId === this.widget.userId ? member.user.displayName + " (You)" : member.user.displayName; + let nameAttributes = [{"id":"ch_member_name"},{"class":"ch-member-name"}]; + this.utility.createElement("div", nameAttributes, memberName, membersList); + + // Create online icon + let iconAttributes = [{"id":member.user.id+"_member_online_icon"},{"class":"ch-online-icon"}]; + let icon = this.utility.createElement("span", iconAttributes, null, memberImg); + + // Show online icon + if(member.user.isOnline) { + icon.classList.add("ch-show-element"); + } + } + + _registerClickEventHandlers() { + // Close search button listener + let closeBtn = document.getElementById("ch_members_close_btn"); + if(closeBtn) { + closeBtn.addEventListener("click", (data) => { + document.getElementById("ch_members_window").remove(); + }); + } + } +} + +export { Members as default } \ No newline at end of file diff --git a/web-widget/src/js/components/recent-conversations.js b/web-widget/src/js/components/recent-conversations.js old mode 100755 new mode 100644 index 13396c5..2cb5321 --- a/web-widget/src/js/components/recent-conversations.js +++ b/web-widget/src/js/components/recent-conversations.js @@ -2,7 +2,7 @@ import Utility from "../utility.js"; import ConversationWindow from "./conversation-window.js"; import Search from "./search.js"; import Login from "./login.js"; -import { LANGUAGE_PHRASES, IMAGES } from "../constants.js"; +import { LANGUAGE_PHRASES, IMAGES, SETTINGS } from "../constants.js"; class RecentConversations { @@ -75,7 +75,7 @@ class RecentConversations { this._registerClickEventHandlers(); // Set user image in header - this.getUser(window.userId, (err, user) => { + this.getUser(this.widget.userId, (err, user) => { if(err) return console.error(err); let imgAttributes = [{"class":"ch-conversation-image"}]; @@ -91,7 +91,7 @@ class RecentConversations { _loadConversations() { // Load conversations - this.chAdapter.getConversationsList(this.limit, this.skip, null, (err, conversations) => { + this.chAdapter.getConversationsList(this.limit, this.skip, null, "members", null, null, null, null, null, (err, conversations) => { if(err) return console.error(err); this.conversations = conversations; @@ -115,9 +115,8 @@ class RecentConversations { let ul = document.getElementById("ch_recent_ul"); conversations.forEach(conversation => { + // modify conversation object conversation = this.modifyConversation(conversation); - if(!conversation.member) - return; // Create list of conversations let listAttributes = [{"id":conversation.id}]; @@ -140,18 +139,21 @@ class RecentConversations { let imgDiv = this.utility.createElement("div", imgAttributes, null, list); imgDiv.style.backgroundImage = "url(" + conversation.profileImageUrl + ")"; - // Create online icon - let iconAttributes = [{"id":conversation.member.userId+"_online_icon"},{"class":"ch-online-icon"}]; - let icon = this.utility.createElement("span", iconAttributes, null, imgDiv); + if(!conversation.isGroup && conversation.user) { + // Create online icon + let iconAttributes = [{"id":conversation.user.id+"_online_icon"},{"class":"ch-online-icon"}]; + let icon = this.utility.createElement("span", iconAttributes, null, imgDiv); - // Show block icon - if(conversation.blockedByUser || conversation.blockedByMember) { - icon.classList.add("ch-user-blocked"); - icon.classList.add("ch-show-element"); - } + // Show block icon + if(conversation.blockedByUser || conversation.blockedByMember) { + icon.classList.add("ch-user-blocked"); + } - if(!conversation.isGroup && conversation.member.user && conversation.member.user.isOnline) - icon.classList.add("ch-show-element"); + // Show online icon + if(conversation.user && conversation.user.isOnline) { + icon.classList.add("ch-show-element"); + } + } // Create title div let titleDivAttributes = [{"id":"ch_title"}]; @@ -165,7 +167,7 @@ class RecentConversations { let lastMsgBoxAttributes = [{"id":"ch_last_msg_box"},{"class":"ch-last-msg-box"}]; let lastMsgBox = this.utility.createElement("div", lastMsgBoxAttributes, null, list); - if(conversation.lastMessageType != "text") { + if(conversation.lastMessageIcon) { // Create last message icon let msgIconAttributes = [{"id":"ch_msg_type_icon"},{"class":"ch-msg-type-icon"},{"src":conversation.lastMessageIcon}]; this.utility.createElement("img", msgIconAttributes, null, lastMsgBox); @@ -186,106 +188,116 @@ class RecentConversations { } modifyConversation(conversation) { - let member = conversation.membersList.find(member => member.userId != window.userId); - if (!member || !member.user) { - conversation.title = LANGUAGE_PHRASES.DELETED_MEMBER; - conversation.profileImageUrl = null; - conversation.isOnline = false; - return conversation; - } - - //Set profile Image of conversation - let imgUrl; - if(!conversation.isGroup) - imgUrl = IMAGES.AVTAR; - else - imgUrl = IMAGES.GROUP; - - if(conversation.isGroup) - conversation.profileImageUrl = conversation.profileImageUrl ? conversation.profileImageUrl : imgUrl; - else - conversation.profileImageUrl = member.user.profileImageUrl ? member.user.profileImageUrl : imgUrl; - - // Set conversation title and member status - conversation.title = conversation.isGroup ? conversation.title : member.user.displayName; - conversation.isOnline = member.user ? member.user.isOnline : false; - conversation.member = member; - - let loginUser = conversation.membersList.find(member => member.userId == window.userId); - conversation = this._setLastMessage(conversation, loginUser.lastMessage); - - // Set block user status - if(!member.isActive) - conversation.blockedByMember = true; - - if(!loginUser.isActive) - conversation.blockedByUser = true; - - conversation.modified = true; + if (!conversation.isGroup && Object.entries(conversation.user).length === 0) { + conversation.title = LANGUAGE_PHRASES.DELETED_MEMBER; + conversation.profileImageUrl = IMAGES.AVTAR; + return conversation; + } + + // Set last message of conversation + conversation = this._setLastMessage(conversation, conversation.lastMessage); + + // Set profile Image, title and status of conversation + if(conversation.isGroup) { + conversation.profileImageUrl = conversation.profileImageUrl ? conversation.profileImageUrl : IMAGES.GROUP; + conversation.status = conversation.memberCount + " " + LANGUAGE_PHRASES.MEMBERS; + } + else { + conversation.profileImageUrl = conversation.user.profileImageUrl ? conversation.user.profileImageUrl : IMAGES.AVTAR; + conversation.title = conversation.user.displayName; + + // Set block user status + let member = conversation.members.find(member => member.userId == conversation.user.id); + if(!member) { + conversation.blockedByMember = true; + conversation.status = ""; + } + else { + conversation.blockedByMember = member ? false : true; + if(!conversation.isActive) { + conversation.blockedByUser = true; + } + + if(conversation.user.isOnline) { + conversation.status = LANGUAGE_PHRASES.ONLINE; + } + else if(conversation.user.lastSeen) { + conversation.status = LANGUAGE_PHRASES.LAST_SEEN + this.utility.updateTimeFormat(member.user.lastSeen); + } + } + } + conversation.isModified = true; return conversation; } _setLastMessage(conversation, message) { if(!message) return conversation; + // Set lastMessage of conersation - if(!message.contentType || message.contentType == 0) { - if(message.isDeleted) { - conversation.lastMessageType = "text"; - conversation.lastMessageBody = "" + LANGUAGE_PHRASES.MESSAGE_DELETED; - } - else if(message.attachmentType && message.attachmentType != "text") { - let icon; - - switch(message.attachmentType) { - case "image": - icon = IMAGES.GALLERY_ICON; - conversation.lastMessageBody = LANGUAGE_PHRASES.IMAGE; - break; - - case "audio": - icon = IMAGES.AUDIO_ICON; - conversation.lastMessageBody = LANGUAGE_PHRASES.AUDIO; - break; - - case "video": - icon = IMAGES.GALLERY_ICON; - conversation.lastMessageBody = LANGUAGE_PHRASES.VIDEO; - break; - } - conversation.lastMessageType = message.attachmentType; - conversation.lastMessageIcon = icon; - } - else { - conversation.lastMessageType = "text"; - conversation.lastMessageBody = message.body; - } + conversation.lastMessage = message; + if(message.isDeleted) { + conversation.lastMessageIcon = null; + conversation.lastMessageBody = "" + LANGUAGE_PHRASES.MESSAGE_DELETED; } - else if(message.contentType == 2) { - if(message.attachmentType == "sticker") { - conversation.lastMessageBody = LANGUAGE_PHRASES.STICKER; - conversation.lastMessageType = "sticker"; - conversation.lastMessageIcon = IMAGES.STICKER_ICON; - } - else { - conversation.lastMessageBody = LANGUAGE_PHRASES.GIF; - conversation.lastMessageType = "gif"; - conversation.lastMessageIcon = IMAGES.GIF_ICON; + else if(message.type == "admin") { + conversation.lastMessageIcon = null; + conversation.lastMessageBody = this._handleMetaMessage(message); + } + else if(message.attachments && message.attachments.length) { + + switch(message.attachments[0].type) { + case "image": + conversation.lastMessageIcon = IMAGES.GALLERY_ICON; + conversation.lastMessageBody = LANGUAGE_PHRASES.IMAGE; + break; + + case "audio": + conversation.lastMessageIcon = IMAGES.AUDIO_ICON; + conversation.lastMessageBody = LANGUAGE_PHRASES.AUDIO; + break; + + case "video": + conversation.lastMessageIcon = IMAGES.GALLERY_ICON; + conversation.lastMessageBody = LANGUAGE_PHRASES.VIDEO; + break; + + case "location": + conversation.lastMessageIcon = IMAGES.LOCATION_ICON; + conversation.lastMessageBody = LANGUAGE_PHRASES.LOCATION; + break; + + case "sticker": + conversation.lastMessageIcon = IMAGES.STICKER_ICON; + conversation.lastMessageBody = LANGUAGE_PHRASES.STICKER; + break; + + case "gif": + conversation.lastMessageIcon = IMAGES.GIF_ICON; + conversation.lastMessageBody = LANGUAGE_PHRASES.GIF; + break; + + case "text": + conversation.lastMessageIcon = IMAGES.GALLERY_ICON; + conversation.lastMessageBody = message.body; + break; + + default: + conversation.lastMessageIcon = IMAGES.GALLERY_ICON; + conversation.lastMessageBody = LANGUAGE_PHRASES.ATTACHMENT; } } - else if(message.contentType == 3) { - conversation.lastMessageBody = LANGUAGE_PHRASES.LOCATION; - conversation.lastMessageType = "location"; - conversation.lastMessageIcon = IMAGES.LOCATION_ICON; + else { + conversation.lastMessageIcon = null; + conversation.lastMessageBody = message.body; } // Set Last Message time - if(!message.recipients.length) { + if(!message.updatedAt) { conversation.lastMessageTime = this.utility.updateTimeFormat(Date()); } else { - let loginUser = conversation.membersList.find(member => member.userId == window.userId); - conversation.lastMessageTime = this.utility.updateTimeFormat(loginUser.updatedAt); + conversation.lastMessageTime = this.utility.updateTimeFormat(message.updatedAt); } // Set last message Id @@ -294,9 +306,8 @@ class RecentConversations { } deleteLastMessage(data, updatedLastMsg) { - let targetLastMsg = document.getElementById("ch_msg_" + data.messageIds[0]); + let targetLastMsg = document.getElementById("ch_msg_" + data.messages[0].id); if(!updatedLastMsg) { - targetLastMsg.innerHTML = ""; return; } @@ -362,79 +373,105 @@ class RecentConversations { } } - updateNewMessage(message) { - if(!message) { + updateNewMessage(message, newConversation = null) { + /* Only add a new message on the recent-screen if thread messaging is disabled and + new message showInConversation is true. */ + if(!message || (SETTINGS.ALLOW_MESSAGE_THREADING && !message.showInConversation)) { return; } - let convToUpdate = this.conversations.find(conv => conv.id == message.chatId); + let convToUpdate = this.conversations.find(conv => conv.id == message.conversationId); + + if(newConversation) { + // Remove no message tag if exist + if(document.getElementById("ch_no_msg")) { + document.getElementById("ch_no_msg").remove(); + } - // Update recent conversation list if exist - if(convToUpdate && document.getElementById(convToUpdate.id)) { + newConversation = this.modifyConversation(newConversation); + this.conversations = this.conversations.concat(newConversation); + this._addNewConversationInList(newConversation); + } + else { document.getElementById(convToUpdate.id).remove(); convToUpdate = this._setLastMessage(convToUpdate, message); this._addNewConversationInList(convToUpdate); } - else { - // Get new conversation object - this.chAdapter.getConversation(message.chatId, (err, conversation) => { - if(err) return console.error(err); + } - // Remove no message tag if exist - if(document.getElementById("ch_no_msg")) - document.getElementById("ch_no_msg").remove(); - - conversation = this.modifyConversation(conversation); - this.conversations = this.conversations.concat(conversation); - this._addNewConversationInList(conversation); - - // Replace dummy conversation with new conversation - this.widget.convWindows.forEach(conversationWindow => { - if(conversationWindow.conversation.isDummyObject) { - if(document.getElementById("ch_conv_window")) { - document.getElementById("ch_conv_window").remove(); - this.widget.convWindows.pop(); - } - - const conversationWindow = new ConversationWindow(this.widget); - conversationWindow.init(conversation); - this.widget.convWindows.push(conversationWindow); - } - }); - }); + _handleMetaMessage(message) { + if(!message) + return; + + // Handle meta message + if(message.type == "admin") { + let body; + + // adminMessageType + switch(message.body) { + case "admin_group_create" : + body = "" + LANGUAGE_PHRASES.GROUP_CREATED; + break; + + case "admin_group_change_photo" : + body = "" + LANGUAGE_PHRASES.GROUP_PHOTO_CHANGED; + break; + + case "admin_group_change_title" : + body = "" + LANGUAGE_PHRASES.GROUP_TITLE_CHANGED; + break; + + case "admin_group_add_members" : + body = "" + LANGUAGE_PHRASES.GROUP_MEMBER_ADDED; + break; + + case "admin_group_remove_members" : + body = "" + LANGUAGE_PHRASES.GROUP_MEMBER_REMOVED; + break; + + case "admin_group_make_admin" : + body = "" + LANGUAGE_PHRASES.GROUP_ADMIN_UPDATED; + break; + + default: + body = "" + message.type + " message"; + } + return body; } } - updateUserOnline(user) { + updateUserStatus(user) { if(!this.conversations) return; - this.conversations.forEach(conversation => { - if(conversation.member.userId == user.id) { - conversation.status = "Online"; - return; + const index = this.conversations.findIndex(conversation => conversation.user.id == user.id); + if(index != -1) { + this.conversations[index].user = user; + if(user.isOnline) { + this.conversations[index].status = LANGUAGE_PHRASES.ONLINE; + } + else { + this.conversations[index].status = LANGUAGE_PHRASES.LAST_SEEN + this.utility.updateTimeFormat(user.lastSeen); } - }); - - let onlineIcon = document.getElementById(user.id+"_online_icon"); - if(onlineIcon) { - onlineIcon.classList.remove("ch-user-blocked"); - onlineIcon.classList.add("ch-show-element"); } - } - updateUserOffline(user) { - if(!this.conversations) + // Update block/unblock icon + let userStatusIcon = document.getElementById(user.id+"_online_icon"); + if(!userStatusIcon) return; - let conv = this.conversations.find(conversation => { - conversation.member.userId == user.id; - conversation.status = this.utility.updateTimeFormat(user.lastSeen); - }); + if(user.isOnline) { + userStatusIcon.classList.add("ch-show-element"); + } + else { + userStatusIcon.classList.remove("ch-show-element"); + } + } - let onlineIcon = document.getElementById(user.id+"_online_icon"); - if(onlineIcon) { - onlineIcon.classList.remove("ch-show-element"); + updateReadAt(data) { + let index = this.conversations.findIndex(conv => conv.id == data.conversation.id); + if(index != -1) { + this.conversations[index].lastReadAt[data.userId] = data.timestamp; } } @@ -445,7 +482,7 @@ class RecentConversations { let newConvlist = this.utility.createElement("li", listAttributes, null, null); ul.insertBefore(newConvlist, ul.childNodes[0]); - // Add event listener on new conversation + // Add event listener on new conversation list newConvlist.addEventListener("click", (data) => { if(document.getElementById("ch_conv_window")) { document.getElementById("ch_conv_window").remove(); @@ -462,6 +499,22 @@ class RecentConversations { let imgDiv = this.utility.createElement("div", imgAttributes, null, newConvlist); imgDiv.style.backgroundImage = "url(" + conversation.profileImageUrl + ")"; + if(!conversation.isGroup && conversation.user) { + // Create online icon + let iconAttributes = [{"id":conversation.user.id+"_online_icon"},{"class":"ch-online-icon"}]; + let icon = this.utility.createElement("span", iconAttributes, null, imgDiv); + + // Show block icon + if(conversation.blockedByUser || conversation.blockedByMember) { + icon.classList.add("ch-user-blocked"); + } + + // Show online icon + if(conversation.user && conversation.user.isOnline) { + icon.classList.add("ch-show-element"); + } + } + // Create title div let titleAttributes = [{"id":"ch_title"}]; this.utility.createElement("div", titleAttributes, conversation.title, newConvlist); @@ -474,7 +527,7 @@ class RecentConversations { let lastMsgBoxAttributes = [{"id":"ch_last_msg_box"},{"class":"ch-last-msg-box"}]; let lastMsgBox = this.utility.createElement("div", lastMsgBoxAttributes, null, newConvlist); - if(conversation.lastMessageType != "text") { + if(conversation.lastMessageIcon) { // Create last message icon let msgIconAttributes = [{"id":"ch_msg_type_icon"},{"class":"ch-msg-type-icon"},{"src":conversation.lastMessageIcon}]; this.utility.createElement("img", msgIconAttributes, null, lastMsgBox); @@ -492,7 +545,7 @@ class RecentConversations { _loadMoreConversations() { ++this.loadCount; this.skip = this.loadCount * this.limit; - this.chAdapter.getConversationsList(this.limit, this.skip, null, (err, conversations) => { + this.chAdapter.getConversationsList(this.limit, this.skip, null, "members", null, null, null, null, null, (err, conversations) => { if(err) return console.error(err); this._createConversationListing(conversations); @@ -554,34 +607,85 @@ class RecentConversations { }); } - handleBlock(self, userId) { + updateDeleteForEveryoneMsg(data) { + let recentTargetMsg = document.getElementById("ch_msg_" + data.messages[0].id); + if(recentTargetMsg) { + // Remove if media/location/sticker/gif icon present + if(recentTargetMsg.parentNode.firstChild.nodeName != "DIV") { + recentTargetMsg.parentNode.firstChild.remove(); + } + recentTargetMsg.innerHTML = "" + LANGUAGE_PHRASES.MESSAGE_DELETED; + } + } + + handleClearConversation(conversation) { + let targetConversation = document.getElementById(conversation.id); + + if(targetConversation && targetConversation.lastChild) { + targetConversation.lastChild.remove(); + } + } + + handleDeleteConversation(conversation) { + let targetConversation = document.getElementById(conversation.id); + + if(targetConversation && targetConversation.lastChild) { + targetConversation.remove(); + } + } + + handleBlock(data) { this.conversations.forEach(conversation => { - if(conversation.member.userId == userId && self) { + if(conversation.isGroup) + return; + + if(conversation.user.id == data.blocker.id) { conversation.blockedByMember = true; } - else if(conversation.member.userId == userId && !self) { + else if(conversation.user.id == data.blockee.id) { conversation.blockedByUser = true; } }); - let onlineIcon = document.getElementById(userId+"_online_icon"); - if(onlineIcon) + let onlineIcon = document.getElementById(data.blockee.id+"_online_icon"); + if(onlineIcon) { onlineIcon.classList.add("ch-user-blocked"); + } } - handleUnblock(self, userId) { + handleUnblock(data) { this.conversations.forEach(conversation => { - if(conversation.member.userId == userId && self) { + if(conversation.isGroup) + return; + + if(conversation.user.id == data.unblocker.id) { conversation.blockedByMember = false; } - else if(conversation.member.userId == userId && !self) { + else if(conversation.user.id == data.unblockee.id) { conversation.blockedByUser = false; } }); - let onlineIcon = document.getElementById(userId+"_online_icon"); - if(onlineIcon) + let onlineIcon = document.getElementById(data.unblockee.id+"_online_icon"); + if(onlineIcon) { onlineIcon.classList.remove("ch-user-blocked"); + } + } + + handleUserJoined(data) { + this.conversations.forEach(conversation => { + if(conversation.user.id == data.conversation.id) { + conversation.isActive = true; + } + }); + } + + handleUserRemoved(data) { + this.conversations.forEach(conversation => { + if(conversation.user.id == data.conversation.id) { + conversation.isActive = false; + } + }); } } diff --git a/web-widget/src/js/components/search.js b/web-widget/src/js/components/search.js old mode 100755 new mode 100644 index cfd1397..a522a4a --- a/web-widget/src/js/components/search.js +++ b/web-widget/src/js/components/search.js @@ -8,6 +8,10 @@ class Search { this.chAdapter = widget.chAdapter; this.widget = widget; this.utility = new Utility(); + this.searchLimit = 10; + this.friendsLimit = 20; + this.friends = []; + this.users = []; this.createSearchComponents(); this._registerClickEventHandlers(); @@ -21,7 +25,7 @@ class Search { // Create search header let searchHeaderAttributes = [{"id":"ch_search_header"},{"class":"ch-header"}]; - let searchHeader = this.utility.createElement("div", searchHeaderAttributes, LANGUAGE_PHRASES.SEARCH, searchWindow); + let searchHeader = this.utility.createElement("div", searchHeaderAttributes, LANGUAGE_PHRASES.SEARCH_MEMBERS, searchWindow); // Create search Close button let closeBtnAttributes = [{"id":"ch_search_close_btn"}]; @@ -33,7 +37,7 @@ class Search { let searchBox = this.utility.createElement("div", searchBoxAttributes, null, searchWindow); // Create search input box - let inputBoxAttributes = [{"id":"ch_search_input_box"},{"class":"ch-search-input-box"}]; + let inputBoxAttributes = [{"id":"ch_search_input_box"},{"class":"ch-search-input-box"},{"placeholder":LANGUAGE_PHRASES.SEARCH}]; this.utility.createElement("input", inputBoxAttributes, null, searchBox); // Create clear search icon @@ -45,24 +49,45 @@ class Search { let friendsBoxAttributes = [{"id":"ch_friends_box"},{"class":"ch-friends-box"}]; let friendsBox = this.utility.createElement("div", friendsBoxAttributes, null, searchWindow); + // Create loader container + let loaderContainerAttributes = [{"id":"ch_search_loader_container"},{"class":"ch-loader-bg"}]; + let loaderContainer = this.utility.createElement("div", loaderContainerAttributes, null, friendsBox); + loaderContainer.style.display = "block"; + + // Create loader + let loaderAttributes = [{"id":"ch_search_loader"},{"class":"ch-loader"}]; + let loader = this.utility.createElement("div", loaderAttributes, null, loaderContainer); + + // Create suggested friends listing box + let suggestedBoxAttributes = [{"id":"ch_suggested_box"}]; + let suggestedBox = this.utility.createElement("div", suggestedBoxAttributes, null, friendsBox); + + // Create other users listing box + let usersBoxAttributes = [{"id":"ch_users_box"}]; + let usersBox = this.utility.createElement("div", usersBoxAttributes, null, friendsBox); + // Get user friends - this.chAdapter.getFriends((err, friends) => { + this.chAdapter.getFriends(null, this.friendsLimit, null, null, null, (err, friends) => { if(err) return console.error(err); + // Hide loader + if(document.getElementById("ch_search_loader_container")) + document.getElementById("ch_search_loader_container").style.display = "none"; + if(friends.length) { // Create suggested element let suggestedAttributes = [{"id":"ch_suggested"},{"class":"ch-suggested"}]; - this.utility.createElement("div", suggestedAttributes, LANGUAGE_PHRASES.SUGGESTED, friendsBox); + this.utility.createElement("div", suggestedAttributes, LANGUAGE_PHRASES.SUGGESTED, suggestedBox); this.friends = friends; friends.forEach(friend => { - this._createFriendList(friend); + this._createFriendList(friend, "suggested"); }); } }); // Get more users - this.chAdapter.getAllUsers(null, 10, 0, null, null, (err, users) => { + this.chAdapter.getAllUsers(null, this.searchLimit, 0, null, null, (err, users) => { if(err) return console.error(err); if(!users.length) @@ -70,12 +95,12 @@ class Search { // Create more users element let moreUsersAttributes = [{"id":"ch_more_users"},{"class":"ch-more-users"}]; - let moreUsers = this.utility.createElement("div", moreUsersAttributes, LANGUAGE_PHRASES.MORE_USERS, friendsBox); + let moreUsers = this.utility.createElement("div", moreUsersAttributes, LANGUAGE_PHRASES.MORE_USERS, usersBox); let moreUsersCount = 0; users.forEach(user => { - if(!document.getElementById(user.id) && user.id != window.userId) { - this._createFriendList(user); + if(!document.getElementById(user.id) && user.id != this.widget.userId) { + this._createFriendList(user, "users"); ++moreUsersCount; } }); @@ -89,11 +114,14 @@ class Search { }); } - _createFriendList(friend) { + _createFriendList(friend, type) { // Create friends listing + let parentId = (type == "suggested") ? "ch_suggested_box" : "ch_users_box"; + let parentBox = document.getElementById(parentId); + let friendListAttributes = [{"id":friend.id},{"class":"ch-friends-list"}]; let friendsBox = document.getElementById("ch_friends_box"); - let friendsList = this.utility.createElement("li", friendListAttributes, null, friendsBox); + let friendsList = this.utility.createElement("li", friendListAttributes, null, parentBox); // Add click listener on friend list friendsList.addEventListener("click", (data) => { @@ -103,10 +131,12 @@ class Search { } // Check for exist conversation - this.chAdapter.getConversationsList(1, 0 , friend.id, (err, conversation) => { + this.chAdapter.getConversationsList(1, 0 , friend.id, "members", null, null, null, null, null, (err, conversation) => { if(err) return console.error(err); - if(conversation.id) { + conversation = conversation[0]; + + if(conversation) { const conversationWindow = new ConversationWindow(this.widget); conversationWindow.init(conversation); this.widget.convWindows.push(conversationWindow); @@ -131,73 +161,96 @@ class Search { } searchMember(searchTerm) { - let friendsBox = document.getElementById("ch_friends_box"); - friendsBox.innerHTML = ""; + // Remove old friends from list + let suggestedbox = document.getElementById("ch_suggested_box"); + suggestedbox.innerHTML = ""; + + let usersBox = document.getElementById("ch_users_box"); + usersBox.innerHTML = ""; + let localFriendsCount = 0; let localUersCount = 0; - // Search in local friend - this.friends.forEach(friend => { - var pattern = new RegExp(searchTerm, "ig"); - let searchResults = friend.displayName.match(pattern); - if(searchResults) { - this._createFriendList(friend); - ++localFriendsCount; - } - }); + if(searchTerm == null) { + // Show local friend + this.friends.forEach(friend => { + this._createFriendList(friend, "suggested"); + }); - // Search in already loaded users - this.users.forEach(user => { - var pattern = new RegExp(searchTerm, "ig"); - let searchResults = user.displayName.match(pattern); - if(searchResults) { - this._createFriendList(user); - ++localUersCount; + // Show already loaded users + this.users.forEach(user => { + this._createFriendList(user, "users"); + }); + + if(this.friends.length) { + // Create suggested tag + let suggestedAttributes = [{"id":"ch_suggested"},{"class":"ch-suggested"}]; + let suggested = this.utility.createElement("div", suggestedAttributes, LANGUAGE_PHRASES.SUGGESTED, suggestedbox); + suggestedbox.insertBefore(suggested, suggestedbox.childNodes[0]); } - }); - if(localFriendsCount) { - // Create suggested tag - let suggestedAttributes = [{"id":"ch_suggested"},{"class":"ch-suggested"}]; - let suggested = this.utility.createElement("div", suggestedAttributes, LANGUAGE_PHRASES.SUGGESTED, friendsBox); - friendsBox.insertBefore(suggested, friendsBox.childNodes[0]); + if(this.users.length) { + // Create more users element + let moreUsersAttributes = [{"id":"ch_more_users"},{"class":"ch-more-users"}]; + let moreUsers = this.utility.createElement("div", moreUsersAttributes, LANGUAGE_PHRASES.MORE_USERS, usersBox); + moreUsers.style.display = "block"; + usersBox.insertBefore(moreUsers, usersBox.childNodes[0]); + } + return; } - if(localUersCount) { - // Create more users element - let moreUsersAttributes = [{"id":"ch_more_users"},{"class":"ch-more-users"}]; - let moreUsers = this.utility.createElement("div", moreUsersAttributes, LANGUAGE_PHRASES.MORE_USERS, friendsBox); - moreUsers.style.display = "block"; - friendsBox.insertBefore(moreUsers, document.getElementById(this.users[0].id)); - } + // Show loader + if(document.getElementById("ch_search_loader_container")) + document.getElementById("ch_search_loader_container").style.display = "block"; - if(!searchTerm) - return; + // Search in all friends by API call + this.chAdapter.getFriends(searchTerm, this.friendsLimit, null, null, null, (err, friends) => { + if(err) return console.error(err); + + // Hide loader + if(document.getElementById("ch_search_loader_container")) + document.getElementById("ch_search_loader_container").style.display = "none"; - // Search in all users - this.chAdapter.getAllUsers(searchTerm, 10, 0, null, null, (err, users) => { + if(!friends.length) + return; + + // Create friends element + let suggested = document.getElementById("ch_suggested"); + if(!suggested) { + let suggestedAttributes = [{"id":"ch_suggested"},{"class":"ch-suggested"}]; + suggested = this.utility.createElement("div", suggestedAttributes, LANGUAGE_PHRASES.SUGGESTED, usersBox); + } + + // let suggestedCount = 0; + friends.forEach(friend => { + this._createFriendList(friend, "users"); + }); + }); + + // Search in all users by API call + this.chAdapter.getAllUsers(searchTerm, this.searchLimit, 0, null, null, (err, users) => { if(err) return console.error(err); if(!users.length) return; // Create more users element - let moreUsers; - if(!document.getElementById("ch_more_users")) { + let moreUsers = document.getElementById("ch_more_users"); + if(!moreUsers) { let moreUsersAttributes = [{"id":"ch_more_users"},{"class":"ch-more-users"}]; - moreUsers = this.utility.createElement("div", moreUsersAttributes, LANGUAGE_PHRASES.MORE_USERS, friendsBox); + moreUsers = this.utility.createElement("div", moreUsersAttributes, LANGUAGE_PHRASES.MORE_USERS, usersBox); } let moreUsersCount = 0; users.forEach(user => { - if(!document.getElementById(user.id) && user.id != window.userId) { - this._createFriendList(user); + if(!document.getElementById(user.id) && user.id != this.widget.userId) { + this._createFriendList(user, "users"); ++moreUsersCount; } }); if(moreUsersCount) { - // Show more user header in other users found + // Show more user header if other users found moreUsers.style.display = "block"; } }); @@ -228,7 +281,7 @@ class Search { let clear = document.getElementById("ch_clear_search_icon"); clear.addEventListener("click", (data) => { document.getElementById("ch_search_input_box").value = ""; - this.searchMember(); + this.searchMember(null); }); } } diff --git a/web-widget/src/js/components/thread.js b/web-widget/src/js/components/thread.js new file mode 100755 index 0000000..4935691 --- /dev/null +++ b/web-widget/src/js/components/thread.js @@ -0,0 +1,1180 @@ +import Utility from "../utility.js"; +import { v4 as uuid } from 'uuid'; +import { LANGUAGE_PHRASES, SETTINGS, IMAGES } from "../constants.js"; + +class Thread { + constructor(widget, parentMessage, conversation) { + this.widget = widget; + this.chAdapter = widget.chAdapter; + + this.parentMessage = new Channelize.core.Message.Model(parentMessage); + this.conversation = conversation; + + this.utility = new Utility(); + + this.loadCount = 0; + this.limit = 25; + this.skip = 0; + this.threadMessages = [this.parentMessage]; + + // Message reactions config + this.reactionsSetting= SETTINGS.REACTION_SETTINGS; + this.reactionsTypes = []; + this.enableScrolling = false; + this.scrollMenuWidth = 0; + + this._openThreadWindow(); + this._registerClickEventHandlers(); + this._createReactionScrollMenuData(); + } + + _createReactionScrollMenuData() { + // Get Reaction types + let reactionsTypes = []; + for(var type of Object.keys(this.reactionsSetting.types)) { + reactionsTypes.push({name: type, icon: this.reactionsSetting.types[type]}) + } + this.reactionsTypes = reactionsTypes; + + // Get reaction menu width + let scrollMenuWidth = this.reactionsTypes.length * 50; + if(scrollMenuWidth > 200) { + this.enableScrolling = true; + scrollMenuWidth = 200; + } + this.scrollMenuWidth = scrollMenuWidth + "px"; + } + + _openThreadWindow() { + + // Remove previous threads window if exist + let olderThreadWindow = document.getElementById("ch_thread_window"); + if (olderThreadWindow) { + olderThreadWindow.remove(); + } + + // Create threads box components + let widget = document.getElementById("ch_frame"); + let threadWindowAttributes = [{"id": "ch_thread_window"},{"class":"ch-thread-window"}]; + let threadWindow = this.utility.createElement("div", threadWindowAttributes, null, widget); + + // Create threads header + let threadHeaderAttributes = [{"id":"ch_thread_header"},{"class":"ch-header"}]; + let threadHeader = this.utility.createElement("div", threadHeaderAttributes, null, threadWindow); + + // Create threads close button + let closeBtnAttributes = [{"id":"ch_thread_close_btn"}]; + let closeBtn = this.utility.createElement("i", closeBtnAttributes, "arrow_back", threadHeader); + closeBtn.classList.add("material-icons", "ch-close-btn"); + + // Create conversation details wrapper + let detailsAttributes = [{"class":"ch-thread-header-details-wrapper"}]; + let detailsWrapper = this.utility.createElement("div", detailsAttributes, null, threadHeader); + + // Create threads header title + let threadHeaderTitleAttributes = [{"id":"ch_thread_header_title"},{"class":"ch-header-title"}]; + let threadHeaderTitle = this.utility.createElement("div", threadHeaderTitleAttributes, LANGUAGE_PHRASES.THREAD, detailsWrapper); + + // Create threads header subtitle + let threadHeaderSubtitleAttributes = [{"id":"ch_thread_header_subtitle"},{"class":"ch-header-subtitle"}]; + let threadHeaderSubtitle = this.utility.createElement("div", threadHeaderSubtitleAttributes, null, detailsWrapper); + + // Create threads header subtitle + let threadHeaderReplyCountAttributes = [{"id":"ch_thread_header_reply_count"},{"class":"ch-header-reply-count"}]; + let threadHeaderReplyCount = this.utility.createElement("span", threadHeaderReplyCountAttributes, "...", threadHeaderSubtitle); + + // Create threads header subtitle + let threadHeaderReplyAttributes = [{"class":"ch-header-reply"}]; + let threadHeaderReply = this.utility.createElement("span", threadHeaderReplyAttributes, LANGUAGE_PHRASES.REPLIES, threadHeaderSubtitle); + + // Create threads listing box + let parentMessageBoxAttributes = [{"id":"ch_thread_parent_msg_box"},{"class":"ch-thread-parent-msg-box"}]; + this.utility.createElement("div", parentMessageBoxAttributes, null, threadWindow); + + // Create threads listing box + let threadMesssagesBoxAttributes = [{"id":"ch_thread_messages_box"},{"class":"ch-thread-messages-box ch-send-box"}]; + let threadMesssagesBox = this.utility.createElement("div", threadMesssagesBoxAttributes, null, threadWindow); + + // Create loader container + let loaderContainerAttributes = [{"id":"ch_thread_loader_container"},{"class":"ch-loader-bg"}]; + let loaderContainer = this.utility.createElement("div", loaderContainerAttributes, null, threadMesssagesBox); + loaderContainer.style.display = "block"; + + // Create loader + let loaderAttributes = [{"id":"ch_thread_loader"},{"class":"ch-loader"}]; + let loader = this.utility.createElement("div", loaderAttributes, null, loaderContainer); + + + // Create send as direct message view + let sendDirectMsgBoxAttributes = [{"id":"ch_send_direct_msg_box"},{"class":"ch-send-direct-msg-box"}]; + let sendDirectMsgBox = this.utility.createElement("div", sendDirectMsgBoxAttributes, null, threadWindow); + + // Create checkbox + let sendDirectMsgCheckboxAttributes = [{"id":"ch_send_direct_msg_checkbox"},{"class":"ch-send-direct-msg-checkbox"},{"type":"checkbox"}]; + let sendDirectMsgCheckbox = this.utility.createElement("input", sendDirectMsgCheckboxAttributes, null, sendDirectMsgBox); + + // Create checkbox + let sendDirectMsgLabelAttributes = [{"id":"ch_send_direct_msg_label"},{"class":"ch-send-direct-msg-label"},{"for":"ch_send_direct_msg_checkbox"}]; + let sendDirectMsgLabel = this.utility.createElement("label", sendDirectMsgLabelAttributes, LANGUAGE_PHRASES.SEND_DIRECT_MESSAGE, sendDirectMsgBox); + + // Create threads listing box + let threadSendBoxAttributes = [{"id":"ch_thread_send_box"},{"class":"ch-thread-send-box"}]; + let threadSendBox = this.utility.createElement("div", threadSendBoxAttributes, null, threadWindow); + + // Create input box + let inputThreadsBoxAttributes = [{"id":"ch_thread_input_box"},{"class":"ch-thread-input-thread-box"}, {"type":"text"}, {"placeholder":LANGUAGE_PHRASES.SEND_MESSAGE}]; + this.utility.createElement("textarea", inputThreadsBoxAttributes, null, threadSendBox); + + // Create media messages docker + let mediaThreadDockerAttributes = [{"id":"ch_thread_media_docker"},{"class":"ch-thread-media-docker"}]; + let mediaThreadDocker = this.utility.createElement("div", mediaThreadDockerAttributes, null, threadSendBox); + + // Create image messages option + let imageOptionAttributes = [{"id":"ch_thread_image_option"},{"class":"ch-thread-image-option"}]; + let imageOption = this.utility.createElement("div", imageOptionAttributes, null, mediaThreadDocker); + + // Create option icon span + let imageIconSpanAttributes = [{"id":"ch_thread_image_icon_span"},{"class":"ch-thread-image-icon-span"}]; + let imageIconSpan = this.utility.createElement("span", imageIconSpanAttributes, null, imageOption); + + // Create image messages option icon + let imageIconAttributes = [{"id":"ch_thread_image_option_icon"},{"class":"ch-thread-image-option-icon"},{"src":IMAGES.GALLERY_ICON}]; + this.utility.createElement("img", imageIconAttributes, null, imageIconSpan); + + // Create input for image + let imageInputAttributes = [{"id":"ch_thread_image_input"},{"class":"ch-thread-image-input"},{"type":"file"},{"accept":"image/*"}]; + this.utility.createElement("input", imageInputAttributes, null, imageOption); + + // Create option name span for image + let imageNameAttributes = [{"id":"ch_thread_image_option_name"},{"class":"ch-thread-image-option-name"}]; + this.utility.createElement("span", imageNameAttributes, LANGUAGE_PHRASES.IMAGE, imageOption); + + // Create audio messages option + let audioOptionAttributes = [{"id":"ch_thread_audio_option"},{"class":"ch-thread-audio-option"}]; + let audioOption = this.utility.createElement("div", audioOptionAttributes, null, mediaThreadDocker); + + // Create option icon span + let audioIconSpanAttributes = [{"id":"ch_thread_audio_icon_span"},{"class":"ch-thread-audio-icon-span"}]; + let audioIconSpan = this.utility.createElement("span", audioIconSpanAttributes, null, audioOption); + + // Create audio messages option icon + let audioIconAttributes = [{"id":"ch_thread_audio_option_icon"},{"class":"ch-thread-audio-option-icon"},{"src":IMAGES.AUDIO_ICON}]; + this.utility.createElement("img", audioIconAttributes, null, audioIconSpan); + + // Create input for audio + let audioInputAttributes = [{"id":"ch_thread_audio_input"},{"class":"ch-thread-audio-input"},{"type":"file"},{"accept":"audio/*"}]; + this.utility.createElement("input", audioInputAttributes, null, audioOption); + + // Create option name span for audio + let audioNameAttributes = [{"id":"ch_thread_audio_option_name"},{"class":"ch-thread-audio-option-name"}]; + this.utility.createElement("span", audioNameAttributes, LANGUAGE_PHRASES.AUDIO, audioOption); + + // Create video messages option + let videoOptionAttributes = [{"id":"ch_thread_video_option"},{"class":"ch-thread-video-option"}]; + let videoOption = this.utility.createElement("div", videoOptionAttributes, null, mediaThreadDocker); + + // Create option icon span + let videoIconSpanAttributes = [{"id":"ch_thread_video_icon_span"},{"class":"ch-thread-video-icon-span"}]; + let videoIconSpan = this.utility.createElement("span", videoIconSpanAttributes, null, videoOption); + + // Create video messages option icon + let videoIconAttributes = [{"id":"ch_thread_video_option_icon"},{"class":"ch-thread-video-option-icon"},{"src":IMAGES.VIDEO_ICON}]; + this.utility.createElement("img", videoIconAttributes, null, videoIconSpan); + + // Create input for video + let videoInputAttributes = [{"id":"ch_thread_video_input"},{"class":"ch-thread-video-input"},{"type":"file"},{"accept":"video/*"}]; + this.utility.createElement("input", videoInputAttributes, null, videoOption); + + // Create option name span for video + let videoNameAttributes = [{"id":"ch_thread_video_option_name"},{"class":"ch-thread-video-option-name"}]; + this.utility.createElement("span", videoNameAttributes, LANGUAGE_PHRASES.VIDEO, videoOption); + + // Create attachment button + let attachmentAttributes = [{"id":"ch_thread_attachment_btn"},{"title":LANGUAGE_PHRASES.SEND_ATTACHMENTS}]; + let attachment = this.utility.createElement("i", attachmentAttributes, "attachment", threadSendBox); + attachment.classList.add("material-icons", "ch-thread-attachment-btn"); + + // Create send button + let sendButtonAttributes = [{"id":"ch_thread_send_button"},{"class":"ch-thread-send-button"}]; + let sendButton = this.utility.createElement("button", sendButtonAttributes, null, threadSendBox); + + // Create send icon + let sendIconAttributes = [{"class":"ch-thread-send-icon"}]; + let sendIcon = this.utility.createElement("i", sendIconAttributes, "send", sendButton); + sendIcon.classList.add("material-icons"); + + // Hide send message box and status is blocked user + if (this.conversation.blockedByUser || this.conversation.blockedByMember) { + status.style.visibility = "hidden"; + threadSendBox.style.visibility = "hidden"; + } + + this._createThreadMessagesListing(); + } + + _createThreadMessagesListing() { + + // Get conversation messages + this._getMessages(this.conversation, this.limit, this.skip, (err, messages) => { + if (err) return console.error(err); + + if (messages.length) { + this.threadMessages = this.threadMessages.concat(messages); + } + + // Update replies count in header + let parentMessageReplyCount = document.getElementById("ch_thread_header_reply_count"); + if (parentMessageReplyCount) { + parentMessageReplyCount.innerHTML = this.parentMessage.replyCount; + } + + // Hide loader + if (document.getElementById("ch_thread_loader_container")) { + document.getElementById("ch_thread_loader_container").remove(); + } + + let messagesBox = document.getElementById("ch_thread_messages_box"); + + // Parent message div + if (messages.length != this.limit) { + this._createParentMessageViewFrame(this.parentMessage, messagesBox, false); + } + + this.threadMessages.forEach(message => { + if (message.id == this.parentMessage.id) { + return; + } + // Update message object + message = this._modifyMessage(message); + + // Create message frame + this._createMessageFrame(message, messagesBox, false); + }); + + if (messagesBox) { + messagesBox.scrollTop = messagesBox.scrollHeight; + } + }); + } + + _createParentMessageViewFrame(message, messagesBox, changePosition) { + + let threadStart = document.getElementById("ch_thread_start"); + if (!threadStart) { + // Create message frame + this._createMessageFrame(message, messagesBox, false); + + // Create a line breaker b/w parent and chid message. + let threadStartAttributes = [{"id":"ch_thread_start"},{"class":"ch-thread-start ch-msg-list"}]; + let threadStart = this.utility.createElement("div", threadStartAttributes, LANGUAGE_PHRASES.START_OF_A_NEW_THREAD, messagesBox); + + // Set parent message and line breaker position + if (changePosition) { + let parentMessage = document.getElementById("thread_" + message.id); + messagesBox.insertBefore(parentMessage, messagesBox.childNodes[0]); + messagesBox.insertBefore(threadStart, messagesBox.childNodes[1]); + } + } + } + + _createTextMessageFrame(message, parentDiv) { + // Create Also sent to the conversation + if (message.id != this.parentMessage.id && message.showInConversation) { + let attachment = message.attachments && message.attachments[0]; + + let msgSendConversationAttributes = [{"class": attachment ? + "ch-attachments-message-sent-conversation" : "ch-text-message-sent-conversation"}]; + + this.utility.createElement("p", msgSendConversationAttributes, LANGUAGE_PHRASES.SEND_TO_CONVERSATION, parentDiv); + } + + // Create message body view + let msgBodyAttributes = [{"id":"ch_thread_message_body_" + message.id},{"class":"ch-message-body"}]; + this.utility.createElement("p", msgBodyAttributes, message.body, parentDiv); + } + + _createMediaMessageFrame(message, parentDiv) { + // Create message div + if (!message.body && Object.keys(message.attachments).length != 0) { + message.attachments.forEach(attachment => { + + switch(attachment.type) { + case "audio": + let audioMsgAttributes = [{"id":"ch_audio_message"},{"class":"ch-audio-message"},{"src":attachment.fileUrl}]; + let audioTag = this.utility.createElement("audio", audioMsgAttributes, null, parentDiv); + audioTag.setAttribute("controls",true); + break; + + case "video": + let videoMsgAttributes = [{"id":"ch_video_message"},{"class":"ch-video-message"}]; + let videoMessage = this.utility.createElement("div", videoMsgAttributes, null, parentDiv); + videoMessage.style.backgroundImage = "url(" + attachment.thumbnailUrl + ")"; + + // Create play icon + let playIconAttributes = [{"id":"ch_play_icon"}]; + let playIcon = this.utility.createElement("i", playIconAttributes, "play_circle_outline", videoMessage); + playIcon.classList.add("material-icons", "ch-play-icon"); + + // Set video message listener + videoMessage.addEventListener("click", data => { + window.open(attachment.fileUrl, "_blank"); + }); + break; + + case "sticker": + let stickerMsgAttributes = [{"id":"ch_sticker_message"},{"class":"ch-sticker-message"}]; + let stickerMsg = this.utility.createElement("div", stickerMsgAttributes, null, parentDiv); + stickerMsg.style.backgroundImage = "url(" + attachment.originalUrl + ")"; + break; + + case "gif": + let gifMsgAttributes = [{"id":"ch_gif_message"},{"class":"ch-sticker-message"}]; + let gifMsg = this.utility.createElement("div", gifMsgAttributes, null, parentDiv); + gifMsg.style.backgroundImage = "url(" + attachment.originalUrl + ")"; + break; + + case "location": + let locationSrc = SETTINGS.LOCATION_IMG_URL + "?center=" + + attachment.latitude + "," + attachment.longitude + "&zoom=15&size=208x100&maptype=roadmap&markers=color:red%7C" + + attachment.latitude + "," + attachment.longitude + "&key=" + SETTINGS.LOCATION_API_KEY; + + let locationMsgAttributes = [{"id":"ch_location_message"},{"class":"ch-location-message"}]; + let locationMsg = this.utility.createElement("div", locationMsgAttributes, null, parentDiv); + locationMsg.style.backgroundImage = "url(" + locationSrc + ")"; + + // Set location message listener + locationMsg.addEventListener("click", data => { + let mapUrl = "https://www.google.com/maps?z=15&t=m&q=loc:" + attachment.latitude + "," + attachment.longitude; + window.open(mapUrl, "_blank"); + }); + break; + + default: + let imageMsgAttributes = [{"id":"ch_image_message"},{"class":"ch-image-message"}]; + let imageMsg = this.utility.createElement("div", imageMsgAttributes, null, parentDiv); + imageMsg.style.backgroundImage = "url(" + attachment.thumbnailUrl + ")"; + + // Set image message listener + imageMsg.addEventListener("click", data => { + window.open(attachment.fileUrl, "_blank"); + }); + } + }); + } + } + + _modifyMessage(message) { + if (!message) { + return message; + } + + // Set read status of message + if (!this.conversation.isDummyObject) { + message.readByAll = this.chAdapter.readByAllMembers(this.conversation, message); + } + + message.createdAt = this.utility.updateTimeFormat(message.createdAt); + + if (message.isDeleted) { + message.body = "" + LANGUAGE_PHRASES.MESSAGE_DELETED; + } + + return message; + } + + _addListenerOnMoreOption(message, moreOption, msgList) { + moreOption.addEventListener("click", (data) => { + if (document.getElementById("ch_thread_msg_option_container")) { + document.getElementById("ch_thread_msg_option_container").remove(); + return; + } + + if (document.getElementById("ch_thread_scroll_menu_container")) { + document.getElementById("ch_thread_scroll_menu_container").remove(); + } + + // Create message options container + let msgOptionsContainerAttributes = [{"id":"ch_thread_msg_option_container"},{"class":"ch-msg-option-container"}]; + let msgOptionsContainer = this.utility.createElement("div", msgOptionsContainerAttributes, null, msgList); + + if (message.ownerId == this.widget.userId) { + msgOptionsContainer.style.left = "15px"; + } else { + msgOptionsContainer.style.right = "15px"; + } + + // Create delete message for me option + let deleteMsgAttributes = [{"class":"ch-msg-delete-for-me"}]; + let deleteMsgOption = this.utility.createElement("div", deleteMsgAttributes, LANGUAGE_PHRASES.DELETE_FOR_ME, msgOptionsContainer); + + // Add listener on delete message for me + deleteMsgOption.addEventListener("click", (data) => { + msgOptionsContainer.remove(); + + // Delete message for me + this.chAdapter.deleteMessagesForMe([message.id], (err, res) => { + if (err) console.error(err); + }) + }); + + if (!message.isDeleted && message.ownerId == this.widget.userId) { + // Create delete message for everyone option + let deleteMsgEveryoneAttributes = [{"id":"ch_msg_delete_for_everyone"},{"class":"ch-msg-delete-for-everyone"}]; + let deleteMsgEveryoneOption = this.utility.createElement("div", deleteMsgEveryoneAttributes, LANGUAGE_PHRASES.DELETE_FOR_EVERYONE, msgOptionsContainer); + + // Add listener on delete message for everyone + deleteMsgEveryoneOption.addEventListener("click", (data) => { + msgOptionsContainer.remove(); + + // Delete message for me + this.chAdapter.deleteMessagesForEveryone([message.id], (err, res) => { + if (err) console.error(err); + }) + }); + } + }); + } + + _registerClickEventHandlers() { + + // Close search button listener + let closeBtn = document.getElementById("ch_thread_close_btn"); + if (closeBtn) { + closeBtn.addEventListener("click", (data) => { + document.getElementById("ch_thread_window").remove(); + this.widget.threads.pop(); + }); + } + + // Send message on Enter press + let input = document.getElementById("ch_thread_input_box"); + input.addEventListener("keydown", (data) => { + if (data.keyCode === 13) { + data.preventDefault(); + this.sendMessage("text"); + } + }); + + // Send button listener + let sendButton = document.getElementById("ch_thread_send_button"); + sendButton.addEventListener("click", (data) => { + this.sendMessage("text"); + }); + + // Scroll message box listener + let msgBox = document.getElementById("ch_thread_messages_box"); + msgBox.addEventListener("scroll", (data) => { + if (msgBox.scrollTop == 0) { + this._loadMoreMessages(); + } + }); + + // Attachment button listener + let attachmentBtn = document.getElementById("ch_thread_attachment_btn"); + attachmentBtn.addEventListener("click", (data) => { + // Toggle media message docker + document.getElementById("ch_thread_media_docker").classList.toggle("ch-thread-show-docker"); + }); + + // Send message on image choose + let imageInput = document.getElementById("ch_thread_image_input"); + imageInput.addEventListener("change", (data) => { + if (data.target.files[0].size > 25000000) { + this.utility.showWarningMsg(LANGUAGE_PHRASES.FILE_SIZE_WARNING); + this.showMediaDocker(false); + } else { + this.sendMessage("image"); + } + }); + + // Send message on audio choose + let audioInput = document.getElementById("ch_thread_audio_input"); + audioInput.addEventListener("change", (data) => { + if (data.target.files[0].size > 25000000) { + this.utility.showWarningMsg(LANGUAGE_PHRASES.FILE_SIZE_WARNING); + this.showMediaDocker(false); + } else { + this.sendMessage("audio"); + } + }); + + // Send message on video choose + let videoInput = document.getElementById("ch_thread_video_input"); + videoInput.addEventListener("change", (data) => { + if (data.target.files[0].size > 25000000) { + this.utility.showWarningMsg(LANGUAGE_PHRASES.FILE_SIZE_WARNING); + this.showMediaDocker(false); + } else { + this.sendMessage("video"); + } + }); + } + + _loadMoreMessages() { + ++this.loadCount; + this.skip = this.loadCount * this.limit; + this._getMessages(this.conversation, this.limit, this.skip, (err, messages) => { + if (err) return console.error(err); + + if (messages.length) { + this.threadMessages = this.threadMessages.concat(messages); + } + + let messagesBox = document.getElementById("ch_thread_messages_box"); + if (!messages.length) { + this._createParentMessageViewFrame(this.parentMessage, messagesBox, true); + return; + } + + // Save first message to scroll + let firstMessage = messagesBox.childNodes[0]; + + messages.forEach(message => { + // Update message object + message = this._modifyMessage(message); + + // Create message frame + this._createMessageFrame(message, messagesBox, false); + + let msgList = document.getElementById("thread_" + message.id); + messagesBox.insertBefore(msgList, messagesBox.childNodes[0]); + }); + + if (firstMessage) { + firstMessage.scrollIntoView(); + } + }); + } + + sendMessage(msgType) { + // Hide media docker + this.showMediaDocker(false); + + let messagesBox = document.getElementById("ch_thread_messages_box"); + + // Show loader image if media message + if (msgType != "text") { + if (document.getElementById("ch_no_thread_msg")) { + document.getElementById("ch_no_thread_msg").remove(); + } + + let msgLoaderAttributes = [{"id":"ch_thread_msg_loader"},{"class":"ch-msg-loader"}]; + let imageMsg = this.utility.createElement("div", msgLoaderAttributes, null, messagesBox); + imageMsg.style.backgroundImage = "url(" + IMAGES.MESSAGE_LOADER + ")"; + imageMsg.scrollIntoView(); + } + + // Check value of checkbox + let showInConversation = document.getElementById("ch_send_direct_msg_checkbox").checked; + if (showInConversation) { + document.getElementById("ch_send_direct_msg_checkbox").checked = false; + } + + let data = { + id : uuid(), + type : "reply", + parentId: this.parentMessage.id, + parentMessage : this.parentMessage, + showInConversation + }; + + switch(msgType) { + case "text": + let inputValue = document.getElementById("ch_thread_input_box").value; + document.getElementById("ch_thread_input_box").value = ""; + + if (!inputValue.trim()) { + return; + } + + data['body'] = inputValue; + + // Add pending message into list + this.addPendingMessage(data); + + if (this.conversation.isDummyObject) { + data['userId'] = this.conversation.userId; + + this.chAdapter.sendMessageToUser(data, (err, res) => { + if (err) return console.error(err); + }); + } else { + this.chAdapter.sendMessage(this.conversation, data, (err, res) => { + if (err) return console.error(err); + }); + } + break; + + case "image": + let imageFile = document.getElementById("ch_thread_image_input").files[0]; + + // Upload file on channelize server + this.chAdapter.uploadFile(imageFile, "image", true, (err, fileData) => { + if (err) return console.error(err); + + fileData.type = fileData.attachmentType; + data['attachments'] = [fileData]; + this._sendFileMessage(data); + }); + break; + + case "audio": + let audioFile = document.getElementById("ch_thread_audio_input").files[0]; + + // Upload file on channelize server + this.chAdapter.uploadFile(audioFile, "audio", true, (err, fileData) => { + if (err) return console.error(err); + + fileData.type = fileData.attachmentType; + data['attachments'] = [fileData]; + this._sendFileMessage(data); + }); + break; + + case "video": + let videoFile = document.getElementById("ch_thread_video_input").files[0]; + // Upload file on channelize server + this.chAdapter.uploadFile(videoFile, "video", true, (err, fileData) => { + if (err) return console.error(err); + + fileData.type = fileData.attachmentType; + data['attachments'] = [fileData]; + this._sendFileMessage(data); + }); + break; + } + } + + _sendFileMessage(data) { + // Send file message as attachment + if (this.conversation.isDummyObject) { + data['userId'] = this.conversation.userId; + this.chAdapter.sendMessageToUser(data, (err, message) => { + if (err) return console.error(err); + }); + } else { + this.chAdapter.sendMessage(this.conversation, data, (err, message) => { + if (err) return console.error(err); + }); + } + } + + addPendingMessage(msgData) { + msgData["ownerId"] = this.widget.userId; + let messagesBox = document.getElementById("ch_thread_messages_box"); + + // Remove no message tag + if (messagesBox.firstChild && messagesBox.firstChild.id == "ch_no_thread_msg") { + messagesBox.firstChild.remove(); + } + + // Create message frame + this._createMessageFrame(msgData, messagesBox, true); + + // Scroll to newly added dummy message + messagesBox.scrollTop = messagesBox.scrollHeight; + } + + + _markAsRead(conversation) { + let currentDate = new Date(); + let timestamp = currentDate.toISOString(); + this.chAdapter.markAsReadConversation(conversation, timestamp, (err, res) => { + if (err) return console.error(err); + }); + } + + addNewMessage(message, newConversation) { + /* Only add a new message on the threads if a new message is a reply and parent message-id + match to currently open thread parent message-id. */ + if (message.type != "reply" || message.parentMessage.id != this.parentMessage.id) { + return; + } + + // Change parent message count or Change header reply count.return + document.getElementById("ch_thread_header_reply_count").innerHTML = message.parentMessage.replyCount; + + // Set new conversation to replace dummy conversation + if (newConversation) { + this.conversation = newConversation; + } + // Convert message object to message model + message = new Channelize.core.Message.Model(message); + + message = this._modifyMessage(message); + this.threadMessages.push(message); + + // Remove pending dummy message + let dummyMessage = document.getElementById("thread_" + message.id); + if (dummyMessage) { + dummyMessage.remove(); + } + + let messagesBox = document.getElementById("ch_thread_messages_box"); + + // Hide message loader + if (document.getElementById("ch_thread_msg_loader") && message.ownerId == this.widget.userId) { + document.getElementById("ch_thread_msg_loader").remove(); + } + + if (message.conversationId != this.conversation.id || !messagesBox) + return; + + message.createdAt = this.utility.updateTimeFormat(Date()); + + // Remove no message tag + if (messagesBox.firstChild && messagesBox.firstChild.id == "ch_no_thread_msg") { + messagesBox.firstChild.remove(); + } + + // Create message frame + this._createMessageFrame(message, messagesBox, false); + + if (message.ownerId != this.widget.userId) { + // Message mark a read + this._markAsRead(this.conversation); + } + + // Scroll to new message + if (messagesBox) { + messagesBox.scrollTop = messagesBox.scrollHeight; + } + } + + updateMsgStatus(data) { + if (data.conversation.id != this.conversation.id || this.conversation.isGroup) { + return; + } + + // Check read status of second last message + if (this.threadMessages.slice(-2, -1) && this.threadMessages.slice(-2, -1).readByAll) { + let lastMessage = this.threadMessages[this.threadMessages.length-1]; + lastMessage.readByAll = true; + + // Update read tag icon + let msgDiv = document.getElementById("thread_" + lastMessage.id); + if (msgDiv) { + let statusDiv = msgDiv.querySelector("#ch_thread_msg_status"); + + if (statusDiv) { + statusDiv.innerHTML = "done_all"; + } + } + } else { + this.threadMessages.forEach(msg => { + msg.readByAll = true; + + // Update read tag icon + let msgDiv = document.getElementById("thread_" + msg.id); + if (msgDiv) { + let statusDiv = msgDiv.querySelector("#ch_thread_msg_status"); + + if (statusDiv) { + statusDiv.innerHTML = "done_all"; + } + } + }); + } + } + + showMediaDocker(value) { + if (value) { + document.getElementById("ch_thread_media_docker").classList.add("ch-thread-show-docker"); + } else { + document.getElementById("ch_thread_media_docker").classList.remove("ch-thread-show-docker"); + } + } + + + _getMessages(conversation, limit, skip, cb) { + this.chAdapter.getMessages(conversation, limit, skip, null, null, null, null, this.parentMessage.id, null, (err, messages) => { + if (err) return cb(err); + + messages.reverse(); + return cb(null, messages); + }); + } + + _createMessageFrame(message, messagesBox, isPendingMessage) { + // Create message list + let msgListAttributes = [{"id":"thread_" + message.id},{"class":"ch-msg-list"}]; + let msgList = this.utility.createElement("div", msgListAttributes, null, messagesBox); + + // Create sender name div + if (this.conversation.isGroup && message.ownerId != this.widget.userId) { + let senderAttributes = [{"class":"ch-sender-name"}]; + this.utility.createElement("div", senderAttributes, message.owner.displayName, msgList); + } + + // Create message container + let msgContainerAttributes = [{"class":"ch-msg-container"}]; + let msgContainer = this.utility.createElement("div", msgContainerAttributes, null, msgList); + + // Create message more options + let moreOptionAttributes = [{"class":"ch-msg-more-option"}]; + let moreOption = this.utility.createElement("i", moreOptionAttributes, "more_vert", msgList); + moreOption.classList.add("material-icons"); + this._addListenerOnMoreOption(message, moreOption, msgList); + + // Create message div + let msgDivAttributes = [{"id":"ch_thread_message_" + message.id},{"class":"ch-message"}]; + let msgDiv = this.utility.createElement("div", msgDivAttributes, null, msgContainer); + + // Create add reaction div. + if (this.reactionsSetting.enable && message.ownerId != this.widget.userId && !message.isDeleted) { + let addReactionAttributes = [{"class":"ch-add-reaction-option"}]; + let addReaction = this.utility.createElement("i", addReactionAttributes, "insert_emoticon", msgList); + addReaction.classList.add("material-icons"); + + // Add event listiner on add reaction option + this._addListenerOnAddReactionOption(message, addReaction, msgList); + } + + // Create message and reply message frame + this._createTextMessageFrame(message, msgDiv); + + // Create media message frame + this._createMediaMessageFrame(message, msgDiv); + + // Create added message reaction view + if (this.reactionsSetting.enable && !message.isDeleted) { + this._createMessageReactionFrame(message, msgDiv); + } + + // Create message time span + let createdAt = message.createdAt; + if (!createdAt) { + let date = new Date(); + date = date.toISOString(); + createdAt = this.utility.updateTimeFormat(date); + } + let msgTimeAttributes = [{"class":"ch-msg-time"}]; + let msgTime = this.utility.createElement("span", msgTimeAttributes, createdAt, msgContainer); + + if (message.ownerId == this.widget.userId) { + msgContainer.classList.add("right"); + moreOption.classList.add("left"); + // Create message read status + let statusAttributes = [{"id":"ch_thread_msg_status"}]; + let readIcon = message.readByAll ? "done_all" : "check"; + var msgStatus = this.utility.createElement("i", statusAttributes, isPendingMessage ? "schedule" : readIcon, msgContainer); + msgStatus.classList.add("material-icons", "ch-msg-status"); + } else { + msgContainer.classList.add("left"); + moreOption.classList.add("right"); + } + } + + handleDeleteForMe(data) { + data.messages.forEach(message => { + let targetMsg = document.getElementById("thread_" + message.id); + + // Remove the message if the message is not this thread parent message. + if (targetMsg && this.parentMessage.id != message.id) { + targetMsg.remove(); + } + }); + } + + updateDeleteForEveryoneMsg(data) { + if (this.conversation.id != data.conversation.id) + return; + + // Update text of deleted message + let targetMsg = document.getElementById("ch_thread_message_" + data.messages[0].id); + if (targetMsg) { + targetMsg.innerHTML = "" + LANGUAGE_PHRASES.MESSAGE_DELETED; + } + + // Update listener of deleted message + let targetMessage = document.getElementById("thread_" + data.messages[0].id); + if (targetMessage) { + let deletedMsgOptionBtn = targetMessage.lastChild; + deletedMsgOptionBtn.addEventListener("click", data => { + // Remove delete for everyone option + let deleteForEveryoneBtn = document.getElementById("ch_msg_delete_for_everyone"); + if (deleteForEveryoneBtn) { + deleteForEveryoneBtn.remove(); + } + }); + } + } + + handleClearConversation(conversation) { + if (conversation.id != this.conversation.id) { + return; + } + + let threadWindow = document.getElementById("ch_thread_window"); + if (threadWindow) { + threadWindow.remove(); + } + } + + handleDeleteConversation(conversation) { + if (conversation.id != this.conversation.id) { + return; + } + + let threadWindow = document.getElementById("ch_thread_window"); + if (threadWindow) { + threadWindow.remove(); + } + } + + handleBlock(data) { + if (this.conversation.isGroup) { + return; + } + + // Hide checkbox and input field + document.getElementById("ch_send_direct_msg_box").style.visibility = "hidden"; + document.getElementById("ch_thread_send_box").style.visibility = "hidden"; + } + + handleUnblock(data) { + if (this.conversation.isGroup) { + return; + } + + // Show checkbox and input field + document.getElementById("ch_send_direct_msg_box").style.visibility = "visible"; + document.getElementById("ch_thread_send_box").style.visibility = "visible"; + } + + handleAddReaction(data) { + if (data.message.conversationId != this.conversation.id) { + return; + } + + const messageId = data.message.id; + const messageIndex = this.threadMessages.findIndex(message => message.id == messageId); + if (messageIndex != -1) { + const reactionType = data.reaction.type; + const userId = data.user.id; + const reactionsCount = data.message.reactionsCount; + + if(this.threadMessages[messageIndex]["reactions"][reactionType]) { + var memberIndex = this.threadMessages[messageIndex]["reactions"][reactionType].indexOf(userId); + if (memberIndex == -1) { + this.threadMessages[messageIndex]["reactions"][reactionType].push(userId); + } + this.threadMessages[messageIndex]["reactionsCount"] = reactionsCount; + } else { + const reactionData = this.threadMessages[messageIndex]["reactions"]; + reactionData[reactionType] = [userId]; + this.threadMessages[messageIndex]["reactions"] = reactionData; + this.threadMessages[messageIndex]["reactionsCount"] = reactionsCount; + } + + let msgDiv = document.getElementById("ch_thread_message_" + messageId); + this._createMessageReactionFrame(this.threadMessages[messageIndex], msgDiv); + } + } + + handleRemoveReaction(data) { + if (data.message.conversationId != this.conversation.id) { + return; + } + + const messageId = data.message.id; + const reactionType = data.reaction.type; + const messageIndex = this.threadMessages.findIndex(message => message.id == messageId); + if (messageIndex != -1 && this.threadMessages[messageIndex]["reactions"][reactionType]) { + const userId = data.user.id; + const reactionsCount = data.message.reactionsCount; + var memberIndex = this.threadMessages[messageIndex]["reactions"][reactionType].indexOf(userId); + if (memberIndex != -1) { + this.threadMessages[messageIndex]["reactions"][reactionType].splice(memberIndex, 1); + } + this.threadMessages[messageIndex]["reactionsCount"] = reactionsCount; + + let msgDiv = document.getElementById("ch_thread_message_" + messageId); + this._createMessageReactionFrame(this.threadMessages[messageIndex], msgDiv); + } + } + + _createMessageReactionFrame(message, parentDiv) { + if (!message.reactions) { + return; + } + + if (document.getElementById("ch_thread_reaction_" + message.id)) { + document.getElementById("ch_thread_reaction_" + message.id).remove(); + } + + let threadMessageDiv = document.getElementById("ch_thread_message_" + message.id); + if (threadMessageDiv) { + threadMessageDiv.classList.remove("reaction-space"); + } + + // Get total reaction counts + let totalReactionCounts = 0 + if (message.reactionsCount) { + Object.keys(message.reactionsCount).forEach((type) => { + totalReactionCounts += message.reactionsCount[type]; + }); + } + + // If no reaction on message then return + if (totalReactionCounts == 0) { + return; + } + + // Add class reaction-space + threadMessageDiv.classList.add("reaction-space"); + + // Create reaction container + let msgReactionContainerAttributes = [{"id":"ch_thread_reaction_" + message.id},{"class":"ch-msg-reaction-container"}]; + let msgReactionContainer = this.utility.createElement("div", msgReactionContainerAttributes, null, parentDiv); + + let msgReactionAttributes = [{"class":"ch-msg-reaction"}]; + let msgReaction = this.utility.createElement("div", msgReactionAttributes, null, msgReactionContainer); + + // Create message reaction listing + let msgReactionListAttributes = [{"class":"ch-msg-reaction-list"}]; + let msgReactionList = this.utility.createElement("ul", msgReactionListAttributes, null, msgReaction); + + Object.keys(message.reactions).forEach((type) => { + if (this.reactionsSetting.types && this.reactionsSetting.types[type] && message.reactionsCount[type]) { + let msgReactionItemAttributes = [{"class":"ch-msg-reaction-item"}]; + let msgReactionItem = this.utility.createElement("li", msgReactionItemAttributes, null, msgReactionList); + + // Set the border radius + msgReactionItem.style['border-radius'] = (message.reactionsCount[type] > 1) ? '15px' : '50%'; + + // Create reaction icons span like 👍, 👎. + let msgReactionNameAttributes = [{"class":"ch-msg-reaction-name"}]; + let msgReactionName = this.utility.createElement("span", msgReactionNameAttributes, this.reactionsSetting.types[type], msgReactionItem); + + // Create reaction count span + if (message.reactionsCount[type] > 1) { + let msgReactionCountAttributes = [{"class":"ch-msg-reaction-count"}]; + let msgReactionCount = this.utility.createElement("span", msgReactionCountAttributes, message.reactionsCount[type], msgReactionItem); + } + } + }); + } + + _addListenerOnAddReactionOption(message, addReaction, msgList) { + addReaction.addEventListener("click", (data) => { + if (document.getElementById("ch_thread_scroll_menu_container")) { + document.getElementById("ch_thread_scroll_menu_container").remove(); + return; + } + + // Hide the more option container + if (document.getElementById("ch_thread_msg_option_container")) { + document.getElementById("ch_thread_msg_option_container").remove(); + } + + // Create message reaction container + let scrollMenuContainerAttributes = [{"id":"ch_thread_scroll_menu_container"},{"class":"ch-scroll-menu-container"}]; + let scrollMenuContainer = this.utility.createElement("div", scrollMenuContainerAttributes, null, msgList); + + // Create message reaction listing + let scrollMenuAttributes = [{"class":"ch-scroll-menu"}]; + let scrollMenu = this.utility.createElement("div", scrollMenuAttributes, null, scrollMenuContainer); + scrollMenu.style.width = this.scrollMenuWidth; + + // Create scroll left arrow + if (this.enableScrolling) { + let scrollMenuLeftAttributes = [{"class":"ch-scroll-menu-arrow ch-scroll-menu-arrow-left"}]; + let scrollMenuLeft = this.utility.createElement("i", scrollMenuLeftAttributes, "keyboard_arrow_left", scrollMenuContainer); + scrollMenuLeft.classList.add("material-icons"); + + // Add event listiner + scrollMenuLeft.addEventListener("click", (data) => { + scrollMenu.scrollLeft -= 200; + }); + } + + // Create message reaction listing + let reactionListingAttributes = [{"class":"ch-reaction-listing"}]; + let reactionListing = this.utility.createElement("ul", reactionListingAttributes, null, scrollMenu); + + // Create message reaction menu listing + this.reactionsTypes.forEach((type) => { + let reactionTypeObj = message.reactions[type.name]; + var reactionMenuListAttributes = [{"class":"ch-reaction-menu-list"}]; + if (reactionTypeObj && reactionTypeObj.indexOf(this.widget.userId) != -1) { + reactionMenuListAttributes = [{"class":"ch-reaction-menu-list reaction-selected"},{"title":type.name},{"name":type.name}]; + } + let reactionMenuList = this.utility.createElement("li", reactionMenuListAttributes, null, reactionListing); + + let reactionMenuListItemAttributes = [{"class":"ch-reaction-menu-list-item"},{"title":type.name},{"name":type.name}]; + let reactionMenuListItem = this.utility.createElement("span", reactionMenuListItemAttributes, type.icon, reactionMenuList); + + // Add event listiner on reaction menu item + this._updateReaction(message.id, reactionMenuListItem); + }); + + // Create scroll right arrow + if (this.enableScrolling) { + let scrollMenuRightAttributes = [{"class":"ch-scroll-menu-arrow ch-scroll-menu-arrow-right"}]; + let scrollMenuRight = this.utility.createElement("i", scrollMenuRightAttributes, "keyboard_arrow_right", scrollMenuContainer); + scrollMenuRight.classList.add("material-icons"); + + // Add event listiner + scrollMenuRight.addEventListener("click", (data) => { + scrollMenu.scrollLeft += 200; + }); + } + + }); + } + + _updateReaction(messageId, reactionMenuListItem) { + reactionMenuListItem.addEventListener("click", (data) => { + // Close the reaction container + if (document.getElementById("ch_thread_scroll_menu_container")) { + document.getElementById("ch_thread_scroll_menu_container").remove(); + } + + const messageIndex = this.threadMessages.findIndex(message => message.id == messageId); + if (messageIndex == -1) { + return; + } + + const message = this.threadMessages[messageIndex]; + const reactionType = reactionMenuListItem.title; + + const reactionTypeObj = message.reactions[reactionType]; + if (reactionTypeObj && reactionTypeObj.indexOf(this.widget.userId) != -1) { + // Update message reactions + var memberIndex = this.threadMessages[messageIndex]["reactions"][reactionType].indexOf(this.widget.userId); + if (memberIndex != -1) { + this.threadMessages[messageIndex]["reactions"][reactionType].splice(memberIndex, 1); + this.threadMessages[messageIndex]["reactionsCount"][reactionType] --; + } + + this.chAdapter.removeReaction(message, { type: reactionType }, (err, res) => { + }); + } else { + // Update message reactions + if(this.threadMessages[messageIndex]["reactions"][reactionType]) { + var memberIndex = this.threadMessages[messageIndex]["reactions"][reactionType].indexOf(this.widget.userId); + if (memberIndex == -1) { + this.threadMessages[messageIndex]["reactions"][reactionType].push(this.widget.userId); + this.threadMessages[messageIndex]["reactionsCount"][reactionType] ++; + } + } else { + const reactionData = this.threadMessages[messageIndex]["reactions"]; + reactionData[reactionType] = [this.widget.userId]; + this.threadMessages[messageIndex]["reactions"] = reactionData; + + const reactionCountData = this.threadMessages[messageIndex]["reactionsCount"]; + reactionCountData[reactionType] = 1; + this.threadMessages[messageIndex]["reactionsCount"] = reactionCountData; + } + + this.chAdapter.addReaction(message, { type: reactionType }, (err, res) => { + }); + } + + }); + } + +} + +export { Thread as default } \ No newline at end of file diff --git a/web-widget/src/js/constants.js b/web-widget/src/js/constants.js old mode 100755 new mode 100644 index 59b65b7..7981550 --- a/web-widget/src/js/constants.js +++ b/web-widget/src/js/constants.js @@ -10,6 +10,8 @@ export const LANGUAGE_PHRASES = { MUTE_CONV : "Mute Conversation", CLEAR_CONV : "Clear Conversation", DELETE_CONV : "Delete Conversation", + LEAVE_CONV : "Leave Conversation", + JOIN_CONV : "Join Conversation", BLOCK_USER : "Block User", UNBLOCK_USER : "Unblock User", SEND_MESSAGE : "Send a message", @@ -20,10 +22,13 @@ export const LANGUAGE_PHRASES = { LOCATION : "Location", STICKER : "Sticker", GIF : "GIF", + DOCUMENT : "Document", + ATTACHMENT : "Attachment", SEND_ATTACHMENTS : "Send Attachments", MEMBERS : "Members", FILE_SIZE_WARNING : "File size should be less then 25mb", SEARCH : "Search", + SEARCH_MEMBERS : "Search Members", SUGGESTED : "Suggested", MORE_USERS : "More Users", LOGIN : "Login", @@ -34,7 +39,23 @@ export const LANGUAGE_PHRASES = { ENTER_NAME : "Please enter a name", USER_EXIST : "User already exist with this username", DELETE_FOR_ME : "Delete for me", - DELETE_FOR_EVERYONE : "Delete for everyone" + DELETE_FOR_EVERYONE : "Delete for everyone", + GROUP_CREATED : "Group created", + GROUP_PHOTO_CHANGED : "Group photo updated", + GROUP_TITLE_CHANGED : "Group title updated", + GROUP_MEMBER_ADDED : "New member added in group", + GROUP_MEMBER_REMOVED : "One member removed from group", + GROUP_ADMIN_UPDATED : "Group admin updated", + CONVERSATION_NOT_FOUND : "Conversation not fond", + YOU : "You", + REPLIES : "Replies", + THREAD : "Thread", + REPLY_IN_THREAD : "Reply in Thread", + VIEW_THREAD : "View thread", + START_OF_A_NEW_THREAD : "Start of a new thread", + SEND_DIRECT_MESSAGE : "Also send as direct message", + SEND_TO_CONVERSATION : "Also sent to the conversation", + REPLY_OF_THREAD : "Reply of thread" } export const IMAGES = { @@ -51,11 +72,31 @@ export const IMAGES = { GIF_ICON : "https://cdn.channelize.io/apps/web-widget/1.0.0/images/gif.png", AVTAR : "https://cdn.channelize.io/apps/web-widget/1.0.0/images/avtar.png", GROUP : "https://cdn.channelize.io/apps/web-widget/1.0.0/images/group.png", + MESSAGE_LOADER : "https://cdn.channelize.io/apps/web-widget/1.0.0/images/image-loader.gif" } export const SETTINGS = { LOCATION_API_KEY : "AIzaSyBzrL8FaUvmYPIxEUd_VTPpqcACtPdniik", - LOCATION_IMG_URL : "https://maps.googleapis.com/maps/api/staticmap" + LOCATION_IMG_URL : "https://maps.googleapis.com/maps/api/staticmap", + ALLOW_MESSAGE_THREADING: true, + REACTION_SETTINGS : { + enable: true, + types: { + "like": "👍", + "dislike": "👎", + "laughing": "😆", + "angry": "😡" + } + } } - +export const ICONS = { + "image" : "photo", + "video" : "play_circle_outline", + "file" : "attach_file", + "audio" : "headset", + "sticker" : "sentiment_very_satisfied", + "gif" : "gif", + "location" : "room", + "document" : "insert_drive_file" +} \ No newline at end of file diff --git a/web-widget/src/js/utility.js b/web-widget/src/js/utility.js old mode 100755 new mode 100644 index 485b4d5..12bf69e --- a/web-widget/src/js/utility.js +++ b/web-widget/src/js/utility.js @@ -3,11 +3,11 @@ class Utility { createElement(tagName, attributes = null, data = null, parentTag = null) { let element = document.createElement(tagName); - if(data) - element.innerHTML = data; - - if(parentTag) - parentTag.appendChild(element); + if(data) + element.innerHTML = data; + + if(parentTag) + parentTag.appendChild(element); if(attributes && Array.isArray(attributes)) { attributes.forEach(attribute => { @@ -20,45 +20,66 @@ class Utility { } updateTimeFormat(time) { - const months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; + const months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; - var _getDay = val => { - let day = parseInt(val); - if (day == 1) { - return day + "st"; - } else if (day == 2) { - return day + "nd"; - } else if (day == 3) { - return day + "rd"; - } else { - return day + "th"; - } - }; + var _getDay = val => { + let day = parseInt(val); + if (day == 1) { + return day + "st"; + } else if (day == 2) { + return day + "nd"; + } else if (day == 3) { + return day + "rd"; + } else { + return day + "th"; + } + }; - var _checkTime = val => { - return +val < 10 ? "0" + val : val; - }; + var _checkTime = val => { + return +val < 10 ? "0" + val : val; + }; - if (time) { - const LAST_MESSAGE_YESTERDAY = "Yesterday"; - var _nowDate = new Date(); - var _date = new Date(time); - if (_nowDate.getDate() - _date.getDate() == 1) { - return LAST_MESSAGE_YESTERDAY; - } else if ( - _nowDate.getFullYear() == _date.getFullYear() && - _nowDate.getMonth() == _date.getMonth() && - _nowDate.getDate() == _date.getDate() - ) { - return ( - _checkTime(_date.getHours()) + ":" + _checkTime(_date.getMinutes()) - ); - } else { - return months[_date.getMonth()] + " " + _getDay(_date.getDate()); - } + if (time) { + const LAST_MESSAGE_YESTERDAY = "Yesterday"; + var _nowDate = new Date(); + var _date = new Date(time); + if (_nowDate.getDate() - _date.getDate() == 1) { + return LAST_MESSAGE_YESTERDAY; + } else if ( + _nowDate.getFullYear() == _date.getFullYear() && + _nowDate.getMonth() == _date.getMonth() && + _nowDate.getDate() == _date.getDate() + ) { + return ( + _checkTime(_date.getHours()) + ":" + _checkTime(_date.getMinutes()) + ); + } else { + return months[_date.getMonth()] + " " + _getDay(_date.getDate()); + } + } + return ""; + } + + showWarningMsg(text) { + // Create snackbar for warnings + let windowDiv = document.getElementById("ch_frame"); + let snackbarAttributes = [{"id":"ch_snackbar"}]; + this.createElement("div", snackbarAttributes, null, windowDiv); + + // Show size limit exceed message + let snackbar = document.getElementById("ch_snackbar"); + snackbar.innerText = text; + setTimeout(function() { + snackbar.remove(); + }, 3000); + } + + formatDuration(duration) { + let updatedDuration, actualDuration; + actualDuration = duration / 1000; + updatedDuration = ((Math.floor(actualDuration / 60) + (actualDuration % 60) / 100).toFixed(2)).toString().replace('.',':'); + return updatedDuration; } - return ""; - } } export { Utility as default }; \ No newline at end of file diff --git a/web-widget/src/js/widget.js b/web-widget/src/js/widget.js old mode 100755 new mode 100644 index ff177d3..d1ebae5 --- a/web-widget/src/js/widget.js +++ b/web-widget/src/js/widget.js @@ -2,6 +2,8 @@ import '../scss/main.scss'; import ChannelizeAdapter from "./adapter.js"; import Utility from "./utility.js"; import Login from "./components/login.js"; +import Members from "./components/members.js"; +import Thread from "./components/thread.js"; import RecentConversations from "./components/recent-conversations.js"; import ConversationWindow from "./components/conversation-window.js"; import { LANGUAGE_PHRASES, IMAGES } from "./constants.js"; @@ -9,33 +11,34 @@ import { LANGUAGE_PHRASES, IMAGES } from "./constants.js"; class ChannelizeWidget { constructor(publicKey) { this.utility = new Utility(); - this.publicKey = publicKey; - this._init(); + this._init(publicKey); } // Initialize the main contents - _init() { + _init(publicKey) { // Create script tag for material icons let materialScriptAttributes = [{"href":"https://fonts.googleapis.com/icon?family=Material+Icons"},{"rel":"stylesheet"}]; this.utility.createElement("link", materialScriptAttributes, null, document.head); // Initialize Channelize Adapter - this.chAdapter = new ChannelizeAdapter(this.publicKey); + this.chAdapter = new ChannelizeAdapter(publicKey); this.convWindows = []; + this.threads = []; } // Load channelize - load() { + load(cb) { // Check for already login user let userId = this.getCookie("ch_user_id"); let accessToken = this.getCookie("ch_access_token"); - + if(userId && accessToken) { this.connect(userId, accessToken, (err, res) => { if(err) return console.error(err); - window.userId = userId; + this.userId = userId; this._createLauncher(); + cb(null, res); }); } else { @@ -43,23 +46,24 @@ class ChannelizeWidget { } } - connect(userId, accessToken, cb) { - this.chAdapter.connect(userId, accessToken, (err, res) => { - if(err) return cb(err); + connect(userId, accessToken, cb) { + this.chAdapter.connect(userId, accessToken, (err, res) => { + if(err) return cb(err); - this._registerChEventHandlers(); - return cb(null, res); - }); - } + this._registerChEventHandlers(); + return cb(null, res); + }); + } // Connect and load channelize - loadWithConnect(userId, accessToken) { + loadWithUserId(userId, accessToken, cb) { this.connect(userId, accessToken, (err, res) => { if(err) return console.error(err); - window.userId = userId; - this.setCookie(userId, accessToken, 1); + this.userId = userId; + this.setCookie(userId, accessToken, 30); this._createLauncher(); + cb(null, res); }); } @@ -94,39 +98,62 @@ class ChannelizeWidget { return; } - this.chAdapter.getCurrentUser((err, user) => { - if(user) { - // Invoke recent conversation window - this.recentConversations = new RecentConversations(this); - } - else { - // Invoke login screen - new Login(this); - } - }); + let user = this.chAdapter.getLoginUser(); + if(user) { + // Invoke recent conversation window + this.recentConversations = new RecentConversations(this); + } + else { + // Invoke login screen + new Login(this); + } }); } // Handle all real time events of JS-SDK _registerChEventHandlers() { // Handle new message - window.channelize.chsocket.on('messageReceived', (message) => { - if(this.recentConversations) { - this.recentConversations.updateNewMessage(message); + window.channelize.chsocket.on('user.message_created', (data) => { + + // I have to handle showInConversation value here. If updateNewMessage is true or threads is + // Is not enabled then show the message in conversation window. + // Get conversation is does not exist + if(!document.getElementById(data.message.conversationId)) { + this.chAdapter.getConversation(data.message.conversationId, (err, conversation) => { + if(err) return console.error(err); + + if(this.recentConversations) { + this.recentConversations.updateNewMessage(data.message, conversation); + } + + this.convWindows.forEach(conversationWindow => { + conversationWindow.addNewMessage(data.message, conversation); + }); + }); + } + else { + if(this.recentConversations) { + this.recentConversations.updateNewMessage(data.message); + } - this.convWindows.forEach(conversationWindow => { - conversationWindow.addNewMessage(message); - }); + this.convWindows.forEach(conversationWindow => { + conversationWindow.addNewMessage(data.message); + }); + + this.threads.forEach(thread => { + thread.addNewMessage(data.message); + }); + } }); // Handle delete message for me - window.channelize.chsocket.on('messagesDeletedForMe', (data) => { + window.channelize.chsocket.on('user.message_deleted', (data) => { let updatedLastMsg; - - // Remove message from conversation screen - if(document.getElementById(data.messageIds[0])) { - document.getElementById(data.messageIds[0]).remove(); + + // Remove message from conversation window + if(document.getElementById(data.messages[0].id)) { + document.getElementById(data.messages[0].id).remove(); if(document.getElementById("ch_messages_box").lastChild) { let lastMsgAfterDelete = document.getElementById("ch_messages_box").lastChild.id; @@ -137,105 +164,167 @@ class ChannelizeWidget { if(this.recentConversations) { this.recentConversations.deleteLastMessage(data, updatedLastMsg); } + + // Remove messge from thread screen + this.threads.forEach(thread => { + thread.handleDeleteForMe(data); + }); }); // Handle delete message for everyone - channelize.chsocket.on('messagesDeletedForEveryone', (data) => { - // Update message text in conversation screen + window.channelize.chsocket.on('message.deleted_for_everyone', (data) => { + // Update message text in recent screen + if(this.recentConversations) { + this.recentConversations.updateDeleteForEveryoneMsg(data); + } + + // Update message text in conversation window this.convWindows.forEach(conversationWindow => { conversationWindow.updateDeleteForEveryoneMsg(data); }); - - // Update message text in recent screen - let recentTargetMsg = document.getElementById("ch_msg_" + data.deletedIds[0]); - if(recentTargetMsg) - recentTargetMsg.innerHTML = "" + LANGUAGE_PHRASES.MESSAGE_DELETED; + + // Update message text in thread screen + this.threads.forEach(thread => { + thread.updateDeleteForEveryoneMsg(data); + }); }); // Handle mark as read - window.channelize.chsocket.on('readMessageToOwner', (message) => { - if(!message.messageId || !document.getElementById(message.messageId)) + window.channelize.chsocket.on('conversation.mark_as_read', (data) => { + if(this.userId == data.user.id) { return; + } - let msgBox = document.getElementById(message.messageId).firstChild; - msgBox.lastChild.innerHTML = "done_all"; - }); - - // Handle user online - window.channelize.chsocket.on('online', (user) => { + // Update lastReadAt of conversation if(this.recentConversations) { - this.recentConversations.updateUserOnline(user); + this.recentConversations.updateReadAt(data); } + // Update message read status in conversation window this.convWindows.forEach(conversationWindow => { - conversationWindow.updateStatus(user); + conversationWindow.updateMsgStatus(data); + }); + + // Update message read status in threads screen + this.threads.forEach(thread => { + thread.updateMsgStatus(data); }); }); - // Handle user offline - window.channelize.chsocket.on('offline', (user) => { - if(this.recentConversations) { - this.recentConversations.updateUserOffline(user); + // Handle user online/ofline status + window.channelize.chsocket.on('user.status_updated', (data) => { + if (this.recentConversations) { + this.recentConversations.updateUserStatus(data.user); } - + this.convWindows.forEach(conversationWindow => { - conversationWindow.updateStatus(user); + conversationWindow.updateUserStatus(data.user); }); + + if(document.getElementById(data.user.id+"_member_online_icon")) { + if (data.user.isOnline) { + document.getElementById(data.user.id+"_member_online_icon").classList.add("ch-show-element"); + } else { + document.getElementById(data.user.id+"_member_online_icon").classList.remove("ch-show-element"); + } + } }); // Handle clear conversation - window.channelize.chsocket.on('conversationCleared', (conversation) => { + window.channelize.chsocket.on('user.conversation_cleared', (data) => { // Delete last message from particular recent conversation - if(document.getElementById(conversation.id) && document.getElementById(conversation.id).lastChild) - document.getElementById(conversation.id).lastChild.remove(); + if (this.recentConversations) { + this.recentConversations.handleClearConversation(data.conversation); + } - // Open new updated conversation screen + // Remove all messages of the conversation this.convWindows.forEach(conversationWindow => { - if(conversationWindow.conversation.id == conversation.id) { - if(document.getElementById("ch_conv_window")) { - document.getElementById("ch_conv_window").remove(); - } - conversationWindow = new ConversationWindow(this); - conversationWindow.init(conversation); - } + conversationWindow.handleClearConversation(data.conversation); + }); + + // Remove all messages of the thread + this.threads.forEach(thread => { + thread.handleClearConversation(data.conversation); }); }); // Handle delete conversation - window.channelize.chsocket.on('conversationDeleted', (conversation) => { - // Delete last message from particular recent conversation - if(document.getElementById(conversation.id) && document.getElementById(conversation.id).lastChild) - document.getElementById(conversation.id).remove(); + window.channelize.chsocket.on('user.conversation_deleted', (data) => { + // Remove the conversation from recent conversation + if (this.recentConversations) { + this.recentConversations.handleDeleteConversation(data.conversation); + } - // Remove conversation screen + // Remove conversation window this.convWindows.forEach(conversationWindow => { - if(conversationWindow.conversation.id == conversation.id) { - if(document.getElementById("ch_conv_window")) { - document.getElementById("ch_conv_window").remove(); - } - } + conversationWindow.handleDeleteConversation(data.conversation); + }); + + // Remove threads screen + this.threads.forEach(thread => { + thread.handleDeleteConversation(data.conversation); }); }); // Handle user block - window.channelize.chsocket.on('userBlocked', (self, userId) => { + window.channelize.chsocket.on('user.blocked', (data) => { // Update block icon in recent conversation - this.recentConversations.handleBlock(self, userId); + if(this.recentConversations) { + this.recentConversations.handleBlock(data); + } - // Update conversation screen of block user + // Update conversation window of block user this.convWindows.forEach(conversationWindow => { - conversationWindow.handleBlock(self, userId); + conversationWindow.handleBlock(data); + }); + + // Update thread screen of block user + this.threads.forEach(thread => { + thread.handleBlock(data); }); }); // Handle user unblock - window.channelize.chsocket.on('userUnblocked', (self, userId) => { + window.channelize.chsocket.on('user.unblocked', (data) => { // Update unblock icon in recent conversation - this.recentConversations.handleUnblock(self, userId); + if(this.recentConversations) { + this.recentConversations.handleUnblock(data); + } - // Update conversation screen of unblock user + // Update conversation window of unblock user + this.convWindows.forEach(conversationWindow => { + conversationWindow.handleUnblock(data); + }); + + // Update thread screen of unblock user + this.threads.forEach(thread => { + thread.handleUnblock(data); + }); + }); + + // Handle user join + window.channelize.chsocket.on('user.joined', (data) => { + // Update conversation active in recent conversation + if(this.recentConversations) { + this.recentConversations.handleUserJoined(data); + } + + // Update conversation active in conversation windows this.convWindows.forEach(conversationWindow => { - conversationWindow.handleUnblock(self, userId); + conversationWindow.handleUserJoined(data); + }); + }); + + // Handle user left + window.channelize.chsocket.on('user.removed', (data) => { + // Update conversation active in recent conversation + if(this.recentConversations) { + this.recentConversations.handleUserRemoved(data); + } + + // Update conversation active in conversation windows + this.convWindows.forEach(conversationWindow => { + conversationWindow.handleUserRemoved(data); }); }); } @@ -249,53 +338,103 @@ class ChannelizeWidget { } getCookie(cname) { - var name = cname + "="; - var cookieArray = document.cookie.split(';'); - for(var i = 0; i < cookieArray.length; i++) { - var singleCookie = cookieArray[i]; - while (singleCookie.charAt(0) == ' ') { - singleCookie = singleCookie.substring(1); - } - if (singleCookie.indexOf(name) == 0) { - return singleCookie.substring(name.length, singleCookie.length); - } - } - return ""; + var name = cname + "="; + var cookieArray = document.cookie.split(';'); + for(var i = 0; i < cookieArray.length; i++) { + var singleCookie = cookieArray[i]; + while (singleCookie.charAt(0) == ' ') { + singleCookie = singleCookie.substring(1); + } + if (singleCookie.indexOf(name) == 0) { + return singleCookie.substring(name.length, singleCookie.length); + } + } + return ""; } // To skip out login process and direct open recent conversation window loadRecentConversation(userId, accessToken) { // Connect to Channelize server - window.userId = userId; - this.chAdapter.connect(userId, accessToken, (err, res) => { + this.userId = userId; + this.connect(userId, accessToken, (err, res) => { if(err) return console.error(err); + // Create channelize frame + let widget = document.getElementById("ch_widget"); + let frameAttributes = [{"id":"ch_frame"},{"class":"ch-frame"}]; + let frame = this.utility.createElement("div", frameAttributes, null, widget); + // Invoke recent conversation window this.recentConversations = new RecentConversations(this); }); } - // To open a conversation screen of any user via member-id or conversation-id - loadConversationWindow(otherMemberId, conversationId = null) { - if(otherMemberId) { - this.chAdapter.getConversationsList(1, 0, otherMemberId, (err, conversation) => { - if(err) return console.error(err); + // To open a conversation window via conversation-id + loadConversationWindow(conversationId ) { + let conversation = this.chAdapter.getConversation(conversationId, (err, conversation) => { + if(err) return console.error(err); - let conversationWindow = new conversationWindow(this); - conversationWindow.init(conversation); // Pass conversation object in params - this.convWindows.push(conversationWindow); + let conversationWindow = new ConversationWindow(this); + conversationWindow.init(conversation); // Pass conversation object in params + this.convWindows.push(conversationWindow); + }); + } + + // To open a conversation window of any user via user-id + loadConversationWindowByUserId(userId) { + this.chAdapter.getConversationsList(1, 0, userId, "members", null, null, null, null, null, (err, conversations) => { + if(err) return console.error(err); + + if(!conversations.length) { + console.error(LANGUAGE_PHRASES.CONVERSATION_NOT_FOUND); + return; + } + + let conversationWindow = new ConversationWindow(this); + conversationWindow.init(conversations[0]); // Pass conversation object in params + this.convWindows.push(conversationWindow); + }); + } + + handleConversationEvents(conversation) { + + // Handle add reaction + conversation.on('reaction.added', (data) => { + // Handle add reaction on conversation window + this.convWindows.forEach(conversationWindow => { + conversationWindow.handleAddReaction(data); }); - } - else if(conversationId) { - let conversation = this.chAdapter.getConversation(conversationId, (err, conversation) => { - if(err) return console.error(err); + + // Handle add reaction on thread screen + this.threads.forEach(thread => { + thread.handleAddReaction(data); + }); + }); - let conversationWindow = new conversationWindow(this); - conversationWindow.init(conversation); // Pass conversation object in params - this.convWindows.push(conversationWindow); + // Handle remove reaction + conversation.on('reaction.removed', (data) => { + // Handle remove reaction on conversation window + this.convWindows.forEach(conversationWindow => { + conversationWindow.handleRemoveReaction(data); }); - } + + // Handle remove reaction on thread screen + this.threads.forEach(thread => { + thread.handleRemoveReaction(data); + }); + + }); + } + + loadConversationMembers(conversationId) { + new Members(this, conversationId); } + + loadThread(message, conversation) { + let thread = new Thread(this, message, conversation); + this.threads.push(thread); + } + } window.ChannelizeWidget = ChannelizeWidget; \ No newline at end of file diff --git a/web-widget/src/scss/main.scss b/web-widget/src/scss/main.scss old mode 100755 new mode 100644 index 590b768..657b933 --- a/web-widget/src/scss/main.scss +++ b/web-widget/src/scss/main.scss @@ -9,6 +9,15 @@ ul { padding-left: 0; margin: 0; } +.left { + float: left; +} +.right { + float: right; +} +.ch-text-pointer { + cursor: text !important; +} .ch-loader-bg { position: absolute; height: inherit; @@ -25,7 +34,7 @@ ul { top: 40%; border: 5px solid #f3f3f3; border-radius: 50%; - border-top: 5px solid #0377ff; + border-top: 5px solid $theme-color; width: 30px; height: 30px; -webkit-animation: spin 1s linear infinite; /* Safari */ @@ -42,78 +51,14 @@ ul { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } - -.ch-login-error { - display: none; -} .ch-no-msg { + position: relative; + top: 50%; text-align: center; color: $ch-title-color; - margin-top: 50%; -} -.ch-dummy-img { - height: 40px; - width: 40px; - margin-right: 10px; - border-radius: 50%; -} -.ch-online-icon { - background: #64ba00; - border-radius: 50%; - border: 2px solid #fff; - bottom: 0; - position: absolute; - right: 1px; - width: 6px; - height: 6px; - display: none; -} -.ch-conv-drop-down { - position: absolute; - display: none; - box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12); - z-index: 8; - background: #fff; - min-width: 100px; - max-width: 250px; - border-radius: 5px; - div { - color: #4a505a; - padding: 4px 12px; - height: auto; - margin: 0; - line-height: 20px; - font-size: 12px; - &:hover { - background: #0000000a; - cursor: pointer; - } - } - .ch-conv-block { - display: none; - } - .ch-conv-unblock { - display: none; - } -} -.ch-created-at { - float: right; - font-size: 10px; -} -.ch-message { - padding: 10px; - word-break: break-word; } - -audio#ch_audio_message { - margin-top: -10px; - width: 295px; - height: 38px; - margin-left: -33px; - margin-right: -33px; - margin-bottom: -14px; - background-color: #f1f3f4; - transform: scaleX(0.9); +.ch-show-element { + display: block !important; } .ch-launcher { position: fixed; @@ -153,44 +98,31 @@ audio#ch_audio_message { vertical-align: middle; display: inline-block; float: left; + position: relative; + height: 32px; + width: 32px; + border-radius: 50%; + background-size: cover; + margin-right: 10px; } - .ch-conv-details-wrapper { - display: inline-block; - } -} -span.ch-msg-time { - font-size: 10px; - display: inline-block; - vertical-align: middle; - color: #969391; -} -i.ch-msg-status { - font-size: 10px; - display: inline-block; - vertical-align: middle; - color: #969391; - margin-right: 5px; } + #ch_snackbar { - visibility: hidden; - min-width: 250px; - margin-left: -125px; - background-color: #333; - color: #fff; - text-align: center; - border-radius: 4px; - padding: 13px; - position: fixed; - z-index: 1; - left: 50%; - bottom: 30px; - font-size: 14px; -} -#ch_snackbar.show { - visibility: visible; - -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; - animation: fadein 0.5s, fadeout 0.5s 2.5s; -} + min-width: 250px; + margin-left: -125px; + background-color: #333; + color: $white-color; + text-align: center; + border-radius: 4px; + padding: 13px; + position: fixed; + z-index: 1; + left: 50%; + bottom: 30px; + font-size: 14px; + -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; + animation: fadein 0.5s, fadeout 0.5s 2.5s; +} @-webkit-keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} @@ -208,7 +140,7 @@ i.ch-msg-status { to {bottom: 0; opacity: 0;} } /*screen window scroll*/ -.ch-messages-box, .ch-recent-listing, .ch-friends-box { +.ch-messages-box, .ch-recent-listing, .ch-friends-box, .ch-thread-messages-box { &::-webkit-scrollbar { width: .4em; overflow: visible; @@ -221,7 +153,7 @@ i.ch-msg-status { } } /*screen window common style*/ -.ch-login-window, .ch-conv-window, .ch-search-window, .ch-recent-window { +.ch-login-window, .ch-conv-window, .ch-search-window, .ch-recent-window, .ch-members-window, .ch-thread-window { border-top-left-radius: 8px; border-top-right-radius: 8px; position: fixed; @@ -229,22 +161,24 @@ i.ch-msg-status { /*Common style end here*/ /*Login style start here*/ -.ch-show-element { - display: block; -} .ch-login-window { box-shadow: rgba(0,0,0,0.3) 0 0 1.2em; right: 1%; top: 35%; bottom: 0; width: $ch-recent-width; - background-color: #fff; + background-color: $white-color; .ch-header { + color : $gray-shade; line-height: 34px; padding-left: 20px; .ch-login-close-btn { + color : $space-gray; float: right; margin-top: 5px; + &:hover { + color: $black-color; + } } } .ch-loader-bg { @@ -258,20 +192,24 @@ i.ch-msg-status { margin-bottom: 20px; } .ch-dummy-img { + border-radius: 50%; cursor: pointer; + height: 40px; + margin-right: 10px; + width: 40px; &:last-child { margin: 0; } } } .ch-login-btn { - background: #0377ff; + background: $theme-color; outline: none; margin: 0 auto; display: inherit; - border: 1px solid #0377ff; + border: 1px solid $theme-color; border-radius: 25px; - color: #fff; + color: $white-color; padding: 10px 30px; font-size: 14px; text-transform: uppercase; @@ -282,7 +220,7 @@ i.ch-msg-status { cursor: pointer; &:hover { background: transparent; - color: #0377ff; + color: $theme-color; } } .ch-login-name-container { @@ -291,8 +229,9 @@ i.ch-msg-status { margin-top: 15px; border-bottom: 1px solid #ccc; .ch-login-error { + display: none; font-size: 85%; - color: red; + color: $red-color; margin-top: 2px; } input { @@ -353,91 +292,108 @@ i.ch-msg-status { } } } -} -.ch-recent-ul { - margin: 0; - padding: 3px 0 0 0; - li { - min-height: 40px; - cursor: pointer; - list-style: none; - position: relative; - padding: 10px; - border-bottom: 1px solid rgba(90,122,190,.08); - background-color: $ch-recent-conversation-list-color; - &:hover { - background-color: $ch-recent-conversation-list-hover-color; - } - &:last-child { - margin-bottom: 0; - } - #ch_title { - width: 55%; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - padding-right: 5px; - font-size: 13px; - display: block; - float: left; - color: $ch-recent-conversation-list-title-color; - font-weight: 400; - margin-top: 4px; - text-transform: capitalize; - } - .ch-created-at { - font-size: $ch-status-fontsize; - float: right; - color: $ch-status-color; - margin-top: 2px; - position: absolute; - right: 5px; - top: 14px; - } - .ch-last-msg-box { - width: 55%; - float: left; - margin-top: 4px; - img { - height: 10px; - width: 12px; - margin: 2px 5px 0 1px; + .ch-recent-listing { + height: calc(100% - 50px); + overflow: auto; + .ch-recent-ul { + margin: 0; + padding: 3px 0 0 0; + li { + min-height: 40px; + cursor: pointer; + list-style: none; + position: relative; + padding: 10px; + border-bottom: 1px solid rgba(90,122,190,.08); + background-color: $ch-recent-conversation-list-color; + .ch-conversation-image { + position: relative; + float: left; + height: 32px; + width: 32px; + border-radius: 50%; + background-size: cover; + margin-right: 10px; + margin-top: 3px; + .ch-online-icon { + background: #64ba00; + border-radius: 50%; + border: 2px solid $white-color; + bottom: 0; + position: absolute; + right: 1px; + width: 6px; + height: 6px; + display: none; + } + .ch-user-blocked { + background: $red-color !important; + display: block !important; + } + } + &:hover { + background-color: $ch-recent-conversation-list-hover-color; + } + &:last-child { + margin-bottom: 0; + } + #ch_title { + width: 55%; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + padding-right: 5px; + font-size: 13px; + display: block; + float: left; + color: $ch-recent-conversation-list-title-color; + font-weight: 400; + margin-top: 4px; + text-transform: capitalize; + } + .ch-created-at { + font-size: $ch-status-fontsize; + float: right; + color: $ch-status-color; + margin-top: 2px; + position: absolute; + right: 5px; + top: 14px; + } + .ch-last-msg-box { + width: 55%; float: left; - vertical-align: middle; + margin-top: 4px; + img { + height: 10px; + width: 12px; + margin: 2px 5px 0 1px; + float: left; + vertical-align: middle; + } + .ch-last-message { + font-size: $ch-subtitle-fontsize; + color: $ch-recent-conversation-list-content-color; + padding-left: 0; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + height: auto; + } + } } - .ch-last-message { - font-size: $ch-subtitle-fontsize; - color: $ch-recent-conversation-list-content-color; - padding-left: 0; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - height: auto; - width: 80%; - } - } - .ch-user-blocked { - background: red !important; } } } -.ch-recent-listing { - height: calc(100% - 50px); - overflow: auto; -} -.ch-conversation-image { - position: relative; - float: left; - height: 32px; - width: 32px; - border-radius: 50%; - background-size: cover; - margin-right: 10px; - margin-top: 3px; -} /*recent style end here*/ + /*Search style start here*/ .ch-search-window { + right: $ch-recent-right-position; + top: $ch-recent-top-position; + bottom: $ch-recent-bottom-position; + width: $ch-recent-width; + background-color: $white-color; .ch-header { line-height: 35px; text-align: center; @@ -459,13 +415,23 @@ i.ch-msg-status { background: transparent; outline: none; border: none; - color: white; + color: $white-color; width: 100%; padding: 15px 25px 15px 15px; box-sizing: border-box; } + ::placeholder { + color: $white-color; + opacity: 1; + } + :-ms-input-placeholder { + color: white; + } + ::-ms-input-placeholder { + color: white; + } .ch-clear-search-icon { - color: #ffffff; + color: $white-color; cursor: pointer; font-size: 20px; position: absolute; @@ -473,57 +439,53 @@ i.ch-msg-status { right: 8px; } } - right: $ch-recent-right-position; - top: $ch-recent-top-position; - bottom: $ch-recent-bottom-position; - width: $ch-recent-width; - background-color: #fff; -} -.ch-friends-box { - height: calc(100% - 92px); - overflow: auto; - li { - cursor: pointer; - list-style: none; - position: relative; - padding: 10px; - border-bottom: 1px solid rgba(90,122,190,.08); - .ch-friend-name { - width: 180px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - padding-right: 5px; + .ch-friends-box { + height: calc(100% - 92px); + overflow: auto; + li { + cursor: pointer; + list-style: none; + position: relative; + padding: 10px; + border-bottom: 1px solid rgba(90,122,190,.08); + .ch-contact-img { + height: 32px; + width: 32px; + border-radius: 50%; + margin-right: 10px; + vertical-align: middle; + } + .ch-friend-name { + width: 180px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + padding-right: 5px; + font-size: 13px; + display: inline-block; + vertical-align: middle; + color: $gray-shade; + font-weight: 400; + text-transform: capitalize; + } + } + .ch-more-users { + display: none; + color: $gray-shade; + margin-left: 10px; + margin-top: 10px; + font-size: 13px; + } + .ch-suggested { + color: $gray-shade; + margin-left: 10px; + margin-top: 10px; font-size: 13px; - display: inline-block; - vertical-align: middle; - color: #4a505a; - font-weight: 400; - text-transform: capitalize; } } - .ch-more-users { - display: none; - color: #4a505a; - margin-left: 10px; - margin-top: 10px; - font-size: 13px; - } - .ch-suggested { - color: #4a505a; - margin-left: 10px; - margin-top: 10px; - font-size: 13px; - } -} -.ch-contact-img { - height: 32px; - width: 32px; - border-radius: 50%; - margin-right: 10px; - vertical-align: middle; } /*search style end here*/ + /*conversation style start here*/ .ch-conv-window { bottom: $ch-conv-bottom-position; @@ -533,282 +495,1264 @@ i.ch-msg-status { box-shadow: rgba(0,0,0,.3) 0 0 1.2em; .ch-header { background-color: $ch-conversation-window-header-bg-color; + .ch-conv-details-wrapper { + display: inline-block; + .ch-conv-title { + display: inline-block; + vertical-align: middle; + max-width: 120px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + color: $ch-title-color; + text-transform: capitalize; + font-size: $ch-title-fontsize; + cursor: pointer; + } + .ch-conv-options { + vertical-align: middle; + color: $ch-title-color; + } + .ch-conv-status { + font-size: $ch-status-fontsize; + color: $ch-status-color; + } + } + .ch-conv-drop-down { + position: absolute; + display: none; + box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12); + z-index: 8; + background: $white-color; + min-width: 100px; + max-width: 250px; + border-radius: 5px; + div { + color: $gray-shade; + padding: 4px 12px; + height: auto; + margin: 0; + line-height: 20px; + font-size: 12px; + &:hover { + background: #0000000a; + cursor: pointer; + } + } + } i#ch_conv_close_btn { - color: $ch-recent-conversation-header-font-icon-color; + color: $ch-conversation-window-header-font-icon-color; position: absolute; - right: 10px; + right: 10px; top: 14px; &:hover { - color: $ch-recent-conversation-header-font-icon-hover-color; + color: $ch-conversation-window-header-font-icon-hover-color; } } } -} -.ch-conv-title { - display: inline-block; - vertical-align: middle; - max-width: 120px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - color: $ch-title-color; - text-transform: capitalize; - font-size: $ch-title-fontsize; - + { - i#ch_conv_options { - vertical-align: middle; - color: $ch-title-color; - margin-left: 3px; + .ch-messages-box { + height: calc(100% - 115px); + overflow: auto; + background-color: $ch-conversation-window-bg-color; + padding-top: 5px; + .ch-loader-bg { + background: $white-color; } + .ch-msg-loader { + float: right; + padding: 5px 0; + background-size: 70px; + position: relative; + background-position: center; + background-repeat: no-repeat; + height: 140px; + min-width: 180px; + border: 1px solid #eee; + border-radius: 6px 6px 0; + } + .ch-admin-msg { + text-align: center; + color: $gray-color; + margin-bottom: 4px; + padding: 0 10px; + font-size: 11px; + } + .ch-msg-list { + position: relative; + float: left; + width: 100%; + padding: 5px 0; + .ch-msg-container { + clear: both; + margin-bottom: 0; + position: relative; + overflow: hidden; + audio#ch_audio_message { + margin-top: -10px; + width: 244px; + height: 45px; + margin-left: -23px; + margin-right: -23px; + margin-bottom: -13px; + background-color: #f5f5f5; + transform: scaleX(0.9); + display: inline-block; + box-sizing: border-box; + } + } + i.ch-msg-more-option { + color: #6e7174; + font-size: 15px; + margin-top: 2px; + cursor: pointer; + } + .ch-msg-option-container { + position: absolute; + box-shadow: rgba(0,0,0,0.3) 0 0 1.2em; + z-index: 8; + background: $white-color; + min-width: 100px; + max-width: 250px; + border-radius: 4px; + div { + color: $gray-shade; + padding: 4px 12px; + height: auto; + margin: 0; + line-height: 20px; + font-size: 12px; + &:hover { + background: #0000000a; + cursor: pointer; + } + } + } + .ch-sender-name { + font-size: 13px; + margin-left: 7px; + margin-bottom: 5px; + text-transform: capitalize; + color: $ch-conversation-window-msg-owner-color; + } + .ch-msg-container.left { + float: left; + max-width: 220px; + margin-left: 8px; + div.ch-msg-reply-count-container { + display: none; + } + div.ch-msg-reply-count-container.show { + display: block; + } + span.ch-msg-reply-count { + font-size: 12px; + display: inline-block; + vertical-align: middle; + color: $theme-color; + margin-top: 3px; + cursor: pointer; + margin-right: 2px; + } + i.ch-msg-reply-count-icon { + font-size: 12px; + display: inline-block; + vertical-align: middle; + color: $gray-color; + margin-top: 3px; + } + span.ch-msg-time { + font-size: 10px; + display: inline-block; + vertical-align: middle; + color: $gray-color; + } + .ch-message { + overflow: hidden; + background: $ch-conversation-window-msg-bg-color; + border-radius: 6px 6px 6px 0; + position: relative; + color: $ch-conversation-window-msg-color; + padding: 10px; + word-break: break-word; + margin-bottom: 2px; + .ch-text-message-reply-thread { + margin: 0px; + border-left: 3px solid $dark-gray; + padding-left: 7px; + display: inline-block; + margin-bottom: 10px; + font-style: italic; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + width: 175px; + cursor: pointer; + } + .ch-attachments-message-reply-thread { + margin: 0px; + border-left: 3px solid $dark-gray; + padding-left: 7px; + display: inline-block; + margin-bottom: 10px; + font-style: italic; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + width: 175px; + cursor: pointer; + } + .ch-reply-msg-container { + border-left: 3px solid $dark-gray; + padding-left: 10px; + display: inline-block; + margin-bottom: 10px; + min-width: 100px; + position: relative; + cursor: pointer; + } + .ch-reply-msg-container-attachment { + border-left: 3px solid $dark-gray; + padding-left: 10px; + display: inline-block; + margin-bottom: 10px; + min-width: 180px; + position: relative; + cursor: pointer; + } + .ch-parent-msg-owner-name { + font-weight: 700; + margin: 3px 0px; + color: $ch-conversation-window-msg-color; + } + .ch-parent-msg-icon, .ch-parent-msg-duration, .ch-parent-msg-body { + margin: 4px 0px; + color: $ch-conversation-window-msg-color; + display: block; + margin-right: 3px; + float: left; + } + .ch-parent-msg-body { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + width: 175px; + } + .ch-parent-msg-icon { + font-size: 15px; + } + .ch-message-body { + margin: 0px; + } + .ch-reply-msg-container-right { + position: absolute; + top: 0; + right: 0; + } + .ch-parent-msg-thumbnail { + height: 40px; + width: 40px; + background: $ch-conversation-window-header-bg-color; + overflow: hidden; + border-radius: 2px; + } + .ch-video-message, .ch-image-message, .ch-location-message, .ch-sticker-message { + background-size: cover; + position: relative; + cursor: pointer; + background-position: center; + background-repeat: no-repeat; + height: 140px; + min-width: 180px; + margin: -10px; + border: 1px solid #eee; + border-radius: 6px 6px 6px 0; + .ch-play-icon { + position: absolute; + left: 0; + right: 0; + top: 28%; + text-align: center; + color: $white-color; + font-size: 55px; + } + } + .ch-audio-message { + width: 220px; + margin: -10px; + } + } + } + .ch-msg-container.right { + float: right; + max-width: 220px; + color: $gray-color; + margin-right: 8px; + text-align: right; + div.ch-msg-reply-count-container { + display: none; + } + div.ch-msg-reply-count-container.show { + display: block; + } + span.ch-msg-reply-count { + font-size: 12px; + display: inline-block; + vertical-align: middle; + color: $theme-color; + margin-top: 3px; + cursor: pointer; + margin-right: 2px; + } + i.ch-msg-reply-count-icon { + font-size: 12px; + display: inline-block; + vertical-align: middle; + color: $gray-color; + margin-top: 3px; + float: right; + } + span.ch-msg-time { + margin-right: 3px; + font-size: 10px; + display: inline-block; + vertical-align: middle; + color: $gray-color; + } + i.ch-msg-status { + font-size: 10px; + display: inline-block; + vertical-align: middle; + color: $gray-color; + } + .ch-message { + background-color: $ch-conversation-window-user-msg-bg-color; + border-radius: 6px 6px 0; + overflow: hidden; + display: block; + color: $ch-conversation-window-user-msg-color; + margin-bottom: 1px; + text-align: left; + padding: 10px; + word-break: break-word; + .ch-text-message-reply-thread { + margin: 0px; + border-left: 3px solid $white-color; + padding-left: 7px; + display: inline-block; + margin-bottom: 10px; + font-style: italic; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + width: 175px; + cursor: pointer; + } + .ch-attachments-message-reply-thread { + margin: 0px; + border-left: 3px solid $white-color; + padding-left: 7px; + display: inline-block; + margin-bottom: 10px; + font-style: italic; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + width: 175px; + cursor: pointer; + } + .ch-reply-msg-container { + border-left: 3px solid $white-color; + padding-left: 10px; + display: inline-block; + margin-bottom: 10px; + min-width: 100px; + position: relative; + cursor: pointer; + } + .ch-reply-msg-container-attachment { + border-left: 3px solid $white-color; + padding-left: 10px; + display: inline-block; + margin-bottom: 10px; + min-width: 180px; + position: relative; + cursor: pointer; + } + .ch-parent-msg-owner-name { + font-weight: 700; + margin: 3px 0px; + color: $ch-conversation-window-user-msg-color; + } + .ch-parent-msg-icon, .ch-parent-msg-duration, .ch-parent-msg-body { + margin: 4px 0px; + color: $ch-conversation-window-user-msg-color; + display: block; + margin-right: 3px; + float: left; + } + .ch-parent-msg-body { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + width: 175px; + } + .ch-parent-msg-icon { + font-size: 15px; + } + .ch-message-body { + margin: 0px; + } + .ch-reply-msg-container-right { + position: absolute; + top: 0; + right: 0; + } + .ch-parent-msg-thumbnail { + height: 40px; + width: 40px; + background: $ch-conversation-window-user-msg-bg-color; + overflow: hidden; + border-radius: 2px; + } + } + .ch-video-message, .ch-image-message, .ch-location-message, .ch-sticker-message { + background-size: cover; + position: relative; + cursor: pointer; + background-position: center; + background-repeat: no-repeat; + height: 140px; + min-width: 180px; + margin: -10px; + border: 1px solid #eee; + border-radius: 6px 6px 0; + .ch-play-icon { + position: absolute; + left: 0; + right: 0; + top: 28%; + text-align: center; + color: $white-color; + font-size: 55px; + } + } + } + } + } -} -.ch-conv-status { - font-size: $ch-status-fontsize; - color: $ch-recent-conversation-header-font-icon-color; -} -.ch-conv-options { - vertical-align: middle; -} -.ch-messages-box { - height: calc(90% - 70px); - overflow: auto; - background-color: $ch-conversation-window-bg-color; - padding-top: 5px; - .ch-loader-bg { - background: #fff; - } - -} -.ch-msg-container { - clear: both; - margin-bottom: 0; - position: relative; - overflow: hidden; -} -i.ch-msg-more-option { - color: #6e7174; - font-size: 15px; - margin-top: 2px; - cursor: pointer; -} -.left { - float: left; -} -.right { - float: right; -} -.ch-msg-container.right { - float: right; - max-width: 220px; - color: #969391; - margin-right: 8px; - text-align: right; - .ch-msg-time { - margin-right: 5px; - } - .ch-message { - background-color: $ch-conversation-window-user-msg-bg-color; - border-radius: 6px 6px 0; - overflow: hidden; - display: block; - color: $ch-conversation-window-user-msg-color; - margin-bottom: 1px; - text-align: left; - } - .ch-video-message, .ch-image-message, .ch-location-message, .ch-sticker-message { - background-size: cover; + .ch-send-box { + padding: 8px 10px 0; + border-top: 1px solid rgba(90,122,190,.08); + min-height: 50px; + background: $ch-conversation-window-composer-bg-color; + font-size: 13px; position: relative; - cursor: pointer; - background-position: center; - background-repeat: no-repeat; - height: 140px; - min-width: 180px; - margin: -10px; - border: 1px solid #eee; - border-radius: 6px 6px 0; - .ch-play-icon { + textarea { + outline: none; + border: none; + width: calc(100% - 54px); + color: $ch-conversation-window-composer-text-color; + padding: 0px 5px 0 0; + resize: none; + font-size: 13px; + vertical-align: bottom; + font-family: $ch-body-font-family; + background: transparent; + } + button { + padding: 11px 0 0 0; + margin: 0; + background: transparent; + border: none; + outline: none; + vertical-align: super; + cursor: pointer; + i.ch-send-icon { + font-size: $ch-app-icon-fontsize; + color: $ch-conversation-window-composer-font-icon-color; + } + } + .ch-attachment-btn { + margin-right: 5px; + display: inline-block; + vertical-align: super; + font-size: 22px; + cursor: pointer; + color: $ch-conversation-window-composer-font-icon-color; + } + .ch-media-docker { position: absolute; + opacity: 0; + visibility: hidden; + bottom: -100px; left: 0; right: 0; - top: 28%; + background: $white-color; + padding: 10px; + z-index: 99; + transition: .5s; + -webkit-box-shadow: 0 -4px 8px 0 rgba(0,0,0,0.2); + -webkit-transition: .5s; + box-shadow: 0 -4px 8px 0 rgba(0,0,0,0.2); + border-radius: 10px 10px 0 0; + overflow: hidden; text-align: center; - color: #fff; - font-size: 55px; + .ch-video-option{ + margin-right: 0 !important; + } + .ch-image-option, .ch-audio-option, .ch-video-option { + display: inline-block; + position: relative; + text-align: center; + margin-right: 35px; + color: $dark-gray; + .ch-image-icon-span{ + background-color: #64b5f6; + } + .ch-audio-icon-span{ + background-color: #ff8a65; + } + .ch-video-icon-span{ + background-color: #f7dc6f; + } + .ch-image-icon-span, .ch-audio-icon-span, .ch-video-icon-span { + height: 45px; + width: 45px; + display: block; + text-align: center; + line-height: 53px; + border-radius: 50%; + margin-bottom: 2px; + cursor: pointer; + img { + width: 16px; + } + } + input { + opacity: 0; + width: 50px; + height: 50px; + position: absolute; + top: 0; + cursor: pointer; + left: 0; + } + } + } + .ch-show-docker.ch-media-docker { + opacity: 1; + bottom: 100%; + visibility: visible; + } + + .ch-reply-container { + position: absolute; + opacity: 0; + visibility: hidden; + bottom: -100px; + left: 0; + right: 0; + background: $white-color; + padding: 10px; + z-index: 99; + transition: .5s; + -webkit-box-shadow: 0 -4px 8px 0 rgba(0,0,0,0.2); + -webkit-transition: .5s; + box-shadow: 0 -4px 8px 0 rgba(0,0,0,0.2); + overflow: hidden; + .ch-reply-composer { + border-left: 3px solid $theme-color; + padding-left: 10px; + display: inline-flex; + } + .ch-reply-composer-left { + float: left; + display: inline-block; + } + .ch-reply-message-thumbnail { + width: 40px; + height: 40px; + margin-right: 13px; + } + .ch-reply-composer-right { + float: left; + display: inline-block; + } + .ch-reply-msg-owner-name { + font-weight: 700; + margin: 3px 0px; + color: $dark-gray; + } + .ch-reply-msg-icon, .ch-reply-msg-duration, .ch-reply-msg-body { + margin: 4px 0px; + color: $light-gray; + display: block; + margin-right: 3px; + float: left; + } + .ch-reply-msg-icon { + font-size: 15px; + } + i { + cursor: pointer; + font-size: 18px; + } + i#ch_reply_composer_close_btn { + color: $dark-gray; + position: absolute; + right: 5px; + top: 5px; + &:hover { + color: $black-color; + } + } + } + .ch-show-reply-container.ch-reply-container { + opacity: 1; + bottom: 100%; + visibility: visible; + } + } + .ch-footer { + .ch-conv-join { + position: absolute; + bottom: 0; + background: $theme-color; + color: $white-color; + width: 100%; + padding: 8px; + } } } +/*conversation style end here*/ + +/*Members style start here*/ + +.ch-members-window { + bottom: $ch-conv-bottom-position; + top: $ch-conv-top-position; + right: $ch-conv-right-position; + width: $ch-conversation-width; + background-color: $white-color; + box-shadow: rgba(0,0,0,.3) 0 0 1.2em; + .ch-header { + line-height: 35px; + text-align: center; + color: $ch-title-color; + i#ch_members_close_btn { + position: absolute; + left: 10px; + top: 17px; + color: $ch-conversation-window-header-font-icon-color; + &:hover { + color: $ch-conversation-window-header-font-icon-hover-color; + } + } + } + .ch-members-box { + height: calc(100% - 92px); + overflow: auto; + li { + cursor: pointer; + list-style: none; + position: relative; + padding: 10px; + min-height: 32px; + border-bottom: 1px solid rgba(90,122,190,.08); + .ch-member-img { + height: 32px; + width: 32px; + border-radius: 50%; + float: left; + margin-right: 10px; + position: relative; + background-size: cover; + .ch-online-icon { + background: #64ba00; + border-radius: 50%; + border: 2px solid $white-color; + bottom: 0; + position: absolute; + right: 1px; + width: 6px; + height: 6px; + display: none; + } + } + .ch-member-name { + width: 180px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + padding-right: 5px; + font-size: 13px; + display: inline-block; + vertical-align: middle; + color: #4a505a; + font-weight: 400; + margin-top: 8px; + text-transform: capitalize; + } + } + } } -.ch-msg-container.left { - float: left; - max-width: 220px; - margin-left: 8px; - .ch-message { - overflow: hidden; - background: $ch-conversation-window-msg-bg-color; - border-radius: 6px 6px 6px 0; - position: relative; - color: $ch-conversation-window-msg-color; - .ch-video-message, .ch-image-message, .ch-location-message, .ch-sticker-message { - background-size: cover; + +/*Members style end here*/ + + +/*Threas style start here*/ +.ch-send-direct-msg-box { + margin: 10px 0 10px 6px; +} +.ch-thread-window { + bottom: $ch-conv-bottom-position; + top: $ch-conv-top-position; + right: $ch-conv-right-position; + width: $ch-conversation-width; + box-shadow: rgba(0,0,0,.3) 0 0 1.2em; + background-color: $ch-conversation-window-bg-color; + .ch-header { + color: $ch-title-color; + i#ch_thread_close_btn { + color: $ch-conversation-window-header-font-icon-color; + vertical-align: middle; + &:hover { + color: $ch-conversation-window-header-font-icon-hover-color; + } + } + .ch-thread-header-details-wrapper { + margin-left: 10px; + display: inline-block; + vertical-align: middle; + .ch-header-title { + display: inline-block; + vertical-align: middle; + max-width: 120px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + color: $ch-title-color; + text-transform: capitalize; + font-size: $ch-title-fontsize; + cursor: pointer; + } + .ch-header-subtitle { + color: $ch-subtitle-color; + font-size: $ch-subtitle-fontsize; + .ch-header-reply { + margin-left: 4px; + } + } + } + } + .ch-thread-messages-box { + height: calc(100% - 145px); + overflow: auto; + background-color: $ch-conversation-window-bg-color; + padding-top: 5px; + .ch-msg-loader { + float: right; + padding: 5px 0; + background-size: 70px; position: relative; - cursor: pointer; background-position: center; background-repeat: no-repeat; height: 140px; min-width: 180px; - margin: -10px; border: 1px solid #eee; - border-radius: 6px 6px 6px 0; - .ch-play-icon { + border-radius: 6px 6px 0; + } + .ch-loader-bg { + background: $white-color; + } + .ch-thread-start { + color: $ch-subtitle-color; + text-align: center; + } + .ch-thread-start:before { + content: ""; + border: .5px solid; + width: 26%; + position: absolute; + right: 3px; + top: 11px; + } + .ch-thread-start:after { + content: ""; + border: .5px solid; + width: 26%; + position: absolute; + left: 3px; + top: 11px; + } + .ch-msg-list { + position: relative; + float: left; + width: 100%; + padding: 5px 0; + .ch-msg-container { + clear: both; + margin-bottom: 0; + position: relative; + overflow: hidden; + audio#ch_audio_message { + margin-top: -10px; + width: 240px; + height: 45px; + margin-left: -22px; + margin-right: -22px; + margin-bottom: -14px; + background-color: #f5f5f5; + transform: scaleX(0.9); + border-radius: 0; + } + } + i.ch-msg-more-option { + color: #6e7174; + font-size: 15px; + margin-top: 2px; + cursor: pointer; + } + .ch-msg-option-container { position: absolute; - left: 0; - right: 0; - top: 28%; - text-align: center; - color: #fff; - font-size: 55px; + box-shadow: rgba(0,0,0,0.3) 0 0 1.2em; + z-index: 8; + background: $white-color; + min-width: 100px; + max-width: 250px; + border-radius: 4px; + div { + color: $gray-shade; + padding: 4px 12px; + height: auto; + margin: 0; + line-height: 20px; + font-size: 12px; + &:hover { + background: #0000000a; + cursor: pointer; + } + } + } + .ch-sender-name { + font-size: 13px; + margin-left: 7px; + margin-bottom: 5px; + text-transform: capitalize; + color: $ch-conversation-window-msg-owner-color; + } + .ch-msg-container.left { + float: left; + max-width: 220px; + margin-left: 8px; + span.ch-msg-time { + font-size: 10px; + display: inline-block; + vertical-align: middle; + color: $gray-color; + } + .ch-message { + overflow: hidden; + background: $ch-conversation-window-msg-bg-color; + border-radius: 6px 6px 6px 0; + position: relative; + color: $ch-conversation-window-msg-color; + padding: 10px; + word-break: break-word; + margin-bottom: 10px; + .ch-text-message-sent-conversation { + margin: 0px; + border-left: 3px solid $dark-gray; + padding-left: 7px; + display: inline-block; + margin-bottom: 10px; + font-style: italic; + } + .ch-attachments-message-sent-conversation { + margin: 0px; + border-left: 3px solid $dark-gray; + padding-left: 7px; + display: inline-block; + margin-bottom: 20px; + font-style: italic; + } + .ch-message-body { + margin: 0px; + } + .ch-video-message, .ch-image-message, .ch-location-message, .ch-sticker-message { + background-size: cover; + position: relative; + cursor: pointer; + background-position: center; + background-repeat: no-repeat; + height: 140px; + min-width: 180px; + margin: -10px; + border: 1px solid #eee; + border-radius: 6px 6px 6px 0; + .ch-play-icon { + position: absolute; + left: 0; + right: 0; + top: 28%; + text-align: center; + color: $white-color; + font-size: 55px; + } + } + .ch-audio-message { + width: 220px; + margin: -10px; + } + } + } + .ch-msg-container.right { + float: right; + max-width: 220px; + color: $gray-color; + margin-right: 8px; + text-align: right; + span.ch-msg-time { + margin-right: 3px; + font-size: 10px; + display: inline-block; + vertical-align: middle; + color: $gray-color; + } + i.ch-msg-status { + font-size: 10px; + display: inline-block; + vertical-align: middle; + color: $gray-color; + } + .ch-message { + background-color: $ch-conversation-window-user-msg-bg-color; + border-radius: 6px 6px 0; + overflow: hidden; + display: block; + color: $ch-conversation-window-user-msg-color; + margin-bottom: 1px; + text-align: left; + padding: 10px; + word-break: break-word; + .ch-text-message-sent-conversation { + margin: 0px; + border-left: 3px solid $white-color; + padding-left: 7px; + display: inline-block; + margin-bottom: 10px; + font-style: italic; + } + .ch-attachments-message-sent-conversation { + margin: 0px; + border-left: 3px solid $white-color; + padding-left: 7px; + display: inline-block; + margin-bottom: 20px; + font-style: italic; + } + .ch-message-body { + margin: 0px; + } + .ch-video-message, .ch-image-message, .ch-location-message, .ch-sticker-message { + background-size: cover; + position: relative; + cursor: pointer; + background-position: center; + background-repeat: no-repeat; + height: 140px; + min-width: 180px; + margin: -10px; + border: 1px solid #eee; + border-radius: 6px 6px 6px 0; + .ch-play-icon { + position: absolute; + left: 0; + right: 0; + top: 28%; + text-align: center; + color: $white-color; + font-size: 55px; + } + } + .ch-audio-message { + width: 220px; + margin: -10px; + } + } + } } } - .ch-audio-message { - width: 220px; - margin: -10px; + .ch-send-direct-msg-label { + color: $gray-color; + display: inline-block; + white-space: nowrap; + margin-left: 3px; } -} -} -.ch-sender-name { - font-size: 13px; - margin-left: 7px; - margin-bottom: 5px; - text-transform: capitalize; - color: $ch-conversation-window-msg-owner-color; -} -.ch-msg-list { - position: relative; - float: left; - width: 100%; - padding: 5px 0; -} -.ch-msg-option-container { - position: absolute; - box-shadow: rgba(0,0,0,0.3) 0 0 1.2em; - z-index: 8; - background: #fff; - min-width: 100px; - max-width: 250px; - border-radius: 4px; - div { - color: #4a505a; - padding: 4px 12px; - height: auto; - margin: 0; - line-height: 20px; - font-size: 12px; - &:hover { - background: #0000000a; + .ch-send-direct-msg-checkbox { + vertical-align: middle; + } + .ch-thread-send-box { + padding: 8px 10px 0; + border-top: 1px solid rgba(90,122,190,.08); + min-height: 50px; + background: $ch-conversation-window-composer-bg-color; + font-size: 13px; + position: relative; + textarea { + outline: none; + border: none; + width: calc(100% - 54px); + color: $ch-conversation-window-composer-text-color; + padding: 0px 5px 0 0; + resize: none; + font-size: 13px; + vertical-align: bottom; + font-family: $ch-body-font-family; + background: transparent; + } + button { + padding: 11px 0 0 0; + margin: 0; + background: transparent; + border: none; + outline: none; + vertical-align: super; cursor: pointer; + i.ch-thread-send-icon { + font-size: $ch-app-icon-fontsize; + color: $ch-conversation-window-composer-font-icon-color; + } + } + .ch-thread-attachment-btn { + margin-right: 5px; + display: inline-block; + vertical-align: super; + font-size: 22px; + cursor: pointer; + color: $ch-conversation-window-composer-font-icon-color; + } + .ch-thread-media-docker { + position: absolute; + opacity: 0; + visibility: hidden; + bottom: -100px; + left: 0; + right: 0; + background: $white-color; + padding: 10px; + z-index: 99; + transition: .5s; + -webkit-box-shadow: 0 -4px 8px 0 rgba(0,0,0,0.2); + -webkit-transition: .5s; + box-shadow: 0 -4px 8px 0 rgba(0,0,0,0.2); + border-radius: 10px 10px 0 0; + overflow: hidden; + text-align: center; + .ch-thread-video-option { + margin-right: 0 !important; + } + .ch-thread-image-option, .ch-thread-audio-option, .ch-thread-video-option { + display: inline-block; + position: relative; + text-align: center; + margin-right: 35px; + color: $dark-gray; + .ch-thread-image-icon-span{ + background-color: #64b5f6; + } + .ch-thread-audio-icon-span{ + background-color: #ff8a65; + } + .ch-thread-video-icon-span{ + background-color: #f7dc6f; + } + .ch-thread-image-icon-span, .ch-thread-audio-icon-span, .ch-thread-video-icon-span { + height: 45px; + width: 45px; + display: block; + text-align: center; + line-height: 53px; + border-radius: 50%; + margin-bottom: 2px; + cursor: pointer; + img { + width: 16px; + } + } + input { + opacity: 0; + width: 50px; + height: 50px; + position: absolute; + top: 0; + cursor: pointer; + left: 0; + } + } + } + .ch-thread-show-docker.ch-thread-media-docker { + opacity: 1; + bottom: 100%; + visibility: visible; } } + +} +.ch-conv-window .ch-messages-box .ch-msg-list .ch-msg-container .ch-message.reaction-space { + padding-bottom: 35px; + overflow: inherit; + margin-bottom: 25px; +} +.ch-conv-window .ch-messages-box .ch-msg-list .ch-msg-container { + overflow: initial; +} +.ch-msg-reaction { + display: inline-block; + top: 0; + margin-bottom: 0; } -.ch-send-box { - padding: 8px 10px 0; - border-top: 1px solid rgba(90,122,190,.08); - min-height: 50px; - background: $ch-conversation-window-composer-bg-color; - font-size: 13px; - position: relative; - textarea { - outline: none; - border: none; - width: calc(100% - 54px); - color: $ch-conversation-window-composer-text-color; - padding: 0px 5px 0 0; - resize: none; - font-size: 13px; - vertical-align: bottom; - font-family: $ch-body-font-family; - background: transparent; - } - button { - padding: 11px 0 0 0; - margin: 0; - background: transparent; - border: none; - outline: none; - vertical-align: super; +/*Thread style end here*/ + +/*Message Reaction style start here*/ +.ch-msg-list { + i.ch-add-reaction-option { + color: $gray-color; + font-size: 16px; + margin: 2px 0px 0px 2px; cursor: pointer; - i.ch-send-icon { - font-size: $ch-app-icon-fontsize; - color: $ch-conversation-window-composer-font-icon-color; - } } - .ch-attachment-btn { - margin-right: 5px; - display: inline-block; - vertical-align: super; - font-size: 22px; - cursor: pointer; - color: $ch-conversation-window-composer-font-icon-color; + i.ch-add-reaction-option:hover { + color: $dark-gray; } - .ch-media-docker { + .ch-scroll-menu-container { position: absolute; - opacity: 0; - visibility: hidden; - bottom: -100px; - left: 0; - right: 0; - color: $ch-title-color; - background: #fff; - padding: 10px; - transition: .5s; - -webkit-box-shadow: 0 -4px 8px 0 rgba(0,0,0,0.2); - -webkit-transition: .5s; - box-shadow: 0 -4px 8px 0 rgba(0,0,0,0.2); - border-radius: 10px 10px 0 0; - overflow: hidden; - text-align: center; - - .ch-image-option, .ch-audio-option, .ch-video-option { - display: inline-block; + box-shadow: rgba(0,0,0,0.3) 0 0 1.2em; + z-index: 8; + background: $white-color; + min-width: 100px; + max-width: 100%; + border-radius: 4px; + left: 15px; + .ch-scroll-menu { + list-style: none; + margin: 0; + position: relative; + white-space: nowrap; + display: inline-block; + overflow: hidden; + } + .ch-reaction-listing { + padding: 0; + margin: 0; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + height: 100%; + } + .ch-reaction-menu-list { + width: 50px; + height: 100%; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + padding: 0; + position: relative; + list-style: none; + line-height: 54px; + } + .ch-reaction-menu-list-item { position: relative; + -webkit-transition: .4s; + transition: .4s; + display: inline-block; + font-size: 22px; + width: 50px; text-align: center; - margin: 0 6%; - .ch-image-icon-span{ - background-color: #64b5f6; - } - .ch-audio-icon-span{ - background-color: #ff8a65; - } - .ch-video-icon-span{ - background-color: #f7dc6f; - } - .ch-image-icon-span, .ch-audio-icon-span, .ch-video-icon-span { - height: 45px; - width: 45px; - display: block; - text-align: center; - line-height: 53px; - border-radius: 50%; - margin-bottom: 2px; - cursor: pointer; - img { - width: 16px; - } - } - input { - opacity: 0; - width: 50px; - height: 50px; - position: absolute; - top: 0; - cursor: pointer; - left: 0; - } + cursor: pointer; + } + .ch-reaction-menu-list-item:hover { + transform: scale(1.3); + } + .ch-reaction-menu-list.reaction-selected:after { + content: ""; + display: inline-block; + height: 5px; + width: 5px; + background-color: #2175f5; + position: absolute; + bottom: 6px; + left: 42%; + border-radius: 25px; + } + .ch-scroll-menu-arrow { + display: inline-block; + line-height: 54px; + -webkit-transition: .4s; + transition: .4s; + position: relative; + width: 25px; + color: $gray-color; + cursor: pointer; + float:left; + } + .ch-scroll-menu-arrow:hover { + color: $dark-gray; + } + + .ch-scroll-menu-arrow-right { + float: right; } } - .ch-show-docker.ch-media-docker { - opacity: 1; - bottom: 100%; - visibility: visible; - } + +} + +.ch-msg-reaction-container { + position: relative; + max-width: 205px; + text-align: left; + margin-bottom: -60px; + bottom: 0px; + margin-top: 0px; + min-height: 35px; +} +.left .ch-msg-reaction-container { + padding-left: 5px; +} +.ch-msg-reaction-list { + list-style: none; + padding-left: 0; + margin: 0; +} +.ch-msg-reaction-item { + padding: 5px; + margin: 2px; + display: inline-block; + background: #fff; + -webkit-box-shadow: rgba(0,0,0,.2) 0 1px 3px 0; + box-shadow: rgba(0,0,0,.2) 0 1px 3px 0; + max-height: 30px; + text-align: center; +} +.ch-msg-reaction-name { + font-size: 18px; + vertical-align: middle; + display: inline-block; + line-height: inherit; +} +.ch-msg-reaction-count { + font-size: 12px; + color: #000!important; + vertical-align: middle; + padding: 0px 4px; +} +.ch-thread-window .ch-thread-messages-box .ch-msg-list .ch-msg-container .ch-message.reaction-space { + padding-bottom: 35px; + overflow: inherit; + margin-bottom: 25px; +} +.ch-thread-window .ch-thread-messages-box .ch-msg-list .ch-msg-container { + overflow: initial; } -/*conversation style end here*/ \ No newline at end of file +/*Message Reaction style end here*/ \ No newline at end of file diff --git a/web-widget/src/scss/variables.scss b/web-widget/src/scss/variables.scss old mode 100755 new mode 100644 index 9bb5e6d..475fc3c --- a/web-widget/src/scss/variables.scss +++ b/web-widget/src/scss/variables.scss @@ -6,48 +6,58 @@ $ch-body-font-size: 13px; /*Colors variables*/ // Theme color $theme-color: #0377ff; + // Gray -$gray: #969391; +$gray-color: #969391; + // Dark gray $dark-gray: #545454; + // Light gray $light-gray: #3a3c4c; + //space gray $space-gray: #999999; + //Gray shade $gray-shade: #4a505a; + // White color $white-color: #ffffff; + // Off white $off-white: #fafafa; + // light white $light-white: #f5f5f5; + //Black -$black: #000000; +$black-color: #000000; +// Red +$red-color: #ff0000; /*Apps colors and font sizes*/ $ch-title-color: $dark-gray; $ch-title-fontsize: 14px; -$ch-subtitle-color: $light-gray; +$ch-subtitle-color: $space-gray; $ch-subtitle-fontsize: 12px; $ch-app-icon-color: $gray-shade; $ch-app-icon-fontsize: 20px; -$ch-status-color: $gray; +$ch-status-color: $gray-color; $ch-status-fontsize: 10px; /*Recent screen*/ $ch-recent-conversation-header-bg-color: $white-color; $ch-recent-conversation-header-font-icon-color: $space-gray; -$ch-recent-conversation-header-font-icon-hover-color: $black; +$ch-recent-conversation-header-font-icon-hover-color: $black-color; $ch-recent-conversation-list-color: $white-color; $ch-recent-conversation-list-hover-color: $off-white; $ch-recent-conversation-list-title-color: $gray-shade; $ch-recent-conversation-list-content-color: $light-gray; - $ch-recent-bg: $white-color; $ch-recent-width: 22%; @@ -56,22 +66,17 @@ $ch-appheader-bg: $white-color; /*Conversation screen*/ $ch-conversation-window-header-bg-color: $white-color; -$ch-recent-conversation-header-font-icon-color: $space-gray; -$ch-recent-conversation-header-font-icon-hover-color: $black; - +$ch-conversation-window-header-font-icon-color: $space-gray; +$ch-conversation-window-header-font-icon-hover-color: $black-color; $ch-conversation-window-user-msg-bg-color: $theme-color; $ch-conversation-window-user-msg-color: $white-color; - $ch-conversation-window-msg-bg-color: $light-white; $ch-conversation-window-msg-color: $dark-gray; - $ch-conversation-window-composer-bg-color: $white-color; $ch-conversation-window-composer-text-color: $dark-gray; $ch-conversation-window-composer-font-icon-color: $theme-color; -$ch-conversation-window-composer-font-icon-hover-color: $black; - +$ch-conversation-window-composer-font-icon-hover-color: $black-color; $ch-conversation-window-msg-owner-color: $dark-gray; - $ch-conversation-window-bg-color: $white-color; $ch-conversation-width: 22%; diff --git a/web-widget/webpack.config.js b/web-widget/webpack.config.js old mode 100755 new mode 100644