diff --git a/.formatter.exs b/.formatter.exs
new file mode 100644
index 0000000..4d24c79
--- /dev/null
+++ b/.formatter.exs
@@ -0,0 +1,4 @@
+[
+ import_deps: [:typed_struct],
+ inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
+]
diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml
new file mode 100644
index 0000000..8b64f82
--- /dev/null
+++ b/.github/workflows/elixir.yml
@@ -0,0 +1,45 @@
+name: analytics-elixir
+
+on:
+ push:
+ branches:
+ - "*"
+ tags-ignore:
+ - "*"
+
+jobs:
+ build:
+ name: Build and test
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Setup Elixir
+ uses: actions/setup-elixir@v1
+ with:
+ elixir-version: "1.12.1"
+ otp-version: "23.0.4"
+ experimental-otp: true
+
+ - name: Restore dependencies cache
+ uses: actions/cache@v2
+ with:
+ path: deps
+ key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
+ restore-keys: ${{ runner.os }}-mix-
+
+ - name: Install dependencies
+ run: mix deps.get
+
+ - name: Check formatted
+ run: mix format --check-formatted
+
+ - name: Run tests
+ env:
+ MIX_ENV: test
+ run: mix test
+
+ - name: Run Dialyzer
+ env:
+ MIX_ENV: dev
+ run: mix dialyzer
diff --git a/.tool-versions b/.tool-versions
new file mode 100644
index 0000000..000a611
--- /dev/null
+++ b/.tool-versions
@@ -0,0 +1,2 @@
+elixir 1.16.0-otp-26
+erlang 26.2.1
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..9acaaa2
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,111 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
+adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+
+## [2.0.0] - 2024-04-29
+
+### Changed
+
+- Replaced `HTTPoison` library with `Tesla`.
+
+### Removed
+
+- Removed `Agent` strategy in favor of configuration. See `t:Segment.options/0` for configuration
+ instructions.
+
+### Added
+
+- Retry mechanism for Segment API requests.
+- Request and response logs through `MetaLogger`.
+- Additional options available (see `t:Segment.options/0` for documentation):
+ - `:disable_meta_logger`
+ - `:filter_body`
+ - `:http_adapter`
+ - `:max_retries`
+ - `:request_timeout`
+ - `:retry_base_delay`
+ - `:retry_jitter_factor`
+ - `:retry_max_delay`
+
+## [1.3.1] - 2022-03-17
+
+### Changed
+
+- Update the `miss` library.
+
+## [1.3.0] - 2022-03-16
+
+### Changed
+
+- Fix the encoding for Decimal, Date and DateTime structs.
+
+## [1.2.1] - 2022-02-25
+
+### Changed
+
+- Bump Poison to v5.0.
+
+## [1.2.0] - 2021-06-21
+
+### Added
+
+- Use `MetaLogger.Formatter` for formatting logs and masking sensitive fields.
+
+## [1.1.0] - 2020-12-23
+
+### Added
+
+- Add `drop_nil_fields` options to filter `null` JSON attributes from the request
+ body sent to the API endpoint.
+
+## [1.0.0] - 2020-10-09
+
+### Changed
+
+- Returns tuple with `:ok` or `:error` and a JSON string to enable clients
+ to handle validation errors.
+
+## [0.2.2] - 2020-10-08
+
+### Added
+
+- Add version field to `Segment.Analytics.Track`, `Segment.Analytics.Identify`,
+ `Segment.Analytics.Alias`, `Segment.Analytics.Page`, `Segment.Analytics.Screen`
+ and `Segment.Analytics.Group`.
+
+## [0.2.1] - 2020-09-28
+
+### Removed
+
+- Removes unused fields.
+
+## [0.2.0] - 2020-09-23
+
+### Added
+
+- Allow endpoint and API key to be passed via options to the new public function
+ `Segment.Analytics.call/2`.
+
+## [v0.1.1] - 2016-10-13
+
+### Added
+
+- First release.
+
+[unreleased]: https://github.com/FindHotel/analytics-elixir/compare/2.0.0...master
+[2.0.0]: https://github.com/FindHotel/analytics-elixir/compare/1.3.1...2.0.0
+[1.3.1]: https://github.com/FindHotel/analytics-elixir/compare/1.3.0...1.3.1
+[1.3.0]: https://github.com/FindHotel/analytics-elixir/compare/1.2.1...1.3.0
+[1.2.1]: https://github.com/FindHotel/analytics-elixir/compare/1.2.0...1.2.1
+[1.2.0]: https://github.com/FindHotel/analytics-elixir/compare/1.1.0...1.2.0
+[1.1.0]: https://github.com/FindHotel/analytics-elixir/compare/1.0.0...1.1.0
+[1.0.0]: https://github.com/FindHotel/analytics-elixir/compare/0.2.2...1.0.0
+[0.2.2]: https://github.com/FindHotel/analytics-elixir/compare/0.2.1...0.2.2
+[0.2.1]: https://github.com/FindHotel/analytics-elixir/compare/0.2.0...0.2.1
+[0.2.0]: https://github.com/FindHotel/analytics-elixir/compare/v0.1.1...0.2.0
+[v0.1.1]: https://github.com/FindHotel/analytics-elixir/releases/tag/v0.1.1
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..36b2e2f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,73 @@
+# -------------------------------------------
+# Common variables
+# -------------------------------------------
+
+VERSION_FILE := mix.exs
+VERSION := $(shell sed -En "s/^.*@version \"([0-9]*\\.[0-9]*\\.[0-9]*)\"*/\\1/p" ${VERSION_FILE})
+
+BLUE_COLOR := \033[0;34m
+DEFAULT_COLOR := \033[0;39m
+DIM_COLOR := \033[0;2m
+YELLOW_COLOR := \033[0;33m
+
+# -------------------------------------------
+# Default task
+# -------------------------------------------
+
+.DEFAULT_GOAL := help
+
+.PHONY: help
+help: ## Print this help
+ @printf "Segment Analytics Elixir ${VERSION}\n"
+ @awk -F ':|##' '/^[^\t].+?:.*?##/ { printf "${BLUE_COLOR}%-30s${DEFAULT_COLOR} %s\n", $$1, $$NF }' $(MAKEFILE_LIST)
+
+# -------------------------------------------
+# Release task
+# -------------------------------------------
+
+CHANGELOG_FILE := CHANGELOG.md
+DATE := $(shell date +"%Y-%m-%d")
+MAJOR := $(shell echo "${VERSION}" | cut -d . -f1)
+MINOR := $(shell echo "${VERSION}" | cut -d . -f2)
+PATCH := $(shell echo "${VERSION}" | cut -d . -f3)
+REPO_NAME := analytics-elixir
+REPO := https:\/\/round-lake.dustinice.workers.dev:443\/https\/github.com\/FindHotel\/${REPO_NAME}\/compare
+
+.PHONY: release
+release: ## Bump the version and create a new tag
+ @printf "${BLUE_COLOR}The current version is:${DEFAULT_COLOR} ${VERSION}\n" && \
+ read -r -p "Do you want to release a [major|minor|patch]: " TYPE && \
+ case "$$TYPE" in \
+ "major") \
+ MAJOR=$$((${MAJOR}+1)); \
+ MINOR="0"; \
+ PATCH="0"; \
+ NEW_VERSION="$$MAJOR.$$MINOR.$$PATCH" \
+ ;; \
+ "minor") \
+ MINOR=$$((${MINOR}+1)); \
+ PATCH="0" && \
+ NEW_VERSION="${MAJOR}.$$MINOR.$$PATCH" \
+ ;; \
+ "patch") \
+ PATCH=$$((${PATCH}+1)); \
+ NEW_VERSION="${MAJOR}.${MINOR}.$$PATCH" \
+ ;; \
+ *) \
+ printf "\\n${YELLOW_COLOR}Release canceled!\n"; \
+ exit 0 \
+ ;; \
+ esac && \
+ printf "${BLUE_COLOR}The new version is:${DEFAULT_COLOR} $$NEW_VERSION\n" && \
+ printf "\t${DIM_COLOR}Updating ${VERSION_FILE} version${DEFAULT_COLOR}\n" && \
+ perl -p -i -e "s/@version \"${VERSION}\"/@version \"$$NEW_VERSION\"/g" ${VERSION_FILE} && \
+ printf "\t${DIM_COLOR}Updating ${CHANGELOG_FILE} version${DEFAULT_COLOR}\n" && \
+ perl -p -i -e "s/## \[Unreleased\]/## \[Unreleased\]\\n\\n## \[$$NEW_VERSION\] - ${DATE}/g" ${CHANGELOG_FILE} && \
+ perl -p -i -e "s/${REPO}\/${VERSION}...master/${REPO}\/$$NEW_VERSION...master/g" ${CHANGELOG_FILE} && \
+ perl -p -i -e "s/...master/...master\\n\[$$NEW_VERSION\]: ${REPO}\/${VERSION}...$$NEW_VERSION/g" ${CHANGELOG_FILE} && \
+ printf "\t${DIM_COLOR}Recording changes to the repository${DEFAULT_COLOR}\n" && \
+ git add ${VERSION_FILE} ${CHANGELOG_FILE} && \
+ git commit -m "Bump to $$NEW_VERSION" > /dev/null && \
+ printf "\t${DIM_COLOR}Creating release tag${DEFAULT_COLOR}\n" && \
+ git tag -a -m "" $$NEW_VERSION && \
+ printf "\n${BLUE_COLOR}If everything's ok, push the changes to updstream!${DEFAULT_COLOR}\n"
diff --git a/README.md b/README.md
index 2b75eda..6f84f51 100644
--- a/README.md
+++ b/README.md
@@ -1,57 +1,47 @@
-analytics-elixir
-================
+# analytics-elixir 
analytics-elixir is a non-supported third-party client for [Segment](https://segment.com)
-## Install
+## Installation
-Add the following to deps section of your mix.exs: `{:segment, github: "stueccles/analytics-elixir"}`
+Add the following to deps section of your mix.exs:
-and then `mix deps.get`
+```elixir
+{:segment, github: "FindHotel/analytics-elixir"}
+```
-## Usage
+And then run:
-Start the Segment agent with your write_key from Segment
-```
-Segment.start_link("YOUR_WRITE_KEY")
+```sh
+mix deps.get
```
-There are then two ways to call the different methods on the API.
-A basic way through `Segment.Analytics` or by passing a full Struct
-with all the data for the API (allowing Context and Integrations to be set)
-## Usage in Phoenix
+## Usage
-This is how I add to a Phoenix project (may not be your preferred way)
+For general usage, first define the `:key` configuration:
-1. Add the following to deps section of your mix.exs: `{:segment, github: "stueccles/analytics-elixir"}`
- and then `mix deps.get`
-2. Add segment to applications list in the Phoenix project mix.exs
-ie.
-```
-def application do
- [mod: {FormAndThread, []},
- applications: [:phoenix, :phoenix_html, :cowboy, :logger,
- :phoenix_ecto, :postgrex, :segment]]
-end
-```
-3. Add a config variable for your write_key (may want to make this environment dependent)
-ie.
-```
-config :segment,
- write_key: "2iFFnRsCfi"
-```
-4. Start the segment agent as a child of the application in the application file under
-the lib directory. In the children list add:
-```
-worker(Segment, [Application.get_env(:segment, :write_key)])
+```elixir
+config :segment, key: "your_segment_key"
```
+> For detailed information about configuration, see `t:Segment.options/0`.
+
+Then call `Segment.Analytics` functions to send analytics.
+
+There are then two ways to call the functions:
+
+- By using a collection of parameters
+- By using the related struct as a parameter
+
### Track
-```
+
+```elixir
Segment.Analytics.track(user_id, event, %{property1: "", property2: ""})
```
+
or the full way using a struct with all the possible options for the track call
-```
+
+```elixir
%Segment.Analytics.Track{ userId: "sdsds",
event: "eventname",
properties: %{property1: "", property2: ""}
@@ -60,11 +50,14 @@ or the full way using a struct with all the possible options for the track call
```
### Identify
-```
+
+```elixir
Segment.Analytics.identify(user_id, %{trait1: "", trait2: ""})
```
+
or the full way using a struct with all the possible options for the identify call
-```
+
+```elixir
%Segment.Analytics.Identify{ userId: "sdsds",
traits: %{trait1: "", trait2: ""}
}
@@ -72,11 +65,14 @@ or the full way using a struct with all the possible options for the identify ca
```
### Screen
-```
+
+```elixir
Segment.Analytics.screen(user_id, name)
```
+
or the full way using a struct with all the possible options for the screen call
-```
+
+```elixir
%Segment.Analytics.Screen{ userId: "sdsds",
name: "dssd"
}
@@ -84,11 +80,14 @@ or the full way using a struct with all the possible options for the screen call
```
### Alias
-```
+
+```elixir
Segment.Analytics.alias(user_id, previous_id)
```
+
or the full way using a struct with all the possible options for the alias call
-```
+
+```elixir
%Segment.Analytics.Alias{ userId: "sdsds",
previousId: "dssd"
}
@@ -96,11 +95,14 @@ or the full way using a struct with all the possible options for the alias call
```
### Group
-```
+
+```elixir
Segment.Analytics.group(user_id, group_id)
```
+
or the full way using a struct with all the possible options for the group call
-```
+
+```elixir
%Segment.Analytics.Group{ userId: "sdsds",
groupId: "dssd"
}
@@ -108,21 +110,33 @@ or the full way using a struct with all the possible options for the group call
```
### Page
-```
+
+```elixir
Segment.Analytics.page(user_id, name)
```
+
or the full way using a struct with all the possible options for the page call
-```
+
+```elixir
%Segment.Analytics.Page{ userId: "sdsds",
name: "dssd"
}
|> Segment.Analytics.page
```
-## Running tests
+## Testing
+
+Clone the repository and run:
-There are not many tests at the moment. But you can run a live test on your segment
-account by running.
+```sh
+mix test
```
-SEGMENT_KEY=yourkey mix test
+
+## Release
+
+After merge a new feature/bug you can bump the version and push it to upstream:
+
+```sh
+make release
+git push origin master && git push origin --tags
```
diff --git a/config/config.exs b/config/config.exs
index 6dfa82f..e714c9e 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -1,24 +1,3 @@
-# This file is responsible for configuring your application
-# and its dependencies with the aid of the Mix.Config module.
-use Mix.Config
+import Config
-# This configuration is loaded before any dependency and is restricted
-# to this project. If another project depends on this project, this
-# file won't be loaded nor affect the parent project. For this reason,
-# if you want to provide default values for your application for third-
-# party users, it should be done in your mix.exs file.
-
-# Sample configuration:
-#
-# config :logger, :console,
-# level: :info,
-# format: "$date $time [$level] $metadata$message\n",
-# metadata: [:user_id]
-
-# It is also possible to import configuration files, relative to this
-# directory. For example, you can emulate configuration per environment
-# by uncommenting the line below and defining dev.exs, test.exs and such.
-# Configuration from the imported file will override the ones defined
-# here (which is why it is important to import them last).
-#
-# import_config "#{Mix.env}.exs"
+config :segment, http_adapter: Tesla.Mock, key: "my-amazing-key"
diff --git a/doc/.build b/doc/.build
deleted file mode 100644
index 422718d..0000000
--- a/doc/.build
+++ /dev/null
@@ -1,20 +0,0 @@
-/Users/stueccles/Development/elixir/analytics-elixir/doc/dist/app-091c05798a.css
-/Users/stueccles/Development/elixir/analytics-elixir/doc/dist/app-574613960f.js
-/Users/stueccles/Development/elixir/analytics-elixir/doc/fonts/icomoon.eot
-/Users/stueccles/Development/elixir/analytics-elixir/doc/fonts/icomoon.svg
-/Users/stueccles/Development/elixir/analytics-elixir/doc/fonts/icomoon.ttf
-/Users/stueccles/Development/elixir/analytics-elixir/doc/fonts/icomoon.woff
-index.html
-api-reference.html
-404.html
-dist/sidebar_items.js
-Segment.html
-Segment.Analytics.html
-Segment.Analytics.Alias.html
-Segment.Analytics.Context.html
-Segment.Analytics.Group.html
-Segment.Analytics.Http.html
-Segment.Analytics.Identify.html
-Segment.Analytics.Page.html
-Segment.Analytics.Screen.html
-Segment.Analytics.Track.html
diff --git a/doc/.keep b/doc/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/doc/404.html b/doc/404.html
deleted file mode 100644
index 16b3ebc..0000000
--- a/doc/404.html
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
- 404 – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Page not found
-
-
Sorry, but the page you were trying to get to, does not exist. You
-may want to try searching this site using the sidebar or using our
-API Reference page to find what
-you were looking for.
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/Segment.Analytics.Alias.html b/doc/Segment.Analytics.Alias.html
deleted file mode 100644
index f2737f9..0000000
--- a/doc/Segment.Analytics.Alias.html
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
-
-
- Segment.Analytics.Alias – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- Segment.Analytics.Alias
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/Segment.Analytics.Context.html b/doc/Segment.Analytics.Context.html
deleted file mode 100644
index 5357dcd..0000000
--- a/doc/Segment.Analytics.Context.html
+++ /dev/null
@@ -1,176 +0,0 @@
-
-
-
-
-
-
-
- Segment.Analytics.Context – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- Segment.Analytics.Context
-
-
-
-
-
-
-
-
-
-
-
-
- Summary
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Functions
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/Segment.Analytics.Group.html b/doc/Segment.Analytics.Group.html
deleted file mode 100644
index 4d8a07a..0000000
--- a/doc/Segment.Analytics.Group.html
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
-
-
- Segment.Analytics.Group – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- Segment.Analytics.Group
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/Segment.Analytics.Http.html b/doc/Segment.Analytics.Http.html
deleted file mode 100644
index 876ebee..0000000
--- a/doc/Segment.Analytics.Http.html
+++ /dev/null
@@ -1,1000 +0,0 @@
-
-
-
-
-
-
-
- Segment.Analytics.Http – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- Segment.Analytics.Http
-
-
-
-
-
-
-
-
-
-
-
-
- Summary
-
-
-
-
-
-
-
-
-
-
-
-
Issues a DELETE request to the given url
-
-
-
-
-
-
-
Issues a DELETE request to the given url, raising an exception in case of
-failure
-
-
-
-
-
-
-
Issues a GET request to the given url
-
-
-
-
-
-
-
Issues a GET request to the given url, raising an exception in case of
-failure
-
-
-
-
-
-
-
Issues a HEAD request to the given url
-
-
-
-
-
-
-
Issues a HEAD request to the given url, raising an exception in case of
-failure
-
-
-
-
-
-
-
Issues an OPTIONS request to the given url
-
-
-
-
-
-
-
Issues a OPTIONS request to the given url, raising an exception in case of
-failure
-
-
-
-
-
-
-
Issues a PATCH request to the given url
-
-
-
-
-
-
-
Issues a PATCH request to the given url, raising an exception in case of
-failure
-
-
-
-
-
-
-
Issues a POST request to the given url
-
-
-
-
-
-
-
Issues a POST request to the given url, raising an exception in case of
-failure
-
-
-
-
-
-
-
-
-
-
Issues a PUT request to the given url
-
-
-
-
-
-
-
Issues a PUT request to the given url, raising an exception in case of
-failure
-
-
-
-
-
-
-
Issues an HTTP request with the given method to the given url
-
-
-
-
-
-
-
Issues an HTTP request with the given method to the given url, raising an
-exception in case of failure
-
-
-
-
-
-
-
Starts HTTPoison and its dependencies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Functions
-
-
-
-
-
-
-
-
-
- Issues a DELETE request to the given url.
-Returns {:ok, response} if the request is successful, {:error, reason}
-otherwise.
-See request/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a DELETE request to the given url, raising an exception in case of
-failure.
-If the request does not fail, the response is returned.
-See request!/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a GET request to the given url.
-Returns {:ok, response} if the request is successful, {:error, reason}
-otherwise.
-See request/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a GET request to the given url, raising an exception in case of
-failure.
-If the request does not fail, the response is returned.
-See request!/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a HEAD request to the given url.
-Returns {:ok, response} if the request is successful, {:error, reason}
-otherwise.
-See request/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a HEAD request to the given url, raising an exception in case of
-failure.
-If the request does not fail, the response is returned.
-See request!/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues an OPTIONS request to the given url.
-Returns {:ok, response} if the request is successful, {:error, reason}
-otherwise.
-See request/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a OPTIONS request to the given url, raising an exception in case of
-failure.
-If the request does not fail, the response is returned.
-See request!/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a PATCH request to the given url.
-Returns {:ok, response} if the request is successful, {:error, reason}
-otherwise.
-See request/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a PATCH request to the given url, raising an exception in case of
-failure.
-If the request does not fail, the response is returned.
-See request!/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a POST request to the given url.
-Returns {:ok, response} if the request is successful, {:error, reason}
-otherwise.
-See request/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a POST request to the given url, raising an exception in case of
-failure.
-If the request does not fail, the response is returned.
-See request!/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Issues a PUT request to the given url.
-Returns {:ok, response} if the request is successful, {:error, reason}
-otherwise.
-See request/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
- Issues a PUT request to the given url, raising an exception in case of
-failure.
-If the request does not fail, the response is returned.
-See request!/5 for more detailed information.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Issues an HTTP request with the given method to the given url.
-This function is usually used indirectly by get/3 , post/4 , put/4 , etc
-Args:
-
-method - HTTP method as an atom (:get, :head, :post, :put,
-:delete, etc.)
-
-url - target url as a binary string or char list
-
-body - request body. See more below
-
-headers - HTTP headers as an orddict (e.g., [{"Accept", "application/json"}])
-
-options - Keyword list of options
-
-
-Body:
-
-binary, char list or an iolist
-
-{:form, [{K, V}, ...]} - send a form url encoded
-
-{:file, "/path/to/file"} - send a file
-
-
-Options:
-
-:timeout - timeout to establish a connection, in milliseconds. Default is 8000
-
-:recv_timeout - timeout used when receiving a connection. Default is 5000
-
-:stream_to - a PID to stream the response to
-
-:proxy - a proxy to be used for the request; it can be a regular url
-or a {Host, Proxy} tuple
-
-:proxy_auth - proxy authentication {User, Password} tuple
-
-:ssl - SSL options supported by the ssl erlang module
-
-:follow_redirect - a boolean that causes redirects to be followed
-
-:max_redirect - an integer denoting the maximum number of redirects to follow
-
-:params - an enumerable consisting of two-item tuples that will be appended to the url as query string parameters
-
-
-Timeouts can be an integer or :infinity
-This function returns {:ok, response} or {:ok, async_response} if the
-request is successful, {:error, reason} otherwise.
-
-
- Examples
-
-
-request(:post, "https://my.website.com", "{\"foo\": 3}", [{"Accept", "application/json"}])
-
-
-
-
-
-
-
-
-
-
-
-
-
- Issues an HTTP request with the given method to the given url, raising an
-exception in case of failure.
-request!/5 works exactly like request/5 but it returns just the
-response in case of a successful request, raising an exception in case the
-request fails.
-
-
-
-
-
-
-
- Starts HTTPoison and its dependencies.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/Segment.Analytics.Identify.html b/doc/Segment.Analytics.Identify.html
deleted file mode 100644
index aa080f8..0000000
--- a/doc/Segment.Analytics.Identify.html
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
-
-
- Segment.Analytics.Identify – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- Segment.Analytics.Identify
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/Segment.Analytics.Page.html b/doc/Segment.Analytics.Page.html
deleted file mode 100644
index ff70788..0000000
--- a/doc/Segment.Analytics.Page.html
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
-
-
- Segment.Analytics.Page – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- Segment.Analytics.Page
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/Segment.Analytics.Screen.html b/doc/Segment.Analytics.Screen.html
deleted file mode 100644
index 0d0561f..0000000
--- a/doc/Segment.Analytics.Screen.html
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
-
-
- Segment.Analytics.Screen – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- Segment.Analytics.Screen
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/Segment.Analytics.Track.html b/doc/Segment.Analytics.Track.html
deleted file mode 100644
index abce2fb..0000000
--- a/doc/Segment.Analytics.Track.html
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
-
-
- Segment.Analytics.Track – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- Segment.Analytics.Track
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/Segment.Analytics.html b/doc/Segment.Analytics.html
deleted file mode 100644
index f0e0b04..0000000
--- a/doc/Segment.Analytics.html
+++ /dev/null
@@ -1,412 +0,0 @@
-
-
-
-
-
-
-
- Segment.Analytics – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- Segment.Analytics
-
-
-
-
-
-
-
-
-
-
-
-
- Summary
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Functions
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/Segment.html b/doc/Segment.html
deleted file mode 100644
index e7c1808..0000000
--- a/doc/Segment.html
+++ /dev/null
@@ -1,228 +0,0 @@
-
-
-
-
-
-
-
- Segment – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- Segment
-
-
-
-
-
-
-
-
-
-
-
-
- Summary
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Functions
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/api-reference.html b/doc/api-reference.html
deleted file mode 100644
index a856c25..0000000
--- a/doc/api-reference.html
+++ /dev/null
@@ -1,138 +0,0 @@
-
-
-
-
-
-
-
- API Reference – segment v0.1.1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- segment v0.1.1
- API Reference
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/dist/app-091c05798a.css b/doc/dist/app-091c05798a.css
deleted file mode 100644
index 18b03fa..0000000
--- a/doc/dist/app-091c05798a.css
+++ /dev/null
@@ -1 +0,0 @@
-@import url(https://fonts.googleapis.com/css?family=Lato:300,700|Merriweather:300italic,300|Inconsolata:400,700);.hljs,article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}img,legend{border:0}.results ul,.sidebar ul{list-style:none}.night-mode-toggle:focus,.sidebar .sidebar-search .sidebar-searchInput:focus,.sidebar .sidebar-search .sidebar-searchInput:hover,.sidebar-toggle:active,.sidebar-toggle:focus,.sidebar-toggle:hover,a:active,a:hover{outline:0}.hljs-comment{color:#8e908c}.css .hljs-class,.css .hljs-id,.css .hljs-pseudo,.hljs-attribute,.hljs-regexp,.hljs-tag,.hljs-variable,.html .hljs-doctype,.ruby .hljs-constant,.xml .hljs-doctype,.xml .hljs-pi,.xml .hljs-tag .hljs-title{color:#c82829}.hljs-built_in,.hljs-constant,.hljs-literal,.hljs-number,.hljs-params,.hljs-pragma,.hljs-preprocessor{color:#f5871f}.css .hljs-rule .hljs-attribute,.ruby .hljs-class .hljs-title{color:#eab700}.hljs-header,.hljs-inheritance,.hljs-name,.hljs-string,.hljs-value,.ruby .hljs-symbol,.xml .hljs-cdata{color:#718c00}.css .hljs-hexcolor,.hljs-title{color:#3e999f}.coffeescript .hljs-title,.hljs-function,.javascript .hljs-title,.perl .hljs-sub,.python .hljs-decorator,.python .hljs-title,.ruby .hljs-function .hljs-title,.ruby .hljs-title .hljs-keyword{color:#4271ae}.hljs-keyword,.javascript .hljs-function{color:#8959a8}.hljs{overflow-x:auto;background:#fff;color:#4d4d4c;padding:.5em;-webkit-text-size-adjust:none}legend,td,th{padding:0}.coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .css,.xml .hljs-cdata,.xml .javascript,.xml .vbscript{opacity:.5}/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}abbr[title]{border-bottom:1px dotted}b,optgroup,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}.content-outer,body{background-color:#fff}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre,textarea{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}table{border-collapse:collapse;border-spacing:0}@font-face{font-family:icomoon;src:url(../fonts/icomoon.eot?h5z89e);src:url(../fonts/icomoon.eot?#iefixh5z89e) format('embedded-opentype'),url(../fonts/icomoon.ttf?h5z89e) format('truetype'),url(../fonts/icomoon.woff?h5z89e) format('woff'),url(../fonts/icomoon.svg?h5z89e#icomoon) format('svg');font-weight:400;font-style:normal}.icon-elem,[class*=" icon-"],[class^=icon-]{font-family:icomoon;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.sidebar,body{font-family:Lato,sans-serif}.icon-link:before{content:"\e005"}.icon-search:before{content:"\e036"}.icon-cross:before{content:"\e117"}@media screen and (max-width:768px){.icon-menu{font-size:1em}}@media screen and (min-width:769px){.icon-menu{font-size:1.25em}}@media screen and (min-width:1281px){.icon-menu{font-size:1.5em}}.icon-menu:before{content:"\e120"}.icon-angle-right:before{content:"\f105"}.icon-code:before{content:"\f121"}body,html{box-sizing:border-box;height:100%;width:100%}body{margin:0;font-size:16px;line-height:1.6875em}*,:after,:before{box-sizing:inherit}.main{display:-webkit-flex;display:-ms-flexbox;display:-ms-flex;display:flex;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end}.sidebar{display:-webkit-flex;display:-ms-flexbox;display:-ms-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-box-direction:normal;-moz-box-direction:normal;min-height:0;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;width:300px;height:100%;position:fixed;top:0;left:0;z-index:4}.content{width:100%;padding-left:300px;overflow-y:auto;-webkit-overflow-scrolling:touch;height:100%;position:relative;z-index:3}@media screen and (max-width:768px){body .content{z-index:0;padding-left:0}body .sidebar{z-index:3;-webkit-transform:translateX(-102%);transform:translateX(-102%);will-change:transform}}body.sidebar-closed .sidebar,body.sidebar-closing .sidebar,body.sidebar-opening .sidebar{z-index:0}body.sidebar-opened .sidebar-toggle,body.sidebar-opening .sidebar-toggle{-webkit-transform:translateX(250px);transform:translateX(250px)}@media screen and (max-width:768px){body.sidebar-opened .sidebar,body.sidebar-opening .sidebar{-webkit-transform:translateX(0);transform:translateX(0)}}body.sidebar-closed .content,body.sidebar-closing .content{padding-left:0}body.sidebar-closed .sidebar-toggle,body.sidebar-closing .sidebar-toggle{-webkit-transform:none;transform:none}body.sidebar-closed .icon-menu{color:#000}.sidebar-toggle i,.sidebar-toggle:hover{color:#e1e1e1}body.sidebar-opening .sidebar-toggle{transition:-webkit-transform .3s ease-in-out;transition:transform .3s ease-in-out}body.sidebar-opening .content{padding-left:300px;transition:padding-left .3s ease-in-out}@media screen and (max-width:768px){body.sidebar-opening .content{padding-left:0}body.sidebar-opening .sidebar{transition:-webkit-transform .3s ease-in-out;transition:transform .3s ease-in-out;z-index:3}}body.sidebar-closing .sidebar-toggle{transition:-webkit-transform .3s ease-in-out;transition:transform .3s ease-in-out}body.sidebar-closing .content{transition:padding-left .3s ease-in-out}@media screen and (max-width:768px){body.sidebar-closing .sidebar{z-index:3;transition:-webkit-transform .3s ease-in-out;transition:transform .3s ease-in-out;-webkit-transform:translateX(-102%);transform:translateX(-102%)}}.sidebar a,.sidebar-toggle{transition:color .3s ease-in-out}body.sidebar-closed .sidebar{visibility:hidden}.content-inner{max-width:949px;margin:0 auto;padding:3px 60px}.content-outer{min-height:100%}@media screen and (max-width:768px){.content-inner{padding:27px 20px 27px 40px}}.sidebar-toggle{position:fixed;z-index:99;left:18px;top:8px;background-color:transparent;border:none;padding:0;font-size:16px;will-change:transform;-webkit-transform:translateX(250px);transform:translateX(250px)}@media screen and (max-width:768px){.sidebar-toggle{-webkit-transform:translateX(0);transform:translateX(0);left:5px;top:5px}.sidebar-opened .sidebar-toggle{left:18px;top:5px}}.sidebar{font-size:15px;line-height:18px;background:#373f52;color:#d5dae6;overflow:hidden}.sidebar .gradient{background:linear-gradient(#373f52,rgba(55,63,82,0));height:20px;margin-top:-20px;pointer-events:none;position:relative;top:20px;z-index:100}.sidebar ul li{margin:0;padding:0 10px}.sidebar a{color:#d5dae6;text-decoration:none}.sidebar a:hover{color:#fff}.sidebar .sidebar-projectLink{margin:23px 30px 0}.sidebar .sidebar-projectDetails{display:inline-block;text-align:right;vertical-align:top;margin-top:6px}.sidebar .sidebar-projectImage{display:inline-block;max-width:64px;max-height:64px;margin-left:15px;vertical-align:bottom}.sidebar .sidebar-projectName{font-weight:700;font-size:24px;line-height:30px;color:#fff;margin:0;padding:0;max-width:155px}.sidebar .sidebar-projectVersion{margin:0;padding:0;font-weight:300;font-size:16px;line-height:20px;color:#fff}.sidebar .sidebar-listNav{padding:10px 30px 20px;margin:0}.sidebar .sidebar-listNav li,.sidebar .sidebar-listNav li a{text-transform:uppercase;font-weight:300;font-size:14px}.sidebar .sidebar-listNav li{padding-left:17px;border-left:3px solid transparent;transition:all .3s linear;line-height:27px}.sidebar .sidebar-listNav li.selected,.sidebar .sidebar-listNav li.selected a,.sidebar .sidebar-listNav li:hover,.sidebar .sidebar-listNav li:hover a{border-color:#9768d1;color:#fff}.sidebar .sidebar-search{margin:23px 30px 18px;display:-webkit-flex;display:-ms-flexbox;display:-ms-flex;display:flex}.sidebar .sidebar-search i.icon-search{font-size:14px;color:#d5dae6}.sidebar .sidebar-search .sidebar-searchInput{background-color:transparent;border:none;border-radius:0;border-bottom:1px solid #959595;margin-left:5px;height:20px}.sidebar #full-list{margin:0 0 0 30px;padding:10px 20px 40px;overflow-y:auto;-webkit-overflow-scrolling:touch;-webkit-flex:1 1 .01%;-moz-flex:1 1 .01%;-ms-flex:1 1 .01%;flex:1 1 .01%;-ms-flex-positive:1;-ms-flex-negative:1;-ms-flex-preferred-size:.01%}.sidebar #full-list ul{display:none;margin:9px 15px;padding:0}.sidebar #full-list ul li{font-weight:300;line-height:18px;padding:2px 10px}.sidebar #full-list ul li a.expand:before{content:"+";font-family:monospaced;font-size:15px;float:left;width:13px;margin-left:-13px}.sidebar #full-list ul li.open a.expand:before{content:"−"}.sidebar #full-list ul li ul{display:none;margin:9px 6px}.sidebar #full-list li.open>ul,.sidebar #full-list ul li.open>ul{display:block}.sidebar #full-list ul li ul li{border-left:1px solid #959595;padding:0 10px}.sidebar #full-list ul li ul li.active:before{font-family:icomoon;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f105";margin-left:-10px;font-size:16px;margin-right:5px}.sidebar #full-list li{padding:0;line-height:27px}.sidebar #full-list li.active{border-left:none}.sidebar #full-list li.active>a,.sidebar #full-list li.clicked>a{color:#fff}.sidebar #full-list li.group{text-transform:uppercase;font-weight:700;font-size:.8em;margin:2em 0 0;line-height:1.8em;color:#ddd}@media screen and (max-height:500px){.sidebar{overflow-y:auto}.sidebar #full-list{overflow:visible}}.content-inner{font-family:Merriweather,serif;font-size:1em;line-height:1.6875em}.content-inner h1,.content-inner h2,.content-inner h3,.content-inner h4,.content-inner h5,.content-inner h6{font-family:Lato,sans-serif;font-weight:700;line-height:1.5em;word-wrap:break-word}.content-inner h1{font-size:2em;margin:1em 0 .5em}.content-inner h1.section-heading{margin:1.5em 0 .5em}.content-inner h1 small{font-weight:300}.content-inner h1 a.view-source{font-size:1.2rem}.content-inner h2{font-size:1.6em;margin:1em 0 .5em;font-weight:700}.content-inner h3{font-size:1.375em;margin:1em 0 .5em;font-weight:700}.content-inner a{color:#000;text-decoration:none;text-shadow:.03em 0 #fff,-.03em 0 #fff,0 .03em #fff,0 -.03em #fff,.06em 0 #fff,-.06em 0 #fff,.09em 0 #fff,-.09em 0 #fff,.12em 0 #fff,-.12em 0 #fff,.15em 0 #fff,-.15em 0 #fff;background-image:linear-gradient(#fff,#fff),linear-gradient(#fff,#fff),linear-gradient(#000,#000);background-size:.05em 1px,.05em 1px,1px 1px;background-repeat:no-repeat,no-repeat,repeat-x;background-position:0 90%,100% 90%,0 90%}.content-inner a:selection{text-shadow:.03em 0 #b4d5fe,-.03em 0 #b4d5fe,0 .03em #b4d5fe,0 -.03em #b4d5fe,.06em 0 #b4d5fe,-.06em 0 #b4d5fe,.09em 0 #b4d5fe,-.09em 0 #b4d5fe,.12em 0 #b4d5fe,-.12em 0 #b4d5fe,.15em 0 #b4d5fe,-.15em 0 #b4d5fe;background:#b4d5fe}.content-inner a:-moz-selection{text-shadow:.03em 0 #b4d5fe,-.03em 0 #b4d5fe,0 .03em #b4d5fe,0 -.03em #b4d5fe,.06em 0 #b4d5fe,-.06em 0 #b4d5fe,.09em 0 #b4d5fe,-.09em 0 #b4d5fe,.12em 0 #b4d5fe,-.12em 0 #b4d5fe,.15em 0 #b4d5fe,-.15em 0 #b4d5fe;background:#b4d5fe}.content-inner a *,.content-inner a :after,.content-inner a :before,.content-inner a:after,.content-inner a:before{text-shadow:none}.content-inner a:visited{color:#000}.content-inner ul li{line-height:1.5em}.content-inner ul li>p{margin:0}.content-inner a.view-source{float:right;color:#959595;background:0 0;border:none;text-shadow:none;transition:color .3s ease-in-out;margin-top:1px}.content-inner a.view-source:hover{color:#373f52}.content-inner .note{color:#959595;margin:0 5px;font-size:14px;font-weight:400}.content-inner blockquote{font-style:italic;margin:.5em 0;padding:.25em 1.5em;border-left:3px solid #e1e1e1;display:inline-block}.content-inner blockquote :first-child{padding-top:0;margin-top:0}.content-inner blockquote :last-child{padding-bottom:0;margin-bottom:0}.content-inner table{margin:2em 0}.content-inner th{text-align:left;font-family:Lato,sans-serif;text-transform:uppercase;font-weight:700;padding-bottom:.5em}.content-inner tr{border-bottom:1px solid #d5dae6;vertical-align:bottom;height:2.5em}.content-inner .summary .summary-row .summary-signature a,.content-inner .summary h2 a{background:0 0;border:none;text-shadow:none}.content-inner td,.content-inner th{padding-left:1em;line-height:2em}.content-inner .section-heading:hover a.hover-link{opacity:1;text-decoration:none}.content-inner .section-heading a.hover-link{transition:opacity .3s ease-in-out;display:inline-block;opacity:0;padding:.3em .6em .6em;line-height:1em;margin-left:-2.7em;background:0 0;border:none;text-shadow:none;font-size:16px;vertical-align:middle}.content-inner .detail h2.section-heading{margin:1.5em 0 .5em .3em}.content-inner .visible-xs{display:none!important}@media screen and (max-width:767px){.content-inner .visible-xs{display:block!important}}.content-inner img{max-width:100%}.content-inner .summary h2{font-weight:700}.content-inner .summary .summary-row .summary-signature{font-family:Inconsolata,Menlo,Courier,monospace;font-weight:700}.content-inner .summary .summary-row .summary-synopsis{font-family:Merriweather,serif;font-style:italic;padding:0 1.2em;margin:0 0 .5em}.content-inner .summary .summary-row .summary-synopsis p{margin:0;padding:0}.content-inner .detail-header{margin:1.5em 0 1em;padding:.5em 1em;background:#f7f7f7;border-left:3px solid #9768d1;font-size:1em;font-family:Inconsolata,Menlo,Courier,monospace;position:relative}.content-inner .detail-header .note{float:right}.content-inner .detail-header .signature{font-size:1rem;font-weight:700}.content-inner .detail-header:hover a.detail-link{opacity:1;text-decoration:none}.content-inner .detail-header a.detail-link{transition:opacity .3s ease-in-out;position:absolute;top:0;left:0;display:block;opacity:0;padding:.6em;line-height:1.5em;margin-left:-2.5em;background:0 0;border:none;text-shadow:none}.content-inner .footer .line,.search-results h1{display:inline-block}.content-inner .specs pre,.content-inner code{font-family:Inconsolata,Menlo,Courier,monospace;font-style:normal;line-height:24px}.content-inner .specs{opacity:.7;padding-bottom:.05em}.content-inner .specs pre{font-size:.9em;margin:0;padding:0}.content-inner .docstring{margin:1.2em 0 2.1em 1.2em}.content-inner .docstring h2,.content-inner .docstring h3,.content-inner .docstring h4,.content-inner .docstring h5{font-weight:700}.content-inner .docstring h2{font-size:1em}.content-inner .docstring h3{font-size:.95em}.content-inner .docstring h4{font-size:.9em}.content-inner .docstring h5{font-size:.85em}.content-inner a.no-underline,.content-inner pre a{color:#9768d1;text-shadow:none;text-decoration:none;background-image:none}.content-inner a.no-underline:active,.content-inner a.no-underline:focus,.content-inner a.no-underline:hover,.content-inner a.no-underline:visited,.content-inner pre a:active,.content-inner pre a:focus,.content-inner pre a:hover,.content-inner pre a:visited{color:#9768d1;text-decoration:none}.content-inner code{font-weight:400;background-color:#f7f9fc;border:1px solid #e1e1e1;vertical-align:baseline;border-radius:2px;padding:0 .5em}.content-inner pre{margin:1.5em 0}.content-inner pre.spec{margin:0}.content-inner pre.spec code{padding:0}.content-inner pre code.hljs{white-space:inherit;padding:.5em 1em;background-color:#f7f9fc}.content-inner .footer{margin:4em auto 1em;text-align:center;font-style:italic;font-size:14px;color:#959595}.content-inner .footer a{color:#959595;text-decoration:none;text-shadow:.03em 0 #fff,-.03em 0 #fff,0 .03em #fff,0 -.03em #fff,.06em 0 #fff,-.06em 0 #fff,.09em 0 #fff,-.09em 0 #fff,.12em 0 #fff,-.12em 0 #fff,.15em 0 #fff,-.15em 0 #fff;background-image:linear-gradient(#fff,#fff),linear-gradient(#fff,#fff),linear-gradient(#959595,#959595);background-size:.05em 1px,.05em 1px,1px 1px;background-repeat:no-repeat,no-repeat,repeat-x;background-position:0 90%,100% 90%,0 90%}.content-inner .footer a:selection{text-shadow:.03em 0 #b4d5fe,-.03em 0 #b4d5fe,0 .03em #b4d5fe,0 -.03em #b4d5fe,.06em 0 #b4d5fe,-.06em 0 #b4d5fe,.09em 0 #b4d5fe,-.09em 0 #b4d5fe,.12em 0 #b4d5fe,-.12em 0 #b4d5fe,.15em 0 #b4d5fe,-.15em 0 #b4d5fe;background:#b4d5fe}.content-inner .footer a:-moz-selection{text-shadow:.03em 0 #b4d5fe,-.03em 0 #b4d5fe,0 .03em #b4d5fe,0 -.03em #b4d5fe,.06em 0 #b4d5fe,-.06em 0 #b4d5fe,.09em 0 #b4d5fe,-.09em 0 #b4d5fe,.12em 0 #b4d5fe,-.12em 0 #b4d5fe,.15em 0 #b4d5fe,-.15em 0 #b4d5fe;background:#b4d5fe}.results .result-id a,.search-results a.close-search{background-image:none;transition:color .3s ease-in-out;text-shadow:none}.content-inner .footer a *,.content-inner .footer a :after,.content-inner .footer a :before,.content-inner .footer a:after,.content-inner .footer a:before{text-shadow:none}.content-inner .footer a:visited{color:#959595}.search-results a.close-search{display:inline-block;float:right}.search-results a.close-search:active,.search-results a.close-search:focus,.search-results a.close-search:visited{color:#000}.search-results a.close-search:hover{color:#9768d1}.results .result-id{font-size:1.2em}.results .result-id a:active,.results .result-id a:focus,.results .result-id a:visited{color:#000}.results .result-id a:hover{color:#9768d1}.results .result-elem em,.results .result-id em{font-style:normal;color:#9768d1}.results ul{margin:0;padding:0}.night-mode-toggle{background:0 0;border:none}.night-mode-toggle:after{font-size:12px;content:'Switch to night mode';text-decoration:underline}body.night-mode{background:#212127}body.night-mode .hljs-comment{color:#969896}body.night-mode .css .hljs-class,body.night-mode .css .hljs-id,body.night-mode .css .hljs-pseudo,body.night-mode .hljs-attribute,body.night-mode .hljs-regexp,body.night-mode .hljs-tag,body.night-mode .hljs-variable,body.night-mode .html .hljs-doctype,body.night-mode .ruby .hljs-constant,body.night-mode .xml .hljs-doctype,body.night-mode .xml .hljs-pi,body.night-mode .xml .hljs-tag .hljs-title{color:#c66}body.night-mode .hljs-built_in,body.night-mode .hljs-constant,body.night-mode .hljs-literal,body.night-mode .hljs-number,body.night-mode .hljs-params,body.night-mode .hljs-pragma,body.night-mode .hljs-preprocessor{color:#de935f}body.night-mode .css .hljs-rule .hljs-attribute,body.night-mode .ruby .hljs-class .hljs-title{color:#f0c674}body.night-mode .hljs-header,body.night-mode .hljs-inheritance,body.night-mode .hljs-name,body.night-mode .hljs-string,body.night-mode .hljs-value,body.night-mode .ruby .hljs-symbol,body.night-mode .xml .hljs-cdata{color:#b5bd68}body.night-mode .css .hljs-hexcolor,body.night-mode .hljs-title{color:#8abeb7}body.night-mode .coffeescript .hljs-title,body.night-mode .hljs-function,body.night-mode .javascript .hljs-title,body.night-mode .perl .hljs-sub,body.night-mode .python .hljs-decorator,body.night-mode .python .hljs-title,body.night-mode .ruby .hljs-function .hljs-title,body.night-mode .ruby .hljs-title .hljs-keyword{color:#81a2be}body.night-mode .hljs-keyword,body.night-mode .javascript .hljs-function{color:#b294bb}body.night-mode .hljs{display:block;overflow-x:auto;background:#1d1f21;color:#c5c8c6;padding:.5em;-webkit-text-size-adjust:none}body.night-mode .coffeescript .javascript,body.night-mode .javascript .xml,body.night-mode .tex .hljs-formula,body.night-mode .xml .css,body.night-mode .xml .hljs-cdata,body.night-mode .xml .javascript,body.night-mode .xml .vbscript{opacity:.5}body.night-mode .content-outer{background:#212127}body.night-mode .night-mode-toggle:after{color:#959595;content:'Switch to day mode';text-decoration:underline}body.night-mode .close-search:active,body.night-mode .close-search:focus,body.night-mode .close-search:visited,body.night-mode .results .result-id a:active,body.night-mode .results .result-id a:focus,body.night-mode .results .result-id a:visited{color:#d2d2d2}body.night-mode .close-search:hover,body.night-mode .results .result-id a:hover{color:#9768d1}body.night-mode .content-inner{color:#b4b4b4}body.night-mode .content-inner h1,body.night-mode .content-inner h2,body.night-mode .content-inner h3,body.night-mode .content-inner h4,body.night-mode .content-inner h5,body.night-mode .content-inner h6{color:#d2d2d2}body.night-mode .content-inner a{color:#d2d2d2;text-decoration:none;text-shadow:none;background-image:none}body.night-mode .content-inner .detail-header{background:#3a4152;color:#d2d2d2}body.night-mode .content-inner code,body.night-mode .content-inner pre code.hljs{background-color:#2c2c31;border:1px solid #38383d}body.night-mode .content-inner .footer{color:#959595}body.night-mode .content-inner .footer .line{display:inline-block}body.night-mode .content-inner .footer a{color:#959595;text-shadow:none;background-image:none;text-decoration:underline}.night-mode .sidebar-toggle i{color:#d5dae6}@media print{#sidebar{display:none}}
\ No newline at end of file
diff --git a/doc/dist/app-574613960f.js b/doc/dist/app-574613960f.js
deleted file mode 100644
index d4322a4..0000000
--- a/doc/dist/app-574613960f.js
+++ /dev/null
@@ -1,6 +0,0 @@
-!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),r=e[t[0]];return function(e,t,i){r.apply(this,[e,t,i].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,n){"use strict";var r=n(1)["default"],i=n(2),a=r(i),o=n(3),s=r(o),l=n(4),u=n(95),c=n(96);window.$=a["default"],a["default"](function(){s["default"].configure({tabReplace:" ",languages:[]}),c.initialize(),u.initialize(),l.initialize(),s["default"].initHighlighting()})},function(e,t){"use strict";t["default"]=function(e){return e&&e.__esModule?e:{"default":e}},t.__esModule=!0},function(e,t,n){var r,i;!function(t,n){"object"==typeof e&&"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,function(n,a){function o(e){var t="length"in e&&e.length,n=re.type(e);return"function"===n||re.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function s(e,t,n){if(re.isFunction(t))return re.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return re.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(fe.test(t))return re.filter(t,e,n);t=re.filter(t,e)}return re.grep(e,function(e){return V.call(t,e)>=0!==n})}function l(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function u(e){var t=ye[e]={};return re.each(e.match(ve)||[],function(e,n){t[n]=!0}),t}function c(){te.removeEventListener("DOMContentLoaded",c,!1),n.removeEventListener("load",c,!1),re.ready()}function f(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=re.expando+f.uid++}function d(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(Ne,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Ee.test(n)?re.parseJSON(n):n}catch(i){}we.set(e,t,n)}else n=void 0;return n}function p(){return!0}function h(){return!1}function g(){try{return te.activeElement}catch(e){}}function m(e,t){return re.nodeName(e,"table")&&re.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function v(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function y(e){var t=Be.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function b(e,t){for(var n=0,r=e.length;r>n;n++)_e.set(e[n],"globalEval",!t||_e.get(t[n],"globalEval"))}function x(e,t){var n,r,i,a,o,s,l,u;if(1===t.nodeType){if(_e.hasData(e)&&(a=_e.access(e),o=_e.set(t,a),u=a.events)){delete o.handle,o.events={};for(i in u)for(n=0,r=u[i].length;r>n;n++)re.event.add(t,i,u[i][n])}we.hasData(e)&&(s=we.access(e),l=re.extend({},s),we.set(t,l))}}function _(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&re.nodeName(e,t)?re.merge([e],n):n}function w(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Se.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function E(e,t){var r,i=re(t.createElement(e)).appendTo(t.body),a=n.getDefaultComputedStyle&&(r=n.getDefaultComputedStyle(i[0]))?r.display:re.css(i[0],"display");return i.detach(),a}function N(e){var t=te,n=We[e];return n||(n=E(e,t),"none"!==n&&n||(ze=(ze||re("")).appendTo(t.documentElement),t=ze[0].contentDocument,t.write(),t.close(),n=E(e,t),ze.detach()),We[e]=n),n}function k(e,t,n){var r,i,a,o,s=e.style;return n=n||Ge(e),n&&(o=n.getPropertyValue(t)||n[t]),n&&(""!==o||re.contains(e.ownerDocument,e)||(o=re.style(e,t)),Ke.test(o)&&Ue.test(t)&&(r=s.width,i=s.minWidth,a=s.maxWidth,s.minWidth=s.maxWidth=s.width=o,o=n.width,s.width=r,s.minWidth=i,s.maxWidth=a)),void 0!==o?o+"":o}function C(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function T(e,t){if(t in e)return t;for(var n=t[0].toUpperCase()+t.slice(1),r=t,i=Je.length;i--;)if(t=Je[i]+n,t in e)return t;return r}function S(e,t,n){var r=Ze.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function A(e,t,n,r,i){for(var a=n===(r?"border":"content")?4:"width"===t?1:0,o=0;4>a;a+=2)"margin"===n&&(o+=re.css(e,n+Ce[a],!0,i)),r?("content"===n&&(o-=re.css(e,"padding"+Ce[a],!0,i)),"margin"!==n&&(o-=re.css(e,"border"+Ce[a]+"Width",!0,i))):(o+=re.css(e,"padding"+Ce[a],!0,i),"padding"!==n&&(o+=re.css(e,"border"+Ce[a]+"Width",!0,i)));return o}function O(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,a=Ge(e),o="border-box"===re.css(e,"boxSizing",!1,a);if(0>=i||null==i){if(i=k(e,t,a),(0>i||null==i)&&(i=e.style[t]),Ke.test(i))return i;r=o&&(ee.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+A(e,t,n||(o?"border":"content"),r,a)+"px"}function M(e,t){for(var n,r,i,a=[],o=0,s=e.length;s>o;o++)r=e[o],r.style&&(a[o]=_e.get(r,"olddisplay"),n=r.style.display,t?(a[o]||"none"!==n||(r.style.display=""),""===r.style.display&&Te(r)&&(a[o]=_e.access(r,"olddisplay",N(r.nodeName)))):(i=Te(r),"none"===n&&i||_e.set(r,"olddisplay",i?n:re.css(r,"display"))));for(o=0;s>o;o++)r=e[o],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?a[o]||"":"none"));return e}function j(e,t,n,r,i){return new j.prototype.init(e,t,n,r,i)}function D(){return setTimeout(function(){et=void 0}),et=re.now()}function P(e,t){var n,r=0,i={height:e};for(t=t?1:0;4>r;r+=2-t)n=Ce[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function R(e,t,n){for(var r,i=(ot[t]||[]).concat(ot["*"]),a=0,o=i.length;o>a;a++)if(r=i[a].call(n,t,e))return r}function L(e,t,n){var r,i,a,o,s,l,u,c,f=this,d={},p=e.style,h=e.nodeType&&Te(e),g=_e.get(e,"fxshow");n.queue||(s=re._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,f.always(function(){f.always(function(){s.unqueued--,re.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],u=re.css(e,"display"),c="none"===u?_e.get(e,"olddisplay")||N(e.nodeName):u,"inline"===c&&"none"===re.css(e,"float")&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",f.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],nt.exec(i)){if(delete t[r],a=a||"toggle"===i,i===(h?"hide":"show")){if("show"!==i||!g||void 0===g[r])continue;h=!0}d[r]=g&&g[r]||re.style(e,r)}else u=void 0;if(re.isEmptyObject(d))"inline"===("none"===u?N(e.nodeName):u)&&(p.display=u);else{g?"hidden"in g&&(h=g.hidden):g=_e.access(e,"fxshow",{}),a&&(g.hidden=!h),h?re(e).show():f.done(function(){re(e).hide()}),f.done(function(){var t;_e.remove(e,"fxshow");for(t in d)re.style(e,t,d[t])});for(r in d)o=R(h?g[r]:0,r,f),r in g||(g[r]=o.start,h&&(o.end=o.start,o.start="width"===r||"height"===r?1:0))}}function H(e,t){var n,r,i,a,o;for(n in e)if(r=re.camelCase(n),i=t[r],a=e[n],re.isArray(a)&&(i=a[1],a=e[n]=a[0]),n!==r&&(e[r]=a,delete e[n]),o=re.cssHooks[r],o&&"expand"in o){a=o.expand(a),delete e[r];for(n in a)n in e||(e[n]=a[n],t[n]=i)}else t[r]=i}function q(e,t,n){var r,i,a=0,o=at.length,s=re.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;for(var t=et||D(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,a=1-r,o=0,l=u.tweens.length;l>o;o++)u.tweens[o].run(a);return s.notifyWith(e,[u,a,n]),1>a&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:re.extend({},t),opts:re.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:et||D(),duration:n.duration,tweens:[],createTween:function(t,n){var r=re.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(H(c,u.opts.specialEasing);o>a;a++)if(r=at[a].call(u,e,c,u.opts))return r;return re.map(c,R,u),re.isFunction(u.opts.start)&&u.opts.start.call(e,u),re.fx.timer(re.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function I(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,a=t.toLowerCase().match(ve)||[];if(re.isFunction(n))for(;r=a[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function B(e,t,n,r){function i(s){var l;return a[s]=!0,re.each(e[s]||[],function(e,s){var u=s(t,n,r);return"string"!=typeof u||o||a[u]?o?!(l=u):void 0:(t.dataTypes.unshift(u),i(u),!1)}),l}var a={},o=e===Et;return i(t.dataTypes[0])||!a["*"]&&i("*")}function $(e,t){var n,r,i=re.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&re.extend(!0,e,r),e}function F(e,t,n){for(var r,i,a,o,s=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){l.unshift(i);break}if(l[0]in n)a=l[0];else{for(i in n){if(!l[0]||e.converters[i+" "+l[0]]){a=i;break}o||(o=i)}a=a||o}return a?(a!==l[0]&&l.unshift(a),n[a]):void 0}function z(e,t,n,r){var i,a,o,s,l,u={},c=e.dataTypes.slice();if(c[1])for(o in e.converters)u[o.toLowerCase()]=e.converters[o];for(a=c.shift();a;)if(e.responseFields[a]&&(n[e.responseFields[a]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=a,a=c.shift())if("*"===a)a=l;else if("*"!==l&&l!==a){if(o=u[l+" "+a]||u["* "+a],!o)for(i in u)if(s=i.split(" "),s[1]===a&&(o=u[l+" "+s[0]]||u["* "+s[0]])){o===!0?o=u[i]:u[i]!==!0&&(a=s[0],c.unshift(s[1]));break}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(f){return{state:"parsererror",error:o?f:"No conversion from "+l+" to "+a}}}return{state:"success",data:t}}function W(e,t,n,r){var i;if(re.isArray(t))re.each(t,function(t,i){n||St.test(e)?r(e,i):W(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==re.type(t))r(e,t);else for(i in t)W(e+"["+i+"]",t[i],n,r)}function U(e){return re.isWindow(e)?e:9===e.nodeType&&e.defaultView}var K=[],G=K.slice,X=K.concat,Z=K.push,V=K.indexOf,Q={},Y=Q.toString,J=Q.hasOwnProperty,ee={},te=n.document,ne="2.1.4",re=function(e,t){return new re.fn.init(e,t)},ie=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ae=/^-ms-/,oe=/-([\da-z])/gi,se=function(e,t){return t.toUpperCase()};re.fn=re.prototype={jquery:ne,constructor:re,selector:"",length:0,toArray:function(){return G.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:G.call(this)},pushStack:function(e){var t=re.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return re.each(this,e,t)},map:function(e){return this.pushStack(re.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(G.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:Z,sort:K.sort,splice:K.splice},re.extend=re.fn.extend=function(){var e,t,n,r,i,a,o=arguments[0]||{},s=1,l=arguments.length,u=!1;for("boolean"==typeof o&&(u=o,o=arguments[s]||{},s++),"object"==typeof o||re.isFunction(o)||(o={}),s===l&&(o=this,s--);l>s;s++)if(null!=(e=arguments[s]))for(t in e)n=o[t],r=e[t],o!==r&&(u&&r&&(re.isPlainObject(r)||(i=re.isArray(r)))?(i?(i=!1,a=n&&re.isArray(n)?n:[]):a=n&&re.isPlainObject(n)?n:{},o[t]=re.extend(u,a,r)):void 0!==r&&(o[t]=r));return o},re.extend({expando:"jQuery"+(ne+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===re.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!re.isArray(e)&&e-parseFloat(e)+1>=0},isPlainObject:function(e){return"object"!==re.type(e)||e.nodeType||re.isWindow(e)?!1:e.constructor&&!J.call(e.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?Q[Y.call(e)]||"object":typeof e},globalEval:function(e){var t,n=eval;e=re.trim(e),e&&(1===e.indexOf("use strict")?(t=te.createElement("script"),t.text=e,te.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(ae,"ms-").replace(oe,se)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,a=e.length,s=o(e);if(n){if(s)for(;a>i&&(r=t.apply(e[i],n),r!==!1);i++);else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(s)for(;a>i&&(r=t.call(e[i],i,e[i]),r!==!1);i++);else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(ie,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(o(Object(e))?re.merge(n,"string"==typeof e?[e]:e):Z.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:V.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;n>r;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],a=0,o=e.length,s=!n;o>a;a++)r=!t(e[a],a),r!==s&&i.push(e[a]);return i},map:function(e,t,n){var r,i=0,a=e.length,s=o(e),l=[];if(s)for(;a>i;i++)r=t(e[i],i,n),null!=r&&l.push(r);else for(i in e)r=t(e[i],i,n),null!=r&&l.push(r);return X.apply([],l)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),re.isFunction(e)?(r=G.call(arguments,2),i=function(){return e.apply(t||this,r.concat(G.call(arguments)))},i.guid=e.guid=e.guid||re.guid++,i):void 0},now:Date.now,support:ee}),re.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){Q["[object "+t+"]"]=t.toLowerCase()});var le=function(e){function t(e,t,n,r){var i,a,o,s,l,u,f,p,h,g;if((t?t.ownerDocument||t:B)!==j&&M(t),t=t||j,n=n||[],s=t.nodeType,"string"!=typeof e||!e||1!==s&&9!==s&&11!==s)return n;if(!r&&P){if(11!==s&&(i=ye.exec(e)))if(o=i[1]){if(9===s){if(a=t.getElementById(o),!a||!a.parentNode)return n;if(a.id===o)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(o))&&q(t,a)&&a.id===o)return n.push(a),n}else{if(i[2])return Y.apply(n,t.getElementsByTagName(e)),n;if((o=i[3])&&_.getElementsByClassName)return Y.apply(n,t.getElementsByClassName(o)),n}if(_.qsa&&(!R||!R.test(e))){if(p=f=I,h=t,g=1!==s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){for(u=k(e),(f=t.getAttribute("id"))?p=f.replace(xe,"\\$&"):t.setAttribute("id",p),p="[id='"+p+"'] ",l=u.length;l--;)u[l]=p+d(u[l]);h=be.test(e)&&c(t.parentNode)||t,g=u.join(",")}if(g)try{return Y.apply(n,h.querySelectorAll(g)),n}catch(m){}finally{f||t.removeAttribute("id")}}}return T(e.replace(le,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>w.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[I]=!0,e}function i(e){var t=j.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function a(e,t){for(var n=e.split("|"),r=e.length;r--;)w.attrHandle[n[r]]=t}function o(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||G)-(~e.sourceIndex||G);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function l(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function u(e){return r(function(t){return t=+t,r(function(n,r){for(var i,a=e([],n.length,t),o=a.length;o--;)n[i=a[o]]&&(n[i]=!(r[i]=n[i]))})})}function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function d(e){for(var t=0,n=e.length,r="";n>t;t++)r+=e[t].value;return r}function p(e,t,n){var r=t.dir,i=n&&"parentNode"===r,a=F++;return t.first?function(t,n,a){for(;t=t[r];)if(1===t.nodeType||i)return e(t,n,a)}:function(t,n,o){var s,l,u=[$,a];if(o){for(;t=t[r];)if((1===t.nodeType||i)&&e(t,n,o))return!0}else for(;t=t[r];)if(1===t.nodeType||i){if(l=t[I]||(t[I]={}),(s=l[r])&&s[0]===$&&s[1]===a)return u[2]=s[2];if(l[r]=u,u[2]=e(t,n,o))return!0}}}function h(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function g(e,n,r){for(var i=0,a=n.length;a>i;i++)t(e,n[i],r);return r}function m(e,t,n,r,i){for(var a,o=[],s=0,l=e.length,u=null!=t;l>s;s++)(a=e[s])&&(!n||n(a,r,i))&&(o.push(a),u&&t.push(s));return o}function v(e,t,n,i,a,o){return i&&!i[I]&&(i=v(i)),a&&!a[I]&&(a=v(a,o)),r(function(r,o,s,l){var u,c,f,d=[],p=[],h=o.length,v=r||g(t||"*",s.nodeType?[s]:s,[]),y=!e||!r&&t?v:m(v,d,e,s,l),b=n?a||(r?e:h||i)?[]:o:y;if(n&&n(y,b,s,l),i)for(u=m(b,p),i(u,[],s,l),c=u.length;c--;)(f=u[c])&&(b[p[c]]=!(y[p[c]]=f));if(r){if(a||e){if(a){for(u=[],c=b.length;c--;)(f=b[c])&&u.push(y[c]=f);a(null,b=[],u,l)}for(c=b.length;c--;)(f=b[c])&&(u=a?ee(r,f):d[c])>-1&&(r[u]=!(o[u]=f))}}else b=m(b===o?b.splice(h,b.length):b),a?a(null,o,b,l):Y.apply(o,b)})}function y(e){for(var t,n,r,i=e.length,a=w.relative[e[0].type],o=a||w.relative[" "],s=a?1:0,l=p(function(e){return e===t},o,!0),u=p(function(e){return ee(t,e)>-1},o,!0),c=[function(e,n,r){var i=!a&&(r||n!==S)||((t=n).nodeType?l(e,n,r):u(e,n,r));return t=null,i}];i>s;s++)if(n=w.relative[e[s].type])c=[p(h(c),n)];else{if(n=w.filter[e[s].type].apply(null,e[s].matches),n[I]){for(r=++s;i>r&&!w.relative[e[r].type];r++);return v(s>1&&h(c),s>1&&d(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(le,"$1"),n,r>s&&y(e.slice(s,r)),i>r&&y(e=e.slice(r)),i>r&&d(e))}c.push(n)}return h(c)}function b(e,n){var i=n.length>0,a=e.length>0,o=function(r,o,s,l,u){var c,f,d,p=0,h="0",g=r&&[],v=[],y=S,b=r||a&&w.find.TAG("*",u),x=$+=null==y?1:Math.random()||.1,_=b.length;for(u&&(S=o!==j&&o);h!==_&&null!=(c=b[h]);h++){if(a&&c){for(f=0;d=e[f++];)if(d(c,o,s)){l.push(c);break}u&&($=x)}i&&((c=!d&&c)&&p--,r&&g.push(c))}if(p+=h,i&&h!==p){for(f=0;d=n[f++];)d(g,v,o,s);if(r){if(p>0)for(;h--;)g[h]||v[h]||(v[h]=V.call(l));v=m(v)}Y.apply(l,v),u&&!r&&v.length>0&&p+n.length>1&&t.uniqueSort(l)}return u&&($=x,S=y),g};return i?r(o):o}var x,_,w,E,N,k,C,T,S,A,O,M,j,D,P,R,L,H,q,I="sizzle"+1*new Date,B=e.document,$=0,F=0,z=n(),W=n(),U=n(),K=function(e,t){return e===t&&(O=!0),0},G=1<<31,X={}.hasOwnProperty,Z=[],V=Z.pop,Q=Z.push,Y=Z.push,J=Z.slice,ee=function(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1},te="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",re="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ie=re.replace("w","w#"),ae="\\["+ne+"*("+re+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+ie+"))|)"+ne+"*\\]",oe=":("+re+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ae+")*)|.*)\\)|)",se=new RegExp(ne+"+","g"),le=new RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),ue=new RegExp("^"+ne+"*,"+ne+"*"),ce=new RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),fe=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),de=new RegExp(oe),pe=new RegExp("^"+ie+"$"),he={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re.replace("w","w*")+")"),ATTR:new RegExp("^"+ae),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},ge=/^(?:input|select|textarea|button)$/i,me=/^h\d$/i,ve=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,be=/[+~]/,xe=/'|\\/g,_e=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),we=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Ee=function(){M()};try{Y.apply(Z=J.call(B.childNodes),B.childNodes),Z[B.childNodes.length].nodeType}catch(Ne){Y={apply:Z.length?function(e,t){Q.apply(e,J.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}_=t.support={},N=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},M=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:B;return r!==j&&9===r.nodeType&&r.documentElement?(j=r,D=r.documentElement,n=r.defaultView,n&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",Ee,!1):n.attachEvent&&n.attachEvent("onunload",Ee)),P=!N(r),_.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),_.getElementsByTagName=i(function(e){return e.appendChild(r.createComment("")),!e.getElementsByTagName("*").length}),_.getElementsByClassName=ve.test(r.getElementsByClassName),_.getById=i(function(e){return D.appendChild(e).id=I,!r.getElementsByName||!r.getElementsByName(I).length}),_.getById?(w.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&P){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},w.filter.ID=function(e){var t=e.replace(_e,we);return function(e){return e.getAttribute("id")===t}}):(delete w.find.ID,w.filter.ID=function(e){var t=e.replace(_e,we);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),w.find.TAG=_.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):_.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,a=t.getElementsByTagName(e);if("*"===e){for(;n=a[i++];)1===n.nodeType&&r.push(n);return r}return a},w.find.CLASS=_.getElementsByClassName&&function(e,t){return P?t.getElementsByClassName(e):void 0},L=[],R=[],(_.qsa=ve.test(r.querySelectorAll))&&(i(function(e){D.appendChild(e).innerHTML=" ",e.querySelectorAll("[msallowcapture^='']").length&&R.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||R.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+I+"-]").length||R.push("~="),e.querySelectorAll(":checked").length||R.push(":checked"),e.querySelectorAll("a#"+I+"+*").length||R.push(".#.+[+~]")}),i(function(e){var t=r.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&R.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||R.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),R.push(",.*:")})),(_.matchesSelector=ve.test(H=D.matches||D.webkitMatchesSelector||D.mozMatchesSelector||D.oMatchesSelector||D.msMatchesSelector))&&i(function(e){_.disconnectedMatch=H.call(e,"div"),H.call(e,"[s!='']:x"),L.push("!=",oe)}),R=R.length&&new RegExp(R.join("|")),L=L.length&&new RegExp(L.join("|")),t=ve.test(D.compareDocumentPosition),q=t||ve.test(D.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},K=t?function(e,t){if(e===t)return O=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!_.sortDetached&&t.compareDocumentPosition(e)===n?e===r||e.ownerDocument===B&&q(B,e)?-1:t===r||t.ownerDocument===B&&q(B,t)?1:A?ee(A,e)-ee(A,t):0:4&n?-1:1)}:function(e,t){if(e===t)return O=!0,0;var n,i=0,a=e.parentNode,s=t.parentNode,l=[e],u=[t];if(!a||!s)return e===r?-1:t===r?1:a?-1:s?1:A?ee(A,e)-ee(A,t):0;if(a===s)return o(e,t);for(n=e;n=n.parentNode;)l.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;l[i]===u[i];)i++;return i?o(l[i],u[i]):l[i]===B?-1:u[i]===B?1:0},r):j},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==j&&M(e),n=n.replace(fe,"='$1']"),_.matchesSelector&&P&&(!L||!L.test(n))&&(!R||!R.test(n)))try{var r=H.call(e,n);if(r||_.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,j,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==j&&M(e),q(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==j&&M(e);var n=w.attrHandle[t.toLowerCase()],r=n&&X.call(w.attrHandle,t.toLowerCase())?n(e,t,!P):void 0;return void 0!==r?r:_.attributes||!P?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(O=!_.detectDuplicates,A=!_.sortStable&&e.slice(0),e.sort(K),O){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return A=null,e},E=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=E(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=E(t);return n},w=t.selectors={cacheLength:50,createPseudo:r,match:he,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(_e,we),e[3]=(e[3]||e[4]||e[5]||"").replace(_e,we),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return he.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&de.test(n)&&(t=k(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(_e,we).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=z[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&z(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var a=t.attr(i,e);return null==a?"!="===n:n?(a+="","="===n?a===r:"!="===n?a!==r:"^="===n?r&&0===a.indexOf(r):"*="===n?r&&a.indexOf(r)>-1:"$="===n?r&&a.slice(-r.length)===r:"~="===n?(" "+a.replace(se," ")+" ").indexOf(r)>-1:"|="===n?a===r||a.slice(0,r.length+1)===r+"-":!1):!0}},CHILD:function(e,t,n,r,i){var a="nth"!==e.slice(0,3),o="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,f,d,p,h,g=a!==o?"nextSibling":"previousSibling",m=t.parentNode,v=s&&t.nodeName.toLowerCase(),y=!l&&!s;if(m){if(a){for(;g;){for(f=t;f=f[g];)if(s?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[o?m.firstChild:m.lastChild],o&&y){for(c=m[I]||(m[I]={}),u=c[e]||[],p=u[0]===$&&u[1],d=u[0]===$&&u[2],f=p&&m.childNodes[p];f=++p&&f&&f[g]||(d=p=0)||h.pop();)if(1===f.nodeType&&++d&&f===t){c[e]=[$,p,d];break}}else if(y&&(u=(t[I]||(t[I]={}))[e])&&u[0]===$)d=u[1];else for(;(f=++p&&f&&f[g]||(d=p=0)||h.pop())&&((s?f.nodeName.toLowerCase()!==v:1!==f.nodeType)||!++d||(y&&((f[I]||(f[I]={}))[e]=[$,d]),f!==t)););return d-=i,d===r||d%r===0&&d/r>=0}}},PSEUDO:function(e,n){var i,a=w.pseudos[e]||w.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return a[I]?a(n):a.length>1?(i=[e,e,"",n],w.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=a(e,n),o=i.length;o--;)r=ee(e,i[o]),e[r]=!(t[r]=i[o])}):function(e){return a(e,0,i)}):a}},pseudos:{not:r(function(e){var t=[],n=[],i=C(e.replace(le,"$1"));return i[I]?r(function(e,t,n,r){for(var a,o=i(e,null,r,[]),s=e.length;s--;)(a=o[s])&&(e[s]=!(t[s]=a))}):function(e,r,a){return t[0]=e,i(t,null,a,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(_e,we),function(t){return(t.textContent||t.innerText||E(t)).indexOf(e)>-1}}),lang:r(function(e){return pe.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(_e,we).toLowerCase(),function(t){var n;do if(n=P?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===D},focus:function(e){return e===j.activeElement&&(!j.hasFocus||j.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!w.pseudos.empty(e)},header:function(e){return me.test(e.nodeName)},input:function(e){return ge.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:u(function(){return[0]}),last:u(function(e,t){return[t-1]}),eq:u(function(e,t,n){return[0>n?n+t:n]}),even:u(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:u(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:u(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:u(function(e,t,n){for(var r=0>n?n+t:n;++r2&&"ID"===(o=a[0]).type&&_.getById&&9===t.nodeType&&P&&w.relative[a[1].type]){if(t=(w.find.ID(o.matches[0].replace(_e,we),t)||[])[0],!t)return n;u&&(t=t.parentNode),e=e.slice(a.shift().value.length)}for(i=he.needsContext.test(e)?0:a.length;i--&&(o=a[i],!w.relative[s=o.type]);)if((l=w.find[s])&&(r=l(o.matches[0].replace(_e,we),be.test(a[0].type)&&c(t.parentNode)||t))){if(a.splice(i,1),e=r.length&&d(a),!e)return Y.apply(n,r),n;break}}return(u||C(e,f))(r,t,!P,n,be.test(e)&&c(t.parentNode)||t),n},_.sortStable=I.split("").sort(K).join("")===I,_.detectDuplicates=!!O,M(),_.sortDetached=i(function(e){return 1&e.compareDocumentPosition(j.createElement("div"))}),i(function(e){return e.innerHTML=" ","#"===e.firstChild.getAttribute("href")})||a("type|href|height|width",function(e,t,n){
-return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),_.attributes&&i(function(e){return e.innerHTML=" ",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||a("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||a(te,function(e,t,n){var r;return n?void 0:e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(n);re.find=le,re.expr=le.selectors,re.expr[":"]=re.expr.pseudos,re.unique=le.uniqueSort,re.text=le.getText,re.isXMLDoc=le.isXML,re.contains=le.contains;var ue=re.expr.match.needsContext,ce=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,fe=/^.[^:#\[\.,]*$/;re.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?re.find.matchesSelector(r,e)?[r]:[]:re.find.matches(e,re.grep(t,function(e){return 1===e.nodeType}))},re.fn.extend({find:function(e){var t,n=this.length,r=[],i=this;if("string"!=typeof e)return this.pushStack(re(e).filter(function(){for(t=0;n>t;t++)if(re.contains(i[t],this))return!0}));for(t=0;n>t;t++)re.find(e,i[t],r);return r=this.pushStack(n>1?re.unique(r):r),r.selector=this.selector?this.selector+" "+e:e,r},filter:function(e){return this.pushStack(s(this,e||[],!1))},not:function(e){return this.pushStack(s(this,e||[],!0))},is:function(e){return!!s(this,"string"==typeof e&&ue.test(e)?re(e):e||[],!1).length}});var de,pe=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,he=re.fn.init=function(e,t){var n,r;if(!e)return this;if("string"==typeof e){if(n="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:pe.exec(e),!n||!n[1]&&t)return!t||t.jquery?(t||de).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof re?t[0]:t,re.merge(this,re.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:te,!0)),ce.test(n[1])&&re.isPlainObject(t))for(n in t)re.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return r=te.getElementById(n[2]),r&&r.parentNode&&(this.length=1,this[0]=r),this.context=te,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):re.isFunction(e)?"undefined"!=typeof de.ready?de.ready(e):e(re):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),re.makeArray(e,this))};he.prototype=re.fn,de=re(te);var ge=/^(?:parents|prev(?:Until|All))/,me={children:!0,contents:!0,next:!0,prev:!0};re.extend({dir:function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&re(e).is(n))break;r.push(e)}return r},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}}),re.fn.extend({has:function(e){var t=re(e,this),n=t.length;return this.filter(function(){for(var e=0;n>e;e++)if(re.contains(this,t[e]))return!0})},closest:function(e,t){for(var n,r=0,i=this.length,a=[],o=ue.test(e)||"string"!=typeof e?re(e,t||this.context):0;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(o?o.index(n)>-1:1===n.nodeType&&re.find.matchesSelector(n,e))){a.push(n);break}return this.pushStack(a.length>1?re.unique(a):a)},index:function(e){return e?"string"==typeof e?V.call(re(e),this[0]):V.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(re.unique(re.merge(this.get(),re(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),re.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return re.dir(e,"parentNode")},parentsUntil:function(e,t,n){return re.dir(e,"parentNode",n)},next:function(e){return l(e,"nextSibling")},prev:function(e){return l(e,"previousSibling")},nextAll:function(e){return re.dir(e,"nextSibling")},prevAll:function(e){return re.dir(e,"previousSibling")},nextUntil:function(e,t,n){return re.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return re.dir(e,"previousSibling",n)},siblings:function(e){return re.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return re.sibling(e.firstChild)},contents:function(e){return e.contentDocument||re.merge([],e.childNodes)}},function(e,t){re.fn[e]=function(n,r){var i=re.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=re.filter(r,i)),this.length>1&&(me[e]||re.unique(i),ge.test(e)&&i.reverse()),this.pushStack(i)}});var ve=/\S+/g,ye={};re.Callbacks=function(e){e="string"==typeof e?ye[e]||u(e):re.extend({},e);var t,n,r,i,a,o,s=[],l=!e.once&&[],c=function(u){for(t=e.memory&&u,n=!0,o=i||0,i=0,a=s.length,r=!0;s&&a>o;o++)if(s[o].apply(u[0],u[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,s&&(l?l.length&&c(l.shift()):t?s=[]:f.disable())},f={add:function(){if(s){var n=s.length;!function o(t){re.each(t,function(t,n){var r=re.type(n);"function"===r?e.unique&&f.has(n)||s.push(n):n&&n.length&&"string"!==r&&o(n)})}(arguments),r?a=s.length:t&&(i=n,c(t))}return this},remove:function(){return s&&re.each(arguments,function(e,t){for(var n;(n=re.inArray(t,s,n))>-1;)s.splice(n,1),r&&(a>=n&&a--,o>=n&&o--)}),this},has:function(e){return e?re.inArray(e,s)>-1:!(!s||!s.length)},empty:function(){return s=[],a=0,this},disable:function(){return s=l=t=void 0,this},disabled:function(){return!s},lock:function(){return l=void 0,t||f.disable(),this},locked:function(){return!l},fireWith:function(e,t){return!s||n&&!l||(t=t||[],t=[e,t.slice?t.slice():t],r?l.push(t):c(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!n}};return f},re.extend({Deferred:function(e){var t=[["resolve","done",re.Callbacks("once memory"),"resolved"],["reject","fail",re.Callbacks("once memory"),"rejected"],["notify","progress",re.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return re.Deferred(function(n){re.each(t,function(t,a){var o=re.isFunction(e[t])&&e[t];i[a[1]](function(){var e=o&&o.apply(this,arguments);e&&re.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a[0]+"With"](this===r?n.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?re.extend(e,r):r}},i={};return r.pipe=r.then,re.each(t,function(e,a){var o=a[2],s=a[3];r[a[1]]=o.add,s&&o.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[a[0]]=function(){return i[a[0]+"With"](this===i?r:this,arguments),this},i[a[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,a=G.call(arguments),o=a.length,s=1!==o||e&&re.isFunction(e.promise)?o:0,l=1===s?e:re.Deferred(),u=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?G.call(arguments):i,r===t?l.notifyWith(n,r):--s||l.resolveWith(n,r)}};if(o>1)for(t=new Array(o),n=new Array(o),r=new Array(o);o>i;i++)a[i]&&re.isFunction(a[i].promise)?a[i].promise().done(u(i,r,a)).fail(l.reject).progress(u(i,n,t)):--s;return s||l.resolveWith(r,a),l.promise()}});var be;re.fn.ready=function(e){return re.ready.promise().done(e),this},re.extend({isReady:!1,readyWait:1,holdReady:function(e){e?re.readyWait++:re.ready(!0)},ready:function(e){(e===!0?--re.readyWait:re.isReady)||(re.isReady=!0,e!==!0&&--re.readyWait>0||(be.resolveWith(te,[re]),re.fn.triggerHandler&&(re(te).triggerHandler("ready"),re(te).off("ready"))))}}),re.ready.promise=function(e){return be||(be=re.Deferred(),"complete"===te.readyState?setTimeout(re.ready):(te.addEventListener("DOMContentLoaded",c,!1),n.addEventListener("load",c,!1))),be.promise(e)},re.ready.promise();var xe=re.access=function(e,t,n,r,i,a,o){var s=0,l=e.length,u=null==n;if("object"===re.type(n)){i=!0;for(s in n)re.access(e,t,s,n[s],!0,a,o)}else if(void 0!==r&&(i=!0,re.isFunction(r)||(o=!0),u&&(o?(t.call(e,r),t=null):(u=t,t=function(e,t,n){return u.call(re(e),n)})),t))for(;l>s;s++)t(e[s],n,o?r:r.call(e[s],s,t(e[s],n)));return i?e:u?t.call(e):l?t(e[0],n):a};re.acceptData=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType},f.uid=1,f.accepts=re.acceptData,f.prototype={key:function(e){if(!f.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=f.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,re.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),a=this.cache[i];if("string"==typeof t)a[t]=n;else if(re.isEmptyObject(a))re.extend(this.cache[i],t);else for(r in t)a[r]=t[r];return a},get:function(e,t){var n=this.cache[this.key(e)];return void 0===t?n:n[t]},access:function(e,t,n){var r;return void 0===t||t&&"string"==typeof t&&void 0===n?(r=this.get(e,t),void 0!==r?r:this.get(e,re.camelCase(t))):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r,i,a=this.key(e),o=this.cache[a];if(void 0===t)this.cache[a]={};else{re.isArray(t)?r=t.concat(t.map(re.camelCase)):(i=re.camelCase(t),t in o?r=[t,i]:(r=i,r=r in o?[r]:r.match(ve)||[])),n=r.length;for(;n--;)delete o[r[n]]}},hasData:function(e){return!re.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}};var _e=new f,we=new f,Ee=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Ne=/([A-Z])/g;re.extend({hasData:function(e){return we.hasData(e)||_e.hasData(e)},data:function(e,t,n){return we.access(e,t,n)},removeData:function(e,t){we.remove(e,t)},_data:function(e,t,n){return _e.access(e,t,n)},_removeData:function(e,t){_e.remove(e,t)}}),re.fn.extend({data:function(e,t){var n,r,i,a=this[0],o=a&&a.attributes;if(void 0===e){if(this.length&&(i=we.get(a),1===a.nodeType&&!_e.get(a,"hasDataAttrs"))){for(n=o.length;n--;)o[n]&&(r=o[n].name,0===r.indexOf("data-")&&(r=re.camelCase(r.slice(5)),d(a,r,i[r])));_e.set(a,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){we.set(this,e)}):xe(this,function(t){var n,r=re.camelCase(e);if(a&&void 0===t){if(n=we.get(a,e),void 0!==n)return n;if(n=we.get(a,r),void 0!==n)return n;if(n=d(a,r,void 0),void 0!==n)return n}else this.each(function(){var n=we.get(this,r);we.set(this,r,t),-1!==e.indexOf("-")&&void 0!==n&&we.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){we.remove(this,e)})}}),re.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=_e.get(e,t),n&&(!r||re.isArray(n)?r=_e.access(e,t,re.makeArray(n)):r.push(n)),r||[]):void 0},dequeue:function(e,t){t=t||"fx";var n=re.queue(e,t),r=n.length,i=n.shift(),a=re._queueHooks(e,t),o=function(){re.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete a.stop,i.call(e,o,a)),!r&&a&&a.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return _e.get(e,n)||_e.access(e,n,{empty:re.Callbacks("once memory").add(function(){_e.remove(e,[t+"queue",n])})})}}),re.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.lengthx",ee.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var Ae="undefined";ee.focusinBubbles="onfocusin"in n;var Oe=/^key/,Me=/^(?:mouse|pointer|contextmenu)|click/,je=/^(?:focusinfocus|focusoutblur)$/,De=/^([^.]*)(?:\.(.+)|)$/;re.event={global:{},add:function(e,t,n,r,i){var a,o,s,l,u,c,f,d,p,h,g,m=_e.get(e);if(m)for(n.handler&&(a=n,n=a.handler,i=a.selector),n.guid||(n.guid=re.guid++),(l=m.events)||(l=m.events={}),(o=m.handle)||(o=m.handle=function(t){return typeof re!==Ae&&re.event.triggered!==t.type?re.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(ve)||[""],u=t.length;u--;)s=De.exec(t[u])||[],p=g=s[1],h=(s[2]||"").split(".").sort(),p&&(f=re.event.special[p]||{},p=(i?f.delegateType:f.bindType)||p,f=re.event.special[p]||{},c=re.extend({type:p,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&re.expr.match.needsContext.test(i),namespace:h.join(".")},a),(d=l[p])||(d=l[p]=[],d.delegateCount=0,f.setup&&f.setup.call(e,r,h,o)!==!1||e.addEventListener&&e.addEventListener(p,o,!1)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?d.splice(d.delegateCount++,0,c):d.push(c),re.event.global[p]=!0)},remove:function(e,t,n,r,i){var a,o,s,l,u,c,f,d,p,h,g,m=_e.hasData(e)&&_e.get(e);if(m&&(l=m.events)){for(t=(t||"").match(ve)||[""],u=t.length;u--;)if(s=De.exec(t[u])||[],p=g=s[1],h=(s[2]||"").split(".").sort(),p){for(f=re.event.special[p]||{},p=(r?f.delegateType:f.bindType)||p,d=l[p]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=a=d.length;a--;)c=d[a],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(d.splice(a,1),c.selector&&d.delegateCount--,f.remove&&f.remove.call(e,c));o&&!d.length&&(f.teardown&&f.teardown.call(e,h,m.handle)!==!1||re.removeEvent(e,p,m.handle),delete l[p])}else for(p in l)re.event.remove(e,p+t[u],n,r,!0);re.isEmptyObject(l)&&(delete m.handle,_e.remove(e,"events"))}},trigger:function(e,t,r,i){var a,o,s,l,u,c,f,d=[r||te],p=J.call(e,"type")?e.type:e,h=J.call(e,"namespace")?e.namespace.split("."):[];if(o=s=r=r||te,3!==r.nodeType&&8!==r.nodeType&&!je.test(p+re.event.triggered)&&(p.indexOf(".")>=0&&(h=p.split("."),p=h.shift(),h.sort()),u=p.indexOf(":")<0&&"on"+p,e=e[re.expando]?e:new re.Event(p,"object"==typeof e&&e),e.isTrigger=i?2:3,e.namespace=h.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:re.makeArray(t,[e]),f=re.event.special[p]||{},i||!f.trigger||f.trigger.apply(r,t)!==!1)){if(!i&&!f.noBubble&&!re.isWindow(r)){for(l=f.delegateType||p,je.test(l+p)||(o=o.parentNode);o;o=o.parentNode)d.push(o),s=o;s===(r.ownerDocument||te)&&d.push(s.defaultView||s.parentWindow||n)}for(a=0;(o=d[a++])&&!e.isPropagationStopped();)e.type=a>1?l:f.bindType||p,c=(_e.get(o,"events")||{})[e.type]&&_e.get(o,"handle"),c&&c.apply(o,t),c=u&&o[u],c&&c.apply&&re.acceptData(o)&&(e.result=c.apply(o,t),e.result===!1&&e.preventDefault());return e.type=p,i||e.isDefaultPrevented()||f._default&&f._default.apply(d.pop(),t)!==!1||!re.acceptData(r)||u&&re.isFunction(r[p])&&!re.isWindow(r)&&(s=r[u],s&&(r[u]=null),re.event.triggered=p,r[p](),re.event.triggered=void 0,s&&(r[u]=s)),e.result}},dispatch:function(e){e=re.event.fix(e);var t,n,r,i,a,o=[],s=G.call(arguments),l=(_e.get(this,"events")||{})[e.type]||[],u=re.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!u.preDispatch||u.preDispatch.call(this,e)!==!1){for(o=re.event.handlers.call(this,e,l),t=0;(i=o[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,n=0;(a=i.handlers[n++])&&!e.isImmediatePropagationStopped();)(!e.namespace_re||e.namespace_re.test(a.namespace))&&(e.handleObj=a,e.data=a.data,r=((re.event.special[a.origType]||{}).handle||a.handler).apply(i.elem,s),void 0!==r&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,a,o=[],s=t.delegateCount,l=e.target;if(s&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!==this;l=l.parentNode||this)if(l.disabled!==!0||"click"!==e.type){for(r=[],n=0;s>n;n++)a=t[n],i=a.selector+" ",void 0===r[i]&&(r[i]=a.needsContext?re(i,this).index(l)>=0:re.find(i,this,null,[l]).length),r[i]&&r.push(a);r.length&&o.push({elem:l,handlers:r})}return s]*)\/>/gi,Re=/<([\w:]+)/,Le=/<|?\w+;/,He=/<(?:script|style|link)/i,qe=/checked\s*(?:[^=]|=\s*.checked.)/i,Ie=/^$|\/(?:java|ecma)script/i,Be=/^true\/(.*)/,$e=/^\s*\s*$/g,Fe={option:[1,""," "],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};Fe.optgroup=Fe.option,Fe.tbody=Fe.tfoot=Fe.colgroup=Fe.caption=Fe.thead,Fe.th=Fe.td,re.extend({clone:function(e,t,n){var r,i,a,o,s=e.cloneNode(!0),l=re.contains(e.ownerDocument,e);if(!(ee.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||re.isXMLDoc(e)))for(o=_(s),a=_(e),r=0,i=a.length;i>r;r++)w(a[r],o[r]);if(t)if(n)for(a=a||_(e),o=o||_(s),r=0,i=a.length;i>r;r++)x(a[r],o[r]);else x(e,s);return o=_(s,"script"),o.length>0&&b(o,!l&&_(e,"script")),s},buildFragment:function(e,t,n,r){for(var i,a,o,s,l,u,c=t.createDocumentFragment(),f=[],d=0,p=e.length;p>d;d++)if(i=e[d],i||0===i)if("object"===re.type(i))re.merge(f,i.nodeType?[i]:i);else if(Le.test(i)){for(a=a||c.appendChild(t.createElement("div")),o=(Re.exec(i)||["",""])[1].toLowerCase(),s=Fe[o]||Fe._default,a.innerHTML=s[1]+i.replace(Pe,"<$1>$2>")+s[2],u=s[0];u--;)a=a.lastChild;re.merge(f,a.childNodes),a=c.firstChild,a.textContent=""}else f.push(t.createTextNode(i));for(c.textContent="",d=0;i=f[d++];)if((!r||-1===re.inArray(i,r))&&(l=re.contains(i.ownerDocument,i),a=_(c.appendChild(i),"script"),l&&b(a),n))for(u=0;i=a[u++];)Ie.test(i.type||"")&&n.push(i);return c},cleanData:function(e){for(var t,n,r,i,a=re.event.special,o=0;void 0!==(n=e[o]);o++){if(re.acceptData(n)&&(i=n[_e.expando],i&&(t=_e.cache[i]))){if(t.events)for(r in t.events)a[r]?re.event.remove(n,r):re.removeEvent(n,r,t.handle);_e.cache[i]&&delete _e.cache[i]}delete we.cache[n[we.expando]]}}}),re.fn.extend({text:function(e){return xe(this,function(e){return void 0===e?re.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=e)})},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=m(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=m(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var n,r=e?re.filter(e,this):this,i=0;null!=(n=r[i]);i++)t||1!==n.nodeType||re.cleanData(_(n)),n.parentNode&&(t&&re.contains(n.ownerDocument,n)&&b(_(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(re.cleanData(_(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return re.clone(this,e,t)})},html:function(e){return xe(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!He.test(e)&&!Fe[(Re.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(Pe,"<$1>$2>");try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(re.cleanData(_(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,re.cleanData(_(this)),e&&e.replaceChild(t,this)}),e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t){e=X.apply([],e);var n,r,i,a,o,s,l=0,u=this.length,c=this,f=u-1,d=e[0],p=re.isFunction(d);if(p||u>1&&"string"==typeof d&&!ee.checkClone&&qe.test(d))return this.each(function(n){var r=c.eq(n);p&&(e[0]=d.call(this,n,r.html())),r.domManip(e,t)});if(u&&(n=re.buildFragment(e,this[0].ownerDocument,!1,this),r=n.firstChild,1===n.childNodes.length&&(n=r),r)){for(i=re.map(_(n,"script"),v),a=i.length;u>l;l++)o=n,l!==f&&(o=re.clone(o,!0,!0),a&&re.merge(i,_(o,"script"))),t.call(this[l],o,l);if(a)for(s=i[i.length-1].ownerDocument,re.map(i,y),l=0;a>l;l++)o=i[l],Ie.test(o.type||"")&&!_e.access(o,"globalEval")&&re.contains(s,o)&&(o.src?re._evalUrl&&re._evalUrl(o.src):re.globalEval(o.textContent.replace($e,"")))}return this}}),re.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){re.fn[e]=function(e){for(var n,r=[],i=re(e),a=i.length-1,o=0;a>=o;o++)n=o===a?this:this.clone(!0),re(i[o])[t](n),Z.apply(r,n.get());return this.pushStack(r)}});var ze,We={},Ue=/^margin/,Ke=new RegExp("^("+ke+")(?!px)[a-z%]+$","i"),Ge=function(e){return e.ownerDocument.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):n.getComputedStyle(e,null)};!function(){function e(){o.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",o.innerHTML="",i.appendChild(a);var e=n.getComputedStyle(o,null);t="1%"!==e.top,r="4px"===e.width,i.removeChild(a)}var t,r,i=te.documentElement,a=te.createElement("div"),o=te.createElement("div");o.style&&(o.style.backgroundClip="content-box",o.cloneNode(!0).style.backgroundClip="",ee.clearCloneStyle="content-box"===o.style.backgroundClip,a.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",a.appendChild(o),n.getComputedStyle&&re.extend(ee,{pixelPosition:function(){return e(),t},boxSizingReliable:function(){return null==r&&e(),r},reliableMarginRight:function(){var e,t=o.appendChild(te.createElement("div"));return t.style.cssText=o.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",o.style.width="1px",i.appendChild(a),e=!parseFloat(n.getComputedStyle(t,null).marginRight),i.removeChild(a),o.removeChild(t),e}}))}(),re.swap=function(e,t,n,r){var i,a,o={};for(a in t)o[a]=e.style[a],e.style[a]=t[a];i=n.apply(e,r||[]);for(a in t)e.style[a]=o[a];return i};var Xe=/^(none|table(?!-c[ea]).+)/,Ze=new RegExp("^("+ke+")(.*)$","i"),Ve=new RegExp("^([+-])=("+ke+")","i"),Qe={position:"absolute",visibility:"hidden",display:"block"},Ye={letterSpacing:"0",fontWeight:"400"},Je=["Webkit","O","Moz","ms"];re.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=k(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,a,o,s=re.camelCase(t),l=e.style;return t=re.cssProps[s]||(re.cssProps[s]=T(l,s)),o=re.cssHooks[t]||re.cssHooks[s],void 0===n?o&&"get"in o&&void 0!==(i=o.get(e,!1,r))?i:l[t]:(a=typeof n,"string"===a&&(i=Ve.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(re.css(e,t)),a="number"),null!=n&&n===n&&("number"!==a||re.cssNumber[s]||(n+="px"),ee.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),o&&"set"in o&&void 0===(n=o.set(e,n,r))||(l[t]=n)),void 0)}},css:function(e,t,n,r){var i,a,o,s=re.camelCase(t);return t=re.cssProps[s]||(re.cssProps[s]=T(e.style,s)),o=re.cssHooks[t]||re.cssHooks[s],o&&"get"in o&&(i=o.get(e,!0,n)),void 0===i&&(i=k(e,t,r)),"normal"===i&&t in Ye&&(i=Ye[t]),""===n||n?(a=parseFloat(i),n===!0||re.isNumeric(a)?a||0:i):i}}),re.each(["height","width"],function(e,t){re.cssHooks[t]={get:function(e,n,r){return n?Xe.test(re.css(e,"display"))&&0===e.offsetWidth?re.swap(e,Qe,function(){return O(e,t,r)}):O(e,t,r):void 0},set:function(e,n,r){var i=r&&Ge(e);return S(e,n,r?A(e,t,r,"border-box"===re.css(e,"boxSizing",!1,i),i):0)}}}),re.cssHooks.marginRight=C(ee.reliableMarginRight,function(e,t){return t?re.swap(e,{display:"inline-block"},k,[e,"marginRight"]):void 0}),re.each({margin:"",padding:"",border:"Width"},function(e,t){re.cssHooks[e+t]={expand:function(n){for(var r=0,i={},a="string"==typeof n?n.split(" "):[n];4>r;r++)i[e+Ce[r]+t]=a[r]||a[r-2]||a[0];return i}},Ue.test(e)||(re.cssHooks[e+t].set=S)}),re.fn.extend({css:function(e,t){return xe(this,function(e,t,n){var r,i,a={},o=0;if(re.isArray(t)){for(r=Ge(e),i=t.length;i>o;o++)a[t[o]]=re.css(e,t[o],!1,r);return a}return void 0!==n?re.style(e,t,n):re.css(e,t)},e,t,arguments.length>1)},show:function(){return M(this,!0)},hide:function(){return M(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Te(this)?re(this).show():re(this).hide()})}}),re.Tween=j,j.prototype={constructor:j,init:function(e,t,n,r,i,a){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=a||(re.cssNumber[n]?"":"px")},cur:function(){var e=j.propHooks[this.prop];return e&&e.get?e.get(this):j.propHooks._default.get(this)},run:function(e){var t,n=j.propHooks[this.prop];return this.options.duration?this.pos=t=re.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):j.propHooks._default.set(this),this}},j.prototype.init.prototype=j.prototype,j.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=re.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){re.fx.step[e.prop]?re.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[re.cssProps[e.prop]]||re.cssHooks[e.prop])?re.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},j.propHooks.scrollTop=j.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},re.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},re.fx=j.prototype.init,re.fx.step={};var et,tt,nt=/^(?:toggle|show|hide)$/,rt=new RegExp("^(?:([+-])=|)("+ke+")([a-z%]*)$","i"),it=/queueHooks$/,at=[L],ot={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=rt.exec(t),a=i&&i[3]||(re.cssNumber[e]?"":"px"),o=(re.cssNumber[e]||"px"!==a&&+r)&&rt.exec(re.css(n.elem,e)),s=1,l=20;if(o&&o[3]!==a){a=a||o[3],i=i||[],o=+r||1;do s=s||".5",o/=s,re.style(n.elem,e,o+a);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(o=n.start=+o||+r||0,n.unit=a,n.end=i[1]?o+(i[1]+1)*i[2]:+i[2]),n}]};re.Animation=re.extend(q,{tweener:function(e,t){re.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;i>r;r++)n=e[r],ot[n]=ot[n]||[],ot[n].unshift(t)},prefilter:function(e,t){t?at.unshift(e):at.push(e)}}),re.speed=function(e,t,n){var r=e&&"object"==typeof e?re.extend({},e):{complete:n||!n&&t||re.isFunction(e)&&e,duration:e,easing:n&&t||t&&!re.isFunction(t)&&t
-};return r.duration=re.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in re.fx.speeds?re.fx.speeds[r.duration]:re.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){re.isFunction(r.old)&&r.old.call(this),r.queue&&re.dequeue(this,r.queue)},r},re.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Te).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=re.isEmptyObject(e),a=re.speed(t,n,r),o=function(){var t=q(this,re.extend({},e),a);(i||_e.get(this,"finish"))&&t.stop(!0)};return o.finish=o,i||a.queue===!1?this.each(o):this.queue(a.queue,o)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",a=re.timers,o=_e.get(this);if(i)o[i]&&o[i].stop&&r(o[i]);else for(i in o)o[i]&&o[i].stop&&it.test(i)&&r(o[i]);for(i=a.length;i--;)a[i].elem!==this||null!=e&&a[i].queue!==e||(a[i].anim.stop(n),t=!1,a.splice(i,1));(t||!n)&&re.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=_e.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],a=re.timers,o=r?r.length:0;for(n.finish=!0,re.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=a.length;t--;)a[t].elem===this&&a[t].queue===e&&(a[t].anim.stop(!0),a.splice(t,1));for(t=0;o>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),re.each(["toggle","show","hide"],function(e,t){var n=re.fn[t];re.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(P(t,!0),e,r,i)}}),re.each({slideDown:P("show"),slideUp:P("hide"),slideToggle:P("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){re.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),re.timers=[],re.fx.tick=function(){var e,t=0,n=re.timers;for(et=re.now();t1)},removeAttr:function(e){return this.each(function(){re.removeAttr(this,e)})}}),re.extend({attr:function(e,t,n){var r,i,a=e.nodeType;if(e&&3!==a&&8!==a&&2!==a)return typeof e.getAttribute===Ae?re.prop(e,t,n):(1===a&&re.isXMLDoc(e)||(t=t.toLowerCase(),r=re.attrHooks[t]||(re.expr.match.bool.test(t)?lt:st)),void 0===n?r&&"get"in r&&null!==(i=r.get(e,t))?i:(i=re.find.attr(e,t),null==i?void 0:i):null!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:(e.setAttribute(t,n+""),n):void re.removeAttr(e,t))},removeAttr:function(e,t){var n,r,i=0,a=t&&t.match(ve);if(a&&1===e.nodeType)for(;n=a[i++];)r=re.propFix[n]||n,re.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!ee.radioValue&&"radio"===t&&re.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}}}),lt={set:function(e,t,n){return t===!1?re.removeAttr(e,n):e.setAttribute(n,n),n}},re.each(re.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ut[t]||re.find.attr;ut[t]=function(e,t,r){var i,a;return r||(a=ut[t],ut[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,ut[t]=a),i}});var ct=/^(?:input|select|textarea|button)$/i;re.fn.extend({prop:function(e,t){return xe(this,re.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[re.propFix[e]||e]})}}),re.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,a,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return a=1!==o||!re.isXMLDoc(e),a&&(t=re.propFix[t]||t,i=re.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||ct.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),ee.optSelected||(re.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),re.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){re.propFix[this.toLowerCase()]=this});var ft=/[\t\r\n\f]/g;re.fn.extend({addClass:function(e){var t,n,r,i,a,o,s="string"==typeof e&&e,l=0,u=this.length;if(re.isFunction(e))return this.each(function(t){re(this).addClass(e.call(this,t,this.className))});if(s)for(t=(e||"").match(ve)||[];u>l;l++)if(n=this[l],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(ft," "):" ")){for(a=0;i=t[a++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");o=re.trim(r),n.className!==o&&(n.className=o)}return this},removeClass:function(e){var t,n,r,i,a,o,s=0===arguments.length||"string"==typeof e&&e,l=0,u=this.length;if(re.isFunction(e))return this.each(function(t){re(this).removeClass(e.call(this,t,this.className))});if(s)for(t=(e||"").match(ve)||[];u>l;l++)if(n=this[l],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(ft," "):"")){for(a=0;i=t[a++];)for(;r.indexOf(" "+i+" ")>=0;)r=r.replace(" "+i+" "," ");o=e?re.trim(r):"",n.className!==o&&(n.className=o)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):re.isFunction(e)?this.each(function(n){re(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n)for(var t,r=0,i=re(this),a=e.match(ve)||[];t=a[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else(n===Ae||"boolean"===n)&&(this.className&&_e.set(this,"__className__",this.className),this.className=this.className||e===!1?"":_e.get(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(ft," ").indexOf(t)>=0)return!0;return!1}});var dt=/\r/g;re.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=re.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,re(this).val()):e,null==i?i="":"number"==typeof i?i+="":re.isArray(i)&&(i=re.map(i,function(e){return null==e?"":e+""})),t=re.valHooks[this.type]||re.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=re.valHooks[i.type]||re.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(dt,""):null==n?"":n)}}}),re.extend({valHooks:{option:{get:function(e){var t=re.find.attr(e,"value");return null!=t?t:re.trim(re.text(e))}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,a="select-one"===e.type||0>i,o=a?null:[],s=a?i+1:r.length,l=0>i?s:a?i:0;s>l;l++)if(n=r[l],(n.selected||l===i)&&(ee.optDisabled?!n.disabled:null===n.getAttribute("disabled"))&&(!n.parentNode.disabled||!re.nodeName(n.parentNode,"optgroup"))){if(t=re(n).val(),a)return t;o.push(t)}return o},set:function(e,t){for(var n,r,i=e.options,a=re.makeArray(t),o=i.length;o--;)r=i[o],(r.selected=re.inArray(r.value,a)>=0)&&(n=!0);return n||(e.selectedIndex=-1),a}}}}),re.each(["radio","checkbox"],function(){re.valHooks[this]={set:function(e,t){return re.isArray(t)?e.checked=re.inArray(re(e).val(),t)>=0:void 0}},ee.checkOn||(re.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),re.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){re.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),re.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var pt=re.now(),ht=/\?/;re.parseJSON=function(e){return JSON.parse(e+"")},re.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=void 0}return(!t||t.getElementsByTagName("parsererror").length)&&re.error("Invalid XML: "+e),t};var gt=/#.*$/,mt=/([?&])_=[^&]*/,vt=/^(.*?):[ \t]*([^\r\n]*)$/gm,yt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,bt=/^(?:GET|HEAD)$/,xt=/^\/\//,_t=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,wt={},Et={},Nt="*/".concat("*"),kt=n.location.href,Ct=_t.exec(kt.toLowerCase())||[];re.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:kt,type:"GET",isLocal:yt.test(Ct[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Nt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":re.parseJSON,"text xml":re.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?$($(e,re.ajaxSettings),t):$(re.ajaxSettings,e)},ajaxPrefilter:I(wt),ajaxTransport:I(Et),ajax:function(e,t){function n(e,t,n,o){var l,c,v,y,x,w=t;2!==b&&(b=2,s&&clearTimeout(s),r=void 0,a=o||"",_.readyState=e>0?4:0,l=e>=200&&300>e||304===e,n&&(y=F(f,_,n)),y=z(f,y,_,l),l?(f.ifModified&&(x=_.getResponseHeader("Last-Modified"),x&&(re.lastModified[i]=x),x=_.getResponseHeader("etag"),x&&(re.etag[i]=x)),204===e||"HEAD"===f.type?w="nocontent":304===e?w="notmodified":(w=y.state,c=y.data,v=y.error,l=!v)):(v=w,(e||!w)&&(w="error",0>e&&(e=0))),_.status=e,_.statusText=(t||w)+"",l?h.resolveWith(d,[c,w,_]):h.rejectWith(d,[_,w,v]),_.statusCode(m),m=void 0,u&&p.trigger(l?"ajaxSuccess":"ajaxError",[_,f,l?c:v]),g.fireWith(d,[_,w]),u&&(p.trigger("ajaxComplete",[_,f]),--re.active||re.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,a,o,s,l,u,c,f=re.ajaxSetup({},t),d=f.context||f,p=f.context&&(d.nodeType||d.jquery)?re(d):re.event,h=re.Deferred(),g=re.Callbacks("once memory"),m=f.statusCode||{},v={},y={},b=0,x="canceled",_={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!o)for(o={};t=vt.exec(a);)o[t[1].toLowerCase()]=t[2];t=o[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=y[n]=y[n]||e,v[e]=t),this},overrideMimeType:function(e){return b||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else _.always(e[_.status]);return this},abort:function(e){var t=e||x;return r&&r.abort(t),n(0,t),this}};if(h.promise(_).complete=g.add,_.success=_.done,_.error=_.fail,f.url=((e||f.url||kt)+"").replace(gt,"").replace(xt,Ct[1]+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=re.trim(f.dataType||"*").toLowerCase().match(ve)||[""],null==f.crossDomain&&(l=_t.exec(f.url.toLowerCase()),f.crossDomain=!(!l||l[1]===Ct[1]&&l[2]===Ct[2]&&(l[3]||("http:"===l[1]?"80":"443"))===(Ct[3]||("http:"===Ct[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=re.param(f.data,f.traditional)),B(wt,f,t,_),2===b)return _;u=re.event&&f.global,u&&0===re.active++&&re.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!bt.test(f.type),i=f.url,f.hasContent||(f.data&&(i=f.url+=(ht.test(i)?"&":"?")+f.data,delete f.data),f.cache===!1&&(f.url=mt.test(i)?i.replace(mt,"$1_="+pt++):i+(ht.test(i)?"&":"?")+"_="+pt++)),f.ifModified&&(re.lastModified[i]&&_.setRequestHeader("If-Modified-Since",re.lastModified[i]),re.etag[i]&&_.setRequestHeader("If-None-Match",re.etag[i])),(f.data&&f.hasContent&&f.contentType!==!1||t.contentType)&&_.setRequestHeader("Content-Type",f.contentType),_.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Nt+"; q=0.01":""):f.accepts["*"]);for(c in f.headers)_.setRequestHeader(c,f.headers[c]);if(f.beforeSend&&(f.beforeSend.call(d,_,f)===!1||2===b))return _.abort();x="abort";for(c in{success:1,error:1,complete:1})_[c](f[c]);if(r=B(Et,f,t,_)){_.readyState=1,u&&p.trigger("ajaxSend",[_,f]),f.async&&f.timeout>0&&(s=setTimeout(function(){_.abort("timeout")},f.timeout));try{b=1,r.send(v,n)}catch(w){if(!(2>b))throw w;n(-1,w)}}else n(-1,"No Transport");return _},getJSON:function(e,t,n){return re.get(e,t,n,"json")},getScript:function(e,t){return re.get(e,void 0,t,"script")}}),re.each(["get","post"],function(e,t){re[t]=function(e,n,r,i){return re.isFunction(n)&&(i=i||r,r=n,n=void 0),re.ajax({url:e,type:t,dataType:i,data:n,success:r})}}),re._evalUrl=function(e){return re.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},re.fn.extend({wrapAll:function(e){var t;return re.isFunction(e)?this.each(function(t){re(this).wrapAll(e.call(this,t))}):(this[0]&&(t=re(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return re.isFunction(e)?this.each(function(t){re(this).wrapInner(e.call(this,t))}):this.each(function(){var t=re(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=re.isFunction(e);return this.each(function(n){re(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){re.nodeName(this,"body")||re(this).replaceWith(this.childNodes)}).end()}}),re.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},re.expr.filters.visible=function(e){return!re.expr.filters.hidden(e)};var Tt=/%20/g,St=/\[\]$/,At=/\r?\n/g,Ot=/^(?:submit|button|image|reset|file)$/i,Mt=/^(?:input|select|textarea|keygen)/i;re.param=function(e,t){var n,r=[],i=function(e,t){t=re.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=re.ajaxSettings&&re.ajaxSettings.traditional),re.isArray(e)||e.jquery&&!re.isPlainObject(e))re.each(e,function(){i(this.name,this.value)});else for(n in e)W(n,e[n],t,i);return r.join("&").replace(Tt,"+")},re.fn.extend({serialize:function(){return re.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=re.prop(this,"elements");return e?re.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!re(this).is(":disabled")&&Mt.test(this.nodeName)&&!Ot.test(e)&&(this.checked||!Se.test(e))}).map(function(e,t){var n=re(this).val();return null==n?null:re.isArray(n)?re.map(n,function(e){return{name:t.name,value:e.replace(At,"\r\n")}}):{name:t.name,value:n.replace(At,"\r\n")}}).get()}}),re.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var jt=0,Dt={},Pt={0:200,1223:204},Rt=re.ajaxSettings.xhr();n.attachEvent&&n.attachEvent("onunload",function(){for(var e in Dt)Dt[e]()}),ee.cors=!!Rt&&"withCredentials"in Rt,ee.ajax=Rt=!!Rt,re.ajaxTransport(function(e){var t;return ee.cors||Rt&&!e.crossDomain?{send:function(n,r){var i,a=e.xhr(),o=++jt;if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)a[i]=e.xhrFields[i];e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)a.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete Dt[o],t=a.onload=a.onerror=null,"abort"===e?a.abort():"error"===e?r(a.status,a.statusText):r(Pt[a.status]||a.status,a.statusText,"string"==typeof a.responseText?{text:a.responseText}:void 0,a.getAllResponseHeaders()))}},a.onload=t(),a.onerror=t("error"),t=Dt[o]=t("abort");try{a.send(e.hasContent&&e.data||null)}catch(s){if(t)throw s}},abort:function(){t&&t()}}:void 0}),re.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return re.globalEval(e),e}}}),re.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),re.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=re("",returnEnd:!0,subLanguage:["actionscript","javascript","handlebars"]}},n,{className:"pi",begin:/<\?\w+/,end:/\?>/,relevance:10},{className:"tag",begin:"?",end:"/?>",contains:[{className:"title",begin:/[^ \/><\n\t]+/,relevance:0},r]}]}}),e.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],contains:[{className:"header",variants:[{begin:"^#{1,6}",end:"$"},{begin:"^.+?\\n[=-]{2,}$"}]},{begin:"<",end:">",subLanguage:"xml",relevance:0},{className:"bullet",begin:"^([*+-]|(\\d+\\.))\\s+"},{className:"strong",begin:"[*_]{2}.+?[*_]{2}"},{className:"emphasis",variants:[{begin:"\\*.+?\\*"},{begin:"_.+?_",relevance:0}]},{className:"blockquote",begin:"^>\\s+",end:"$"},{className:"code",variants:[{begin:"`.+?`"},{begin:"^( {4}| )",end:"$",relevance:0}]},{className:"horizontal_rule",begin:"^[-\\*]{3,}",end:"$"},{begin:"\\[.+?\\][\\(\\[].*?[\\)\\]]",returnBegin:!0,contains:[{className:"link_label",begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0,relevance:0},{className:"link_url",begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"link_reference",begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}],relevance:10},{begin:"^\\[.+\\]:",returnBegin:!0,contains:[{className:"link_reference",begin:"\\[",end:"\\]:",excludeBegin:!0,excludeEnd:!0,starts:{className:"link_url",end:"$"}}]}]}}),e.registerLanguage("sql",function(e){var t=e.COMMENT("--","$");return{case_insensitive:!0,illegal:/[<>{}*]/,contains:[{className:"operator",beginKeywords:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke",end:/;/,endsWithParent:!0,keywords:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes c cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle d data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration e each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract f failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function g general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http i id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists k keep keep_duplicates key keys kill l language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim m main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex n name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding p package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime t table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},contains:[{className:"string",begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE,{begin:"''"}]},{className:"string",begin:'"',end:'"',contains:[e.BACKSLASH_ESCAPE,{begin:'""'}]},{className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,t]},e.C_BLOCK_COMMENT_MODE,t]}}),e})},function(e,t,n){"use strict";function r(e){_.forEach(function(t){t===e?g["default"](t).parent().addClass("selected"):g["default"](t).parent().removeClass("selected")})}function i(){var e=g["default"]("#full-list"),t=g["default"]("#full-list .clicked");t.length>0&&e.scrollTop(t.offset().top-e.offset().top-40)}function a(e,t){function n(t){var n=e[t],r=g["default"]("#full-list");r.replaceWith(x["default"]({nodes:n,group:""}))}var i=y.getModuleType();t=t||i,n(t),r(["#",t,"-list"].join("")),g["default"]("#full-list li a").on("click",function(e){var t=g["default"](e.target);t.hasClass("expand")?(e.preventDefault(),g["default"](e.target).closest("li").toggleClass("open")):(g["default"]("#full-list .clicked li.active").removeClass("active"),g["default"](e.target).closest("li").addClass("active"))})}function o(e){return function(t){t.preventDefault(),a(sidebarNodes,e),i()}}function s(){w.on("click","#extras-list",o("extras")),w.on("click","#modules-list",o("modules")),w.on("click","#exceptions-list",o("exceptions")),w.on("click","#protocols-list",o("protocols")),g["default"](".sidebar-search input").on("keyup",function(e){13===e.which?m.start():27===e.which&&g["default"](this).val("")}),g["default"](".sidebar-search i.icon-search").on("click",function(e){m.start()})}function l(){var e=window.location.hash.replace(/^#/,"");e||(e="content");var t=sidebarNodes[y.getModuleType()],n=y.findSidebarCategory(t,e);g["default"]('#full-list .clicked a.expand[href$="#'+n+'"]').closest("li").addClass("open"),g["default"]('#full-list .clicked a[href$="#'+e+'"]').closest("li").addClass("active")}function u(){E.find("a").has("code").addClass("no-underline"),E.find("a").has("img").addClass("no-underline")}function c(){E.attr("tabindex",-1).focus()}function f(){a(sidebarNodes),s(),i(),l(),u(),c()}var d=n(1)["default"],p=n(5)["default"];Object.defineProperty(t,"__esModule",{value:!0}),t.initialize=f;var h=n(2),g=d(h),m=n(6),v=n(7),y=p(v),b=n(90),x=d(b),_=["#extras-list","#modules-list","#exceptions-list","#protocols-list"],w=g["default"](".sidebar-listNav"),E=g["default"](".content")},function(e,t){"use strict";t["default"]=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t},t.__esModule=!0},function(e,t,n){"use strict";function r(e){var t=e.index,n=e.index+e[0].length,r=e.input,i=""+e[0]+" ";return r.slice(0,t)+i+r.slice(n)}function i(e){return!!e}function a(e,t,n){return(e||[]).map(function(e){var i=(t+"."+e.id).match(n),a=e.id&&e.id.match(n);if(i||a){var o=JSON.parse(JSON.stringify(e));return o.match=a?r(a):e.id,o}}).filter(i)}function o(e,t){return e.map(function(e){var n=e.id,i=n&&n.match(t),o=a(e.functions,n,t),s=a(e.macros,n,t),l=a(e.callbacks,n,t),u={id:e.id,match:i?r(i):e.id};return o.length>0&&(u.functions=o),s.length>0&&(u.macros=s),l.length>0&&(u.callbacks=l),i||o.length>0||s.length>0||l.length>0?u:void 0}).filter(i)}function s(e,t){function n(e){var t=e||window.event;"object"==typeof t&&null!==t&&(t.metaKey||t.shiftKey||t.altKey||t.ctrlKey||1===t.button||2===t.button)||(u.remove(),c.fadeIn())}var r=new RegExp(h.escapeText(t),"i"),i=[],a=o(e.modules,r),s=o(e.exceptions,r),l=o(e.protocols,r);a.length>0&&i.push({name:"Modules",results:a}),s.length>0&&i.push({name:"Exceptions",results:s}),l.length>0&&i.push({name:"Protocols",results:l});var u=d["default"](m["default"]({value:t,levels:i,empty:0===i.length})),c=v.children();c.hide(),v.append(u),u.find(".close-search").on("click",function(e){e.preventDefault()}),d["default"].merge(u.find("a"),b).on("click",n),u.fadeIn(function(){v.parent().scrollTop(0)})}function l(){var e=y.val();""!==e&&s(sidebarNodes,e)}var u=n(1)["default"],c=n(5)["default"];Object.defineProperty(t,"__esModule",{value:!0}),t.findIn=o,t.start=l;var f=n(2),d=u(f),p=n(7),h=c(p),g=n(70),m=u(g),v=d["default"](".content-inner"),y=d["default"](".sidebar-search input"),b=d["default"]("#full-list li")},function(e,t,n){"use strict";function r(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function i(){return u["default"]("body").data("type")}function a(e,t){var n=!0,r=!1,i=void 0;try{for(var a,s=o(e);!(n=(a=s.next()).done);n=!0){var l=a.value,u=p["default"](l,function(e,n){var r=f["default"](e,function(e){var n=e.anchor;return n===t});return r});if(u)return u}}catch(c){r=!0,i=c}finally{try{!n&&s["return"]&&s["return"]()}finally{if(r)throw i}}}var o=n(8)["default"],s=n(1)["default"];Object.defineProperty(t,"__esModule",{value:!0}),t.escapeText=r,t.getModuleType=i,t.findSidebarCategory=a;var l=n(2),u=s(l),c=n(44),f=s(c),d=n(57),p=s(d)},function(e,t,n){e.exports={"default":n(9),__esModule:!0}},function(e,t,n){n(10),n(36),e.exports=n(39)},function(e,t,n){n(11);var r=n(14);r.NodeList=r.HTMLCollection=r.Array},function(e,t,n){"use strict";var r=n(12),i=n(13),a=n(14),o=n(15);n(19)(Array,"Array",function(e,t){this._t=o(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,n):"values"==t?i(0,e[n]):i(0,[n,e[n]])},"values"),a.Arguments=a.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t){e.exports={}},function(e,t,n){var r=n(16),i=n(18);e.exports=function(e){return r(i(e))}},function(e,t,n){var r=n(17);e.exports=0 in Object("z")?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){"use strict";var r=n(20),i=n(21),a=n(24),o=n(25),s=n(30),l=n(31)("iterator"),u=n(14),c=!([].keys&&"next"in[].keys()),f="@@iterator",d="keys",p="values",h=function(){return this};e.exports=function(e,t,g,m,v,y,b){n(34)(g,t,m);var x,_,w=function(e){switch(e){case d:return function(){return new g(this,e)};case p:return function(){return new g(this,e)}}return function(){return new g(this,e)}},E=t+" Iterator",N=e.prototype,k=N[l]||N[f]||v&&N[v],C=k||w(v);if(k){var T=n(26).getProto(C.call(new e));n(35)(T,E,!0),!r&&s(N,f)&&o(T,l,h)}if((!r||b)&&o(N,l,C),u[t]=C,u[E]=h,v)if(x={keys:y?C:w(d),values:v==p?C:w(p),entries:v!=p?C:w("entries")},b)for(_ in x)_ in N||a(N,_,x[_]);else i(i.P+i.F*c,t,x)}},function(e,t){e.exports=!0},function(e,t,n){var r=n(22),i=n(23),a="prototype",o=function(e,t){return function(){return e.apply(t,arguments)}},s=function(e,t,n){var l,u,c,f,d=e&s.G,p=e&s.P,h=d?r:e&s.S?r[t]:(r[t]||{})[a],g=d?i:i[t]||(i[t]={});d&&(n=t);for(l in n)u=!(e&s.F)&&h&&l in h,u&&l in g||(c=u?h[l]:n[l],d&&"function"!=typeof h[l]?f=n[l]:e&s.B&&u?f=o(c,r):e&s.W&&h[l]==c?!function(e){f=function(t){return this instanceof e?new e(t):e(t)},f[a]=e[a]}(c):f=p&&"function"==typeof c?o(Function.call,c):c,g[l]=f,p&&((g[a]||(g[a]={}))[l]=c))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,e.exports=s},function(e,t){var n="undefined",r=e.exports=typeof window!=n&&window.Math==Math?window:typeof self!=n&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(e,t){var n=e.exports={};"number"==typeof __e&&(__e=n)},function(e,t,n){e.exports=n(25)},function(e,t,n){var r=n(26),i=n(27);e.exports=n(28)?function(e,t,n){return r.setDesc(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){var n=Object;e.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){e.exports=!n(29)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(32)("wks"),i=n(22).Symbol;e.exports=function(e){return r[e]||(r[e]=i&&i[e]||(i||n(33))("Symbol."+e))}},function(e,t,n){var r=n(22),i="__core-js_shared__",a=r[i]||(r[i]={});e.exports=function(e){return a[e]||(a[e]={})}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){"use strict";var r=n(26),i={};
-n(25)(i,n(31)("iterator"),function(){return this}),e.exports=function(e,t,a){e.prototype=r.create(i,{next:n(27)(1,a)}),n(35)(e,t+" Iterator")}},function(e,t,n){var r=n(30),i=n(25),a=n(31)("toStringTag");e.exports=function(e,t,n){e&&!r(e=n?e:e.prototype,a)&&i(e,a,t)}},function(e,t,n){"use strict";var r=n(37)(!0);n(19)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var r=n(38),i=n(18);e.exports=function(e){return function(t,n){var a,o,s=String(i(t)),l=r(n),u=s.length;return 0>l||l>=u?e?"":void 0:(a=s.charCodeAt(l),55296>a||a>56319||l+1===u||(o=s.charCodeAt(l+1))<56320||o>57343?e?s.charAt(l):a:e?s.slice(l,l+2):(a-55296<<10)+(o-56320)+65536)}}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(40),i=n(42);e.exports=n(23).getIterator=function(e){var t=i(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},function(e,t,n){var r=n(41);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}},function(e,t,n){var r=n(43),i=n(31)("iterator"),a=n(14);e.exports=n(23).getIteratorMethod=function(e){return void 0!=e?e[i]||e["@@iterator"]||a[r(e)]:void 0}},function(e,t,n){var r=n(17),i=n(31)("toStringTag"),a="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=(t=Object(e))[i])?n:a?r(t):"Object"==(o=r(t))&&"function"==typeof t.callee?"Arguments":o}},function(e,t,n){function r(e,t){return function(n,r,a){if(r=i(r,a,3),l(n)){var u=s(n,r,t);return u>-1?n[u]:void 0}return o(n,r,e)}}var i=n(45),a=n(54),o=n(55),s=n(56),l=n(47),u=r(a);e.exports=u},[97,46,52,47,53],[98,47,48,49],function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e,t){var n=null==e?void 0:e[t];return s(n)?n:void 0}function i(e){return"number"==typeof e&&e>-1&&e%1==0&&v>=e}function a(e){return o(e)&&h.call(e)==u}function o(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function s(e){return null==e?!1:a(e)?g.test(d.call(e)):n(e)&&c.test(e)}var l="[object Array]",u="[object Function]",c=/^\[object .+?Constructor\]$/,f=Object.prototype,d=Function.prototype.toString,p=f.hasOwnProperty,h=f.toString,g=RegExp("^"+d.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),m=r(Array,"isArray"),v=9007199254740991,y=m||function(e){return n(e)&&i(e.length)&&h.call(e)==l};e.exports=y},function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e){return"number"==typeof e&&e>-1&&e%1==0&&M>=e}function i(e){return n(e)&&r(e.length)&&!!S[O.call(e)]}var a="[object Arguments]",o="[object Array]",s="[object Boolean]",l="[object Date]",u="[object Error]",c="[object Function]",f="[object Map]",d="[object Number]",p="[object Object]",h="[object RegExp]",g="[object Set]",m="[object String]",v="[object WeakMap]",y="[object ArrayBuffer]",b="[object Float32Array]",x="[object Float64Array]",_="[object Int8Array]",w="[object Int16Array]",E="[object Int32Array]",N="[object Uint8Array]",k="[object Uint8ClampedArray]",C="[object Uint16Array]",T="[object Uint32Array]",S={};S[b]=S[x]=S[_]=S[w]=S[E]=S[N]=S[k]=S[C]=S[T]=!0,S[a]=S[o]=S[y]=S[s]=S[l]=S[u]=S[c]=S[f]=S[d]=S[p]=S[h]=S[g]=S[m]=S[v]=!1;var A=Object.prototype,O=A.toString,M=9007199254740991;e.exports=i},[99,50,51,47],function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e,t){var n=null==e?void 0:e[t];return o(n)?n:void 0}function i(e){return a(e)&&d.call(e)==s}function a(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function o(e){return null==e?!1:i(e)?p.test(c.call(e)):n(e)&&l.test(e)}var s="[object Function]",l=/^\[object .+?Constructor\]$/,u=Object.prototype,c=Function.prototype.toString,f=u.hasOwnProperty,d=u.toString,p=RegExp("^"+c.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},function(e,t){function n(e){return!!e&&"object"==typeof e}function r(e){return function(t){return null==t?void 0:t[e]}}function i(e){return null!=e&&a(f(e))}function a(e){return"number"==typeof e&&e>-1&&e%1==0&&c>=e}function o(e){return n(e)&&i(e)&&l.call(e,"callee")&&!u.call(e,"callee")}var s=Object.prototype,l=s.hasOwnProperty,u=s.propertyIsEnumerable,c=9007199254740991,f=r("length");e.exports=o},function(e,t){function n(e,t,n){if("function"!=typeof e)return r;if(void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,a){return e.call(t,n,r,i,a)};case 5:return function(n,r,i,a,o){return e.call(t,n,r,i,a,o)}}return function(){return e.apply(t,arguments)}}function r(e){return e}e.exports=n},[100,49],function(e,t,n){function r(e,t){return p(e,t,c)}function i(e){return function(t){return null==t?void 0:t[e]}}function a(e,t){return function(n,r){var i=n?h(n):0;if(!s(i))return e(n,r);for(var a=t?i:-1,o=l(n);(t?a--:++a-1&&e%1==0&&f>=e}function l(e){return u(e)?e:Object(e)}function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var c=n(49),f=9007199254740991,d=a(r),p=o(),h=i("length");e.exports=d},function(e,t){function n(e,t,n,r){var i;return n(e,function(e,n,a){return t(e,n,a)?(i=r?n:e,!1):void 0}),i}e.exports=n},function(e,t){function n(e,t,n){for(var r=e.length,i=n?r:-1;n?i--:++i"+e.escapeExpression((a=null!=(a=n.value||(null!=t?t.value:t))?a:n.helperMissing,"function"==typeof a?a.call(t,{name:"value",hash:{},data:i}):a))+".\n"},3:function(e,t,n,r,i,a,o){var s;return null!=(s=n.each.call(t,null!=t?t.levels:t,{name:"each",hash:{},fn:e.program(4,i,0,a,o),inverse:e.noop,data:i}))?s:""},4:function(e,t,n,r,i,a,o){var s,l;return' '+e.escapeExpression((l=null!=(l=n.name||(null!=t?t.name:t))?l:n.helperMissing,"function"==typeof l?l.call(t,{name:"name",hash:{},data:i}):l))+" \n"+(null!=(s=n.each.call(t,null!=t?t.results:t,{name:"each",hash:{},fn:e.program(5,i,0,a,o),inverse:e.noop,data:i}))?s:"")},5:function(e,t,n,r,i,a,o){var s,l,u=n.helperMissing,c="function";return' \n
\n
\n'+(null!=(s=n.each.call(t,null!=t?t.functions:t,{name:"each",hash:{},fn:e.program(6,i,0,a,o),inverse:e.noop,data:i}))?s:"")+' \n
\n'+(null!=(s=n.each.call(t,null!=t?t.macros:t,{name:"each",hash:{},fn:e.program(6,i,0,a,o),inverse:e.noop,data:i}))?s:"")+' \n
\n'+(null!=(s=n.each.call(t,null!=t?t.callbacks:t,{name:"each",hash:{},fn:e.program(8,i,0,a,o),inverse:e.noop,data:i}))?s:"")+" \n
\n"},6:function(e,t,n,r,i,a,o){var s,l,u=n.helperMissing,c="function";return' '+(null!=(l=null!=(l=n.match||(null!=t?t.match:t))?l:u,s=typeof l===c?l.call(t,{name:"match",hash:{},data:i}):l)?s:"")+" \n"},8:function(e,t,n,r,i,a,o){var s,l,u=n.helperMissing,c="function";return' '+(null!=(l=null!=(l=n.match||(null!=t?t.match:t))?l:u,s=typeof l===c?l.call(t,{name:"match",hash:{},data:i}):l)?s:"")+" (callback) \n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i,a,o){var s,l;return'\n
Search Results for '+e.escapeExpression((l=null!=(l=n.value||(null!=t?t.value:t))?l:n.helperMissing,"function"==typeof l?l.call(t,{name:"value",hash:{},data:i}):l))+' \n\n
\n \n \n
\n\n\n'+(null!=(s=n["if"].call(t,null!=t?t.empty:t,{name:"if",hash:{},fn:e.program(1,i,0,a,o),inverse:e.program(3,i,0,a,o),data:i}))?s:"")+"
\n"},useData:!0,useDepths:!0})},function(e,t,n){e.exports=n(72)["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function a(){var e=new s.HandlebarsEnvironment;return p.extend(e,s),e.SafeString=u["default"],e.Exception=f["default"],e.Utils=p,e.escapeExpression=p.escapeExpression,e.VM=g,e.template=function(t){return g.template(t,e)},e}t.__esModule=!0;var o=n(73),s=i(o),l=n(87),u=r(l),c=n(75),f=r(c),d=n(74),p=i(d),h=n(88),g=i(h),m=n(89),v=r(m),y=a();y.create=a,v["default"](y),y["default"]=y,t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},l.registerDefaultHelpers(this),u.registerDefaultDecorators(this)}t.__esModule=!0,t.HandlebarsEnvironment=i;var a=n(74),o=n(75),s=r(o),l=n(76),u=n(84),c=n(86),f=r(c),d="4.0.2";t.VERSION=d;var p=7;t.COMPILER_REVISION=p;var h={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0"};t.REVISION_CHANGES=h;var g="[object Object]";i.prototype={constructor:i,logger:f["default"],log:f["default"].log,registerHelper:function(e,t){if(a.toString.call(e)===g){if(t)throw new s["default"]("Arg not supported with multiple helpers");a.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(a.toString.call(e)===g)a.extend(this.partials,e);else{if("undefined"==typeof t)throw new s["default"]("Attempting to register a partial as undefined");this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if(a.toString.call(e)===g){if(t)throw new s["default"]("Arg not supported with multiple decorators");a.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]}};var m=f["default"].log;t.log=m,t.createFrame=a.createFrame,t.logger=f["default"]},function(e,t){"use strict";function n(e){return c[e]}function r(e){for(var t=1;tn;n++)if(e[n]===t)return n;return-1}function a(e){if("string"!=typeof e){if(e&&e.toHTML)return e.toHTML();if(null==e)return"";if(!e)return e+"";e=""+e}return d.test(e)?e.replace(f,n):e}function o(e){return e||0===e?g(e)&&0===e.length?!0:!1:!0}function s(e){var t=r({},e);return t._parent=e,t}function l(e,t){return e.path=t,e}function u(e,t){return(e?e+".":"")+t}t.__esModule=!0,t.extend=r,t.indexOf=i,t.escapeExpression=a,t.isEmpty=o,t.createFrame=s,t.blockParams=l,t.appendContextPath=u;var c={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},f=/[&<>"'`=]/g,d=/[&<>"'`=]/,p=Object.prototype.toString;t.toString=p;var h=function(e){return"function"==typeof e};h(/x/)&&(t.isFunction=h=function(e){return"function"==typeof e&&"[object Function]"===p.call(e)}),t.isFunction=h;var g=Array.isArray||function(e){return e&&"object"==typeof e?"[object Array]"===p.call(e):!1};t.isArray=g},function(e,t){"use strict";function n(e,t){var i=t&&t.loc,a=void 0,o=void 0;i&&(a=i.start.line,o=i.start.column,e+=" - "+a+":"+o);for(var s=Error.prototype.constructor.call(this,e),l=0;l0?(n.ids&&(n.ids=[n.name]),e.helpers.each(t,n)):i(this);if(n.data&&n.ids){var o=r.createFrame(n.data);o.contextPath=r.appendContextPath(n.data.contextPath,n.name),n={data:o}}return a(t,n)})},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(74),a=n(75),o=r(a);t["default"]=function(e){e.registerHelper("each",function(e,t){function n(t,n,a){null!=e[t]&&(u&&(u.key=t,u.index=n,u.first=0===n,u.last=!!a,c&&(u.contextPath=c+t)),l+=r(e[t],{data:u,blockParams:i.blockParams([e[t],t],[c+t,null])}))}if(!t)throw new o["default"]("Must pass iterator to #each");var r=t.fn,a=t.inverse,s=0,l="",u=void 0,c=void 0;if(t.data&&t.ids&&(c=i.appendContextPath(t.data.contextPath,t.ids[0])+"."),i.isFunction(e)&&(e=e.call(this)),t.data&&(u=i.createFrame(t.data)),e&&"object"==typeof e)if(i.isArray(e))for(var f=e.length;f>s;s++)n(s,s,s===e.length-1);else{var d=void 0;for(var p in e)e.hasOwnProperty(p)&&(void 0!==d&&n(d,s-1),d=p,s++);void 0!==d&&n(d,s-1,!0)}return 0===s&&(l=a(this)),l})},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var i=n(75),a=r(i);t["default"]=function(e){e.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new a["default"]('Missing helper: "'+arguments[arguments.length-1].name+'"')})},e.exports=t["default"]},function(e,t,n){"use strict";t.__esModule=!0;var r=n(74);t["default"]=function(e){e.registerHelper("if",function(e,t){return r.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||r.isEmpty(e)?t.inverse(this):t.fn(this)}),e.registerHelper("unless",function(t,n){return e.helpers["if"].call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0,t["default"]=function(e){e.registerHelper("log",function(){for(var t=[void 0],n=arguments[arguments.length-1],r=0;r=0?t:parseInt(e,10)}return e},log:function(e){if(e=n.lookupLevel(e),"undefined"!=typeof console&&n.lookupLevel(n.level)<=e){var t=n.methodMap[e];console[t]||(t="log");for(var r=arguments.length,i=Array(r>1?r-1:0),a=1;r>a;a++)i[a-1]=arguments[a];console[t].apply(console,i)}}};t["default"]=n,e.exports=t["default"]},function(e,t){"use strict";function n(e){this.string=e}t.__esModule=!0,n.prototype.toString=n.prototype.toHTML=function(){return""+this.string},t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function a(e){var t=e&&e[0]||1,n=v.COMPILER_REVISION;if(t!==n){if(n>t){var r=v.REVISION_CHANGES[n],i=v.REVISION_CHANGES[t];throw new m["default"]("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+i+").")}throw new m["default"]("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}}function o(e,t){function n(n,r,i){i.hash&&(r=h.extend({},r,i.hash),i.ids&&(i.ids[0]=!0)),n=t.VM.resolvePartial.call(this,n,r,i);var a=t.VM.invokePartial.call(this,n,r,i);if(null==a&&t.compile&&(i.partials[i.name]=t.compile(n,e.compilerOptions,t),a=i.partials[i.name](r,i)),null!=a){if(i.indent){for(var o=a.split("\n"),s=0,l=o.length;l>s&&(o[s]||s+1!==l);s++)o[s]=i.indent+o[s];a=o.join("\n")}return a}throw new m["default"]("The partial "+i.name+" could not be compiled when running in runtime-only mode")}function r(t){function n(t){return""+e.main(i,t,i.helpers,i.partials,o,l,s)}var a=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=a.data;r._setup(a),!a.partial&&e.useData&&(o=f(t,o));var s=void 0,l=e.useBlockParams?[]:void 0;return e.useDepths&&(s=a.depths?t!==a.depths[0]?[t].concat(a.depths):a.depths:[t]),(n=d(e.main,n,i,a.depths||[],o,l))(t,a)}if(!t)throw new m["default"]("No environment passed to template");if(!e||!e.main)throw new m["default"]("Unknown template object: "+typeof e);e.main.decorator=e.main_d,t.VM.checkRevision(e.compiler);var i={strict:function(e,t){if(!(t in e))throw new m["default"]('"'+t+'" not defined in '+e);return e[t]},lookup:function(e,t){for(var n=e.length,r=0;n>r;r++)if(e[r]&&null!=e[r][t])return e[r][t]},lambda:function(e,t){return"function"==typeof e?e.call(t):e},escapeExpression:h.escapeExpression,invokePartial:n,fn:function(t){var n=e[t];return n.decorator=e[t+"_d"],n},programs:[],program:function(e,t,n,r,i){var a=this.programs[e],o=this.fn(e);return t||i||r||n?a=s(this,e,o,t,n,r,i):a||(a=this.programs[e]=s(this,e,o)),a},data:function(e,t){for(;e&&t--;)e=e._parent;return e},merge:function(e,t){var n=e||t;return e&&t&&e!==t&&(n=h.extend({},t,e)),n},noop:t.VM.noop,compilerInfo:e.compiler};return r.isTop=!0,r._setup=function(n){n.partial?(i.helpers=n.helpers,i.partials=n.partials,i.decorators=n.decorators):(i.helpers=i.merge(n.helpers,t.helpers),e.usePartial&&(i.partials=i.merge(n.partials,t.partials)),(e.usePartial||e.useDecorators)&&(i.decorators=i.merge(n.decorators,t.decorators)))},r._child=function(t,n,r,a){if(e.useBlockParams&&!r)throw new m["default"]("must pass block params");if(e.useDepths&&!a)throw new m["default"]("must pass parent depths");return s(i,t,e[t],n,0,r,a)},r}function s(e,t,n,r,i,a,o){function s(t){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],s=o;return o&&t!==o[0]&&(s=[t].concat(o)),n(e,t,e.helpers,e.partials,i.data||r,a&&[i.blockParams].concat(a),s)}return s=d(n,s,e,o,r,a),s.program=t,s.depth=o?o.length:0,s.blockParams=i||0,s}function l(e,t,n){return e?e.call||n.name||(n.name=e,e=n.partials[e]):e="@partial-block"===n.name?n.data["partial-block"]:n.partials[n.name],e}function u(e,t,n){n.partial=!0,n.ids&&(n.data.contextPath=n.ids[0]||n.data.contextPath);var r=void 0;if(n.fn&&n.fn!==c&&(r=n.data["partial-block"]=n.fn,r.partials&&(n.partials=h.extend({},n.partials,r.partials))),void 0===e&&r&&(e=r),void 0===e)throw new m["default"]("The partial "+n.name+" could not be found");return e instanceof Function?e(t,n):void 0}function c(){return""}function f(e,t){return t&&"root"in t||(t=t?v.createFrame(t):{},t.root=e),t}function d(e,t,n,r,i,a){if(e.decorator){var o={};t=e.decorator(t,o,n,r&&r[0],i,a,r),h.extend(t,o)}return t}t.__esModule=!0,t.checkRevision=a,t.template=o,t.wrapProgram=s,t.resolvePartial=l,t.invokePartial=u,t.noop=c;var p=n(74),h=i(p),g=n(75),m=r(g),v=n(73)},function(e,t){(function(n){"use strict";t.__esModule=!0,t["default"]=function(e){var t="undefined"!=typeof n?n:window,r=t.Handlebars;e.noConflict=function(){t.Handlebars===e&&(t.Handlebars=r)}},e.exports=t["default"]}).call(t,function(){return this}())},function(e,t,n){var r=n(71);e.exports=(r["default"]||r).template({1:function(e,t,r,i,a,o,s){var l,u=e.lambda,c=e.escapeExpression;return(null!=(l=n(91).call(t,s[1],null!=(l=o[0][0])?l.group:l,{name:"newGroup",hash:{},fn:e.program(2,a,0,o,s),inverse:e.noop,data:a,blockParams:o}))?l:"")+' \n\n\n '+c(u(null!=(l=o[0][0])?l.title:l,t))+' \n\n \n \n Top \n \n\n'+(null!=(l=n(93).call(t,null!=(l=o[0][0])?l.headers:l,{name:"isArray",hash:{},fn:e.program(6,a,0,o,s),inverse:e.program(9,a,0,o,s),data:a,blockParams:o}))?l:"")+" \n \n"},2:function(e,t,n,r,i,a){var o;return' '+e.escapeExpression(e.lambda(null!=(o=a[1][0])?o.group:o,t))+" \n"},4:function(e,t,n,r,i){return"clicked open"},6:function(e,t,n,r,i,a){var o;return null!=(o=n.each.call(t,null!=(o=a[1][0])?o.headers:o,{name:"each",hash:{},fn:e.program(7,i,0,a),inverse:e.noop,data:i,blockParams:a}))?o:""},7:function(e,t,n,r,i,a){var o,s=e.lambda,l=e.escapeExpression;return' \n '+l(s(null!=t?t.id:t,t))+" \n \n"},9:function(e,t,r,i,a,o){var s;return(null!=(s=n(94).call(t,o[1][0],{name:"showSummary",hash:{},fn:e.program(10,a,0,o),inverse:e.noop,data:a,blockParams:o}))?s:"")+(null!=(s=r["if"].call(t,null!=(s=o[1][0])?s.types:s,{name:"if",hash:{},fn:e.program(12,a,0,o),inverse:e.noop,data:a,blockParams:o}))?s:"")+(null!=(s=r["if"].call(t,null!=(s=o[1][0])?s.functions:s,{name:"if",hash:{},fn:e.program(15,a,0,o),inverse:e.noop,data:a,blockParams:o}))?s:"")+(null!=(s=r["if"].call(t,null!=(s=o[1][0])?s.macros:s,{name:"if",hash:{},fn:e.program(17,a,0,o),inverse:e.noop,data:a,blockParams:o}))?s:"")+(null!=(s=r["if"].call(t,null!=(s=o[1][0])?s.callbacks:s,{name:"if",hash:{},fn:e.program(20,a,0,o),inverse:e.noop,data:a,blockParams:o}))?s:"")},10:function(e,t,n,r,i,a){var o;return' \n Summary \n \n'},12:function(e,t,n,r,i,a){var o;return' \n Types \n \n'+(null!=(o=n.each.call(t,null!=(o=a[2][0])?o.types:o,{name:"each",hash:{},fn:e.program(13,i,0,a),inverse:e.noop,data:i,blockParams:a}))?o:"")+" \n \n"},13:function(e,t,n,r,i,a){var o,s=e.lambda,l=e.escapeExpression;return' \n '+l(s(null!=t?t.id:t,t))+" \n \n"},15:function(e,t,n,r,i,a){var o;return' \n Functions \n \n'+(null!=(o=n.each.call(t,null!=(o=a[2][0])?o.functions:o,{name:"each",hash:{},fn:e.program(13,i,0,a),inverse:e.noop,data:i,blockParams:a}))?o:"")+" \n \n"},17:function(e,t,n,r,i,a){var o;return' \n Macros \n \n'+(null!=(o=n.each.call(t,null!=(o=a[2][0])?o.macros:o,{name:"each",hash:{},fn:e.program(18,i,0,a),inverse:e.noop,data:i,blockParams:a}))?o:"")+" \n \n"},18:function(e,t,n,r,i,a){var o,s=e.lambda,l=e.escapeExpression;return' \n '+l(s(null!=t?t.id:t,t))+" \n \n"},20:function(e,t,n,r,i,a){var o;return' \n Callbacks \n \n'+(null!=(o=n.each.call(t,null!=(o=a[2][0])?o.callbacks:o,{name:"each",hash:{},fn:e.program(18,i,0,a),inverse:e.noop,data:i,blockParams:a}))?o:"")+" \n \n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i,a,o){var s;return'\n'+(null!=(s=n.each.call(t,null!=t?t.nodes:t,{name:"each",hash:{},fn:e.program(1,i,2,a,o),inverse:e.noop,data:i,blockParams:a}))?s:"")+" \n"},useData:!0,useDepths:!0,useBlockParams:!0})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t,n){var r=t||"";return e.group!==r?(e.group=r,n.fn(this)):void 0},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t){var n=window.location.pathname.split("/");return e+=".html",e===n[n.length-1]?t.fn(this):t.inverse(this)},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t){return Array.isArray(e)?t.fn(this):t.inverse(this)},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t){return e.types||e.functions||e.macros||e.callbacks?t.fn(this):void 0},e.exports=t["default"]},function(e,t,n){"use strict";function r(){c.addClass(m).removeClass(p).removeClass(h),v=setTimeout(function(){return c.addClass(g).removeClass(m)},d)}function i(){c.addClass(h).removeClass(g).removeClass(m),v=setTimeout(function(){return c.addClass(p).removeClass(h)},d)}function a(){var e=c.attr("class")||"";clearTimeout(v),e.includes(g)||e.includes(m)?i():e.includes(p)||e.includes(h)?r():window.screen.width>f?r():i()}function o(){u["default"](".sidebar-toggle").click(function(){a()})}var s=n(1)["default"];Object.defineProperty(t,"__esModule",{value:!0}),t.initialize=o;var l=n(2),u=s(l),c=u["default"]("body"),f=768,d=300,p="sidebar-opened",h="sidebar-opening",g="sidebar-closed",m="sidebar-closing",v=void 0},function(e,t,n){"use strict";function r(){f.addClass(d),localStorage.setItem(d,!0)}function i(){f.removeClass(d),localStorage.removeItem(d)}function a(){var e=localStorage.getItem(d);e&&r()}function o(){f.hasClass(d)?i():r()}function s(){a(),p.click(function(){o()})}var l=n(1)["default"];Object.defineProperty(t,"__esModule",{value:!0}),t.initialize=s;var u=n(2),c=l(u),f=c["default"]("body"),d="night-mode",p=c["default"](".night-mode-toggle")},function(e,t,n,r,i,a,o){function s(e){return null==e?"":e+""}function l(e,t,n){var r=typeof e;return"function"==r?void 0===t?e:C(e,t,n):null==e?E:"object"==r?f(e):void 0===t?N(e):d(e,t)}function u(e,t,n){if(null!=e){void 0!==n&&n in b(e)&&(t=[n]);for(var r=0,i=t.length;null!=e&&i>r;)e=e[t[r++]];return r&&r==i?e:void 0}}function c(e,t,n){var r=t.length,i=r,a=!n;if(null==e)return!i;for(e=b(e);r--;){var o=t[r];if(a&&o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++rt&&(t=-t>i?0:i+t),n=void 0===n||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++ru))return!1;for(;++l-1&&e%1==0&&t>e}function u(e){return"number"==typeof e&&e>-1&&e%1==0&&x>=e}function c(e){for(var t=d(e),n=t.length,r=n&&e.length,i=!!r&&u(r)&&(g(e)||h(e)),a=-1,o=[];++a0;++r
-
-
-Generated by IcoMoon
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/doc/fonts/icomoon.ttf b/doc/fonts/icomoon.ttf
deleted file mode 100644
index 6e45b23..0000000
Binary files a/doc/fonts/icomoon.ttf and /dev/null differ
diff --git a/doc/fonts/icomoon.woff b/doc/fonts/icomoon.woff
deleted file mode 100644
index e6a27ef..0000000
Binary files a/doc/fonts/icomoon.woff and /dev/null differ
diff --git a/doc/index.html b/doc/index.html
deleted file mode 100644
index 6f4e9e5..0000000
--- a/doc/index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- segment v0.1.1 – Documentation
-
-
-
-
-
-
diff --git a/lib/segment.ex b/lib/segment.ex
index f988d1f..94a711d 100644
--- a/lib/segment.ex
+++ b/lib/segment.ex
@@ -1,14 +1,85 @@
defmodule Segment do
+ @moduledoc """
+ Client for Segment API.
- @type status :: :ok | :error
+ For usage, see `Segment.Analytics`.
- @spec start_link(binary) :: { Segment.status, pid }
- def start_link(write_key) do
- Agent.start_link(fn -> write_key end, name: __MODULE__)
- end
+ For options and configuration, see `t:Segment.options/0`.
+ """
- def write_key() do
- Agent.get(__MODULE__, fn(state) -> state end)
- end
+ @default_config %Segment.Config{}
+ @typedoc "The struct that will be used as payload."
+ @type model :: struct()
+
+ @typedoc "Request and response body patterns that will be filtered before logging."
+ @type filter_body :: [{Regex.t() | String.pattern(), String.t()}]
+
+ @typedoc "HTTP headers that will be filtered before logging."
+ @type filter_headers :: [String.t()]
+
+ @typedoc """
+ Options to customize the operation.
+
+ It is possible to define options through application environment:
+
+ # in config.exs
+ import Config
+
+ config :segment,
+ disable_meta_logger: #{inspect(@default_config.disable_meta_logger)},
+ drop_nil_fields: #{inspect(@default_config.drop_nil_fields)},
+ endpoint: #{inspect(@default_config.endpoint)},
+ filter_body: #{inspect(@default_config.filter_body)},
+ http_adapter: #{inspect(@default_config.http_adapter)},
+ key: "a-valid-api-key",
+ max_retries: #{inspect(@default_config.max_retries)},
+ prefix: #{inspect(@default_config.prefix)},
+ request_timeout: #{inspect(@default_config.request_timeout)},
+ retry_base_delay: #{inspect(@default_config.retry_base_delay)},
+ retry_jitter_factor: #{inspect(@default_config.retry_jitter_factor)},
+ retry_max_delay: #{inspect(@default_config.retry_max_delay)}
+
+ Available options:
+
+ - `:disable_meta_logger` - If `true`, the request and response will not be logged.
+ Defaults to `#{inspect(@default_config.disable_meta_logger)}`.
+ - `:drop_nil_fields` - If `true`, removes any field with `nil` value from the request payload.
+ Defaults to `#{inspect(@default_config.drop_nil_fields)}`.
+ - `:endpoint` - The base URL for the Segment API.
+ Defaults to `#{inspect(@default_config.endpoint)}`.
+ - `:filter_body` - Request and response body patterns that will be filtered before logging.
+ Defaults to `#{inspect(@default_config.filter_body)}`.
+ - `:http_adapter` - `:Tesla` adapter for the client.
+ Defaults to `#{inspect(@default_config.http_adapter)}`.
+ - `:key` - The `x-api-key` HTTP header value.
+ Must be set.
+ - `:max_retries` - Maximum number of retries.
+ Defaults to `#{inspect(@default_config.max_retries)}`.
+ - `:prefix` - String or atom (including modules) to be used as the log prefix.
+ Defaults to `#{inspect(@default_config.prefix)}`.
+ - `:request_timeout` - Maximum amount of milliseconds to wait for a response.
+ Defaults to `#{inspect(@default_config.request_timeout)}`.
+ - `:retry_base_delay` - The base amount of milliseconds to wait before attempting a new request.
+ Defaults to `#{inspect(@default_config.retry_base_delay)}`.
+ - `:retry_jitter_factor` - Additive noise multiplier to update the retry delay.
+ Defaults to `#{inspect(@default_config.retry_jitter_factor)}`.
+ - `:retry_max_delay` - Maximum delay in milliseconds to wait before attempting a new request.
+ Defaults to `#{inspect(@default_config.retry_max_delay)}`.
+
+ """
+ @type options :: [
+ disable_meta_logger: boolean(),
+ drop_nil_fields: boolean(),
+ endpoint: String.t(),
+ filter_body: Segment.filter_body(),
+ http_adapter: module(),
+ key: String.t(),
+ max_retries: non_neg_integer(),
+ prefix: atom() | String.t(),
+ request_timeout: non_neg_integer(),
+ retry_base_delay: non_neg_integer(),
+ retry_jitter_factor: non_neg_integer(),
+ retry_max_delay: non_neg_integer()
+ ]
end
diff --git a/lib/segment/analytics.ex b/lib/segment/analytics.ex
index 5238c90..2833127 100644
--- a/lib/segment/analytics.ex
+++ b/lib/segment/analytics.ex
@@ -1,100 +1,158 @@
defmodule Segment.Analytics do
- alias Segment.Analytics.Context
- alias Segment.Analytics.Http
+ @moduledoc """
+ Performs requests to Segment API.
+ """
require Logger
- def track(t = %Segment.Analytics.Track{}) do
- call(t)
- end
+ alias Segment.Analytics.Batch
+ alias Segment.Analytics.Context
+ alias Segment.Analytics.HTTP
+ alias Segment.Config
+ alias Segment.Encoder
- def track(user_id, event, properties \\ %{}, context \\ Context.new) do
- %Segment.Analytics.Track{ userId: user_id,
- event: event,
- properties: properties,
- context: context }
- |> call
- end
+ def track(t = %Segment.Analytics.Track{}), do: call(t)
- def identify(i = %Segment.Analytics.Identify{}) do
- call(i)
+ def track(user_id, event, properties \\ %{}, context \\ %Context{}) do
+ %Segment.Analytics.Track{
+ userId: user_id,
+ event: event,
+ properties: properties,
+ context: context
+ }
+ |> call()
end
- def identify(user_id, traits \\ %{}, context \\ Context.new) do
- %Segment.Analytics.Identify{ userId: user_id,
- traits: traits,
- context: context }
- |> call
- end
+ def identify(i = %Segment.Analytics.Identify{}), do: call(i)
- def screen(s = %Segment.Analytics.Screen{}) do
- call(s)
+ def identify(user_id, traits \\ %{}, context \\ %Context{}) do
+ %Segment.Analytics.Identify{
+ userId: user_id,
+ traits: traits,
+ context: context
+ }
+ |> call()
end
- def screen(user_id, name \\ "", properties \\ %{}, context \\ Context.new ) do
- %Segment.Analytics.Screen{ userId: user_id,
- name: name,
- properties: properties,
- context: context }
- |> call
- end
+ def screen(s = %Segment.Analytics.Screen{}), do: call(s)
- def alias(a = %Segment.Analytics.Alias{}) do
- call(a)
+ def screen(user_id, name \\ "", properties \\ %{}, context \\ %Context{}) do
+ %Segment.Analytics.Screen{
+ userId: user_id,
+ name: name,
+ properties: properties,
+ context: context
+ }
+ |> call()
end
- def alias(user_id, previous_id, context \\ Context.new) do
- %Segment.Analytics.Alias{ userId: user_id,
- previousId: previous_id,
- context: context }
- |> call
- end
+ def alias(a = %Segment.Analytics.Alias{}), do: call(a)
- def group(g = %Segment.Analytics.Group{}) do
- call(g)
+ def alias(user_id, previous_id, context \\ %Context{}) do
+ %Segment.Analytics.Alias{
+ userId: user_id,
+ previousId: previous_id,
+ context: context
+ }
+ |> call()
end
- def group(user_id, group_id, traits \\ %{}, context \\ Context.new) do
- %Segment.Analytics.Group{ userId: user_id,
- groupId: group_id,
- traits: traits,
- context: context }
- |> call
- end
+ def group(g = %Segment.Analytics.Group{}), do: call(g)
- def page(p = %Segment.Analytics.Page{}) do
- call(p)
+ def group(user_id, group_id, traits \\ %{}, context \\ %Context{}) do
+ %Segment.Analytics.Group{
+ userId: user_id,
+ groupId: group_id,
+ traits: traits,
+ context: context
+ }
+ |> call()
end
- def page(user_id, name \\ "", properties \\ %{}, context \\ Context.new ) do
- %Segment.Analytics.Page{ userId: user_id,
- name: name,
- properties: properties,
- context: context }
- |> call
- end
+ def page(p = %Segment.Analytics.Page{}), do: call(p)
- defp call(api) do
- Task.async(fn -> post_to_segment(api.method, Poison.encode!(api)) end)
+ def page(user_id, name \\ "", properties \\ %{}, context \\ %Context{}) do
+ %Segment.Analytics.Page{
+ userId: user_id,
+ name: name,
+ properties: properties,
+ context: context
+ }
+ |> call()
end
- defp post_to_segment(function, body) do
- Http.post(function, body)
- |> log_result(function, body)
- end
+ @doc """
+ Returns a `Task` that must be awaited on that merges the options received with the application
+ environment and sends the payload to the Segment API.
+
+ The task returns `{:ok, binary}` with the raw response body if the request succeeded with
+ valid result.
+
+ On failure, the task returns `{:error, binary}` with either the raw response body if the
+ request succeded or the inspected error otherwise.
- defp log_result({_, %{status_code: code}}, function, body) when code in 200..299 do
- #success
- Logger.debug("Segment #{function} call success: #{code} with body: #{body}")
+ For options documentation, see `t:Segment.options/0`.
+
+ ## Examples
+
+ iex> model = %Segment.Analytics.Page{...}
+ ...> #{inspect(__MODULE__)}.call(model)
+ %Task{...}
+
+ ...> #{inspect(__MODULE__)}.call(model, max_retries: 2)
+ %Task{...}
+
+ """
+ @spec call(Segment.model(), Segment.options()) :: Task.t()
+ def call(model, options \\ []) do
+ caller_metadata = MetaLogger.metadata()
+
+ Task.async(fn ->
+ Logger.metadata(caller_metadata)
+
+ %Config{} = config = Config.get(options)
+
+ model
+ |> generate_message_id()
+ |> fill_context()
+ |> wrap_in_batch()
+ |> Encoder.encode!(config)
+ |> post_to_segment(config)
+ end)
end
- defp log_result({_, %{status_code: code}}, function, body) do
- #HTTP failure
- Logger.debug("Segment #{function} call failed: #{code} with body: #{body}")
+ defp generate_message_id(model), do: put_in(model.messageId, UUID.uuid4())
+
+ defp fill_context(model),
+ do: put_in(model.context.library, Context.Library.build())
+
+ # TODO: replace with an actual buffering
+ # to send events in batches rather than one by one
+ # The idea is to reduce the traffic to the segment service
+ defp wrap_in_batch(model) do
+ %Batch{
+ batch: [model],
+ sentAt: :os.system_time(:milli_seconds)
+ }
end
- defp log_result(error, function, body) do
- #every other failure
- Logger.debug("Segment #{function} call failed: #{inspect(error)} with body: #{body}")
+ @spec post_to_segment(String.t(), Config.t()) :: HTTP.request_result()
+ defp post_to_segment(body, %Config{} = config) do
+ case HTTP.post(body, config) do
+ {:ok, _body} = result ->
+ result
+
+ {:error, _reason} = result ->
+ log_post_result(:error, "Segment API request failed", config)
+ result
+ end
end
+
+ @spec log_post_result(Logger.level(), String.t(), Config.t()) :: :ok
+ defp log_post_result(log_level, message, %Config{} = config),
+ do: Logger.log(log_level, "[#{log_tag(config.prefix)}] #{message}")
+
+ @spec log_tag(atom() | String.t()) :: String.t()
+ defp log_tag(string) when is_binary(string), do: string
+ defp log_tag(value), do: inspect(value)
end
diff --git a/lib/segment/analytics/http.ex b/lib/segment/analytics/http.ex
new file mode 100644
index 0000000..c3bb364
--- /dev/null
+++ b/lib/segment/analytics/http.ex
@@ -0,0 +1,75 @@
+defmodule Segment.Analytics.HTTP do
+ @moduledoc false
+
+ alias Segment.Config
+ alias Tesla.Middleware
+
+ @type request_result :: {:ok, String.t()} | {:error, String.t()}
+
+ defguardp response_ok?(value) when is_struct(value, Tesla.Env) and value.status in 200..299
+
+ @spec post(String.t(), Config.t()) :: request_result()
+ @spec post(String.t(), String.t(), Config.t()) :: request_result()
+ def post(path \\ "", raw_body, %Config{} = config) do
+ config
+ |> client()
+ |> Tesla.post(path, raw_body)
+ |> handle_result()
+ end
+
+ @spec client(Config.t()) :: Tesla.Client.t()
+ defp client(%Config{} = config) do
+ # The order matters, see Tesla.Middleware
+ [
+ {Middleware.BaseUrl, config.endpoint},
+ {Middleware.Headers, headers(config)},
+ {Middleware.Retry, retry(config)},
+ if(config.disable_meta_logger != true, do: {Middleware.MetaLogger, meta_logger(config)})
+ ]
+ |> Enum.reject(&is_nil/1)
+ |> Tesla.client(adapter(config))
+ end
+
+ @spec headers(Config.t()) :: Tesla.Env.headers()
+ defp headers(%Config{} = config) do
+ [
+ {"accept", "application/json"},
+ {"content-Type", "application/json"},
+ {"x-api-key", config.key}
+ ]
+ end
+
+ @spec retry(Config.t()) :: Keyword.t()
+ defp retry(%Config{} = config) do
+ [
+ delay: config.retry_base_delay,
+ jitter_factor: config.retry_jitter_factor,
+ max_delay: config.retry_max_delay,
+ max_retries: config.max_retries,
+ should_retry: &should_retry?/1
+ ]
+ end
+
+ @spec should_retry?(Tesla.Env.result()) :: boolean()
+ defp should_retry?({:ok, %Tesla.Env{} = env}) when response_ok?(env), do: false
+ defp should_retry?(_result), do: true
+
+ @spec meta_logger(Config.t()) :: Keyword.t()
+ defp meta_logger(%Config{} = config) do
+ [
+ filter_body: config.filter_body,
+ filter_headers: ~w(x-api-key),
+ log_level: :info,
+ log_tag: __MODULE__
+ ]
+ end
+
+ @spec adapter(Config.t()) :: {module(), recv_timeout: non_neg_integer()}
+ defp adapter(%Config{} = config),
+ do: {config.http_adapter, recv_timeout: config.request_timeout}
+
+ @spec handle_result(Tesla.Env.result()) :: request_result()
+ defp handle_result({:ok, %Tesla.Env{} = env}) when response_ok?(env), do: {:ok, env.body}
+ defp handle_result({:ok, %Tesla.Env{} = env}), do: {:error, env.body}
+ defp handle_result({:error, reason}), do: {:error, inspect(reason)}
+end
diff --git a/lib/segment/analytics/model.ex b/lib/segment/analytics/model.ex
new file mode 100644
index 0000000..6c912ec
--- /dev/null
+++ b/lib/segment/analytics/model.ex
@@ -0,0 +1,135 @@
+defmodule Segment.Analytics.Batch do
+ @derive [Poison.Encoder]
+
+ defstruct [
+ :batch,
+ :sentAt
+ ]
+end
+
+defmodule Segment.Analytics.Track do
+ @derive [Poison.Encoder]
+ @method "track"
+
+ defstruct [
+ :anonymousId,
+ :context,
+ :event,
+ :messageId,
+ :properties,
+ :timestamp,
+ :userId,
+ :version,
+ type: @method
+ ]
+end
+
+defmodule Segment.Analytics.Identify do
+ @derive [Poison.Encoder]
+ @method "identify"
+
+ defstruct [
+ :anonymousId,
+ :context,
+ :messageId,
+ :timestamp,
+ :traits,
+ :userId,
+ :version,
+ type: @method
+ ]
+end
+
+defmodule Segment.Analytics.Alias do
+ @derive [Poison.Encoder]
+ @method "alias"
+
+ defstruct [:context, :previousId, :timestamp, :userId, :version, type: @method]
+end
+
+defmodule Segment.Analytics.Page do
+ @derive [Poison.Encoder]
+ @method "page"
+
+ defstruct [
+ :anonymousId,
+ :context,
+ :messageId,
+ :name,
+ :properties,
+ :timestamp,
+ :userId,
+ :version,
+ type: @method
+ ]
+end
+
+defmodule Segment.Analytics.Screen do
+ @derive [Poison.Encoder]
+ @method "screen"
+
+ defstruct [
+ :anonymousId,
+ :context,
+ :messageId,
+ :name,
+ :properties,
+ :timestamp,
+ :userId,
+ :version,
+ type: @method
+ ]
+end
+
+defmodule Segment.Analytics.Group do
+ @derive [Poison.Encoder]
+ @method "group"
+
+ defstruct [
+ :anonymousId,
+ :context,
+ :groupId,
+ :messageId,
+ :timestamp,
+ :traits,
+ :userId,
+ :version,
+ type: @method
+ ]
+end
+
+defmodule Segment.Analytics.Context.Library do
+ @derive [Poison.Encoder]
+
+ @project_name Mix.Project.get().project[:name]
+ @project_version Mix.Project.get().project[:version]
+
+ defstruct [:name, :version, :transport]
+
+ def build() do
+ %__MODULE__{
+ name: @project_name,
+ version: @project_version,
+ # the only supported by the library for now.
+ transport: "http"
+ }
+ end
+end
+
+defmodule Segment.Analytics.Context do
+ @derive [Poison.Encoder]
+
+ defstruct [
+ :app,
+ :ip,
+ :library,
+ :location,
+ :os,
+ :page,
+ :referrer,
+ :screen,
+ :timezone,
+ :traits,
+ :userAgent
+ ]
+end
diff --git a/lib/segment/config.ex b/lib/segment/config.ex
new file mode 100644
index 0000000..6271fdd
--- /dev/null
+++ b/lib/segment/config.ex
@@ -0,0 +1,80 @@
+defmodule Segment.Config do
+ @moduledoc false
+
+ use TypedStruct
+
+ @boolean_keys ~w(disable_meta_logger drop_nil_fields)a
+ @float_keys ~w(retry_jitter_factor)a
+ @integer_keys ~w(max_retries request_timeout retry_base_delay retry_max_delay)a
+
+ @replacement "[FILTERED]"
+
+ @filter_body [
+ {~r/"address":\s?{.*?}/, ~s("address":{})},
+ {~s("email":\s?".*"), ~s("email":"#{@replacement}")},
+ {~s("first_name":\s?".*"), ~s("first_name":"#{@replacement}")},
+ {~s("last_name":\s?".*"), ~s("last_name":"#{@replacement}")},
+ {~s("phone_number":\s?".*"), ~s("phone_number":"#{@replacement}")}
+ ]
+
+ typedstruct do
+ field :disable_meta_logger, boolean(), default: false
+ field :drop_nil_fields, boolean(), default: false
+ field :endpoint, String.t(), default: "https://api.segment.io/v1/"
+ field :filter_body, Segment.filter_body(), default: @filter_body
+ field :http_adapter, module(), default: Tesla.Adapter.Hackney
+ field :key, String.t()
+ field :max_retries, non_neg_integer(), default: 5
+ field :prefix, atom() | String.t(), default: Segment.Analytics
+ field :request_timeout, non_neg_integer(), default: 5_000
+ field :retry_base_delay, non_neg_integer(), default: 200
+ field :retry_jitter_factor, float(), default: 0.2
+ field :retry_max_delay, non_neg_integer(), default: 5_000
+ end
+
+ @spec boolean_keys :: [atom()]
+ def boolean_keys, do: @boolean_keys
+
+ @spec float_keys :: [atom()]
+ def float_keys, do: @float_keys
+
+ @spec get :: t()
+ @spec get(Segment.options()) :: t()
+ def get(fields \\ []) do
+ :segment
+ |> Application.get_all_env()
+ |> reject_nil_values()
+ |> Keyword.merge(reject_nil_values(fields))
+ |> Keyword.new(&parse/1)
+ |> then(&struct(__MODULE__, &1))
+ end
+
+ @spec integer_keys :: [atom()]
+ def integer_keys, do: @integer_keys
+
+ @spec keys :: [atom()]
+ def keys do
+ %__MODULE__{}
+ |> Map.from_struct()
+ |> Map.keys()
+ end
+
+ @spec reject_nil_values(Keyword.t()) :: Keyword.t()
+ defp reject_nil_values(keywords),
+ do: Keyword.reject(keywords, fn {_key, value} -> is_nil(value) end)
+
+ @spec parse({atom(), any()}) :: {atom(), any()}
+ defp parse({key, value}) when is_binary(value) do
+ value =
+ cond do
+ key in @boolean_keys -> value == "true"
+ key in @float_keys -> String.to_float(value)
+ key in @integer_keys -> String.to_integer(value)
+ true -> value
+ end
+
+ {key, value}
+ end
+
+ defp parse(key_value), do: key_value
+end
diff --git a/lib/segment/encoder.ex b/lib/segment/encoder.ex
new file mode 100644
index 0000000..38d2b82
--- /dev/null
+++ b/lib/segment/encoder.ex
@@ -0,0 +1,40 @@
+defmodule Segment.Encoder do
+ @moduledoc false
+
+ alias Segment.Config
+
+ @spec encode!(struct(), Config.t()) :: String.t()
+ def encode!(struct, %Config{} = config) do
+ struct
+ |> Miss.Map.from_nested_struct([
+ {Date, &Date.to_iso8601/1},
+ {DateTime, &DateTime.to_iso8601/1},
+ {Decimal, &Decimal.to_float/1}
+ ])
+ |> maybe_drop_nil_fields(config)
+ |> Poison.encode!()
+ end
+
+ @spec maybe_drop_nil_fields(map(), Config.t()) :: map()
+ defp maybe_drop_nil_fields(map, %Config{} = config) do
+ if config.drop_nil_fields == true do
+ drop_nil_fields_from_map(map)
+ else
+ map
+ end
+ end
+
+ @spec drop_nil_fields_from_map(map()) :: map()
+ def drop_nil_fields_from_map(map), do: Enum.reduce(map, %{}, &drop_nil_fields/2)
+
+ @spec drop_nil_fields({any(), any()}, map()) :: map()
+ defp drop_nil_fields({key, value}, map) when is_map(value),
+ do: Map.put(map, key, drop_nil_fields_from_map(value))
+
+ defp drop_nil_fields({key, [item | _items] = value}, map)
+ when is_list(value) and is_map(item),
+ do: Map.put(map, key, Enum.map(value, &drop_nil_fields_from_map/1))
+
+ defp drop_nil_fields({_field, value}, map) when is_nil(value), do: map
+ defp drop_nil_fields({key, value}, map), do: Map.put(map, key, value)
+end
diff --git a/lib/segment/http.ex b/lib/segment/http.ex
deleted file mode 100644
index 5568bc1..0000000
--- a/lib/segment/http.ex
+++ /dev/null
@@ -1,26 +0,0 @@
-defmodule Segment.Analytics.Http do
- use HTTPoison.Base
-
- @base_url "https://api.segment.io/v1/"
-
- def process_url(url) do
- @base_url <> url
- end
-
- def post(url, body, headers, options \\ []) do
- options_with_auth =
- Keyword.merge(options, [hackney: [basic_auth: {Segment.write_key(), ""}]])
-
- request(:post, url, body, headers, options_with_auth)
- end
-
- def process_options(options) do
- Keyword.put(options, :basic_auth, {Segment.write_key(),""})
- end
-
- def process_request_headers(headers) do
- headers
- |> Keyword.put(:"Content-Type", "application/json")
- |> Keyword.put(:"accept", "application/json")
- end
-end
diff --git a/lib/segment/model.ex b/lib/segment/model.ex
deleted file mode 100644
index 3d6bb73..0000000
--- a/lib/segment/model.ex
+++ /dev/null
@@ -1,120 +0,0 @@
-defmodule Segment.Analytics.Track do
- @derive [Poison.Encoder]
- @method "track"
-
- defstruct [ :userId,
- :event,
- :properties,
- :context,
- :timestamp,
- :integrations,
- :anonymousId,
- method: @method
- ]
-
-end
-
-defmodule Segment.Analytics.Identify do
- @derive [Poison.Encoder]
- @method "identify"
-
- defstruct [ :userId,
- :traits,
- :context,
- :timestamp,
- :integrations,
- :anonymousId,
- method: @method
- ]
-end
-
-defmodule Segment.Analytics.Alias do
- @derive [Poison.Encoder]
- @method "alias"
-
- defstruct [ :userId,
- :previousId,
- :context,
- :timestamp,
- :integrations,
- method: @method
- ]
-
-end
-
-defmodule Segment.Analytics.Page do
- @derive [Poison.Encoder]
- @method "page"
-
- defstruct [ :userId,
- :name,
- :properties,
- :context,
- :timestamp,
- :integrations,
- :anonymousId,
- method: @method]
-
-end
-
-defmodule Segment.Analytics.Screen do
- @derive [Poison.Encoder]
- @method "screen"
-
- defstruct [ :userId,
- :name,
- :properties,
- :context,
- :timestamp,
- :integrations,
- :anonymousId,
- method: @method
- ]
-end
-
-defmodule Segment.Analytics.Group do
- @derive [Poison.Encoder]
- @method "group"
-
- defstruct [ :userId,
- :groupId,
- :traits,
- :context,
- :timestamp,
- :integrations,
- :anonymousId,
- method: @method
- ]
-end
-
-defmodule Segment.Analytics.Context do
- @derive [Poison.Encoder]
- @library_name Mix.Project.get().project[:description]
- @library_version Mix.Project.get().project[:version]
-
- defstruct [ :app,
- :campaign,
- :device,
- :ip,
- :library,
- :locale,
- :location,
- :network,
- :os,
- :page,
- :referrer,
- :screen,
- :timezone,
- :traits,
- :userAgent
- ]
-
- def update(context = %__MODULE__{}) do
- %{context | library: %{name: @library_name, version: @library_version}}
- end
-
- def new do
- update(%__MODULE__{})
- end
-
-end
diff --git a/mix.exs b/mix.exs
index a9b52fd..1c5fcac 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,14 +1,19 @@
defmodule AnalyticsElixir.Mixfile do
use Mix.Project
+ @version "2.0.0"
+ @source_url "https://github.com/FindHotel/analytics-elixir"
+
def project do
[
app: :segment,
- version: "0.1.2",
- elixir: "~> 1.0",
deps: deps(),
description: "analytics_elixir",
+ elixir: "~> 1.12",
+ elixirc_paths: elixirc_paths(Mix.env()),
+ name: "analytics_elixir",
package: package(),
+ version: @version
]
end
@@ -16,7 +21,7 @@ defmodule AnalyticsElixir.Mixfile do
#
# Type `mix help compile.app` for more information
def application do
- [applications: [:httpoison, :logger, :poison]]
+ []
end
# Dependencies can be Hex packages:
@@ -30,18 +35,37 @@ defmodule AnalyticsElixir.Mixfile do
# Type `mix help deps` for more examples and options
defp deps do
[
- {:httpoison, "~> 0.12"},
- {:poison, "~> 1.3 or ~> 2.0 or ~> 3.1.0"},
- {:ex_doc, ">= 0.0.0", only: :dev}
+ {:decimal, "~> 2.0"},
+ {:meta_logger, "~> 1.4"},
+ {:miss, "~> 0.1"},
+ {:poison, "~> 5.0"},
+ {:tesla, "~> 1.5"},
+ {:typed_struct, "~> 0.2", runtime: false},
+ {:uuid, "~> 1.1"},
+
+ # Dev
+ {:ex_doc, "~> 0.28", only: :dev, runtime: false},
+
+ # Static analysis
+ {:dialyxir, "~> 1.1", only: :dev, runtime: false}
]
end
+ defp elixirc_paths(:test), do: ["lib", "test/support"]
+ defp elixirc_paths(_environment), do: ["lib"]
+
defp package do
- [ # These are the default files included in the package
- files: ["lib", "mix.exs", "README*", "LICENSE*"],
- maintainers: ["Stuart Eccles"],
+ # These are the default files included in the package
+ [
+ files: ["lib", "mix.exs", "README*", "LICENSE*", "CHANGELOG*"],
licenses: ["MIT"],
- links: %{ "GitHub" => "https://github.com/stueccles/analytics-elixir" }
+ links: %{"GitHub" => @source_url},
+ maintainers: [
+ "Antonio Lorusso",
+ "Felipe Vieira",
+ "Fernando Hamasaki de Amorim",
+ "Sergio Rodrigues"
+ ]
]
end
end
diff --git a/mix.lock b/mix.lock
index 527a8ff..ab13190 100644
--- a/mix.lock
+++ b/mix.lock
@@ -1,11 +1,18 @@
-%{"certifi": {:hex, :certifi, "1.2.1", "c3904f192bd5284e5b13f20db3ceac9626e14eeacfbb492e19583cf0e37b22be", [:rebar3], []},
- "earmark": {:hex, :earmark, "1.0.2", "a0b0904d74ecc14da8bd2e6e0248e1a409a2bc91aade75fcf428125603de3853", [:mix], []},
- "ex_doc": {:hex, :ex_doc, "0.14.3", "e61cec6cf9731d7d23d254266ab06ac1decbb7651c3d1568402ec535d387b6f7", [:mix], [{:earmark, "~> 1.0", [hex: :earmark, optional: false]}]},
- "hackney": {:hex, :hackney, "1.8.6", "21a725db3569b3fb11a6af17d5c5f654052ce9624219f1317e8639183de4a423", [:rebar3], [{:certifi, "1.2.1", [hex: :certifi, optional: false]}, {:idna, "5.0.2", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, optional: false]}]},
- "httpoison": {:hex, :httpoison, "0.12.0", "8fc3d791c5afe6beb0093680c667dd4ce712a49d89c38c3fe1a43100dd76cf90", [:mix], [{:hackney, "~> 1.8.0", [hex: :hackney, optional: false]}]},
- "idna": {:hex, :idna, "5.0.2", "ac203208ada855d95dc591a764b6e87259cb0e2a364218f215ad662daa8cd6b4", [:rebar3], [{:unicode_util_compat, "0.2.0", [hex: :unicode_util_compat, optional: false]}]},
- "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []},
- "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []},
- "poison": {:hex, :poison, "1.5.2", "560bdfb7449e3ddd23a096929fb9fc2122f709bcc758b2d5d5a5c7d0ea848910", [:mix], []},
- "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], []},
- "unicode_util_compat": {:hex, :unicode_util_compat, "0.2.0", "dbbccf6781821b1c0701845eaf966c9b6d83d7c3bfc65ca2b78b88b8678bfa35", [:rebar3], []}}
+%{
+ "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
+ "dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
+ "earmark_parser": {:hex, :earmark_parser, "1.4.22", "1de32345aab0d28bc208314937d2e69ff72ac6cacfdf89b1c0b75fc00283eb56", [:mix], [], "hexpm", "e10a2857c3b5333c503c7f95710c64f0beb2cfaa1d9de024513ad5242dc7cad5"},
+ "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
+ "ex_doc": {:hex, :ex_doc, "0.28.2", "e031c7d1a9fc40959da7bf89e2dc269ddc5de631f9bd0e326cbddf7d8085a9da", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "51ee866993ffbd0e41c084a7677c570d0fc50cb85c6b5e76f8d936d9587fa719"},
+ "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
+ "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
+ "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
+ "meta_logger": {:hex, :meta_logger, "1.7.0", "60e50736bfee20f398861f3b8e4646247896bd9e435272454b92e1dc6b0139e5", [:mix], [{:miss, "~> 0.1", [hex: :miss, repo: "hexpm", optional: true]}, {:tesla, "~> 1.4", [hex: :tesla, repo: "hexpm", optional: true]}], "hexpm", "29f5d40eaadde01c51369130321a0d603e4de95a634d5707485756cc7f297cc8"},
+ "mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"},
+ "miss": {:hex, :miss, "0.1.5", "dcf0771834ecd82580ff02d7299563c327afa8330485d281afe0b9512adcd500", [:mix], [], "hexpm", "494aba3ba3ed8a290714b4b9ff8c8d750b76dccb63c1aca21830a74989f8a047"},
+ "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
+ "poison": {:hex, :poison, "5.0.0", "d2b54589ab4157bbb82ec2050757779bfed724463a544b6e20d79855a9e43b24", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "11dc6117c501b80c62a7594f941d043982a1bd05a1184280c0d9166eb4d8d3fc"},
+ "tesla": {:hex, :tesla, "1.9.0", "8c22db6a826e56a087eeb8cdef56889731287f53feeb3f361dec5d4c8efb6f14", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, ">= 1.0.0", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "7c240c67e855f7e63e795bf16d6b3f5115a81d1f44b7fe4eadbf656bae0fef8a"},
+ "typed_struct": {:hex, :typed_struct, "0.2.1", "e1993414c371f09ff25231393b6430bd89d780e2a499ae3b2d2b00852f593d97", [:mix], [], "hexpm", "8f5218c35ec38262f627b2c522542f1eae41f625f92649c0af701a6fab2e11b3"},
+ "uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], [], "hexpm", "c790593b4c3b601f5dc2378baae7efaf5b3d73c4c6456ba85759905be792f2ac"},
+}
diff --git a/test/segment/analytics/model_test.exs b/test/segment/analytics/model_test.exs
new file mode 100644
index 0000000..20e7206
--- /dev/null
+++ b/test/segment/analytics/model_test.exs
@@ -0,0 +1,15 @@
+defmodule Segment.Analytics.Context.LibraryTest do
+ use ExUnit.Case, async: true
+
+ alias Segment.Analytics.Context.Library
+
+ describe "build/1" do
+ test "builds the library struct with the default values" do
+ assert %Library{
+ name: Mix.Project.get().project[:name],
+ transport: "http",
+ version: Mix.Project.get().project[:version]
+ } == Library.build()
+ end
+ end
+end
diff --git a/test/segment/analytics_test.exs b/test/segment/analytics_test.exs
new file mode 100644
index 0000000..cb043ef
--- /dev/null
+++ b/test/segment/analytics_test.exs
@@ -0,0 +1,238 @@
+defmodule Segment.AnalyticsTest do
+ use ExUnit.Case
+
+ import ExUnit.CaptureLog
+ import Tesla.Mock
+
+ alias Segment.Analytics, as: Subject
+
+ @version Mix.Project.get().project[:version]
+
+ describe "call/2" do
+ test "sends an event, and returns the response" do
+ response_body = mocked_response_body()
+ mock_request(request_body_with_nil_values(), {200, [], response_body})
+ assert_call_result({:ok, response_body}, successful_logs())
+ end
+
+ test "when `drop_nil_fields` option is set to `true`, sends an event without " <>
+ "null JSON attributes, and returns the response" do
+ response_body = mocked_response_body()
+ mock_request(request_body_without_nil_values(), {200, [], response_body})
+ assert_call_result([drop_nil_fields: true], {:ok, response_body}, successful_logs())
+ end
+
+ test "sends an event using endpoint and key from options, and returns the response" do
+ response_body = mocked_response_body()
+ mock_request(request_body_with_nil_values(), {200, [], response_body})
+
+ endpoint = "https://some-other-endpoint.vio.io/"
+
+ assert_call_result(
+ [endpoint: endpoint, key: "anotherkey"],
+ {:ok, response_body},
+ successful_logs(endpoint)
+ )
+ end
+
+ test "when failed to request, tries again" do
+ response_body = mocked_response_body()
+
+ mock_request(request_body_with_nil_values(), [
+ {:error, :timeout},
+ {:error, :timeout},
+ {:error, :timeout},
+ {200, [], response_body}
+ ])
+
+ assert_call_result(
+ [retry_base_delay: 1],
+ {:ok, response_body},
+ retried_successful_logs(3, ":timeout")
+ )
+ end
+
+ test "when failed to request and no retries left, returns error" do
+ mock_request(request_body_with_nil_values(), {:error, :nxdomain})
+ assert_call_result([max_retries: 0], {:error, ":nxdomain"}, failed_logs(":nxdomain"))
+ end
+
+ test "with meta logger disabled, does not log requests and responses" do
+ response_body = mocked_response_body()
+
+ mock_request(request_body_with_nil_values(), [
+ {:error, :timeout},
+ {200, [], response_body}
+ ])
+
+ # No logs whatsoever on success, even with retried requests
+ assert_call_result(
+ [disable_meta_logger: true, retry_base_delay: 1],
+ {:ok, response_body},
+ []
+ )
+
+ # Analytics still logs if no request succeeds.
+ assert_call_result(
+ [disable_meta_logger: true, max_retries: 0],
+ {:error, ":timeout"},
+ analytics_failed_logs()
+ )
+ end
+ end
+
+ defp mock_request(expected_request_body, responses) when is_list(responses) do
+ mock_global(fn %Tesla.Env{} = env ->
+ assert_request_body(env, expected_request_body)
+ index = Process.get(:attempts, 0)
+ Process.put(:attempts, index + 1)
+ Enum.fetch!(responses, index)
+ end)
+ end
+
+ defp mock_request(expected_request_body, response) do
+ mock_global(fn %Tesla.Env{} = env ->
+ assert_request_body(env, expected_request_body)
+ response
+ end)
+ end
+
+ defp assert_request_body(%Tesla.Env{} = env, expected_request_body) do
+ request_body =
+ env.body
+ |> Poison.decode!()
+ |> Map.delete("sentAt")
+ |> Map.update!("batch", &Enum.map(&1, fn event -> Map.delete(event, "messageId") end))
+
+ assert request_body == expected_request_body
+ end
+
+ defp assert_call_result(expected_result, expected_logs) do
+ # asserts call/1
+ assert_call_result(nil, expected_result, expected_logs)
+ # asserts call/2
+ assert_call_result([], expected_result, expected_logs)
+ end
+
+ defp assert_call_result(options, expected_result, expected_logs) do
+ event = %Segment.Analytics.Track{
+ userId: nil,
+ event: "test1",
+ properties: %{},
+ context: %Segment.Analytics.Context{}
+ }
+
+ fn ->
+ result =
+ case options do
+ nil -> Subject.call(event)
+ options -> Subject.call(event, options)
+ end
+
+ assert %Task{} = task = result
+
+ assert Task.await(task) == expected_result
+ end
+ |> capture_log()
+ |> String.replace([IO.ANSI.normal(), IO.ANSI.red(), IO.ANSI.reset()], "")
+ |> String.split("\n", trim: true)
+ |> Enum.zip(List.wrap(expected_logs))
+ |> Enum.each(fn {log, expected_log_substrings} ->
+ for expected_log_substring <- List.wrap(expected_log_substrings) do
+ assert log =~ expected_log_substring
+ end
+ end)
+ end
+
+ defp request_body_with_nil_values do
+ %{
+ "batch" => [
+ %{
+ "anonymousId" => nil,
+ "context" => %{
+ "app" => nil,
+ "ip" => nil,
+ "library" => %{
+ "name" => "analytics_elixir",
+ "transport" => "http",
+ "version" => @version
+ },
+ "location" => nil,
+ "os" => nil,
+ "page" => nil,
+ "referrer" => nil,
+ "screen" => nil,
+ "timezone" => nil,
+ "traits" => nil,
+ "userAgent" => nil
+ },
+ "event" => "test1",
+ "properties" => %{},
+ "timestamp" => nil,
+ "type" => "track",
+ "userId" => nil,
+ "version" => nil
+ }
+ ]
+ }
+ end
+
+ defp request_body_without_nil_values do
+ %{
+ "batch" => [
+ %{
+ "context" => %{
+ "library" => %{
+ "name" => "analytics_elixir",
+ "transport" => "http",
+ "version" => @version
+ }
+ },
+ "event" => "test1",
+ "properties" => %{},
+ "type" => "track"
+ }
+ ]
+ }
+ end
+
+ defp mocked_response_body do
+ Poison.encode!(%{
+ "another" => %{"json" => ["response"]},
+ "address" => %{"city" => "Amsterdam"}
+ })
+ end
+
+ defp successful_logs(endpoint \\ "https://api.segment.io/v1/") do
+ [
+ [
+ "[info] [Segment.Analytics.HTTP] POST #{endpoint}",
+ ~s({"x-api-key", "[FILTERED]"}])
+ ],
+ "[info] [Segment.Analytics.HTTP] {",
+ "[info] [Segment.Analytics.HTTP] 200",
+ ["[info] [Segment.Analytics.HTTP] {", ~s("address":{})]
+ ]
+ end
+
+ defp failed_logs(reason) do
+ api_failed_logs(reason) ++ analytics_failed_logs()
+ end
+
+ defp api_failed_logs(reason) do
+ [
+ [
+ "[info] [Segment.Analytics.HTTP] POST https://api.segment.io/v1/",
+ ~s({"x-api-key", "[FILTERED]"}])
+ ],
+ "[info] [Segment.Analytics.HTTP] {",
+ "[error] [Segment.Analytics.HTTP] #{reason}"
+ ]
+ end
+
+ defp analytics_failed_logs,
+ do: ["[error] [Segment.Analytics] Segment API request failed"]
+
+ defp retried_successful_logs(amount, reason),
+ do: Enum.flat_map(1..amount, fn _index -> api_failed_logs(reason) end) ++ successful_logs()
+end
diff --git a/test/segment/config_test.exs b/test/segment/config_test.exs
new file mode 100644
index 0000000..f39de93
--- /dev/null
+++ b/test/segment/config_test.exs
@@ -0,0 +1,57 @@
+defmodule Segment.ConfigTest do
+ use ExUnit.Case, async: true
+
+ alias Segment.Config, as: Subject
+
+ @default_config %Subject{http_adapter: Tesla.Mock, key: "my-amazing-key"}
+
+ describe "get/0" do
+ test "returns default config" do
+ assert Subject.get() == @default_config
+ end
+ end
+
+ describe "get/1" do
+ test "with empty options, returns default config" do
+ assert Subject.get([]) == @default_config
+ end
+
+ for key <- Subject.keys() do
+ @tag options: [{key, :value}], result: struct!(@default_config, [{key, :value}])
+ test "returns config with updated #{inspect(key)} value", context do
+ assert Subject.get(context.options) == context.result
+ end
+
+ @tag options: [{key, nil}], result: @default_config
+ test "ignores nil #{inspect(key)}, returns default config", context do
+ assert Subject.get(context.options) == context.result
+ end
+ end
+
+ for key <- Subject.boolean_keys() do
+ @tag options: [{key, "true"}], result: struct!(@default_config, [{key, true}])
+ test "returns config with parsed true string for #{inspect(key)}", context do
+ assert Subject.get(context.options) == context.result
+ end
+
+ @tag options: [{key, "untrue"}], result: struct!(@default_config, [{key, false}])
+ test "returns config with parsed untrue string for #{inspect(key)}", context do
+ assert Subject.get(context.options) == context.result
+ end
+ end
+
+ for key <- Subject.float_keys() do
+ @tag options: [{key, "0.2"}], result: struct!(@default_config, [{key, 0.2}])
+ test "returns config with parsed string for #{inspect(key)}", context do
+ assert Subject.get(context.options) == context.result
+ end
+ end
+
+ for key <- Subject.integer_keys() do
+ @tag options: [{key, "10000"}], result: struct!(@default_config, [{key, 10_000}])
+ test "returns config with parsed string for #{inspect(key)}", context do
+ assert Subject.get(context.options) == context.result
+ end
+ end
+ end
+end
diff --git a/test/segment/encoder_test.exs b/test/segment/encoder_test.exs
new file mode 100644
index 0000000..8658acc
--- /dev/null
+++ b/test/segment/encoder_test.exs
@@ -0,0 +1,41 @@
+defmodule Segment.EncoderTest do
+ use ExUnit.Case, async: true
+
+ alias Segment.Encoder, as: Subject
+
+ alias Segment.Config
+ alias Segment.Support.Factory
+
+ describe "encode!/2" do
+ setup do
+ batch = Factory.build(:batch)
+
+ {:ok, batch: batch}
+ end
+
+ test "transforms a struct into a JSON string", %{batch: batch} do
+ assert_encode!(batch, %Config{}, :batch)
+ end
+
+ test "when `drop_nil_fields` options is `true`, " <>
+ "returns a JSON string without `null` attributes",
+ %{batch: batch} do
+ assert_encode!(batch, %Config{drop_nil_fields: true}, :batch_without_null)
+ end
+
+ test "when `drop_nil_fields` option is set to something different than `true`," <>
+ "returns a JSON string with `null` attributes",
+ %{batch: batch} do
+ assert_encode!(batch, %Config{drop_nil_fields: "Please don't"}, :batch)
+ end
+ end
+
+ defp assert_encode!(batch, %Config{} = config, result_factory) do
+ # For OTP 26+, it is required to parse the encoded value back to map since the order is not
+ # predictable.
+
+ result = Subject.encode!(batch, config)
+
+ assert Poison.decode!(result) == Factory.string_map_for(result_factory)
+ end
+end
diff --git a/test/segment_test.exs b/test/segment_test.exs
deleted file mode 100644
index 63781e7..0000000
--- a/test/segment_test.exs
+++ /dev/null
@@ -1,11 +0,0 @@
-defmodule SegmentTest do
- use ExUnit.Case
-
- @segment_test_key System.get_env("SEGMENT_KEY")
-
- test "track debugging" do
- Segment.start_link(@segment_test_key)
- t = Segment.Analytics.track("343434", "track debugging #{elem(:os.timestamp,2)}")
- Task.await(t)
- end
-end
diff --git a/test/support/factory.ex b/test/support/factory.ex
new file mode 100644
index 0000000..2d8253d
--- /dev/null
+++ b/test/support/factory.ex
@@ -0,0 +1,152 @@
+defmodule Segment.Support.Factory do
+ alias Segment.Analytics.{Batch, Context, Track}
+
+ defmodule Properties do
+ defstruct ~w(
+ foo
+ bar
+ baz
+ decimal
+ date
+ datetime
+ qux
+ corge
+ grault
+ garply
+ waldo
+ )a
+ end
+
+ defmodule NestedProperties do
+ defstruct ~w(foo bar baz qux)a
+ end
+
+ def build(:batch) do
+ %Batch{
+ batch: [
+ %Track{
+ context: %Context{app: %{name: "analytics_elixir", version: "1.0.0"}},
+ messageId: "e66f98cf-3a99-4895-a0a3-d5e6f72eeb23",
+ properties: %Properties{
+ bar: 2.5,
+ baz: "baz",
+ corge: [
+ %{bar: 2.5, baz: "baz", foo: 1, qux: nil},
+ %{}
+ ],
+ foo: 1,
+ garply: %{foo: 1, bar: 2.5, baz: "baz", qux: nil},
+ grault: [
+ %NestedProperties{bar: 2.5, baz: "baz", foo: 1, qux: nil},
+ %NestedProperties{}
+ ],
+ decimal: Decimal.new("123.33"),
+ date: ~D[2016-05-24],
+ datetime: ~U[2016-05-24 13:26:08.003Z],
+ qux: nil,
+ waldo: %NestedProperties{bar: 2.5, baz: "baz", foo: 1, qux: nil}
+ }
+ }
+ ],
+ sentAt: 1_608_657_553_311
+ }
+ end
+
+ def map_for(:app), do: %{name: "analytics_elixir", version: "1.0.0"}
+
+ def map_for(:batch), do: %{batch: [map_for(:track)], sentAt: 1_608_657_553_311}
+
+ def map_for(:batch_without_null),
+ do: %{batch: [map_for(:track_without_null)], sentAt: 1_608_657_553_311}
+
+ def map_for(:context) do
+ %{
+ app: map_for(:app),
+ ip: nil,
+ library: nil,
+ location: nil,
+ os: nil,
+ page: nil,
+ referrer: nil,
+ screen: nil,
+ timezone: nil,
+ traits: nil,
+ userAgent: nil
+ }
+ end
+
+ def map_for(:context_without_null), do: %{app: map_for(:app)}
+
+ def map_for(:properties) do
+ %{
+ baz: "baz",
+ bar: 2.5,
+ corge: [
+ %{bar: 2.5, baz: "baz", foo: 1, qux: nil},
+ %{}
+ ],
+ foo: 1,
+ garply: %{bar: 2.5, baz: "baz", foo: 1, qux: nil},
+ grault: [
+ %{bar: 2.5, baz: "baz", foo: 1, qux: nil},
+ %{bar: nil, baz: nil, foo: nil, qux: nil}
+ ],
+ qux: nil,
+ decimal: 123.33,
+ date: "2016-05-24",
+ datetime: "2016-05-24T13:26:08.003Z",
+ waldo: %{bar: 2.5, baz: "baz", foo: 1, qux: nil}
+ }
+ end
+
+ def map_for(:properties_without_null) do
+ %{
+ baz: "baz",
+ bar: 2.5,
+ corge: [
+ %{bar: 2.5, baz: "baz", foo: 1},
+ %{}
+ ],
+ foo: 1,
+ garply: %{bar: 2.5, baz: "baz", foo: 1},
+ grault: [
+ %{bar: 2.5, baz: "baz", foo: 1},
+ %{}
+ ],
+ decimal: 123.33,
+ date: "2016-05-24",
+ datetime: "2016-05-24T13:26:08.003Z",
+ waldo: %{bar: 2.5, baz: "baz", foo: 1}
+ }
+ end
+
+ def map_for(:track) do
+ %{
+ anonymousId: nil,
+ context: map_for(:context),
+ event: nil,
+ messageId: "e66f98cf-3a99-4895-a0a3-d5e6f72eeb23",
+ properties: map_for(:properties),
+ timestamp: nil,
+ type: "track",
+ userId: nil,
+ version: nil
+ }
+ end
+
+ def map_for(:track_without_null) do
+ %{
+ context: map_for(:context_without_null),
+ messageId: "e66f98cf-3a99-4895-a0a3-d5e6f72eeb23",
+ properties: map_for(:properties_without_null),
+ type: "track"
+ }
+ end
+
+ def string_map_for(key) do
+ key
+ |> map_for()
+ |> Poison.encode!()
+ |> Poison.decode!()
+ end
+end
diff --git a/test/test_helper.exs b/test/test_helper.exs
index 869559e..655a9e9 100644
--- a/test/test_helper.exs
+++ b/test/test_helper.exs
@@ -1 +1,2 @@
-ExUnit.start()
+ExUnit.start(capture_log: true)
+Application.ensure_all_started(:bypass)